From 052984c5ae43a9846f012c3b3b1449c8aef47d2f Mon Sep 17 00:00:00 2001 From: Jakub Konka Date: Mon, 28 Aug 2023 19:37:09 +0200 Subject: [PATCH] macho: remove MachO.requiresThunks as it is obsolete --- src/link/MachO.zig | 4 ---- src/link/MachO/zld.zig | 8 ++++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/link/MachO.zig b/src/link/MachO.zig index e7ab05876e3a9c6503eee12d68b3c799dd44a191..4cca79f994cba147e7e91b7cbaae80bf298ff440 100644 --- a/src/link/MachO.zig +++ b/src/link/MachO.zig @@ -4767,10 +4767,6 @@ pub inline fn getPageSize(cpu_arch: std.Target.Cpu.Arch) u16 { }; } -pub inline fn requiresThunks(self: MachO) bool { - return self.base.options.target.cpu.arch == .aarch64; -} - pub fn requiresCodeSignature(self: MachO) bool { if (self.base.options.entitlements) |_| return true; const cpu_arch = self.base.options.target.cpu.arch; diff --git a/src/link/MachO/zld.zig b/src/link/MachO/zld.zig index 1be357985617fea07c1d6aed07d1442f7cb06ec7..efa23d46410379dd4573b7a0e796307a216fb8ed 100644 --- a/src/link/MachO/zld.zig +++ b/src/link/MachO/zld.zig @@ -488,7 +488,7 @@ pub fn linkWithZld( } try writeAtoms(macho_file); - if (macho_file.requiresThunks()) try writeThunks(macho_file); + if (macho_file.base.options.target.cpu.arch == .aarch64) try writeThunks(macho_file); try writeDyldPrivateAtom(macho_file); if (macho_file.stubs_section_index) |_| { @@ -778,7 +778,7 @@ fn writeDyldPrivateAtom(macho_file: *MachO) !void { } fn writeThunks(macho_file: *MachO) !void { - assert(macho_file.requiresThunks()); + assert(macho_file.base.options.target.cpu.arch == .aarch64); const gpa = macho_file.base.allocator; const sect_id = macho_file.text_section_index orelse return; @@ -991,7 +991,7 @@ fn calcSectionSizes(macho_file: *MachO) !void { for (slice.items(.header), 0..) |*header, sect_id| { if (header.size == 0) continue; if (macho_file.text_section_index) |txt| { - if (txt == sect_id and macho_file.requiresThunks()) continue; + if (txt == sect_id and macho_file.base.options.target.cpu.arch == .aarch64) continue; } var atom_index = slice.items(.first_atom_index)[sect_id] orelse continue; @@ -1017,7 +1017,7 @@ fn calcSectionSizes(macho_file: *MachO) !void { } } - if (macho_file.text_section_index != null and macho_file.requiresThunks()) { + if (macho_file.text_section_index != null and macho_file.base.options.target.cpu.arch == .aarch64) { // Create jump/branch range extenders if needed. try thunks.createThunks(macho_file, macho_file.text_section_index.?); } -- 2.54.0