[PATCH] D62055: [ARM][AArch64] Revert Android Bionic PT_TLS overaligning hack

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 17 00:06:31 PDT 2019


MaskRay created this revision.
Herald added subscribers: llvm-commits, kristof.beyls, arichardson, javed.absar, emaste, srhines.
Herald added a reviewer: espindola.
Herald added a project: LLVM.
MaskRay updated this revision to Diff 199983.
MaskRay edited reviewers, added: peter.smith, rprichard, ruiu, srhines; removed: espindola.
MaskRay added a comment.
Herald added a reviewer: espindola.

.


This reverts D53906 <https://reviews.llvm.org/D53906>.

D53906 <https://reviews.llvm.org/D53906> increased p_align of PT_TLS on ARM/AArch64 to 32/64 to make the
TLS layout compatible with Android Bionic's ELF TLS. However, this may
cause glibc ARM/AArch64 programs to crash (see PR41527). local-exec
offsets using {initial,local}-exec TLS models crash (see PR41527).

The faulty PT_TLS satisfies p_vaddr%p_align != 0. The remainder is normally
0 but may be non-zero with the D53906 <https://reviews.llvm.org/D53906> hack in place. The problem is that
we increase the p_align of the PT_TLS after the OutputSection's
addresses are fixed (assignAddress()). It is possible that
p_vaddr%old_p_align = 0 while p_vaddr%new_p_align != 0.

When this happens, lld computed offsets in the main module (local-exec)
are different from glibc computed initial-exec offsets from another
module (the example in PR41527).

Android developers are fine to revert this patch, carry this patch in their
tree before figuring out a long-term solution (e.g. a dummy .tdata with
appropriate alignment/size in crtbegin* files).


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D62055

Files:
  ELF/Config.h
  ELF/Driver.cpp
  ELF/Options.td
  ELF/Writer.cpp
  docs/ld.lld.1
  test/ELF/aarch64-cortex-a53-843419-tlsrelax.s
  test/ELF/aarch64-tls-gdle.s
  test/ELF/aarch64-tls-iele.s
  test/ELF/aarch64-tls-le.s
  test/ELF/aarch64-tlsld-ldst.s
  test/ELF/arm-tls-le32.s
  test/ELF/arm-tls-norelax-ie-le.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62055.199983.patch
Type: text/x-patch
Size: 11863 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190517/75620034/attachment.bin>


More information about the llvm-commits mailing list