mirror of
https://github.com/ziglang/zig.git
synced 2026-01-21 14:55:25 +00:00
macho: ensure we always name decls like LLVM to avoid confusion
This commit is contained in:
parent
91de8dc8ab
commit
e117e05768
@ -979,7 +979,9 @@ fn updateDeclCode(
|
||||
sym.out_n_sect = sect_index;
|
||||
atom.out_n_sect = sect_index;
|
||||
|
||||
sym.name = try self.strtab.insert(gpa, decl.fqn.toSlice(ip));
|
||||
const sym_name = try std.fmt.allocPrintZ(gpa, "_{s}", .{decl.fqn.toSlice(ip)});
|
||||
defer gpa.free(sym_name);
|
||||
sym.name = try self.strtab.insert(gpa, sym_name);
|
||||
atom.flags.alive = true;
|
||||
atom.name = sym.name;
|
||||
nlist.n_strx = sym.name;
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user