This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [GOLD] advice on powerpc64 .opd handling
On Fri, Aug 17, 2012 at 6:13 PM, Alan Modra <amodra@gmail.com> wrote:
>
>> >> Will this work correctly if the symbol is defined in a SHT_GROUP
>> >> section that is discarded?
>> >
>> > Hasn't something gone horribly if we're trying to call such a
>> > function?
>>
>> Seems to me that it's normal for a C++ template instantiation. Maybe
>> I'm missing something.
>
> I meant function as in a symbol in the object file, not a language
> feature. In other words, if gold is relocating a function call then
> (a) the section we're relocating is a kept section, and
> (b) the function symbol referenced in the reloc will have its code
> section kept too, unless something has gone wrong with --gc-sections.
> As far as I'm aware, the only way (b) might fail is if the function
> symbol is STB_LOCAL, but I thought gcc no longer used local symbols in
> comdat groups or linkonce sections. Or is there something I'm missing
> about gold symbol resolution?
It's possible that the case I'm thinking of can not occur (although in
that case you should call get_output_section_offset and assert that it
does not return invalid_address). I'm thinking about a call to an
instantiated template function, which will be a STB_WEAK symbol in a
section that is in a SHT_GROUP. The same SHT_GROUP may be defined in
some other object file, in which case that is the symbol definition
that will be used, not the one in the current object file.
Ian