| ... | @@ -16,7 +16,6 @@ const CodeSignature = @import("CodeSignature.zig"); | ... | @@ -16,7 +16,6 @@ const CodeSignature = @import("CodeSignature.zig"); |
| 16 | const Archive = @import("Archive.zig"); | 16 | const Archive = @import("Archive.zig"); |
| 17 | const Object = @import("Object.zig"); | 17 | const Object = @import("Object.zig"); |
| 18 | const Trie = @import("Trie.zig"); | 18 | const Trie = @import("Trie.zig"); |
| 19 | const aarch64 = @import("../../codegen/aarch64.zig"); | | |
| 20 | | 19 | |
| 21 | usingnamespace @import("commands.zig"); | 20 | usingnamespace @import("commands.zig"); |
| 22 | usingnamespace @import("bind.zig"); | 21 | usingnamespace @import("bind.zig"); |
| ... | @@ -566,14 +565,14 @@ fn writeStubHelperCommon(self: *Zld) !void { | ... | @@ -566,14 +565,14 @@ fn writeStubHelperCommon(self: *Zld) !void { |
| 566 | // adr x17, disp | 565 | // adr x17, disp |
| 567 | mem.writeIntLittle(u32, code[0..4], Arm64.adr(17, @bitCast(u21, displacement)).toU32()); | 566 | mem.writeIntLittle(u32, code[0..4], Arm64.adr(17, @bitCast(u21, displacement)).toU32()); |
| 568 | // nop | 567 | // nop |
| 569 | mem.writeIntLittle(u32, code[4..8], aarch64.Instruction.nop().toU32()); | 568 | mem.writeIntLittle(u32, code[4..8], Arm64.nop().toU32()); |
| 570 | break :data_blk_outer; | 569 | break :data_blk_outer; |
| 571 | } | 570 | } |
| 572 | data_blk: { | 571 | data_blk: { |
| 573 | const new_this_addr = this_addr + @sizeOf(u32); | 572 | const new_this_addr = this_addr + @sizeOf(u32); |
| 574 | const displacement = math.cast(i21, target_addr - new_this_addr) catch |_| break :data_blk; | 573 | const displacement = math.cast(i21, target_addr - new_this_addr) catch |_| break :data_blk; |
| 575 | // nop | 574 | // nop |
| 576 | mem.writeIntLittle(u32, code[0..4], aarch64.Instruction.nop().toU32()); | 575 | mem.writeIntLittle(u32, code[0..4], Arm64.nop().toU32()); |
| 577 | // adr x17, disp | 576 | // adr x17, disp |
| 578 | mem.writeIntLittle(u32, code[4..8], Arm64.adr(17, @bitCast(u21, displacement)).toU32()); | 577 | mem.writeIntLittle(u32, code[4..8], Arm64.adr(17, @bitCast(u21, displacement)).toU32()); |
| 579 | break :data_blk_outer; | 578 | break :data_blk_outer; |
| ... | @@ -601,7 +600,7 @@ fn writeStubHelperCommon(self: *Zld) !void { | ... | @@ -601,7 +600,7 @@ fn writeStubHelperCommon(self: *Zld) !void { |
| 601 | // ldr x16, label | 600 | // ldr x16, label |
| 602 | mem.writeIntLittle(u32, code[12..16], Arm64.ldr(16, literal, 1).toU32()); | 601 | mem.writeIntLittle(u32, code[12..16], Arm64.ldr(16, literal, 1).toU32()); |
| 603 | // nop | 602 | // nop |
| 604 | mem.writeIntLittle(u32, code[16..20], aarch64.Instruction.nop().toU32()); | 603 | mem.writeIntLittle(u32, code[16..20], Arm64.nop().toU32()); |
| 605 | break :binder_blk_outer; | 604 | break :binder_blk_outer; |
| 606 | } | 605 | } |
| 607 | binder_blk: { | 606 | binder_blk: { |
| ... | @@ -611,7 +610,7 @@ fn writeStubHelperCommon(self: *Zld) !void { | ... | @@ -611,7 +610,7 @@ fn writeStubHelperCommon(self: *Zld) !void { |
| 611 | log.warn("2: disp=0x{x}, literal=0x{x}", .{ displacement, literal }); | 610 | log.warn("2: disp=0x{x}, literal=0x{x}", .{ displacement, literal }); |
| 612 | // Pad with nop to please division. | 611 | // Pad with nop to please division. |
| 613 | // nop | 612 | // nop |
| 614 | mem.writeIntLittle(u32, code[12..16], aarch64.Instruction.nop().toU32()); | 613 | mem.writeIntLittle(u32, code[12..16], Arm64.nop().toU32()); |
| 615 | // ldr x16, label | 614 | // ldr x16, label |
| 616 | mem.writeIntLittle(u32, code[16..20], Arm64.ldr(16, literal, 1).toU32()); | 615 | mem.writeIntLittle(u32, code[16..20], Arm64.ldr(16, literal, 1).toU32()); |
| 617 | break :binder_blk_outer; | 616 | break :binder_blk_outer; |
| ... | @@ -697,7 +696,7 @@ fn writeStub(self: *Zld, index: u32) !void { | ... | @@ -697,7 +696,7 @@ fn writeStub(self: *Zld, index: u32) !void { |
| 697 | // ldr x16, literal | 696 | // ldr x16, literal |
| 698 | mem.writeIntLittle(u32, code[0..4], Arm64.ldr(16, literal, 1).toU32()); | 697 | mem.writeIntLittle(u32, code[0..4], Arm64.ldr(16, literal, 1).toU32()); |
| 699 | // nop | 698 | // nop |
| 700 | mem.writeIntLittle(u32, code[4..8], aarch64.Instruction.nop().toU32()); | 699 | mem.writeIntLittle(u32, code[4..8], Arm64.nop().toU32()); |
| 701 | break :outer; | 700 | break :outer; |
| 702 | } | 701 | } |
| 703 | inner: { | 702 | inner: { |
| ... | @@ -705,7 +704,7 @@ fn writeStub(self: *Zld, index: u32) !void { | ... | @@ -705,7 +704,7 @@ fn writeStub(self: *Zld, index: u32) !void { |
| 705 | const displacement = math.divExact(u64, target_addr - new_this_addr, 4) catch |_| break :inner; | 704 | const displacement = math.divExact(u64, target_addr - new_this_addr, 4) catch |_| break :inner; |
| 706 | const literal = math.cast(u18, displacement) catch |_| break :inner; | 705 | const literal = math.cast(u18, displacement) catch |_| break :inner; |
| 707 | // nop | 706 | // nop |
| 708 | mem.writeIntLittle(u32, code[0..4], aarch64.Instruction.nop().toU32()); | 707 | mem.writeIntLittle(u32, code[0..4], Arm64.nop().toU32()); |
| 709 | // ldr x16, literal | 708 | // ldr x16, literal |
| 710 | mem.writeIntLittle(u32, code[4..8], Arm64.ldr(16, literal, 1).toU32()); | 709 | mem.writeIntLittle(u32, code[4..8], Arm64.ldr(16, literal, 1).toU32()); |
| 711 | break :outer; | 710 | break :outer; |