mirror of
https://github.com/ziglang/zig.git
synced 2026-02-14 05:20:34 +00:00
macho: use smaller padding until we have branch islands on arm64
Without branch islands, it is impossible to link self-hosted using the common linker path.
This commit is contained in:
parent
e229202cb8
commit
e00b9d6192
@ -262,7 +262,7 @@ pub const GotIndirectionKey = struct {
|
||||
|
||||
/// When allocating, the ideal_capacity is calculated by
|
||||
/// actual_capacity + (actual_capacity / ideal_factor)
|
||||
const ideal_factor = 2;
|
||||
const ideal_factor = 4;
|
||||
|
||||
/// Default path to dyld
|
||||
const default_dyld_path: [*:0]const u8 = "/usr/lib/dyld";
|
||||
|
||||
@ -243,10 +243,21 @@ pub const Relocation = struct {
|
||||
pub fn resolve(self: Branch, args: ResolveArgs) !void {
|
||||
switch (self.arch) {
|
||||
.aarch64 => {
|
||||
const displacement = try math.cast(
|
||||
const displacement = math.cast(
|
||||
i28,
|
||||
@intCast(i64, args.target_addr) - @intCast(i64, args.source_addr),
|
||||
);
|
||||
) catch |err| switch (err) {
|
||||
error.Overflow => {
|
||||
log.err("jump too big to encode as i28 displacement value", .{});
|
||||
log.err(" (target - source) = displacement => 0x{x} - 0x{x} = 0x{x}", .{
|
||||
args.target_addr,
|
||||
args.source_addr,
|
||||
@intCast(i64, args.target_addr) - @intCast(i64, args.source_addr),
|
||||
});
|
||||
log.err(" TODO implement branch islands to extend jump distance for arm64", .{});
|
||||
return error.TODOImplementBranchIslands;
|
||||
},
|
||||
};
|
||||
const code = args.block.code.items[args.offset..][0..4];
|
||||
var inst = aarch64.Instruction{
|
||||
.unconditional_branch_immediate = mem.bytesToValue(meta.TagPayload(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user