authorgravatar for luuk@degram.devLuuk de Gram <luuk@degram.dev> 2023-09-01 16:37:07+02:00
committergravatar for luuk@degram.devLuuk de Gram <luuk@degram.dev> 2023-11-03 12:48:53+01:00
log938f9dea374193972be05b19b58dced54d79b1cb
tree3778a6e153a29ffa267c9ab3e6b64824466d6d25
parent58618afaee7c14feedad4f115e9a4468bac4c529
signature Commit is signed but in an unrecognized format.

update linker tests

This updates all linker tests to include `no_entry` as well as changes all tests to executable so they do not need to be updated later when the in-house WebAssembly linker supports dynamic libraries.

14 files changed, 113 insertions(+), 93 deletions(-)

lib/std/Build/Step/Compile.zig+5-1
...@@ -1853,7 +1853,11 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void {...@@ -1853,7 +1853,11 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void {
1853 if (self.global_base) |global_base| {1853 if (self.global_base) |global_base| {
1854 try zig_args.append(b.fmt("--global-base={d}", .{global_base}));1854 try zig_args.append(b.fmt("--global-base={d}", .{global_base}));
1855 }1855 }
1856 try addFlag(&zig_args, "entry", self.no_entry);1856 // invert the value due to naming so when `no_entry` is set to 'true'
1857 // we actually emit the flag `-fno_entry`.
1858 if (self.no_entry) |no_entry| {
1859 try addFlag(&zig_args, "entry", !no_entry);
1860 }
18571861
1858 if (self.code_model != .default) {1862 if (self.code_model != .default) {
1859 try zig_args.append("-mcmodel");1863 try zig_args.append("-mcmodel");
test/link/wasm/archive/build.zig+2-1
...@@ -15,12 +15,13 @@ pub fn build(b: *std.Build) void {...@@ -15,12 +15,13 @@ pub fn build(b: *std.Build) void {
15fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void {15fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void {
16 // The code in question will pull-in compiler-rt,16 // The code in question will pull-in compiler-rt,
17 // and therefore link with its archive file.17 // and therefore link with its archive file.
18 const lib = b.addSharedLibrary(.{18 const lib = b.addExecutable(.{
19 .name = "main",19 .name = "main",
20 .root_source_file = .{ .path = "main.zig" },20 .root_source_file = .{ .path = "main.zig" },
21 .optimize = optimize,21 .optimize = optimize,
22 .target = .{ .cpu_arch = .wasm32, .os_tag = .freestanding },22 .target = .{ .cpu_arch = .wasm32, .os_tag = .freestanding },
23 });23 });
24 lib.no_entry = true;
24 lib.use_llvm = false;25 lib.use_llvm = false;
25 lib.use_lld = false;26 lib.use_lld = false;
26 lib.strip = false;27 lib.strip = false;
test/link/wasm/basic-features/build.zig+2-1
...@@ -4,7 +4,7 @@ pub const requires_stage2 = true;...@@ -4,7 +4,7 @@ pub const requires_stage2 = true;
44
5pub fn build(b: *std.Build) void {5pub fn build(b: *std.Build) void {
6 // Library with explicitly set cpu features6 // Library with explicitly set cpu features
7 const lib = b.addSharedLibrary(.{7 const lib = b.addExecutable(.{
8 .name = "lib",8 .name = "lib",
9 .root_source_file = .{ .path = "main.zig" },9 .root_source_file = .{ .path = "main.zig" },
10 .optimize = .Debug,10 .optimize = .Debug,
...@@ -15,6 +15,7 @@ pub fn build(b: *std.Build) void {...@@ -15,6 +15,7 @@ pub fn build(b: *std.Build) void {
15 .os_tag = .freestanding,15 .os_tag = .freestanding,
16 },16 },
17 });17 });
18 lib.no_entry = true;
18 lib.use_llvm = false;19 lib.use_llvm = false;
19 lib.use_lld = false;20 lib.use_lld = false;
2021
test/link/wasm/bss/build.zig+4-2
...@@ -14,12 +14,13 @@ pub fn build(b: *std.Build) void {...@@ -14,12 +14,13 @@ pub fn build(b: *std.Build) void {
1414
15fn add(b: *std.Build, test_step: *std.Build.Step, optimize_mode: std.builtin.OptimizeMode, is_safe: bool) void {15fn add(b: *std.Build, test_step: *std.Build.Step, optimize_mode: std.builtin.OptimizeMode, is_safe: bool) void {
16 {16 {
17 const lib = b.addSharedLibrary(.{17 const lib = b.addExecutable(.{
18 .name = "lib",18 .name = "lib",
19 .root_source_file = .{ .path = "lib.zig" },19 .root_source_file = .{ .path = "lib.zig" },
20 .target = .{ .cpu_arch = .wasm32, .os_tag = .freestanding },20 .target = .{ .cpu_arch = .wasm32, .os_tag = .freestanding },
21 .optimize = optimize_mode,21 .optimize = optimize_mode,
22 });22 });
23 lib.no_entry = true;
23 lib.use_llvm = false;24 lib.use_llvm = false;
24 lib.use_lld = false;25 lib.use_lld = false;
25 lib.strip = false;26 lib.strip = false;
...@@ -60,12 +61,13 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize_mode: std.builtin.Opt...@@ -60,12 +61,13 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize_mode: std.builtin.Opt
6061
61 // verify zero'd declaration is stored in bss for all optimization modes.62 // verify zero'd declaration is stored in bss for all optimization modes.
62 {63 {
63 const lib = b.addSharedLibrary(.{64 const lib = b.addExecutable(.{
64 .name = "lib",65 .name = "lib",
65 .root_source_file = .{ .path = "lib2.zig" },66 .root_source_file = .{ .path = "lib2.zig" },
66 .target = .{ .cpu_arch = .wasm32, .os_tag = .freestanding },67 .target = .{ .cpu_arch = .wasm32, .os_tag = .freestanding },
67 .optimize = optimize_mode,68 .optimize = optimize_mode,
68 });69 });
70 lib.no_entry = true;
69 lib.use_llvm = false;71 lib.use_llvm = false;
70 lib.use_lld = false;72 lib.use_lld = false;
71 lib.strip = false;73 lib.strip = false;
test/link/wasm/export-data/build.zig+2-1
...@@ -9,12 +9,13 @@ pub fn build(b: *std.Build) void {...@@ -9,12 +9,13 @@ pub fn build(b: *std.Build) void {
9 return;9 return;
10 }10 }
1111
12 const lib = b.addSharedLibrary(.{12 const lib = b.addExecutable(.{
13 .name = "lib",13 .name = "lib",
14 .root_source_file = .{ .path = "lib.zig" },14 .root_source_file = .{ .path = "lib.zig" },
15 .optimize = .ReleaseSafe, // to make the output deterministic in address positions15 .optimize = .ReleaseSafe, // to make the output deterministic in address positions
16 .target = .{ .cpu_arch = .wasm32, .os_tag = .freestanding },16 .target = .{ .cpu_arch = .wasm32, .os_tag = .freestanding },
17 });17 });
18 lib.no_entry = true;
18 lib.use_lld = false;19 lib.use_lld = false;
19 lib.export_symbol_names = &.{ "foo", "bar" };20 lib.export_symbol_names = &.{ "foo", "bar" };
20 lib.global_base = 0; // put data section at address 0 to make data symbols easier to parse21 lib.global_base = 0; // put data section at address 0 to make data symbols easier to parse
test/link/wasm/export/build.zig+6-3
...@@ -13,31 +13,34 @@ pub fn build(b: *std.Build) void {...@@ -13,31 +13,34 @@ pub fn build(b: *std.Build) void {
13}13}
1414
15fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void {15fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void {
16 const no_export = b.addSharedLibrary(.{16 const no_export = b.addExecutable(.{
17 .name = "no-export",17 .name = "no-export",
18 .root_source_file = .{ .path = "main.zig" },18 .root_source_file = .{ .path = "main.zig" },
19 .optimize = optimize,19 .optimize = optimize,
20 .target = .{ .cpu_arch = .wasm32, .os_tag = .freestanding },20 .target = .{ .cpu_arch = .wasm32, .os_tag = .freestanding },
21 });21 });
22 no_export.no_entry = true;
22 no_export.use_llvm = false;23 no_export.use_llvm = false;
23 no_export.use_lld = false;24 no_export.use_lld = false;
2425
25 const dynamic_export = b.addSharedLibrary(.{26 const dynamic_export = b.addExecutable(.{
26 .name = "dynamic",27 .name = "dynamic",
27 .root_source_file = .{ .path = "main.zig" },28 .root_source_file = .{ .path = "main.zig" },
28 .optimize = optimize,29 .optimize = optimize,
29 .target = .{ .cpu_arch = .wasm32, .os_tag = .freestanding },30 .target = .{ .cpu_arch = .wasm32, .os_tag = .freestanding },
30 });31 });
32 dynamic_export.no_entry = true;
31 dynamic_export.rdynamic = true;33 dynamic_export.rdynamic = true;
32 dynamic_export.use_llvm = false;34 dynamic_export.use_llvm = false;
33 dynamic_export.use_lld = false;35 dynamic_export.use_lld = false;
3436
35 const force_export = b.addSharedLibrary(.{37 const force_export = b.addExecutable(.{
36 .name = "force",38 .name = "force",
37 .root_source_file = .{ .path = "main.zig" },39 .root_source_file = .{ .path = "main.zig" },
38 .optimize = optimize,40 .optimize = optimize,
39 .target = .{ .cpu_arch = .wasm32, .os_tag = .freestanding },41 .target = .{ .cpu_arch = .wasm32, .os_tag = .freestanding },
40 });42 });
43 force_export.no_entry = true;
41 force_export.export_symbol_names = &.{"foo"};44 force_export.export_symbol_names = &.{"foo"};
42 force_export.use_llvm = false;45 force_export.use_llvm = false;
43 force_export.use_lld = false;46 force_export.use_lld = false;
test/link/wasm/extern-mangle/build.zig+2-1
...@@ -11,12 +11,13 @@ pub fn build(b: *std.Build) void {...@@ -11,12 +11,13 @@ pub fn build(b: *std.Build) void {
11}11}
1212
13fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void {13fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void {
14 const lib = b.addSharedLibrary(.{14 const lib = b.addExecutable(.{
15 .name = "lib",15 .name = "lib",
16 .root_source_file = .{ .path = "lib.zig" },16 .root_source_file = .{ .path = "lib.zig" },
17 .target = .{ .cpu_arch = .wasm32, .os_tag = .freestanding },17 .target = .{ .cpu_arch = .wasm32, .os_tag = .freestanding },
18 .optimize = optimize,18 .optimize = optimize,
19 });19 });
20 lib.no_entry = true;
20 lib.import_symbols = true; // import `a` and `b`21 lib.import_symbols = true; // import `a` and `b`
21 lib.rdynamic = true; // export `foo`22 lib.rdynamic = true; // export `foo`
2223
test/link/wasm/function-table/build.zig+6-3
...@@ -13,32 +13,35 @@ pub fn build(b: *std.Build) void {...@@ -13,32 +13,35 @@ pub fn build(b: *std.Build) void {
13}13}
1414
15fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void {15fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void {
16 const import_table = b.addSharedLibrary(.{16 const import_table = b.addExecutable(.{
17 .name = "import_table",17 .name = "import_table",
18 .root_source_file = .{ .path = "lib.zig" },18 .root_source_file = .{ .path = "lib.zig" },
19 .target = .{ .cpu_arch = .wasm32, .os_tag = .freestanding },19 .target = .{ .cpu_arch = .wasm32, .os_tag = .freestanding },
20 .optimize = optimize,20 .optimize = optimize,
21 });21 });
22 import_table.no_entry = true;
22 import_table.use_llvm = false;23 import_table.use_llvm = false;
23 import_table.use_lld = false;24 import_table.use_lld = false;
24 import_table.import_table = true;25 import_table.import_table = true;
2526
26 const export_table = b.addSharedLibrary(.{27 const export_table = b.addExecutable(.{
27 .name = "export_table",28 .name = "export_table",
28 .root_source_file = .{ .path = "lib.zig" },29 .root_source_file = .{ .path = "lib.zig" },
29 .target = .{ .cpu_arch = .wasm32, .os_tag = .freestanding },30 .target = .{ .cpu_arch = .wasm32, .os_tag = .freestanding },
30 .optimize = optimize,31 .optimize = optimize,
31 });32 });
33 export_table.no_entry = true;
32 export_table.use_llvm = false;34 export_table.use_llvm = false;
33 export_table.use_lld = false;35 export_table.use_lld = false;
34 export_table.export_table = true;36 export_table.export_table = true;
3537
36 const regular_table = b.addSharedLibrary(.{38 const regular_table = b.addExecutable(.{
37 .name = "regular_table",39 .name = "regular_table",
38 .root_source_file = .{ .path = "lib.zig" },40 .root_source_file = .{ .path = "lib.zig" },
39 .target = .{ .cpu_arch = .wasm32, .os_tag = .freestanding },41 .target = .{ .cpu_arch = .wasm32, .os_tag = .freestanding },
40 .optimize = optimize,42 .optimize = optimize,
41 });43 });
44 regular_table.no_entry = true;
42 regular_table.use_llvm = false;45 regular_table.use_llvm = false;
43 regular_table.use_lld = false;46 regular_table.use_lld = false;
4447
test/link/wasm/infer-features/build.zig+2-1
...@@ -17,7 +17,7 @@ pub fn build(b: *std.Build) void {...@@ -17,7 +17,7 @@ pub fn build(b: *std.Build) void {
1717
18 // Wasm library that doesn't have any features specified. This will18 // Wasm library that doesn't have any features specified. This will
19 // infer its featureset from other linked object files.19 // infer its featureset from other linked object files.
20 const lib = b.addSharedLibrary(.{20 const lib = b.addExecutable(.{
21 .name = "lib",21 .name = "lib",
22 .root_source_file = .{ .path = "main.zig" },22 .root_source_file = .{ .path = "main.zig" },
23 .optimize = .Debug,23 .optimize = .Debug,
...@@ -27,6 +27,7 @@ pub fn build(b: *std.Build) void {...@@ -27,6 +27,7 @@ pub fn build(b: *std.Build) void {
27 .os_tag = .freestanding,27 .os_tag = .freestanding,
28 },28 },
29 });29 });
30 lib.no_entry = true;
30 lib.use_llvm = false;31 lib.use_llvm = false;
31 lib.use_lld = false;32 lib.use_lld = false;
32 lib.addObject(c_obj);33 lib.addObject(c_obj);
test/link/wasm/producers/build.zig+2-1
...@@ -14,12 +14,13 @@ pub fn build(b: *std.Build) void {...@@ -14,12 +14,13 @@ pub fn build(b: *std.Build) void {
14}14}
1515
16fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void {16fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void {
17 const lib = b.addSharedLibrary(.{17 const lib = b.addExecutable(.{
18 .name = "lib",18 .name = "lib",
19 .root_source_file = .{ .path = "lib.zig" },19 .root_source_file = .{ .path = "lib.zig" },
20 .target = .{ .cpu_arch = .wasm32, .os_tag = .freestanding },20 .target = .{ .cpu_arch = .wasm32, .os_tag = .freestanding },
21 .optimize = optimize,21 .optimize = optimize,
22 });22 });
23 lib.no_entry = true;
23 lib.use_llvm = false;24 lib.use_llvm = false;
24 lib.use_lld = false;25 lib.use_lld = false;
25 lib.strip = false;26 lib.strip = false;
test/link/wasm/segments/build.zig+2-1
...@@ -13,12 +13,13 @@ pub fn build(b: *std.Build) void {...@@ -13,12 +13,13 @@ pub fn build(b: *std.Build) void {
13}13}
1414
15fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void {15fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void {
16 const lib = b.addSharedLibrary(.{16 const lib = b.addExecutable(.{
17 .name = "lib",17 .name = "lib",
18 .root_source_file = .{ .path = "lib.zig" },18 .root_source_file = .{ .path = "lib.zig" },
19 .target = .{ .cpu_arch = .wasm32, .os_tag = .freestanding },19 .target = .{ .cpu_arch = .wasm32, .os_tag = .freestanding },
20 .optimize = optimize,20 .optimize = optimize,
21 });21 });
22 lib.no_entry = true;
22 lib.use_llvm = false;23 lib.use_llvm = false;
23 lib.use_lld = false;24 lib.use_lld = false;
24 lib.strip = false;25 lib.strip = false;
test/link/wasm/shared-memory/build.zig+74-75
...@@ -11,88 +11,87 @@ pub fn build(b: *std.Build) void {...@@ -11,88 +11,87 @@ pub fn build(b: *std.Build) void {
11}11}
1212
13fn add(b: *std.Build, test_step: *std.Build.Step, optimize_mode: std.builtin.OptimizeMode) void {13fn add(b: *std.Build, test_step: *std.Build.Step, optimize_mode: std.builtin.OptimizeMode) void {
14 {14 const lib = b.addExecutable(.{
15 const lib = b.addSharedLibrary(.{15 .name = "lib",
16 .name = "lib",16 .root_source_file = .{ .path = "lib.zig" },
17 .root_source_file = .{ .path = "lib.zig" },17 .target = .{
18 .target = .{18 .cpu_arch = .wasm32,
19 .cpu_arch = .wasm32,19 .cpu_model = .{ .explicit = &std.Target.wasm.cpu.mvp },
20 .cpu_model = .{ .explicit = &std.Target.wasm.cpu.mvp },20 .cpu_features_add = std.Target.wasm.featureSet(&.{ .atomics, .bulk_memory }),
21 .cpu_features_add = std.Target.wasm.featureSet(&.{ .atomics, .bulk_memory }),21 .os_tag = .freestanding,
22 .os_tag = .freestanding,22 },
23 },23 .optimize = optimize_mode,
24 .optimize = optimize_mode,24 });
25 });25 lib.no_entry = true;
26 lib.use_lld = false;26 lib.use_lld = false;
27 lib.strip = false;27 lib.strip = false;
28 lib.import_memory = true;28 lib.import_memory = true;
29 lib.export_memory = true;29 lib.export_memory = true;
30 lib.shared_memory = true;30 lib.shared_memory = true;
31 lib.max_memory = 67108864;31 lib.max_memory = 67108864;
32 lib.single_threaded = false;32 lib.single_threaded = false;
33 lib.export_symbol_names = &.{"foo"};33 lib.export_symbol_names = &.{"foo"};
3434
35 const check_lib = lib.checkObject();35 const check_lib = lib.checkObject();
3636
37 check_lib.checkStart("Section import");37 check_lib.checkStart("Section import");
38 check_lib.checkNext("entries 1");38 check_lib.checkNext("entries 1");
39 check_lib.checkNext("module env");39 check_lib.checkNext("module env");
40 check_lib.checkNext("name memory"); // ensure we are importing memory40 check_lib.checkNext("name memory"); // ensure we are importing memory
4141
42 check_lib.checkStart("Section export");42 check_lib.checkStart("Section export");
43 check_lib.checkNext("entries 2");43 check_lib.checkNext("entries 2");
44 check_lib.checkNext("name memory"); // ensure we also export memory again44 check_lib.checkNext("name memory"); // ensure we also export memory again
4545
46 // This section *must* be emit as the start function is set to the index46 // This section *must* be emit as the start function is set to the index
47 // of __wasm_init_memory47 // of __wasm_init_memory
48 // release modes will have the TLS segment optimized out in our test-case.48 // release modes will have the TLS segment optimized out in our test-case.
49 // This means we won't have __wasm_init_memory in such case, and therefore49 // This means we won't have __wasm_init_memory in such case, and therefore
50 // should also not have a section "start"50 // should also not have a section "start"
51 if (optimize_mode == .Debug) {51 if (optimize_mode == .Debug) {
52 check_lib.checkStart("Section start");52 check_lib.checkStart("Section start");
53 }53 }
54
55 // This section is only and *must* be emit when shared-memory is enabled
56 // release modes will have the TLS segment optimized out in our test-case.
57 if (optimize_mode == .Debug) {
58 check_lib.checkStart("Section data_count");
59 check_lib.checkNext("count 3");
60 }
6154
62 check_lib.checkStart("Section custom");55 // This section is only and *must* be emit when shared-memory is enabled
63 check_lib.checkNext("name name");56 // release modes will have the TLS segment optimized out in our test-case.
64 check_lib.checkNext("type function");57 if (optimize_mode == .Debug) {
65 if (optimize_mode == .Debug) {58 check_lib.checkStart("Section data_count");
66 check_lib.checkNext("name __wasm_init_memory");59 check_lib.checkNext("count 3");
67 }60 }
68 check_lib.checkNext("name __wasm_init_tls");
69 check_lib.checkNext("type global");
7061
71 // In debug mode the symbol __tls_base is resolved to an undefined symbol62 check_lib.checkStart("Section custom");
72 // from the object file, hence its placement differs than in release modes63 check_lib.checkNext("name name");
73 // where the entire tls segment is optimized away, and tls_base will have64 check_lib.checkNext("type function");
74 // its original position.65 if (optimize_mode == .Debug) {
75 if (optimize_mode == .Debug) {66 check_lib.checkNext("name __wasm_init_memory");
76 check_lib.checkNext("name __tls_size");67 }
77 check_lib.checkNext("name __tls_align");68 check_lib.checkNext("name __wasm_init_tls");
78 check_lib.checkNext("name __tls_base");69 check_lib.checkNext("type global");
79 } else {
80 check_lib.checkNext("name __tls_base");
81 check_lib.checkNext("name __tls_size");
82 check_lib.checkNext("name __tls_align");
83 }
8470
85 check_lib.checkNext("type data_segment");71 // In debug mode the symbol __tls_base is resolved to an undefined symbol
86 if (optimize_mode == .Debug) {72 // from the object file, hence its placement differs than in release modes
87 check_lib.checkNext("names 3");73 // where the entire tls segment is optimized away, and tls_base will have
88 check_lib.checkNext("index 0");74 // its original position.
89 check_lib.checkNext("name .rodata");75 if (optimize_mode == .Debug) {
90 check_lib.checkNext("index 1");76 check_lib.checkNext("name __tls_size");
91 check_lib.checkNext("name .bss");77 check_lib.checkNext("name __tls_align");
92 check_lib.checkNext("index 2");78 check_lib.checkNext("name __tls_base");
93 check_lib.checkNext("name .tdata");79 } else {
94 }80 check_lib.checkNext("name __tls_base");
81 check_lib.checkNext("name __tls_size");
82 check_lib.checkNext("name __tls_align");
83 }
9584
96 test_step.dependOn(&check_lib.step);85 check_lib.checkNext("type data_segment");
86 if (optimize_mode == .Debug) {
87 check_lib.checkNext("names 3");
88 check_lib.checkNext("index 0");
89 check_lib.checkNext("name .rodata");
90 check_lib.checkNext("index 1");
91 check_lib.checkNext("name .bss");
92 check_lib.checkNext("index 2");
93 check_lib.checkNext("name .tdata");
97 }94 }
95
96 test_step.dependOn(&check_lib.step);
98}97}
test/link/wasm/stack_pointer/build.zig+2-1
...@@ -13,12 +13,13 @@ pub fn build(b: *std.Build) void {...@@ -13,12 +13,13 @@ pub fn build(b: *std.Build) void {
13}13}
1414
15fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void {15fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void {
16 const lib = b.addSharedLibrary(.{16 const lib = b.addExecutable(.{
17 .name = "lib",17 .name = "lib",
18 .root_source_file = .{ .path = "lib.zig" },18 .root_source_file = .{ .path = "lib.zig" },
19 .target = .{ .cpu_arch = .wasm32, .os_tag = .freestanding },19 .target = .{ .cpu_arch = .wasm32, .os_tag = .freestanding },
20 .optimize = optimize,20 .optimize = optimize,
21 });21 });
22 lib.no_entry = true;
22 lib.use_llvm = false;23 lib.use_llvm = false;
23 lib.use_lld = false;24 lib.use_lld = false;
24 lib.strip = false;25 lib.strip = false;
test/link/wasm/type/build.zig+2-1
...@@ -13,12 +13,13 @@ pub fn build(b: *std.Build) void {...@@ -13,12 +13,13 @@ pub fn build(b: *std.Build) void {
13}13}
1414
15fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void {15fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void {
16 const lib = b.addSharedLibrary(.{16 const lib = b.addExecutable(.{
17 .name = "lib",17 .name = "lib",
18 .root_source_file = .{ .path = "lib.zig" },18 .root_source_file = .{ .path = "lib.zig" },
19 .target = .{ .cpu_arch = .wasm32, .os_tag = .freestanding },19 .target = .{ .cpu_arch = .wasm32, .os_tag = .freestanding },
20 .optimize = optimize,20 .optimize = optimize,
21 });21 });
22 lib.no_entry = true;
22 lib.use_llvm = false;23 lib.use_llvm = false;
23 lib.use_lld = false;24 lib.use_lld = false;
24 lib.strip = false;25 lib.strip = false;