| ... | @@ -949,6 +949,10 @@ pub fn resolveRelocsNonAlloc(self: Atom, elf_file: *Elf, code: []u8, undefs: any | ... | @@ -949,6 +949,10 @@ pub fn resolveRelocsNonAlloc(self: Atom, elf_file: *Elf, code: []u8, undefs: any |
| 949 | error.RelocFailure => has_reloc_errors = true, | 949 | error.RelocFailure => has_reloc_errors = true, |
| 950 | else => |e| return e, | 950 | else => |e| return e, |
| 951 | }, | 951 | }, |
| | 952 | .aarch64 => aarch64.resolveRelocNonAlloc(self, elf_file, rel, target, args, &it, code, &stream) catch |err| switch (err) { |
| | 953 | error.RelocFailure => has_reloc_errors = true, |
| | 954 | else => |e| return e, |
| | 955 | }, |
| 952 | else => return error.UnsupportedCpuArch, | 956 | else => return error.UnsupportedCpuArch, |
| 953 | } | 957 | } |
| 954 | } | 958 | } |
| ... | @@ -1629,8 +1633,6 @@ const aarch64 = struct { | ... | @@ -1629,8 +1633,6 @@ const aarch64 = struct { |
| 1629 | | 1633 | |
| 1630 | const r_type: elf.R_AARCH64 = @enumFromInt(rel.r_type()); | 1634 | const r_type: elf.R_AARCH64 = @enumFromInt(rel.r_type()); |
| 1631 | const r_offset = std.math.cast(usize, rel.r_offset) orelse return error.Overflow; | 1635 | const r_offset = std.math.cast(usize, rel.r_offset) orelse return error.Overflow; |
| 1632 | | | |
| 1633 | try stream.seekTo(r_offset); | | |
| 1634 | const cwriter = stream.writer(); | 1636 | const cwriter = stream.writer(); |
| 1635 | | 1637 | |
| 1636 | const P, const A, const S, const GOT, const G, const TP, const DTP, const ZIG_GOT = args; | 1638 | const P, const A, const S, const GOT, const G, const TP, const DTP, const ZIG_GOT = args; |
| ... | @@ -1724,6 +1726,33 @@ const aarch64 = struct { | ... | @@ -1724,6 +1726,33 @@ const aarch64 = struct { |
| 1724 | } | 1726 | } |
| 1725 | } | 1727 | } |
| 1726 | | 1728 | |
| | 1729 | fn resolveRelocNonAlloc( |
| | 1730 | atom: Atom, |
| | 1731 | elf_file: *Elf, |
| | 1732 | rel: elf.Elf64_Rela, |
| | 1733 | target: *const Symbol, |
| | 1734 | args: ResolveArgs, |
| | 1735 | it: *RelocsIterator, |
| | 1736 | code: []u8, |
| | 1737 | stream: anytype, |
| | 1738 | ) !void { |
| | 1739 | _ = it; |
| | 1740 | _ = code; |
| | 1741 | _ = target; |
| | 1742 | |
| | 1743 | const r_type: elf.R_AARCH64 = @enumFromInt(rel.r_type()); |
| | 1744 | const cwriter = stream.writer(); |
| | 1745 | |
| | 1746 | _, const A, const S, _, _, _, _, _ = args; |
| | 1747 | |
| | 1748 | switch (r_type) { |
| | 1749 | .NONE => unreachable, |
| | 1750 | .ABS32 => try cwriter.writeInt(i32, @as(i32, @intCast(S + A)), .little), |
| | 1751 | .ABS64 => try cwriter.writeInt(i64, S + A, .little), |
| | 1752 | else => try atom.reportUnhandledRelocError(rel, elf_file), |
| | 1753 | } |
| | 1754 | } |
| | 1755 | |
| 1727 | const aarch64_util = @import("../aarch64.zig"); | 1756 | const aarch64_util = @import("../aarch64.zig"); |
| 1728 | }; | 1757 | }; |
| 1729 | | 1758 | |