[PATCH] D102570: RFC: [ELF] -Bsymbolic-global-functions

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 17 09:00:16 PDT 2021


peter.smith added a comment.

I don't have any strong objections. Just want to make sure that weak symbols are the right subset to use. My understanding is that this is coming from vague linkage https://itanium-cxx-abi.github.io/cxx-abi/abi.html#vague the only part that I could find in there about weak definitions is in static data: (https://itanium-cxx-abi.github.io/cxx-abi/abi.html#vague-static)

  Some objects with static storage duration have associated guard variables used to ensure that they are initialized only once (see 3.3.3). If the object is emitted using a COMDAT group, the guard variable must be too. It is suggested that it be emitted in the same COMDAT group as the associated data object, but it may be emitted in its own COMDAT group, identified by its name. In either case, it must be weak.

The part about out of line copies of inline functions https://itanium-cxx-abi.github.io/cxx-abi/abi.html#vague-inline says to define them in a comdat group but nothing about weak definitions. I think that both clang and GCC use weak definitions for functions in COMDAT groups but is that guaranteed of all compilers that might use LLD?

Some suggestions:

- Is -Bsymbolic-non-vague-functions more descriptive, or perhaps -Bsymbolic-non-weak-functions? When I see global-functions as a programmer, not a linker person, I think of non-static functions rather than non-weak functions.
- Would "Not defined in a COMDAT group" be a better criteria for the subset than non-weak? This would correctly find global symbols defined in COMDAT groups? Certainly more work to implement.


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