aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJakub Konka <kubkon@jakubkonka.com>2024-07-15 14:51:17 +0200
committerJakub Konka <kubkon@jakubkonka.com>2024-07-18 09:13:08 +0200
commite117e05768be08078a8484eaf982cfa5347a674e (patch)
tree5abf76c2a2bda4e964057f7f318a1117c7cbae82 /test
parent91de8dc8abd9db03ba4ac4c4a5fcbe86e8bc7ee4 (diff)
downloadzig-e117e05768be08078a8484eaf982cfa5347a674e.tar.gz
zig-e117e05768be08078a8484eaf982cfa5347a674e.zip
macho: ensure we always name decls like LLVM to avoid confusion
Diffstat (limited to 'test')
-rw-r--r--test/link/link.zig3
-rw-r--r--test/link/macho.zig21
2 files changed, 17 insertions, 7 deletions
diff --git a/test/link/link.zig b/test/link/link.zig
index a098da757d..aee3bbe01b 100644
--- a/test/link/link.zig
+++ b/test/link/link.zig
@@ -74,8 +74,9 @@ fn addCompileStep(
.target = base.target,
.optimize = base.optimize,
.root_source_file = rsf: {
+ const name = b.fmt("{s}.zig", .{overlay.name});
const bytes = overlay.zig_source_bytes orelse break :rsf null;
- break :rsf b.addWriteFiles().add("a.zig", bytes);
+ break :rsf b.addWriteFiles().add(name, bytes);
},
.pic = overlay.pic,
.strip = if (base.strip) |s| s else overlay.strip,
diff --git a/test/link/macho.zig b/test/link/macho.zig
index 7dd27c0467..6c047ee322 100644
--- a/test/link/macho.zig
+++ b/test/link/macho.zig
@@ -916,7 +916,7 @@ fn testLinksection(b: *Build, opts: Options) *Step {
if (opts.optimize == .Debug) {
check.checkInSymtab();
- check.checkContains("(__TEXT,__TestGenFnA) _a.testGenericFn__anon_");
+ check.checkContains("(__TEXT,__TestGenFnA) _main.testGenericFn__anon_");
}
test_step.dependOn(&check.step);
@@ -2519,11 +2519,20 @@ fn testUnresolvedError(b: *Build, opts: Options) *Step {
});
exe.addObject(obj);
- expectLinkErrors(exe, test_step, .{ .exact = &.{
- "error: undefined symbol: _foo",
- "note: referenced by /?/a.o:_bar",
- "note: referenced by /?/main.o:_a.main",
- } });
+ // TODO order should match across backends if possible
+ if (opts.use_llvm) {
+ expectLinkErrors(exe, test_step, .{ .exact = &.{
+ "error: undefined symbol: _foo",
+ "note: referenced by /?/a.o:_bar",
+ "note: referenced by /?/main.o:_main.main",
+ } });
+ } else {
+ expectLinkErrors(exe, test_step, .{ .exact = &.{
+ "error: undefined symbol: _foo",
+ "note: referenced by /?/main.o:_main.main",
+ "note: referenced by /?/a.o:__TEXT$__text_zig",
+ } });
+ }
return test_step;
}