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 {...@@ -4767,10 +4767,6 @@ pub inline fn getPageSize(cpu_arch: std.Target.Cpu.Arch) u16 {
4767 };4767 };
4768}4768}
47694769
4770pub inline fn requiresThunks(self: MachO) bool {
4771 return self.base.options.target.cpu.arch == .aarch64;
4772}
4773
4774pub fn requiresCodeSignature(self: MachO) bool {4770pub fn requiresCodeSignature(self: MachO) bool {
4775 if (self.base.options.entitlements) |_| return true;4771 if (self.base.options.entitlements) |_| return true;
4776 const cpu_arch = self.base.options.target.cpu.arch;4772 const cpu_arch = self.base.options.target.cpu.arch;
src/link/MachO/zld.zig+4-4
...@@ -488,7 +488,7 @@ pub fn linkWithZld(...@@ -488,7 +488,7 @@ pub fn linkWithZld(
488 }488 }
489489
490 try writeAtoms(macho_file);490 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);
492 try writeDyldPrivateAtom(macho_file);492 try writeDyldPrivateAtom(macho_file);
493493
494 if (macho_file.stubs_section_index) |_| {494 if (macho_file.stubs_section_index) |_| {
...@@ -778,7 +778,7 @@ fn writeDyldPrivateAtom(macho_file: *MachO) !void {...@@ -778,7 +778,7 @@ fn writeDyldPrivateAtom(macho_file: *MachO) !void {
778}778}
779779
780fn writeThunks(macho_file: *MachO) !void {780fn writeThunks(macho_file: *MachO) !void {
781 assert(macho_file.requiresThunks());781 assert(macho_file.base.options.target.cpu.arch == .aarch64);
782 const gpa = macho_file.base.allocator;782 const gpa = macho_file.base.allocator;
783783
784 const sect_id = macho_file.text_section_index orelse return;784 const sect_id = macho_file.text_section_index orelse return;
...@@ -991,7 +991,7 @@ fn calcSectionSizes(macho_file: *MachO) !void {...@@ -991,7 +991,7 @@ fn calcSectionSizes(macho_file: *MachO) !void {
991 for (slice.items(.header), 0..) |*header, sect_id| {991 for (slice.items(.header), 0..) |*header, sect_id| {
992 if (header.size == 0) continue;992 if (header.size == 0) continue;
993 if (macho_file.text_section_index) |txt| {993 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;
995 }995 }
996996
997 var atom_index = slice.items(.first_atom_index)[sect_id] orelse continue;997 var atom_index = slice.items(.first_atom_index)[sect_id] orelse continue;
...@@ -1017,7 +1017,7 @@ fn calcSectionSizes(macho_file: *MachO) !void {...@@ -1017,7 +1017,7 @@ fn calcSectionSizes(macho_file: *MachO) !void {
1017 }1017 }
1018 }1018 }
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) {
1021 // Create jump/branch range extenders if needed.1021 // Create jump/branch range extenders if needed.
1022 try thunks.createThunks(macho_file, macho_file.text_section_index.?);1022 try thunks.createThunks(macho_file, macho_file.text_section_index.?);
1023 }1023 }