Jakub Konka e8b613783f check-object: remove wildcard matchers as they are too clunky
Instead, we now have a looser helper called `checkContains(...)`
that will match on any occurrence similarly to `std.mem.indexOf()`.

While at it, I have cleaned up other combinators to make the entire
API more consistent, and so:
* `checkStart(phrase)` is now `checkStart()` followed by
`checkExact(phrase)`
* `checkNext(phrase)` if matching exactly is now `checkExact(phrase)`
* `checkNext(phrase)` if matching loosely is now `checkContains(phrase)`
* `checkNext(phrase)` if matching exactly with var extractors is now
`checkExtract(phrase)`

Finally, `ElfDumper` is now dumping contents of `.symtab` and `.dynsym`
symbol tables. I have also removed dumping of symtabs as optional - they
are now always dumped which cleaned up the implementation even more.
2023-07-20 20:01:06 +02:00

32 lines
993 B
Zig

const std = @import("std");
pub const requires_stage2 = true;
pub fn build(b: *std.Build) void {
// Library with explicitly set cpu features
const lib = b.addSharedLibrary(.{
.name = "lib",
.root_source_file = .{ .path = "main.zig" },
.optimize = .Debug,
.target = .{
.cpu_arch = .wasm32,
.cpu_model = .{ .explicit = &std.Target.wasm.cpu.mvp },
.cpu_features_add = std.Target.wasm.featureSet(&.{.atomics}),
.os_tag = .freestanding,
},
});
lib.use_llvm = false;
lib.use_lld = false;
// Verify the result contains the features explicitly set on the target for the library.
const check = lib.checkObject();
check.checkStart();
check.checkExact("name target_features");
check.checkExact("features 1");
check.checkExact("+ atomics");
const test_step = b.step("test", "Run linker test");
test_step.dependOn(&check.step);
b.default_step = test_step;
}