| author | |
| committer | |
| log | 7051f8e73b875aca52cc2e56a8f296d847f8dfa8 |
| tree | acb491f8d2ea6ea83da894b133ef492e569e1dc3 |
| parent | 5ec479a179e24a2124e25dc3ae6560a74574526f |
9 files changed, 26 insertions(+), 2 deletions(-)
lib/compiler/Maker/Step/Compile.zig+1| ... | ... | @@ -728,6 +728,7 @@ fn lowerZigArgs( |
| 728 | 728 | try addBool(gpa, zig_args, "--import-symbols", conf_comp.flags.import_symbols); |
| 729 | 729 | try addBool(gpa, zig_args, "--import-table", conf_comp.flags.import_table); |
| 730 | 730 | try addBool(gpa, zig_args, "--export-table", conf_comp.flags.export_table); |
| 731 | try addBool(gpa, zig_args, "--growable-table", conf_comp.flags.growable_table); | |
| 731 | 732 | try addBool(gpa, zig_args, "--shared-memory", conf_comp.flags.shared_memory); |
| 732 | 733 | |
| 733 | 734 | { |
lib/std/Build/Configuration.zig+1-1| ... | ... | @@ -953,6 +953,7 @@ pub const Step = extern struct { |
| 953 | 953 | import_symbols: bool, |
| 954 | 954 | import_table: bool, |
| 955 | 955 | export_table: bool, |
| 956 | growable_table: bool, | |
| 956 | 957 | shared_memory: bool, |
| 957 | 958 | link_eh_frame_hdr: bool, |
| 958 | 959 | link_emit_relocs: bool, |
| ... | ... | @@ -968,7 +969,6 @@ pub const Step = extern struct { |
| 968 | 969 | force_load_objc: bool, |
| 969 | 970 | discard_local_symbols: bool, |
| 970 | 971 | mingw_unicode_entry_point: bool, |
| 971 | _: u1 = 0, | |
| 972 | 972 | }; |
| 973 | 973 | |
| 974 | 974 | pub const Flags2 = packed struct(u32) { |
lib/std/Build/Serialize.zig+1| ... | ... | @@ -133,6 +133,7 @@ pub fn write(b: *std.Build, wc: *Configuration.Wip, writer: *std.Io.Writer) !voi |
| 133 | 133 | .import_symbols = c.import_symbols, |
| 134 | 134 | .import_table = c.import_table, |
| 135 | 135 | .export_table = c.export_table, |
| 136 | .growable_table = c.growable_table, | |
| 136 | 137 | .shared_memory = c.shared_memory, |
| 137 | 138 | .link_eh_frame_hdr = c.link_eh_frame_hdr, |
| 138 | 139 | .link_emit_relocs = c.link_emit_relocs, |
lib/std/Build/Step/Compile.zig+1| ... | ... | @@ -45,6 +45,7 @@ import_symbols: bool = false, |
| 45 | 45 | /// (WebAssembly) import function table from the host environment |
| 46 | 46 | import_table: bool = false, |
| 47 | 47 | export_table: bool = false, |
| 48 | growable_table: bool = false, | |
| 48 | 49 | initial_memory: ?u64 = null, |
| 49 | 50 | max_memory: ?u64 = null, |
| 50 | 51 | shared_memory: bool = false, |
src/Compilation.zig+3| ... | ... | @@ -1478,6 +1478,7 @@ pub const CreateOptions = struct { |
| 1478 | 1478 | linker_import_symbols: bool = false, |
| 1479 | 1479 | linker_import_table: bool = false, |
| 1480 | 1480 | linker_export_table: bool = false, |
| 1481 | linker_growable_table: bool = false, | |
| 1481 | 1482 | linker_initial_memory: ?u64 = null, |
| 1482 | 1483 | linker_max_memory: ?u64 = null, |
| 1483 | 1484 | linker_global_base: ?u64 = null, |
| ... | ... | @@ -2183,6 +2184,7 @@ pub fn create(gpa: Allocator, arena: Allocator, io: Io, diag: *CreateDiagnostic, |
| 2183 | 2184 | .import_symbols = options.linker_import_symbols, |
| 2184 | 2185 | .import_table = options.linker_import_table, |
| 2185 | 2186 | .export_table = options.linker_export_table, |
| 2187 | .growable_table = options.linker_growable_table, | |
| 2186 | 2188 | .initial_memory = options.linker_initial_memory, |
| 2187 | 2189 | .max_memory = options.linker_max_memory, |
| 2188 | 2190 | .global_base = options.linker_global_base, |
| ... | ... | @@ -3434,6 +3436,7 @@ fn addNonIncrementalStuffToCacheManifest( |
| 3434 | 3436 | man.hash.add(opts.import_symbols); |
| 3435 | 3437 | man.hash.add(opts.import_table); |
| 3436 | 3438 | man.hash.add(opts.export_table); |
| 3439 | man.hash.add(opts.growable_table); | |
| 3437 | 3440 | |
| 3438 | 3441 | // Mach-O specific stuff |
| 3439 | 3442 | try link.File.MachO.hashAddFrameworks(man, opts.frameworks); |
src/link.zig+1| ... | ... | @@ -444,6 +444,7 @@ pub const File = struct { |
| 444 | 444 | import_symbols: bool, |
| 445 | 445 | import_table: bool, |
| 446 | 446 | export_table: bool, |
| 447 | growable_table: bool, | |
| 447 | 448 | initial_memory: ?u64, |
| 448 | 449 | max_memory: ?u64, |
| 449 | 450 | object_host_name: ?[]const u8, |
src/link/Lld.zig+7| ... | ... | @@ -166,6 +166,8 @@ const Wasm = struct { |
| 166 | 166 | import_table: bool, |
| 167 | 167 | /// When true, will export the function table to the host environment. |
| 168 | 168 | export_table: bool, |
| 169 | /// When true, remove maximum size from function table, allowing table to grow. | |
| 170 | growable_table: bool, | |
| 169 | 171 | /// When defined, sets the initial memory size of the memory. |
| 170 | 172 | initial_memory: ?u64, |
| 171 | 173 | /// When defined, sets the maximum memory size of the memory. |
| ... | ... | @@ -190,6 +192,7 @@ const Wasm = struct { |
| 190 | 192 | }, |
| 191 | 193 | .import_table = options.import_table, |
| 192 | 194 | .export_table = options.export_table, |
| 195 | .growable_table = options.growable_table, | |
| 193 | 196 | .initial_memory = options.initial_memory, |
| 194 | 197 | .max_memory = options.max_memory, |
| 195 | 198 | .global_base = options.global_base, |
| ... | ... | @@ -1465,6 +1468,10 @@ fn wasmLink(lld: *Lld, arena: Allocator) !void { |
| 1465 | 1468 | try argv.append("--export-table"); |
| 1466 | 1469 | } |
| 1467 | 1470 | |
| 1471 | if (wasm.growable_table) { | |
| 1472 | try argv.append("--growable-table"); | |
| 1473 | } | |
| 1474 | ||
| 1468 | 1475 | // For wasm-ld we only need to specify '--no-gc-sections' when the user explicitly |
| 1469 | 1476 | // specified it as garbage collection is enabled by default. |
| 1470 | 1477 | if (!base.gc_sections) { |
src/link/Wasm.zig+4-1| ... | ... | @@ -75,6 +75,8 @@ initial_memory: ?u64, |
| 75 | 75 | max_memory: ?u64, |
| 76 | 76 | /// When true, will export the function table to the host environment. |
| 77 | 77 | export_table: bool, |
| 78 | /// When true, remove maximum size from function table, allowing table to grow. | |
| 79 | growable_table: bool, | |
| 78 | 80 | /// Output name of the file |
| 79 | 81 | name: []const u8, |
| 80 | 82 | /// List of relocatable files to be linked into the final binary. |
| ... | ... | @@ -1535,7 +1537,7 @@ pub const TableImport = extern struct { |
| 1535 | 1537 | return switch (unpack(r)) { |
| 1536 | 1538 | .unresolved => unreachable, |
| 1537 | 1539 | .__indirect_function_table => .{ |
| 1538 | .flags = .{ .has_max = true, .is_shared = false }, | |
| 1540 | .flags = .{ .has_max = !wasm.growable_table, .is_shared = false }, | |
| 1539 | 1541 | .min = @intCast(wasm.flush_buffer.indirect_function_table.entries.len + 1), |
| 1540 | 1542 | .max = @intCast(wasm.flush_buffer.indirect_function_table.entries.len + 1), |
| 1541 | 1543 | }, |
| ... | ... | @@ -3381,6 +3383,7 @@ pub fn createEmpty( |
| 3381 | 3383 | .string_table = .empty, |
| 3382 | 3384 | .string_bytes = .empty, |
| 3383 | 3385 | .export_table = options.export_table, |
| 3386 | .growable_table = options.growable_table, | |
| 3384 | 3387 | .import_symbols = options.import_symbols, |
| 3385 | 3388 | .export_symbol_names = options.export_symbol_names, |
| 3386 | 3389 | .global_base = options.global_base, |
src/main.zig+7| ... | ... | @@ -751,6 +751,7 @@ const usage_build_generic = |
| 751 | 751 | \\ --import-symbols (WebAssembly) import missing symbols from the host environment |
| 752 | 752 | \\ --import-table (WebAssembly) import function table from the host environment |
| 753 | 753 | \\ --export-table (WebAssembly) export function table to the host environment |
| 754 | \\ --growable-table (WebAssembly) remove maximum size from function table, allowing table to grow | |
| 754 | 755 | \\ --initial-memory=[bytes] (WebAssembly) initial size of the linear memory |
| 755 | 756 | \\ --max-memory=[bytes] (WebAssembly) maximum size of the linear memory |
| 756 | 757 | \\ --shared-memory (WebAssembly) use shared linear memory |
| ... | ... | @@ -985,6 +986,7 @@ fn buildOutputType( |
| 985 | 986 | var linker_import_symbols: bool = false; |
| 986 | 987 | var linker_import_table: bool = false; |
| 987 | 988 | var linker_export_table: bool = false; |
| 989 | var linker_growable_table: bool = false; | |
| 988 | 990 | var linker_initial_memory: ?u64 = null; |
| 989 | 991 | var linker_max_memory: ?u64 = null; |
| 990 | 992 | var linker_global_base: ?u64 = null; |
| ... | ... | @@ -1764,6 +1766,8 @@ fn buildOutputType( |
| 1764 | 1766 | linker_import_table = true; |
| 1765 | 1767 | } else if (mem.eql(u8, arg, "--export-table")) { |
| 1766 | 1768 | linker_export_table = true; |
| 1769 | } else if (mem.eql(u8, arg, "--growable-table")) { | |
| 1770 | linker_growable_table = true; | |
| 1767 | 1771 | } else if (prefixedIntArg(arg, "--initial-memory=")) |int| { |
| 1768 | 1772 | linker_initial_memory = int; |
| 1769 | 1773 | } else if (prefixedIntArg(arg, "--max-memory=")) |int| { |
| ... | ... | @@ -2712,6 +2716,8 @@ fn buildOutputType( |
| 2712 | 2716 | linker_import_table = true; |
| 2713 | 2717 | } else if (mem.eql(u8, arg, "--export-table")) { |
| 2714 | 2718 | linker_export_table = true; |
| 2719 | } else if (mem.eql(u8, arg, "--growable-table")) { | |
| 2720 | linker_growable_table = true; | |
| 2715 | 2721 | } else if (mem.eql(u8, arg, "--no-entry")) { |
| 2716 | 2722 | entry = .disabled; |
| 2717 | 2723 | } else if (mem.eql(u8, arg, "--initial-memory")) { |
| ... | ... | @@ -3674,6 +3680,7 @@ fn buildOutputType( |
| 3674 | 3680 | .linker_import_symbols = linker_import_symbols, |
| 3675 | 3681 | .linker_import_table = linker_import_table, |
| 3676 | 3682 | .linker_export_table = linker_export_table, |
| 3683 | .linker_growable_table = linker_growable_table, | |
| 3677 | 3684 | .linker_initial_memory = linker_initial_memory, |
| 3678 | 3685 | .linker_max_memory = linker_max_memory, |
| 3679 | 3686 | .linker_print_gc_sections = linker_print_gc_sections, |