| ... | @@ -1592,6 +1592,8 @@ const aarch64 = struct { | ... | @@ -1592,6 +1592,8 @@ const aarch64 = struct { |
| 1592 | _ = it; | 1592 | _ = it; |
| 1593 | | 1593 | |
| 1594 | const r_type: elf.R_AARCH64 = @enumFromInt(rel.r_type()); | 1594 | const r_type: elf.R_AARCH64 = @enumFromInt(rel.r_type()); |
| | 1595 | const is_dyn_lib = elf_file.base.isDynLib(); |
| | 1596 | |
| 1595 | switch (r_type) { | 1597 | switch (r_type) { |
| 1596 | .ABS64 => { | 1598 | .ABS64 => { |
| 1597 | try atom.scanReloc(symbol, rel, dynAbsRelocAction(symbol, elf_file), elf_file); | 1599 | try atom.scanReloc(symbol, rel, dynAbsRelocAction(symbol, elf_file), elf_file); |
| ... | @@ -1629,6 +1631,12 @@ const aarch64 = struct { | ... | @@ -1629,6 +1631,12 @@ const aarch64 = struct { |
| 1629 | .LDST128_ABS_LO12_NC, | 1631 | .LDST128_ABS_LO12_NC, |
| 1630 | => {}, | 1632 | => {}, |
| 1631 | | 1633 | |
| | 1634 | .TLSLE_ADD_TPREL_HI12, |
| | 1635 | .TLSLE_ADD_TPREL_LO12_NC, |
| | 1636 | => { |
| | 1637 | if (is_dyn_lib) try atom.reportPicError(symbol, rel, elf_file); |
| | 1638 | }, |
| | 1639 | |
| 1632 | else => try atom.reportUnhandledRelocError(rel, elf_file), | 1640 | else => try atom.reportUnhandledRelocError(rel, elf_file), |
| 1633 | } | 1641 | } |
| 1634 | } | 1642 | } |
| ... | @@ -1650,7 +1658,6 @@ const aarch64 = struct { | ... | @@ -1650,7 +1658,6 @@ const aarch64 = struct { |
| 1650 | const cwriter = stream.writer(); | 1658 | const cwriter = stream.writer(); |
| 1651 | | 1659 | |
| 1652 | const P, const A, const S, const GOT, const G, const TP, const DTP, const ZIG_GOT = args; | 1660 | const P, const A, const S, const GOT, const G, const TP, const DTP, const ZIG_GOT = args; |
| 1653 | _ = TP; | | |
| 1654 | _ = DTP; | 1661 | _ = DTP; |
| 1655 | _ = ZIG_GOT; | 1662 | _ = ZIG_GOT; |
| 1656 | | 1663 | |
| ... | @@ -1736,6 +1743,17 @@ const aarch64 = struct { | ... | @@ -1736,6 +1743,17 @@ const aarch64 = struct { |
| 1736 | try aarch64_util.writePageOffset(kind, taddr, code[r_offset..][0..4]); | 1743 | try aarch64_util.writePageOffset(kind, taddr, code[r_offset..][0..4]); |
| 1737 | }, | 1744 | }, |
| 1738 | | 1745 | |
| | 1746 | .TLSLE_ADD_TPREL_HI12 => { |
| | 1747 | const value = math.cast(i12, (S + A - TP) >> 12) orelse |
| | 1748 | return error.Overflow; |
| | 1749 | try aarch64_util.writeAddInst(@bitCast(value), code[rel.r_offset..][0..4]); |
| | 1750 | }, |
| | 1751 | |
| | 1752 | .TLSLE_ADD_TPREL_LO12_NC => { |
| | 1753 | const value: i12 = @truncate(S + A - TP); |
| | 1754 | try aarch64_util.writeAddInst(@bitCast(value), code[rel.r_offset..][0..4]); |
| | 1755 | }, |
| | 1756 | |
| 1739 | else => try atom.reportUnhandledRelocError(rel, elf_file), | 1757 | else => try atom.reportUnhandledRelocError(rel, elf_file), |
| 1740 | } | 1758 | } |
| 1741 | } | 1759 | } |