[PATCH] D61824: [ARM][AArch64] Overalign SHF_TLS instead of PT_TLS (Android Bionic hack) to make glibc happy

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 13 09:33:37 PDT 2019


MaskRay added a comment.

@rprichard Rich Felker briefly mentioned this can be worked around in crt1.o. My understanding is that:

1. create a dummy `.tdata` or `.tbss` ((a) with placeholder TLS variables of `8*sizeof(void*)` bytes (b) `sh_addralign=8*sizeof(void*)`) in `crt1.o` (and its variants)
2. create a `R_{ARM,AARCH64}_NONE` from `.text` offset 0 to the `.tbss` (this prevents `--gc-sections` stripping)
3. no hack is needed in ld.bfd/gold/lld. crt1.o is linked into executables. Don't use the dummy part of the TLS block (they may collide with Bionic's reserved TLS slots)

Does this approach work?


Repository:
  rLLD LLVM Linker

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

https://reviews.llvm.org/D61824





More information about the llvm-commits mailing list