This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Warning about zero-sized dynamic symbols


Alan Modra <amodra@gmail.com> writes:

> On Fri, Mar 09, 2012 at 07:05:07AM -0800, Ian Lance Taylor wrote:
>> Alan, back in http://sourceware.org/ml/binutils/2005-08/msg00279.html
>> you added an error to GNU ld about dynamic variables that have a zero
>> size.  The Go language permits global variables to have a zero size, and
>> that is even useful as a way of aggregating methods (e.g., in the
>> encoding/binary package in Go's standard library the variables BigEndian
>> and LittleEndian have a zero size).  I've worked around the problem in
>> the gccgo compiler, but thinking about it I don't think the error is
>> appropriate.
>
> I think I added that code to fix a ld.so segfault when handling a copy
> reloc for a zero size symbol.  So what should ld do here?  Make a zero
> size entry in dynbss but omit any copy reloc?

Yes, I think so.  There is no reason to have a COPY reloc for a
zero-sized symbol.

By the way, I think it would be reasonable to check for STT_NOTYPE when
generating a COPY reloc.  The symbol ought to be STT_OBJECT.  I just
don't think there is anything wrong with st_size == 0.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]