[PATCH] D61824: [ARM][AArch64] Overalign .tbss (Android Bionic hack) to avoid p_vaddr%p_align!=0

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Mon May 20 00:03:48 PDT 2019


 I should have read this thread first.

On Sat, May 18, 2019 at 1:55 AM Rich Felker via Phabricator <
reviews at reviews.llvm.org> wrote:

> dalias added a comment.
>
> The waste is not just 48 bytes in the ELF image on disk, but up to 63
> bytes in each thread. Depending on how that falls, the waste is likely
> actually either 0 bytes or 4096 bytes per thread, since the memory is
> allocated with page granularity.
>
> Forcing the alignment will also force musl to *always* mmap space (on page
> granularity, so A LOT of waste) for the main thread's TLS at startup,
> rather than using the built-in bss space intended to be used when the
> application's TLS needs are small, since the built-in space does not have
> excess alignment. This imposes a syscall as well, and a new failure mode
> for static-linked binaries that may have been intended not to be able to
> fail after exec.
>

I honestly don't think that 48 waste on average per a thread matters, as a
thread isn't that cheap anyway. But the second thing you mentioned is
indeed concerning. Given the pushback from libc side, hiding the hack for
Bionic under --android-tls seems to make more sense.


> Please, drop this ridiculous and costly hack for Bionic or put it under
> the --android-tls option or whatever.
>
>
> Repository:
>   rLLD LLVM Linker
>
> CHANGES SINCE LAST ACTION
>   https://reviews.llvm.org/D61824/new/
>
> https://reviews.llvm.org/D61824
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190520/b6beeeb4/attachment.html>


More information about the llvm-commits mailing list