[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 08:33:10 PST 2016

On Thu, Mar 10, 2016 at 10:32 PM, John McCall via llvm-dev <
llvm-dev at lists.llvm.org> wrote:
> I mean, I’ve never really liked ELF’s stance on symbol interposition, but
> taking it as given, I’m not sure I agree that it’s reasonable to carve out
> virtual functions as a general exception.

Given that LLVM does IPO (inlining, funcattrs) on symbols that can be
interposed on ELF, we already don't support interposability very well:

Adding another exception for virtual functions, especially under an
off-by-default flag, doesn't seem like a big deal.

> Isn’t there some global flag to make (non-weak?) definitions use protected
> visibility by default?  Wouldn’t using that be an overall performance win
> anyway?

Joerg mentioned -Bsymbolic, but I'm surprised that I don't see people use
-Bsymbolic-functions more often. C++ has the ODR, so we can say that all
definitions of the same (C++!) function must be equivalent, and it doesn't
matter which you call. Programs very rarely rely on function pointer
identity across DSOs, and it already isn't preserved on a number of
platforms (MSVC does ICF). Typically only global data needs to be coalesced
across DSOs, so that things like static data members of templates and
static locals in inline functions work.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160311/731c3348/attachment.html>

More information about the cfe-dev mailing list