stage2: add 4 new linker flags for WebAssembly

--import-memory          import memory from the environment
--initial-memory=[bytes] initial size of the linear memory
--max-memory=[bytes]     maximum size of the linear memory
--global-base=[addr]     where to start to place global data

See #8633
This commit is contained in:
Andrew Kelley
2021-11-09 14:29:20 -07:00
parent 9bb7ff68cc
commit d2cdfb9490
5 changed files with 86 additions and 1 deletions

View File

@@ -716,6 +716,10 @@ pub const InitOptions = struct {
linker_gc_sections: ?bool = null,
linker_allow_shlib_undefined: ?bool = null,
linker_bind_global_refs_locally: ?bool = null,
linker_import_memory: ?bool = null,
linker_initial_memory: ?u64 = null,
linker_max_memory: ?u64 = null,
linker_global_base: ?u64 = null,
each_lib_rpath: ?bool = null,
disable_c_depfile: bool = false,
linker_z_nodelete: bool = false,
@@ -1401,6 +1405,10 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation {
.function_sections = options.function_sections,
.allow_shlib_undefined = options.linker_allow_shlib_undefined,
.bind_global_refs_locally = options.linker_bind_global_refs_locally orelse false,
.import_memory = options.linker_import_memory orelse false,
.initial_memory = options.linker_initial_memory,
.max_memory = options.linker_max_memory,
.global_base = options.linker_global_base,
.z_nodelete = options.linker_z_nodelete,
.z_notext = options.linker_z_notext,
.z_defs = options.linker_z_defs,