[cfe-dev] [llvm-dev] RFC: A new ABI for virtual calls, and a change to the virtual call representation in the IR
Rafael Espíndola via cfe-dev
cfe-dev at lists.llvm.org
Fri Mar 11 12:16:46 PST 2016
On 11 March 2016 at 14:58, John McCall <rjmccall at apple.com> wrote:
>> On Mar 11, 2016, at 11:26 AM, Rafael Espíndola <rafael.espindola at gmail.com> wrote:
>>> Now, there are a number of things about linkage that are kindof orthogonal,
>>> and it would be nice to model them more orthogonally. That would be a major
>>> change in representation, though. Absent the will to do that, I propose
>>> that we:
>>> - remove/deprecate protected visibility, making visibility purely a hidden
>>> vs. non-hidden flag
>> This would prevent us from propagating
>> __attribute__((visibility("protected")) to a STV_PROTECTED in the .o,
>> so I don't think we should do it.
> The whole point of this proposal is to get us to a state where we can use
> STV_PROTECTED for ordinary external or weak_for_linker symbols.
And you can't also just produce STV_PROTECTED for every symbol. I
would love for that to be the case, but while most ELF systems support
copy relocations and related PLT hacks for functions it is not
practical to do it.
> __attribute__((visibility(“protected”))) on a strong definition would just map
> to ordinary non-hidden external linkage, which the backend would turn into
> __attribute__((visibility(“default”))) on a strong definition would map the
> same way unless -fsemantic-interposition was enabled.
> The point of removing protected visibility is that we don’t actually honor
> default visibility in the ELF sense, so it’s silly to pretend that LLVM
> visibility is the same as ELF visibility. ELF protected visibility is basically
> the semantics LLVM already assigns to default visibility.
Except that we still produce STV_DEFAULT. Basically we have a mode
where we handle GVs as if they were protected but produce a
If we are going to drop it, I think the only workable default solution
would be for -fsemantic-interposition to be the default. That is, on
ELF systems we would match GCC: with -fPIC we don't inline non-odr
symbols that end up as STV_DEFAULT.
In summary, I think it is important that
* a __attribute__((visibility("protected"))) maps to STV_PROTECED
* by default a decl with no attributes maps to STV_DEFAULT
More information about the cfe-dev