[PATCH] D91611: [PowerPC][LLD] Detecting and fixing missing TLS relocation on __tls_get_addr
Sean Fertile via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 19 08:36:25 PST 2020
sfertile added inline comments.
================
Comment at: lld/ELF/Relocations.cpp:1316
+ const RelType prevType = prevRel.getType(config->isMips64EL);
+ // Check if this call to __tls_get_addr is part of a TLS sequence.
+ if (prevType == R_PPC64_GOT_TLSGD16_HA ||
----------------
I don't think this is something you can reliably determine. For example consider the code:
```
# r30 is previously saved to the stack.
# setup r3 for the call to __tls_get_addr
addis 3, 2, i at got@tlsgd at ha
addi 3, 3, i at got@tlsgd at l
# Load unrelated variable into a non-volatile register so it will stay live across the call.
addis 30, 2, j at toc@ha
addi 30, j at toc@l(30)
# call __tls_get_addr. Relocation I - 2 is NOT one of the relocations used to setup the argument.
bl __tls_get_addr(i at tlsgd)
nop
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D91611/new/
https://reviews.llvm.org/D91611
More information about the llvm-commits
mailing list