[llvm-commits] [pr11697][patch] Implement linking of symbols with different visibilities

Chris Lattner clattner at apple.com
Thu Jan 5 10:41:03 PST 2012


On Jan 3, 2012, at 6:56 PM, Rafael Ávila de Espíndola wrote:

> The LLVM IL linker currently refuses to link symbols if the visibilities
> are different. This causes problems when using LTO and
> -fvisibility-inlines-hidden.

This makes perfect sense to me, please commit!  One request: please rename your operator< overload to specific though, instead of abusing "<"  :)

-Chris

> 
> This patch implements the rules of the System V Application Binary
> Interface (http://sco.com/developers/gabi/2009-10-26/ch4.symtab.html),
> so that we get consistent behavior with and without LTO.
> 
> This does mean that when using -fvisibility-inlines-hidden, if we have
> an explicit template instantiation definition in a library(.so), then
> every use of an inline method of that class must see an explicit
> template instantiation declaration or we can end up with a hidden symbol
> in the library. I think this is OK because:
> 
> * That is already the case when *not* doing LTO and using gold (the gnu
> bfd linker is not conformant with the spec).
> 
> * -fvisibility-inlines-hidden already breaks the standard a bit (pointer
> comparisons), so saying that it requires explicit template instantiation
> declaratios when a definition is used is not too bad.
> 
> * As Eli pointed out on IRC, LTO supersedes -fvisibility-inlines-hidden.
> At the IL level we differentiate weak_odr and linkonce_odr. All that we
> need is for the link to still work if someone ends up using both LTO and
> -fvisibility-inlines-hidden.
> 
> Thanks a lot to Eli and Ian for the comments and pointers.
> 
> Cheers,
> Rafael
> <pr11697.patch>_______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits





More information about the llvm-commits mailing list