[lld] r295632 - Add more comments about copy relocations.

Joerg Sonnenberger via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 21 12:19:17 PST 2017


On Tue, Feb 21, 2017 at 12:19:04PM -0500, Rafael Avila de Espindola wrote:
> Joerg Sonnenberger via llvm-commits <llvm-commits at lists.llvm.org>
> writes:
> 
> > On Mon, Feb 20, 2017 at 06:16:08PM -0800, Rui Ueyama via llvm-commits wrote:
> >> Are you suggesting I bring it up to the LLVM blog? This comment is my
> >> opinion, and I guess not everybody agrees we should avoid exporting globals
> >> from DSOs.
> >
> > Sadly, the accessor approach is expensive and often not a choice. A
> > better way would be to provide an attribute to force GOT-based access
> > even in non-PIC mode. We are slowly getting the necessary relocations on
> > the modern platforms at least.
> 
> I have adding a -fno-copy-reloc to clang in my todo list. But a library
> author should at least document that copy relocations are not guaranteed
> to work after an upgrade.

A general option won't work without hurting all local symbols in a DSO
-- but adding an attribute for those few exported global variables
sounds perfectly reasonable to me.

Joerg


More information about the llvm-commits mailing list