[lld] r261838 - [ELF2] - Basic implementation of -r/--relocatable

Joerg Sonnenberger via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 1 08:44:01 PST 2016


On Tue, Mar 01, 2016 at 04:14:38PM +0000, George Rimar wrote:
> >> > I believe that the resulting object files with this patch contains some linker-synthesized symbols such as __init_array_start or __start_<section-name>. Is this expected?
> >>
> >> So, returning to this,
> >> gold also generates __start_/_end_?<section-name> for relocatable output.
> >
> >That sounds like a bug to me. I would strongly expect them to be *not*
> >generated and wouldn't be surprised if it creates problems down the
> >line.
> >
> >Joerg
> 
> I was not very correct here.
> If we have:
> _start:
> 	call __start_foo
>         call __start_foo111
> 
> then gold output is
> Symbol table '.symtab' contains 4 entries:
>    Num:    Value          Size Type    Bind   Vis      Ndx Name
> .. 
>      1: 0000000000000000     0 NOTYPE  GLOBAL HIDDEN   UND __start_foo
>      2: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND __start_foo111
> 
> So gold just sets the visibility to hidden here. It does not do that for other common undefined symbols.
> So it not generates the values for them. Not sure is it a bug or not, I think not. As it just knows that
> these symbols exist and can be used with that visibility.

OK, that's not that bad. It would be nice to just keep the symbol as is,
but it sounds like a // TODO comment is enough for that.

Joerg


More information about the llvm-commits mailing list