[cfe-dev] [llvm-dev] RFC: A new ABI for virtual calls, and a change to the virtual call representation in the IR

Reid Kleckner via cfe-dev cfe-dev at lists.llvm.org
Fri Mar 11 09:56:46 PST 2016


On Fri, Mar 11, 2016 at 9:41 AM, John McCall <rjmccall at apple.com> wrote:
>
> Okay, so, it sounds to me like LLVM basically treats strong definitions as
> protected, then.  Should we just formalize that?
>
> I guess the proposal here would be:
>   1. Remove protected visibility from LLVM.  (Or deprecate it as
> equivalent to default.)
>   2. Teach the ELF emitter to emit non-hidden strong definitions using ELF
> protected visibility.
>   3. Teach the ELF emitter to emit non-hidden weak definitions using ELF
> default visibility (unless they’re unnamed_addr?).
>

LLVM definitely thinks that strong definitions are "ODR", so we could do 2.
I'm sure it would break somebody, somewhere though. We probably don't want
to do 1 and 3, so that users can still mark their weak definitions as
protected if they want to.

GCC must do *some* inlining between strong definitions.  Do you know what
> their rule is?  Is it just a C++ thing?
>

GCC only inlines strong definitions when -fPIC is disabled, meaning the
code will be linked into the main executable. In this case, no
interposition can occur because dynamic symbol search always starts in the
executable. They also have -fno-semantic-interposition, which allows
inlining strong definitions:
https://gcc.gnu.org/onlinedocs/gcc-5.3.0/gcc/Optimize-Options.html#index-fsemantic-interposition-972
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160311/778443cc/attachment.html>


More information about the cfe-dev mailing list