[PATCH] D70398: [lld] Support copy relocations for TLS symbols

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 19 11:29:33 PST 2019


MaskRay added a comment.

TLS copy relocation requires cooperation from the dynamic loader. Just skimmed through several dynamic loader implementations:

- glibc: `sysdeps/riscv/dl-machine.h`
- musl: https://git.musl-libc.org/cgit/musl/tree/ldso/dynlink.c `case REL_COPY:`
- FreeBSD ld.so: `libexec/rtld-elf/riscv/reloc.c`

None special cases STT_TLS and copies the data from the shared object to the TLS image in the executable. So even if lld supported TLS copy relocation, it would not work because the TLS image would not be properly initialized.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70398/new/

https://reviews.llvm.org/D70398





More information about the llvm-commits mailing list