authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2023-08-28 19:37:09+02:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2023-08-29 11:40:20+02:00
log052984c5ae43a9846f012c3b3b1449c8aef47d2f
tree436e0333f69aa3964d337c4615fc8ca93ae691af
parent2473ccc3358a33c0827ec7f4ea2ecfe18a1055ec

macho: remove MachO.requiresThunks as it is obsolete


2 files changed, 4 insertions(+), 8 deletions(-)

src/link/MachO.zig-4
......@@ -4767,10 +4767,6 @@ pub inline fn getPageSize(cpu_arch: std.Target.Cpu.Arch) u16 {
47674767 };
47684768}
47694769
4770pub inline fn requiresThunks(self: MachO) bool {
4771 return self.base.options.target.cpu.arch == .aarch64;
4772}
4773
47744770pub fn requiresCodeSignature(self: MachO) bool {
47754771 if (self.base.options.entitlements) |_| return true;
47764772 const cpu_arch = self.base.options.target.cpu.arch;
src/link/MachO/zld.zig+4-4
......@@ -488,7 +488,7 @@ pub fn linkWithZld(
488488 }
489489
490490 try writeAtoms(macho_file);
491 if (macho_file.requiresThunks()) try writeThunks(macho_file);
491 if (macho_file.base.options.target.cpu.arch == .aarch64) try writeThunks(macho_file);
492492 try writeDyldPrivateAtom(macho_file);
493493
494494 if (macho_file.stubs_section_index) |_| {
......@@ -778,7 +778,7 @@ fn writeDyldPrivateAtom(macho_file: *MachO) !void {
778778}
779779
780780fn writeThunks(macho_file: *MachO) !void {
781 assert(macho_file.requiresThunks());
781 assert(macho_file.base.options.target.cpu.arch == .aarch64);
782782 const gpa = macho_file.base.allocator;
783783
784784 const sect_id = macho_file.text_section_index orelse return;
......@@ -991,7 +991,7 @@ fn calcSectionSizes(macho_file: *MachO) !void {
991991 for (slice.items(.header), 0..) |*header, sect_id| {
992992 if (header.size == 0) continue;
993993 if (macho_file.text_section_index) |txt| {
994 if (txt == sect_id and macho_file.requiresThunks()) continue;
994 if (txt == sect_id and macho_file.base.options.target.cpu.arch == .aarch64) continue;
995995 }
996996
997997 var atom_index = slice.items(.first_atom_index)[sect_id] orelse continue;
......@@ -1017,7 +1017,7 @@ fn calcSectionSizes(macho_file: *MachO) !void {
10171017 }
10181018 }
10191019
1020 if (macho_file.text_section_index != null and macho_file.requiresThunks()) {
1020 if (macho_file.text_section_index != null and macho_file.base.options.target.cpu.arch == .aarch64) {
10211021 // Create jump/branch range extenders if needed.
10221022 try thunks.createThunks(macho_file, macho_file.text_section_index.?);
10231023 }