aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/link.zig1
-rw-r--r--src/link/MachO/Archive.zig4
-rw-r--r--src/link/MachO/Atom.zig14
-rw-r--r--src/link/MachO/eh_frame.zig2
-rw-r--r--src/link/MachO/thunks.zig2
5 files changed, 9 insertions, 14 deletions
diff --git a/src/link.zig b/src/link.zig
index 4bb30f7a7e..90244a44c2 100644
--- a/src/link.zig
+++ b/src/link.zig
@@ -700,7 +700,6 @@ pub const File = struct {
DllImportLibraryNotFound,
ExpectedFuncType,
FailedToEmit,
- FailedToResolveRelocationTarget,
FileSystem,
FilesOpenedWithWrongFlags,
FlushFailure,
diff --git a/src/link/MachO/Archive.zig b/src/link/MachO/Archive.zig
index 20a191281e..6d1c769f04 100644
--- a/src/link/MachO/Archive.zig
+++ b/src/link/MachO/Archive.zig
@@ -128,7 +128,7 @@ fn parseTableOfContents(self: *Archive, allocator: Allocator, reader: anytype) !
defer allocator.free(symtab);
reader.readNoEof(symtab) catch {
- log.err("incomplete symbol table: expected symbol table of length 0x{x}", .{symtab_size});
+ log.debug("incomplete symbol table: expected symbol table of length 0x{x}", .{symtab_size});
return error.MalformedArchive;
};
@@ -137,7 +137,7 @@ fn parseTableOfContents(self: *Archive, allocator: Allocator, reader: anytype) !
defer allocator.free(strtab);
reader.readNoEof(strtab) catch {
- log.err("incomplete symbol table: expected string table of length 0x{x}", .{strtab_size});
+ log.debug("incomplete symbol table: expected string table of length 0x{x}", .{strtab_size});
return error.MalformedArchive;
};
diff --git a/src/link/MachO/Atom.zig b/src/link/MachO/Atom.zig
index bde6b09583..16d318ba2c 100644
--- a/src/link/MachO/Atom.zig
+++ b/src/link/MachO/Atom.zig
@@ -615,7 +615,7 @@ pub fn resolveRelocs(
};
}
-pub fn getRelocTargetAddress(macho_file: *MachO, target: SymbolWithLoc, is_tlv: bool) !u64 {
+pub fn getRelocTargetAddress(macho_file: *MachO, target: SymbolWithLoc, is_tlv: bool) u64 {
const target_atom_index = getRelocTargetAtomIndex(macho_file, target) orelse {
// If there is no atom for target, we still need to check for special, atom-less
// symbols such as `___dso_handle`.
@@ -648,17 +648,13 @@ pub fn getRelocTargetAddress(macho_file: *MachO, target: SymbolWithLoc, is_tlv:
// defined TLV template init section in the following order:
// * wrt to __thread_data if defined, then
// * wrt to __thread_bss
+ // TODO remember to check what the mechanism was prior to HAS_TLV_INITIALIZERS in earlier versions of macOS
const sect_id: u16 = sect_id: {
if (macho_file.thread_data_section_index) |i| {
break :sect_id i;
} else if (macho_file.thread_bss_section_index) |i| {
break :sect_id i;
- } else {
- log.err("threadlocal variables present but no initializer sections found", .{});
- log.err(" __thread_data not found", .{});
- log.err(" __thread_bss not found", .{});
- return error.FailedToResolveRelocationTarget;
- }
+ } else break :base_address 0;
};
break :base_address macho_file.sections.items(.header)[sect_id].addr;
} else 0;
@@ -744,7 +740,7 @@ fn resolveRelocsArm64(
const header = macho_file.sections.items(.header)[source_sym.n_sect - 1];
break :is_tlv header.type() == macho.S_THREAD_LOCAL_VARIABLES;
};
- break :blk try getRelocTargetAddress(macho_file, target, is_tlv);
+ break :blk getRelocTargetAddress(macho_file, target, is_tlv);
};
log.debug(" | source_addr = 0x{x}", .{source_addr});
@@ -1040,7 +1036,7 @@ fn resolveRelocsX86(
const header = macho_file.sections.items(.header)[source_sym.n_sect - 1];
break :is_tlv header.type() == macho.S_THREAD_LOCAL_VARIABLES;
};
- break :blk try getRelocTargetAddress(macho_file, target, is_tlv);
+ break :blk getRelocTargetAddress(macho_file, target, is_tlv);
};
log.debug(" | source_addr = 0x{x}", .{source_addr});
diff --git a/src/link/MachO/eh_frame.zig b/src/link/MachO/eh_frame.zig
index 332aea08e5..96b8f5c5a6 100644
--- a/src/link/MachO/eh_frame.zig
+++ b/src/link/MachO/eh_frame.zig
@@ -347,7 +347,7 @@ pub fn EhFrameRecord(comptime is_mutable: bool) type {
},
.ARM64_RELOC_UNSIGNED => {
assert(rel.r_extern == 1);
- const target_addr = try Atom.getRelocTargetAddress(macho_file, target, false);
+ const target_addr = Atom.getRelocTargetAddress(macho_file, target, false);
const result = @as(i64, @intCast(target_addr)) - @as(i64, @intCast(source_addr));
mem.writeIntLittle(i64, rec.data[rel_offset..][0..8], @as(i64, @intCast(result)));
},
diff --git a/src/link/MachO/thunks.zig b/src/link/MachO/thunks.zig
index 726fbdf2a6..2ee47478f4 100644
--- a/src/link/MachO/thunks.zig
+++ b/src/link/MachO/thunks.zig
@@ -317,7 +317,7 @@ fn isReachable(
const target_addr = if (Atom.relocRequiresGot(macho_file, rel))
macho_file.getGotEntryAddress(target).?
else
- Atom.getRelocTargetAddress(macho_file, target, false) catch unreachable;
+ Atom.getRelocTargetAddress(macho_file, target, false);
_ = Relocation.calcPcRelativeDisplacementArm64(source_addr, target_addr) catch
return false;