test/link: Add linker test for producers section
This also turns off non-debug modes for the bss linker tests for Wasm. This is done as it's not required to guarantee to zero out the bss section for non-debug modes.
This commit is contained in:
@@ -34,7 +34,7 @@ fn addWasmCases(cases: *tests.StandaloneContext) void {
|
||||
});
|
||||
|
||||
cases.addBuildFile("test/link/wasm/bss/build.zig", .{
|
||||
.build_modes = true,
|
||||
.build_modes = false,
|
||||
.requires_stage2 = true,
|
||||
});
|
||||
|
||||
@@ -44,6 +44,11 @@ fn addWasmCases(cases: *tests.StandaloneContext) void {
|
||||
.use_emulation = true,
|
||||
});
|
||||
|
||||
cases.addBuildFile("test/link/wasm/producers/build.zig", .{
|
||||
.build_modes = true,
|
||||
.requires_stage2 = true,
|
||||
});
|
||||
|
||||
cases.addBuildFile("test/link/wasm/segments/build.zig", .{
|
||||
.build_modes = true,
|
||||
.requires_stage2 = true,
|
||||
|
||||
36
test/link/wasm/producers/build.zig
Normal file
36
test/link/wasm/producers/build.zig
Normal file
@@ -0,0 +1,36 @@
|
||||
const std = @import("std");
|
||||
const builtin = @import("builtin");
|
||||
const Builder = std.build.Builder;
|
||||
|
||||
pub fn build(b: *Builder) void {
|
||||
const mode = b.standardReleaseOptions();
|
||||
|
||||
const test_step = b.step("test", "Test");
|
||||
test_step.dependOn(b.getInstallStep());
|
||||
|
||||
const lib = b.addSharedLibrary("lib", "lib.zig", .unversioned);
|
||||
lib.setBuildMode(mode);
|
||||
lib.setTarget(.{ .cpu_arch = .wasm32, .os_tag = .freestanding });
|
||||
lib.use_llvm = false;
|
||||
lib.use_stage1 = false;
|
||||
lib.use_lld = false;
|
||||
lib.install();
|
||||
|
||||
const zig_version = builtin.zig_version;
|
||||
var version_buf: [100]u8 = undefined;
|
||||
const version_fmt = std.fmt.bufPrint(&version_buf, "version {}", .{zig_version}) catch unreachable;
|
||||
|
||||
const check_lib = lib.checkObject(.wasm);
|
||||
check_lib.checkStart("name producers");
|
||||
check_lib.checkNext("fields 2");
|
||||
check_lib.checkNext("field_name language");
|
||||
check_lib.checkNext("values 1");
|
||||
check_lib.checkNext("value_name Zig");
|
||||
check_lib.checkNext(version_fmt);
|
||||
check_lib.checkNext("field_name processed-by");
|
||||
check_lib.checkNext("values 1");
|
||||
check_lib.checkNext("value_name Zig");
|
||||
check_lib.checkNext(version_fmt);
|
||||
|
||||
test_step.dependOn(&check_lib.step);
|
||||
}
|
||||
1
test/link/wasm/producers/lib.zig
Normal file
1
test/link/wasm/producers/lib.zig
Normal file
@@ -0,0 +1 @@
|
||||
export fn foo() void {}
|
||||
Reference in New Issue
Block a user