[PATCH] D102570: RFC: [ELF] -Bsymbolic-non-weak-functions

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 29 14:35:13 PDT 2021


MaskRay added a comment.

In D102570#2914731 <https://reviews.llvm.org/D102570#2914731>, @smeenai wrote:

> Do you plan to land this? I thought of it as potentially useful for https://github.com/android/ndk/issues/1551. The issue has the full details, but the summary is that we only want a single copy of `__emutls_get_address` that's used by all shared objects in a process, otherwise different DSOs will see different emulated TLS state for the same variable. One way to ensure that would be to put the emulated TLS bits in their own DSO and have everyone else reference that, but a full DSO is pretty heavy-weight. Another would be to make it default visibility and weak and let the dynamic linker coalesce multiple copies at runtime; `-Bsymbolic` and `-Bsymbolic-functions` would break that, but `-Bsymbolic-non-weak-functions` wouldn't.

I was waiting for users:) Glad that this can find a user.

For Linux distributions, I am hoping they can use a `-fvisibility` variant which applies to non-weak functions/variables (say, `-fvisibility-non-weak=protected`).
I think GNU people aren't thrilled at the idea (and so users are stuck with GCC -fpic -fsemantic-interposition suppressing lining).
Even with a compiler option, a linker option can be convenient as well. It allows easy experiments without recompilation.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102570



More information about the llvm-commits mailing list