gold patch to discard .note.callgraph sections in the final link.

Ian Lance Taylor iant@google.com
Thu Sep 22 19:30:00 GMT 2011


Cary Coutant <ccoutant@google.com> writes:

>> +         // This section is special.  It records the callgraph edge profile
>> +         // information.  It should be omitted after its contents are read.
>> +         if (is_prefix_of(".note.callgraph.text", name))
>> +           {
>> +             if (!relocatable)
>> +               omit[i] = true;
>> +           }
>
> The comment should mention that the contents of this section are read
> by a plugin, rather than by the linker itself.
>
> Like Ian, I don't like special-casing the name. I thought of
> suggesting that the plugin should arrange to discard the section, but
> we'd want to discard it even (especially!) when the plugin isn't being
> used. That suggests use of the SHF_EXCLUDE flag, but we want ld -r to
> pass the section through for processing during the final link. That
> brings up the issue of whether SHF_EXCLUDE sections should be
> discarded during an ld -r link, or whether we'd want yet another flag
> for that. This special case seems easiest for now.

As I understand it, SHF_EXCLUDE sections should not be discarded by an
ld -r link.  If gold is doing that today, which it probably is, that
should be fixed.  So, yeah, SHF_EXCLUDE sounds like a much better way to
deal with this.

Ian



More information about the Binutils mailing list