test/link: update wasm linker tests

Disable garbage-collection for certain tests to ensure the tested
sections are being emitted.
This commit is contained in:
Luuk de Gram 2023-11-28 18:32:31 +01:00
parent 596d1cd5a8
commit 4115f70cd3
No known key found for this signature in database
GPG Key ID: A8CFE58E4DC7D664
4 changed files with 7 additions and 0 deletions

View File

@ -26,6 +26,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize_mode: std.builtin.Opt
lib.strip = false;
// to make sure the bss segment is emitted, we must import memory
lib.import_memory = true;
lib.link_gc_sections = false;
const check_lib = lib.checkObject();
@ -73,6 +74,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize_mode: std.builtin.Opt
lib.strip = false;
// to make sure the bss segment is emitted, we must import memory
lib.import_memory = true;
lib.link_gc_sections = false;
const check_lib = lib.checkObject();
check_lib.checkStart();

View File

@ -23,6 +23,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
import_table.use_llvm = false;
import_table.use_lld = false;
import_table.import_table = true;
import_table.link_gc_sections = false;
const export_table = b.addExecutable(.{
.name = "export_table",
@ -34,6 +35,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
export_table.use_llvm = false;
export_table.use_lld = false;
export_table.export_table = true;
export_table.link_gc_sections = false;
const regular_table = b.addExecutable(.{
.name = "regular_table",
@ -44,6 +46,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
regular_table.entry = .disabled;
regular_table.use_llvm = false;
regular_table.use_lld = false;
regular_table.link_gc_sections = false; // Ensure function table is not empty
const check_import = import_table.checkObject();
const check_export = export_table.checkObject();

View File

@ -23,6 +23,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
lib.use_llvm = false;
lib.use_lld = false;
lib.strip = false;
lib.link_gc_sections = false; // so data is not garbage collected and we can verify data section
b.installArtifact(lib);
const check_lib = lib.checkObject();

View File

@ -24,6 +24,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
lib.use_lld = false;
lib.strip = false;
lib.stack_size = std.wasm.page_size * 2; // set an explicit stack size
lib.link_gc_sections = false;
b.installArtifact(lib);
const check_lib = lib.checkObject();