From 1cb7a01b25349c42dbe207b68f9e19b92890b3d2 Mon Sep 17 00:00:00 2001 From: Luuk de Gram Date: Wed, 30 Aug 2023 16:59:48 +0200 Subject: wasm-linker: implement `-fno-entry` flag This adds support for the `-fno-entry` and `-fentry` flags respectively, for zig build-{exe/lib} and the build system. For `zig cc` we use the `--no-entry` flag to be compatible with clang and existing tooling. In `start.zig` we now make the main function optional when the target is WebAssembly, as to allow for the build-exe command in combination with `-fno-entry`. When the execution model is set, and is set to 'reactor', we now verify when an entry name is given it matches what is expected. When no entry point is given, we set it to `_initialize` by default. This means the user will also be met with an error when they use the reactor model, but did not provide the correct function. --- src/main.zig | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src/main.zig') diff --git a/src/main.zig b/src/main.zig index cbc7283eef..fc7e43b16f 100644 --- a/src/main.zig +++ b/src/main.zig @@ -577,6 +577,8 @@ const usage_build_generic = \\ --shared-memory (WebAssembly) use shared linear memory \\ --global-base=[addr] (WebAssembly) where to start to place global data \\ --export=[value] (WebAssembly) Force a symbol to be exported + \\ -fentry (WebAssembly) Force output an entry point + \\ -fno-entry (WebAssembly) Do not output any entry point \\ \\Test Options: \\ --test-filter [text] Skip tests that do not match filter @@ -835,6 +837,7 @@ fn buildOutputType( var linker_import_symbols: bool = false; var linker_import_table: bool = false; var linker_export_table: bool = false; + var linker_no_entry: ?bool = null; var linker_initial_memory: ?u64 = null; var linker_max_memory: ?u64 = null; var linker_shared_memory: bool = false; @@ -1503,6 +1506,10 @@ fn buildOutputType( } } else if (mem.eql(u8, arg, "--import-memory")) { linker_import_memory = true; + } else if (mem.eql(u8, arg, "-fentry")) { + linker_no_entry = false; + } else if (mem.eql(u8, arg, "-fno-entry")) { + linker_no_entry = true; } else if (mem.eql(u8, arg, "--export-memory")) { linker_export_memory = true; } else if (mem.eql(u8, arg, "--import-symbols")) { @@ -2134,6 +2141,8 @@ fn buildOutputType( linker_import_table = true; } else if (mem.eql(u8, arg, "--export-table")) { linker_export_table = true; + } else if (mem.eql(u8, arg, "--no-entry")) { + linker_no_entry = true; } else if (mem.eql(u8, arg, "--initial-memory")) { const next_arg = linker_args_it.nextOrFatal(); linker_initial_memory = std.fmt.parseUnsigned(u32, eatIntPrefix(next_arg, 16), 16) catch |err| { @@ -2618,6 +2627,25 @@ fn buildOutputType( if (single_threaded == null) { single_threaded = true; } + if (wasi_exec_model) |model| { + if (model == .reactor) { + if (linker_no_entry != null and !linker_no_entry.?) { + fatal("WASI exucution model 'reactor' incompatible with flag '-fentry'. Reactor execution model has no entry point", .{}); + } + if (entry) |entry_name| { + if (!mem.eql(u8, "_initialize", entry_name)) { + fatal("the entry symbol of the reactor model must be '_initialize', but found '{s}'", .{entry_name}); + } + } else { + entry = "_initialize"; + } + } + } + if (linker_no_entry) |no_entry| { + if (no_entry and entry != null) { + fatal("combination of '--entry' and `-fno-entry` are incompatible", .{}); + } + } if (linker_shared_memory) { if (output_mode == .Obj) { fatal("shared memory is not allowed in object files", .{}); @@ -3465,6 +3493,7 @@ fn buildOutputType( .linker_import_symbols = linker_import_symbols, .linker_import_table = linker_import_table, .linker_export_table = linker_export_table, + .linker_no_entry = linker_no_entry orelse false, .linker_initial_memory = linker_initial_memory, .linker_max_memory = linker_max_memory, .linker_shared_memory = linker_shared_memory, -- cgit v1.2.3 From 58618afaee7c14feedad4f115e9a4468bac4c529 Mon Sep 17 00:00:00 2001 From: Luuk de Gram Date: Thu, 31 Aug 2023 17:12:12 +0200 Subject: wasm-linker: correctly pass --shared and --pie When linking a WebAssembly binary using wasm-ld, we will now correctly pass --shared when building a dynamic library and --pie when `-fpic` is given. This is a breaking change and users who currently build dynamic libraries for WebAssembly but wish to have an executable without a main, should use build-exe instead while supplying `-fno-entry`. We also verify the user does not supply --export-memory when -dynamic is enabled. By default we set this flag now to 'false' when `-dynamic` is used to ensure we do not enable it as it's enabled by default for regular WebAssembly binaries. --- src/link/Wasm.zig | 7 +++++++ src/main.zig | 10 ++++++++++ 2 files changed, 17 insertions(+) (limited to 'src/main.zig') diff --git a/src/link/Wasm.zig b/src/link/Wasm.zig index 135803007a..ad9f8266f0 100644 --- a/src/link/Wasm.zig +++ b/src/link/Wasm.zig @@ -4548,6 +4548,13 @@ fn linkWithLLD(wasm: *Wasm, comp: *Compilation, prog_node: *std.Progress.Node) ! try argv.append("--no-entry"); } + if (wasm.base.options.output_mode == .Lib and wasm.base.options.link_mode == .Dynamic) { + try argv.append("--shared"); + } + if (wasm.base.options.pie) { + try argv.append("--pie"); + } + // XXX - TODO: add when wasm-ld supports --build-id. // if (wasm.base.options.build_id) { // try argv.append("--build-id=tree"); diff --git a/src/main.zig b/src/main.zig index fc7e43b16f..95174ae344 100644 --- a/src/main.zig +++ b/src/main.zig @@ -2627,6 +2627,16 @@ fn buildOutputType( if (single_threaded == null) { single_threaded = true; } + if (link_mode) |mode| { + if (mode == .Dynamic) { + if (linker_export_memory != null and linker_export_memory.?) { + fatal("flags '-dynamic' and '--export-memory' are incompatible", .{}); + } + // User did not supply `--export-memory` which is incompatible with -dynamic, therefore + // set the flag to false to ensure it does not get enabled by default. + linker_export_memory = false; + } + } if (wasi_exec_model) |model| { if (model == .reactor) { if (linker_no_entry != null and !linker_no_entry.?) { -- cgit v1.2.3 From c893f837151d4764fd34911376836a01192b4d75 Mon Sep 17 00:00:00 2001 From: Luuk de Gram Date: Thu, 2 Nov 2023 19:06:19 +0100 Subject: cli: consolidate entry point flags --- lib/std/Build/Step/Compile.zig | 32 ++++++++++------ src/Compilation.zig | 3 -- src/link.zig | 1 - src/link/Wasm.zig | 12 +++--- src/main.zig | 64 +++++++++++++++++++------------- test/link/elf.zig | 4 +- test/link/macho/entry/build.zig | 2 +- test/link/macho/entry_in_dylib/build.zig | 2 +- test/link/wasm/archive/build.zig | 2 +- test/link/wasm/basic-features/build.zig | 2 +- test/link/wasm/bss/build.zig | 4 +- test/link/wasm/export-data/build.zig | 2 +- test/link/wasm/export/build.zig | 6 +-- test/link/wasm/extern-mangle/build.zig | 2 +- test/link/wasm/function-table/build.zig | 6 +-- test/link/wasm/infer-features/build.zig | 2 +- test/link/wasm/producers/build.zig | 2 +- test/link/wasm/segments/build.zig | 2 +- test/link/wasm/shared-memory/build.zig | 2 +- test/link/wasm/stack_pointer/build.zig | 2 +- test/link/wasm/type/build.zig | 2 +- 21 files changed, 86 insertions(+), 70 deletions(-) (limited to 'src/main.zig') diff --git a/lib/std/Build/Step/Compile.zig b/lib/std/Build/Step/Compile.zig index f59de11deb..2d08541545 100644 --- a/lib/std/Build/Step/Compile.zig +++ b/lib/std/Build/Step/Compile.zig @@ -64,8 +64,6 @@ initial_memory: ?u64 = null, max_memory: ?u64 = null, shared_memory: bool = false, global_base: ?u64 = null, -/// For WebAssembly only. Tells the linker to not output an entry point. -no_entry: ?bool = null, c_std: std.Build.CStd, /// Set via options; intended to be read-only after that. zig_lib_dir: ?LazyPath, @@ -191,7 +189,8 @@ dll_export_fns: ?bool = null, subsystem: ?std.Target.SubSystem = null, -entry_symbol_name: ?[]const u8 = null, +/// How the linker must handle the entry point of the executable. +entry: Entry = .default, /// List of symbols forced as undefined in the symbol table /// thus forcing their resolution by the linker. @@ -306,6 +305,18 @@ const FrameworkLinkInfo = struct { weak: bool = false, }; +const Entry = union(enum) { + /// Let the compiler decide whether to make an entry point and what to name + /// it. + default, + /// The executable will have no entry point. + disabled, + /// The executable will have an entry point with the default symbol name. + enabled, + /// The executable will have an entry point with the specified symbol name. + symbol_name: []const u8, +}; + pub const IncludeDir = union(enum) { path: LazyPath, path_system: LazyPath, @@ -1420,9 +1431,13 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void { try zig_args.append(try std.fmt.allocPrint(b.allocator, "-ofmt={s}", .{@tagName(ofmt)})); } - if (self.entry_symbol_name) |entry| { - try zig_args.append("--entry"); - try zig_args.append(entry); + switch (self.entry) { + .default => {}, + .disabled => try zig_args.append("-fno-entry"), + .enabled => try zig_args.append("-fentry"), + .symbol_name => |entry_name| { + try zig_args.append(try std.fmt.allocPrint(b.allocator, "-fentry={s}", .{entry_name})); + }, } { @@ -1853,11 +1868,6 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void { if (self.global_base) |global_base| { try zig_args.append(b.fmt("--global-base={d}", .{global_base})); } - // invert the value due to naming so when `no_entry` is set to 'true' - // we actually emit the flag `-fno_entry`. - if (self.no_entry) |no_entry| { - try addFlag(&zig_args, "entry", !no_entry); - } if (self.code_model != .default) { try zig_args.append("-mcmodel"); diff --git a/src/Compilation.zig b/src/Compilation.zig index 1d60be20a5..954acd44b7 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -643,7 +643,6 @@ pub const InitOptions = struct { linker_import_symbols: bool = false, linker_import_table: bool = false, linker_export_table: bool = false, - linker_no_entry: bool = false, linker_initial_memory: ?u64 = null, linker_max_memory: ?u64 = null, linker_shared_memory: bool = false, @@ -1615,7 +1614,6 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { .import_symbols = options.linker_import_symbols, .import_table = options.linker_import_table, .export_table = options.linker_export_table, - .no_entry = options.linker_no_entry, .initial_memory = options.linker_initial_memory, .max_memory = options.linker_max_memory, .shared_memory = options.linker_shared_memory, @@ -2579,7 +2577,6 @@ fn addNonIncrementalStuffToCacheManifest(comp: *Compilation, man: *Cache.Manifes man.hash.addOptional(comp.bin_file.options.max_memory); man.hash.add(comp.bin_file.options.shared_memory); man.hash.addOptional(comp.bin_file.options.global_base); - man.hash.add(comp.bin_file.options.no_entry); // Mach-O specific stuff man.hash.addListOfBytes(comp.bin_file.options.framework_dirs); diff --git a/src/link.zig b/src/link.zig index a49582aac9..1648d6a63e 100644 --- a/src/link.zig +++ b/src/link.zig @@ -166,7 +166,6 @@ pub const Options = struct { export_table: bool, initial_memory: ?u64, max_memory: ?u64, - no_entry: bool, shared_memory: bool, export_symbol_names: []const []const u8, global_base: ?u64, diff --git a/src/link/Wasm.zig b/src/link/Wasm.zig index ad9f8266f0..baa10be603 100644 --- a/src/link/Wasm.zig +++ b/src/link/Wasm.zig @@ -2817,11 +2817,11 @@ fn setupExports(wasm: *Wasm) !void { } fn setupStart(wasm: *Wasm) !void { - if (wasm.base.options.no_entry) return; - const entry_name = wasm.base.options.entry orelse "_start"; + // do not export entry point if user set none or no default was set. + const entry_name = wasm.base.options.entry orelse return; const symbol_loc = wasm.findGlobalSymbol(entry_name) orelse { - log.err("Entry symbol '{s}' missing", .{entry_name}); + log.err("Entry symbol '{s}' missing, use '-fno-entry' to suppress", .{entry_name}); return error.MissingSymbol; }; @@ -4531,6 +4531,8 @@ fn linkWithLLD(wasm: *Wasm, comp: *Compilation, prog_node: *std.Progress.Node) ! if (wasm.base.options.entry) |entry| { try argv.append("--entry"); try argv.append(entry); + } else { + try argv.append("--no-entry"); } // Increase the default stack size to a more reasonable value of 1MB instead of @@ -4544,10 +4546,6 @@ fn linkWithLLD(wasm: *Wasm, comp: *Compilation, prog_node: *std.Progress.Node) ! try argv.append("--allow-undefined"); } - if (wasm.base.options.no_entry) { - try argv.append("--no-entry"); - } - if (wasm.base.options.output_mode == .Lib and wasm.base.options.link_mode == .Dynamic) { try argv.append("--shared"); } diff --git a/src/main.zig b/src/main.zig index 95174ae344..51c5397c10 100644 --- a/src/main.zig +++ b/src/main.zig @@ -509,7 +509,9 @@ const usage_build_generic = \\ --dynamic-linker [path] Set the dynamic interpreter path (usually ld.so) \\ --sysroot [path] Set the system root directory (usually /) \\ --version [ver] Dynamic library semver - \\ --entry [name] Set the entrypoint symbol name + \\ -fentry Enable entry point with default symbol name + \\ -fentry=[name] Override the entry point symbol name + \\ -fno-entry Do not output any entry point \\ --force_undefined [name] Specify the symbol must be defined for the link to succeed \\ -fsoname[=name] Override the default SONAME value \\ -fno-soname Disable emitting a SONAME @@ -577,8 +579,6 @@ const usage_build_generic = \\ --shared-memory (WebAssembly) use shared linear memory \\ --global-base=[addr] (WebAssembly) where to start to place global data \\ --export=[value] (WebAssembly) Force a symbol to be exported - \\ -fentry (WebAssembly) Force output an entry point - \\ -fno-entry (WebAssembly) Do not output any entry point \\ \\Test Options: \\ --test-filter [text] Skip tests that do not match filter @@ -837,7 +837,7 @@ fn buildOutputType( var linker_import_symbols: bool = false; var linker_import_table: bool = false; var linker_export_table: bool = false; - var linker_no_entry: ?bool = null; + var linker_force_entry: ?bool = null; var linker_initial_memory: ?u64 = null; var linker_max_memory: ?u64 = null; var linker_shared_memory: bool = false; @@ -1074,8 +1074,8 @@ fn buildOutputType( subsystem = try parseSubSystem(args_iter.nextOrFatal()); } else if (mem.eql(u8, arg, "-O")) { optimize_mode_string = args_iter.nextOrFatal(); - } else if (mem.eql(u8, arg, "--entry")) { - entry = args_iter.nextOrFatal(); + } else if (mem.startsWith(u8, arg, "-fentry=")) { + entry = arg["-fentry=".len..]; } else if (mem.eql(u8, arg, "--force_undefined")) { try force_undefined_symbols.put(gpa, args_iter.nextOrFatal(), {}); } else if (mem.eql(u8, arg, "--stack")) { @@ -1507,9 +1507,9 @@ fn buildOutputType( } else if (mem.eql(u8, arg, "--import-memory")) { linker_import_memory = true; } else if (mem.eql(u8, arg, "-fentry")) { - linker_no_entry = false; + linker_force_entry = true; } else if (mem.eql(u8, arg, "-fno-entry")) { - linker_no_entry = true; + linker_force_entry = false; } else if (mem.eql(u8, arg, "--export-memory")) { linker_export_memory = true; } else if (mem.eql(u8, arg, "--import-symbols")) { @@ -2142,7 +2142,7 @@ fn buildOutputType( } else if (mem.eql(u8, arg, "--export-table")) { linker_export_table = true; } else if (mem.eql(u8, arg, "--no-entry")) { - linker_no_entry = true; + linker_force_entry = false; } else if (mem.eql(u8, arg, "--initial-memory")) { const next_arg = linker_args_it.nextOrFatal(); linker_initial_memory = std.fmt.parseUnsigned(u32, eatIntPrefix(next_arg, 16), 16) catch |err| { @@ -2605,6 +2605,23 @@ fn buildOutputType( link_libcpp = true; } + if (linker_force_entry) |force| { + if (!force) { + entry = null; + } else if (entry == null and output_mode == .Exe) { + entry = switch (target_info.target.ofmt) { + .coff => "wWinMainCRTStartup", + .macho => "_main", + .elf, .plan9 => "_start", + .wasm => defaultWasmEntryName(wasi_exec_model), + else => |tag| fatal("No default entry point available for output format {s}", .{@tagName(tag)}), + }; + } + } else if (entry == null and target_info.target.isWasm() and output_mode == .Exe) { + // For WebAssembly the compiler defaults to setting the entry name when no flags are set. + entry = defaultWasmEntryName(wasi_exec_model); + } + if (target_info.target.ofmt == .coff) { // Now that we know the target supports resources, // we can add the res files as link objects. @@ -2637,25 +2654,13 @@ fn buildOutputType( linker_export_memory = false; } } - if (wasi_exec_model) |model| { - if (model == .reactor) { - if (linker_no_entry != null and !linker_no_entry.?) { - fatal("WASI exucution model 'reactor' incompatible with flag '-fentry'. Reactor execution model has no entry point", .{}); - } - if (entry) |entry_name| { - if (!mem.eql(u8, "_initialize", entry_name)) { - fatal("the entry symbol of the reactor model must be '_initialize', but found '{s}'", .{entry_name}); - } - } else { - entry = "_initialize"; + if (wasi_exec_model != null and wasi_exec_model.? == .reactor) { + if (entry) |entry_name| { + if (!mem.eql(u8, "_initialize", entry_name)) { + fatal("the entry symbol of the reactor model must be '_initialize', but found '{s}'", .{entry_name}); } } } - if (linker_no_entry) |no_entry| { - if (no_entry and entry != null) { - fatal("combination of '--entry' and `-fno-entry` are incompatible", .{}); - } - } if (linker_shared_memory) { if (output_mode == .Obj) { fatal("shared memory is not allowed in object files", .{}); @@ -3503,7 +3508,6 @@ fn buildOutputType( .linker_import_symbols = linker_import_symbols, .linker_import_table = linker_import_table, .linker_export_table = linker_export_table, - .linker_no_entry = linker_no_entry orelse false, .linker_initial_memory = linker_initial_memory, .linker_max_memory = linker_max_memory, .linker_shared_memory = linker_shared_memory, @@ -7253,3 +7257,11 @@ fn createDependenciesModule( try main_mod.deps.put(arena, "@dependencies", deps_mod); return deps_mod; } + +fn defaultWasmEntryName(exec_model: ?std.builtin.WasiExecModel) []const u8 { + const model = exec_model orelse .command; + if (model == .reactor) { + return "_initialize"; + } + return "_start"; +} diff --git a/test/link/elf.zig b/test/link/elf.zig index dad3604c31..d7fe756276 100644 --- a/test/link/elf.zig +++ b/test/link/elf.zig @@ -651,7 +651,7 @@ fn testEntryPoint(b: *Build, opts: Options) *Step { const exe = addExecutable(b, "main", opts); exe.addObject(a_o); exe.addObject(b_o); - exe.entry_symbol_name = "foo"; + exe.entry = .{ .symbol_name = "foo" }; const check = exe.checkObject(); check.checkStart(); @@ -667,7 +667,7 @@ fn testEntryPoint(b: *Build, opts: Options) *Step { const exe = addExecutable(b, "other", opts); exe.addObject(a_o); exe.addObject(b_o); - exe.entry_symbol_name = "bar"; + exe.entry = .{ .symbol_name = "bar" }; const check = exe.checkObject(); check.checkStart(); diff --git a/test/link/macho/entry/build.zig b/test/link/macho/entry/build.zig index fcba02cd9a..9f493d2715 100644 --- a/test/link/macho/entry/build.zig +++ b/test/link/macho/entry/build.zig @@ -20,7 +20,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize }); exe.addCSourceFile(.{ .file = .{ .path = "main.c" }, .flags = &.{} }); exe.linkLibC(); - exe.entry_symbol_name = "_non_main"; + exe.entry = .{ .symbol_name = "_non_main" }; const check_exe = exe.checkObject(); diff --git a/test/link/macho/entry_in_dylib/build.zig b/test/link/macho/entry_in_dylib/build.zig index 97ffa917b4..eb036abe6a 100644 --- a/test/link/macho/entry_in_dylib/build.zig +++ b/test/link/macho/entry_in_dylib/build.zig @@ -30,7 +30,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize exe.addCSourceFile(.{ .file = .{ .path = "main.c" }, .flags = &.{} }); exe.linkLibrary(lib); exe.linkLibC(); - exe.entry_symbol_name = "_bootstrap"; + exe.entry = .{ .symbol_name = "_bootstrap" }; exe.forceUndefinedSymbol("_my_main"); const check_exe = exe.checkObject(); diff --git a/test/link/wasm/archive/build.zig b/test/link/wasm/archive/build.zig index c238e1647b..3da284ac8f 100644 --- a/test/link/wasm/archive/build.zig +++ b/test/link/wasm/archive/build.zig @@ -21,7 +21,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize .optimize = optimize, .target = .{ .cpu_arch = .wasm32, .os_tag = .freestanding }, }); - lib.no_entry = true; + lib.entry = .disabled; lib.use_llvm = false; lib.use_lld = false; lib.strip = false; diff --git a/test/link/wasm/basic-features/build.zig b/test/link/wasm/basic-features/build.zig index 689527b52b..0566fbe2c1 100644 --- a/test/link/wasm/basic-features/build.zig +++ b/test/link/wasm/basic-features/build.zig @@ -15,7 +15,7 @@ pub fn build(b: *std.Build) void { .os_tag = .freestanding, }, }); - lib.no_entry = true; + lib.entry = .disabled; lib.use_llvm = false; lib.use_lld = false; diff --git a/test/link/wasm/bss/build.zig b/test/link/wasm/bss/build.zig index 9435c78485..1bc059acde 100644 --- a/test/link/wasm/bss/build.zig +++ b/test/link/wasm/bss/build.zig @@ -20,7 +20,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize_mode: std.builtin.Opt .target = .{ .cpu_arch = .wasm32, .os_tag = .freestanding }, .optimize = optimize_mode, }); - lib.no_entry = true; + lib.entry = .disabled; lib.use_llvm = false; lib.use_lld = false; lib.strip = false; @@ -67,7 +67,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize_mode: std.builtin.Opt .target = .{ .cpu_arch = .wasm32, .os_tag = .freestanding }, .optimize = optimize_mode, }); - lib.no_entry = true; + lib.entry = .disabled; lib.use_llvm = false; lib.use_lld = false; lib.strip = false; diff --git a/test/link/wasm/export-data/build.zig b/test/link/wasm/export-data/build.zig index 5c2fbac7ce..58a8795390 100644 --- a/test/link/wasm/export-data/build.zig +++ b/test/link/wasm/export-data/build.zig @@ -15,7 +15,7 @@ pub fn build(b: *std.Build) void { .optimize = .ReleaseSafe, // to make the output deterministic in address positions .target = .{ .cpu_arch = .wasm32, .os_tag = .freestanding }, }); - lib.no_entry = true; + lib.entry = .disabled; lib.use_lld = false; lib.export_symbol_names = &.{ "foo", "bar" }; lib.global_base = 0; // put data section at address 0 to make data symbols easier to parse diff --git a/test/link/wasm/export/build.zig b/test/link/wasm/export/build.zig index 0ad9f380d2..5c0306335d 100644 --- a/test/link/wasm/export/build.zig +++ b/test/link/wasm/export/build.zig @@ -19,7 +19,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize .optimize = optimize, .target = .{ .cpu_arch = .wasm32, .os_tag = .freestanding }, }); - no_export.no_entry = true; + no_export.entry = .disabled; no_export.use_llvm = false; no_export.use_lld = false; @@ -29,7 +29,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize .optimize = optimize, .target = .{ .cpu_arch = .wasm32, .os_tag = .freestanding }, }); - dynamic_export.no_entry = true; + dynamic_export.entry = .disabled; dynamic_export.rdynamic = true; dynamic_export.use_llvm = false; dynamic_export.use_lld = false; @@ -40,7 +40,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize .optimize = optimize, .target = .{ .cpu_arch = .wasm32, .os_tag = .freestanding }, }); - force_export.no_entry = true; + force_export.entry = .disabled; force_export.export_symbol_names = &.{"foo"}; force_export.use_llvm = false; force_export.use_lld = false; diff --git a/test/link/wasm/extern-mangle/build.zig b/test/link/wasm/extern-mangle/build.zig index 13446fec0d..9f450c2dcc 100644 --- a/test/link/wasm/extern-mangle/build.zig +++ b/test/link/wasm/extern-mangle/build.zig @@ -17,7 +17,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize .target = .{ .cpu_arch = .wasm32, .os_tag = .freestanding }, .optimize = optimize, }); - lib.no_entry = true; + lib.entry = .disabled; lib.import_symbols = true; // import `a` and `b` lib.rdynamic = true; // export `foo` diff --git a/test/link/wasm/function-table/build.zig b/test/link/wasm/function-table/build.zig index c8c5f4c3f9..906a255642 100644 --- a/test/link/wasm/function-table/build.zig +++ b/test/link/wasm/function-table/build.zig @@ -19,7 +19,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize .target = .{ .cpu_arch = .wasm32, .os_tag = .freestanding }, .optimize = optimize, }); - import_table.no_entry = true; + import_table.entry = .disabled; import_table.use_llvm = false; import_table.use_lld = false; import_table.import_table = true; @@ -30,7 +30,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize .target = .{ .cpu_arch = .wasm32, .os_tag = .freestanding }, .optimize = optimize, }); - export_table.no_entry = true; + export_table.entry = .disabled; export_table.use_llvm = false; export_table.use_lld = false; export_table.export_table = true; @@ -41,7 +41,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize .target = .{ .cpu_arch = .wasm32, .os_tag = .freestanding }, .optimize = optimize, }); - regular_table.no_entry = true; + regular_table.entry = .disabled; regular_table.use_llvm = false; regular_table.use_lld = false; diff --git a/test/link/wasm/infer-features/build.zig b/test/link/wasm/infer-features/build.zig index d92f5865ec..5c7fa57447 100644 --- a/test/link/wasm/infer-features/build.zig +++ b/test/link/wasm/infer-features/build.zig @@ -27,7 +27,7 @@ pub fn build(b: *std.Build) void { .os_tag = .freestanding, }, }); - lib.no_entry = true; + lib.entry = .disabled; lib.use_llvm = false; lib.use_lld = false; lib.addObject(c_obj); diff --git a/test/link/wasm/producers/build.zig b/test/link/wasm/producers/build.zig index dd9dcdf45a..e2bd95f450 100644 --- a/test/link/wasm/producers/build.zig +++ b/test/link/wasm/producers/build.zig @@ -20,7 +20,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize .target = .{ .cpu_arch = .wasm32, .os_tag = .freestanding }, .optimize = optimize, }); - lib.no_entry = true; + lib.entry = .disabled; lib.use_llvm = false; lib.use_lld = false; lib.strip = false; diff --git a/test/link/wasm/segments/build.zig b/test/link/wasm/segments/build.zig index fa95c20c61..21b954a902 100644 --- a/test/link/wasm/segments/build.zig +++ b/test/link/wasm/segments/build.zig @@ -19,7 +19,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize .target = .{ .cpu_arch = .wasm32, .os_tag = .freestanding }, .optimize = optimize, }); - lib.no_entry = true; + lib.entry = .disabled; lib.use_llvm = false; lib.use_lld = false; lib.strip = false; diff --git a/test/link/wasm/shared-memory/build.zig b/test/link/wasm/shared-memory/build.zig index a113ac7bcd..a1d660d135 100644 --- a/test/link/wasm/shared-memory/build.zig +++ b/test/link/wasm/shared-memory/build.zig @@ -22,7 +22,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize_mode: std.builtin.Opt }, .optimize = optimize_mode, }); - lib.no_entry = true; + lib.entry = .disabled; lib.use_lld = false; lib.strip = false; lib.import_memory = true; diff --git a/test/link/wasm/stack_pointer/build.zig b/test/link/wasm/stack_pointer/build.zig index b004583cf3..00ef54c052 100644 --- a/test/link/wasm/stack_pointer/build.zig +++ b/test/link/wasm/stack_pointer/build.zig @@ -19,7 +19,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize .target = .{ .cpu_arch = .wasm32, .os_tag = .freestanding }, .optimize = optimize, }); - lib.no_entry = true; + lib.entry = .disabled; lib.use_llvm = false; lib.use_lld = false; lib.strip = false; diff --git a/test/link/wasm/type/build.zig b/test/link/wasm/type/build.zig index 98e12eb4dc..de574e36e4 100644 --- a/test/link/wasm/type/build.zig +++ b/test/link/wasm/type/build.zig @@ -19,7 +19,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize .target = .{ .cpu_arch = .wasm32, .os_tag = .freestanding }, .optimize = optimize, }); - lib.no_entry = true; + lib.entry = .disabled; lib.use_llvm = false; lib.use_lld = false; lib.strip = false; -- cgit v1.2.3