Possible bug in gas/ld when using .linkonce

Pavel Tsekov ptsekov@gmx.net
Fri Mar 11 10:02:00 GMT 2005


On Fri, 11 Mar 2005, Danny Smith wrote:

> I don't think your usage of .linkonce in your example is quite corect.
>
> In PECOFF, each linkonce symbol needs to have its own unique section.  When you
> try to put  more than one linkonce symbol into a section you get problems like
> those mentioned here:
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14808

I didn't say that it is correct, but obviously it was allowed by the
toolchain. The described behaviour seemed strange to me so I thought I'd
post just in case someone else is interested. At the end this seems to be
a false alarm.

> Secondly, I believe you need to specify a linkonce type (ie, one_only, discard,
> same_size, same_content)

I red the gas manual before posting the original message - it says:

   The TYPE argument is optional.  If specified, it must be one of the
following strings.  For example:
     .linkonce same_size
   Not all types may be supported on all object file formats.

`discard'
     Silently discard duplicate sections.  This is the default.

`one_only'
     Warn if there are duplicate sections, but still keep only one copy.

`same_size'
     Warn if any of the duplicates have different sizes.

`same_contents'
     Warn if any of the duplicates do not have exactly the same
     contents.



More information about the Binutils mailing list