| ... | ... | @@ -1634,9 +1634,16 @@ const aarch64 = struct { |
| 1634 | 1634 | symbol.flags.needs_gottp = true; |
| 1635 | 1635 | }, |
| 1636 | 1636 | |
| 1637 | .TLSGD_ADR_PAGE21, |
| 1638 | .TLSGD_ADD_LO12_NC, |
| 1639 | => { |
| 1640 | symbol.flags.needs_tlsgd = true; |
| 1641 | }, |
| 1642 | |
| 1637 | 1643 | .TLSDESC_ADR_PAGE21, |
| 1638 | 1644 | .TLSDESC_LD64_LO12, |
| 1639 | 1645 | .TLSDESC_ADD_LO12, |
| 1646 | .TLSDESC_CALL, |
| 1640 | 1647 | => { |
| 1641 | 1648 | const should_relax = elf_file.base.isStatic() or (!is_dyn_lib and !symbol.flags.import); |
| 1642 | 1649 | if (!should_relax) { |
| ... | ... | @@ -1651,7 +1658,6 @@ const aarch64 = struct { |
| 1651 | 1658 | .LDST32_ABS_LO12_NC, |
| 1652 | 1659 | .LDST64_ABS_LO12_NC, |
| 1653 | 1660 | .LDST128_ABS_LO12_NC, |
| 1654 | | .TLSDESC_CALL, |
| 1655 | 1661 | => {}, |
| 1656 | 1662 | |
| 1657 | 1663 | else => try atom.reportUnhandledRelocError(rel, elf_file), |
| ... | ... | @@ -1792,6 +1798,23 @@ const aarch64 = struct { |
| 1792 | 1798 | aarch64_util.writeLoadStoreRegInst(offset, code); |
| 1793 | 1799 | }, |
| 1794 | 1800 | |
| 1801 | .TLSGD_ADR_PAGE21 => { |
| 1802 | const S_: i64 = @intCast(target.tlsGdAddress(elf_file)); |
| 1803 | const saddr: u64 = @intCast(P); |
| 1804 | const taddr: u64 = @intCast(S_ + A); |
| 1805 | relocs_log.debug(" [{x} => {x}]", .{ P, taddr }); |
| 1806 | const pages: u21 = @bitCast(try aarch64_util.calcNumberOfPages(saddr, taddr)); |
| 1807 | aarch64_util.writeAdrpInst(pages, code); |
| 1808 | }, |
| 1809 | |
| 1810 | .TLSGD_ADD_LO12_NC => { |
| 1811 | const S_: i64 = @intCast(target.tlsGdAddress(elf_file)); |
| 1812 | const taddr: u64 = @intCast(S_ + A); |
| 1813 | relocs_log.debug(" [{x} => {x}]", .{ P, taddr }); |
| 1814 | const offset: u12 = @truncate(taddr); |
| 1815 | aarch64_util.writeAddImmInst(offset, code); |
| 1816 | }, |
| 1817 | |
| 1795 | 1818 | .TLSDESC_ADR_PAGE21 => { |
| 1796 | 1819 | if (target.flags.has_tlsdesc) { |
| 1797 | 1820 | const S_: i64 = @intCast(target.tlsDescAddress(elf_file)); |