mirror of
https://github.com/ziglang/zig.git
synced 2026-02-12 12:27:41 +00:00
Zld: Report archive file with cpu arch mismatch
This is just a simple/hacky feature to report the source of a linking error. I found this helpful in fixing-up some of my libs when recently switching from an x86_64 to aarch64 device, so thought it might be useful to others a well before zld has a fully featured error reporting system.
This commit is contained in:
parent
d09e39aefd
commit
47e14b7ffb
@ -1065,7 +1065,13 @@ pub const Zld = struct {
|
||||
assert(offsets.items.len > 0);
|
||||
|
||||
const object_id = @intCast(u16, self.objects.items.len);
|
||||
const object = try archive.parseObject(gpa, cpu_arch, offsets.items[0]);
|
||||
const object = archive.parseObject(gpa, cpu_arch, offsets.items[0]) catch |e| switch (e) {
|
||||
error.MismatchedCpuArchitecture => {
|
||||
log.err("CPU architecture mismatch found in {s}", .{archive.name});
|
||||
return e;
|
||||
},
|
||||
else => return e,
|
||||
};
|
||||
try self.objects.append(gpa, object);
|
||||
try self.resolveSymbolsInObject(object_id, resolver);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user