| author | |
| committer | |
| log | 700b1e38ceeb66416a327e4f31969b1e52ba55ef |
| tree | 339971ca9589943563bbd7011d4cddc4070df198 |
| parent | 0353bfd55ed67fa5c1c1d0e3004fcbae7f139b92 |
3 files changed, 4 insertions(+), 8 deletions(-)
src/link/MachO.zig+1-5| ... | ... | @@ -2912,11 +2912,7 @@ fn populateMissingMetadata(self: *MachO) !void { |
| 2912 | 2912 | if (self.stub_helper_section_index == null) { |
| 2913 | 2913 | self.stub_helper_section_index = try self.allocateSection("__TEXT3", "__stub_helper", .{ |
| 2914 | 2914 | .size = @sizeOf(u32), |
| 2915 | .alignment = switch (cpu_arch) { | |
| 2916 | .x86_64 => 1, | |
| 2917 | .aarch64 => @sizeOf(u32), | |
| 2918 | else => unreachable, // unhandled architecture type | |
| 2919 | }, | |
| 2915 | .alignment = stubs.stubAlignment(cpu_arch), | |
| 2920 | 2916 | .flags = macho.S_REGULAR | macho.S_ATTR_PURE_INSTRUCTIONS | macho.S_ATTR_SOME_INSTRUCTIONS, |
| 2921 | 2917 | .prot = macho.PROT.READ | macho.PROT.EXEC, |
| 2922 | 2918 | }); |
src/link/MachO/stubs.zig+1-1| ... | ... | @@ -25,7 +25,7 @@ pub inline fn stubSize(cpu_arch: std.Target.Cpu.Arch) u8 { |
| 25 | 25 | pub inline fn stubAlignment(cpu_arch: std.Target.Cpu.Arch) u8 { |
| 26 | 26 | return switch (cpu_arch) { |
| 27 | 27 | .x86_64 => 1, |
| 28 | .aarch64 => 2, | |
| 28 | .aarch64 => 4, | |
| 29 | 29 | else => unreachable, // unhandled architecture type |
| 30 | 30 | }; |
| 31 | 31 | } |
src/link/MachO/zld.zig+2-2| ... | ... | @@ -1032,14 +1032,14 @@ fn calcSectionSizes(macho_file: *MachO) !void { |
| 1032 | 1032 | if (macho_file.stubs_section_index) |sect_id| { |
| 1033 | 1033 | const header = &macho_file.sections.items(.header)[sect_id]; |
| 1034 | 1034 | header.size = macho_file.stub_table.count() * stubs.stubSize(cpu_arch); |
| 1035 | header.@"align" = stubs.stubAlignment(cpu_arch); | |
| 1035 | header.@"align" = math.log2(stubs.stubAlignment(cpu_arch)); | |
| 1036 | 1036 | } |
| 1037 | 1037 | |
| 1038 | 1038 | if (macho_file.stub_helper_section_index) |sect_id| { |
| 1039 | 1039 | const header = &macho_file.sections.items(.header)[sect_id]; |
| 1040 | 1040 | header.size = macho_file.stub_table.count() * stubs.stubHelperSize(cpu_arch) + |
| 1041 | 1041 | stubs.stubHelperPreambleSize(cpu_arch); |
| 1042 | header.@"align" = stubs.stubAlignment(cpu_arch); | |
| 1042 | header.@"align" = math.log2(stubs.stubAlignment(cpu_arch)); | |
| 1043 | 1043 | } |
| 1044 | 1044 | |
| 1045 | 1045 | if (macho_file.la_symbol_ptr_section_index) |sect_id| { |