[lld] [X86][LLD] Handle R_X86_64_CODE_4_GOTPC32_TLSDESC relocation type (PR #116909)
Shengchen Kan via llvm-commits
llvm-commits at lists.llvm.org
Sun Nov 24 23:40:31 PST 2024
================
@@ -486,18 +490,26 @@ void X86_64::relaxTlsGdToLe(uint8_t *loc, const Relocation &rel,
// The original code used a pc relative relocation and so we have to
// compensate for the -4 in had in the addend.
write32le(loc + 8, val + 4);
- } else if (rel.type == R_X86_64_GOTPC32_TLSDESC) {
+ } else if (rel.type == R_X86_64_GOTPC32_TLSDESC ||
+ rel.type == R_X86_64_CODE_4_GOTPC32_TLSDESC) {
// Convert leaq x at tlsdesc(%rip), %REG to movq $x at tpoff, %REG.
if ((loc[-3] & 0xfb) != 0x48 || loc[-2] != 0x8d ||
----------------
KanRobert wrote:
Never mind. I got something wrong. It works for REX2 too if we don't support
```
{rex2} leaq x at tlsdesc(%rip), %r8
```
for this relocation.
Currently, compiler won't emit such code.
https://github.com/llvm/llvm-project/pull/116909
More information about the llvm-commits
mailing list