This is the mail archive of the binutils@sourceware.cygnus.com 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]

Re: bug(?) in ppc relocations


   Date: Tue, 21 Mar 2000 21:01:37 +0200
   From: Momchil Velikov <velco@fadata.bg>

   >    Nope, I don't assume that. I see the output offset of the linker .sdata
   >    secton being greater than zero, so the value of _SDA_BASE_ in the
   >    output file is == (the address of .sdata + something greater than
   >    32768), thus
   >    the data items near the beginning of .sdata cannot be addressed with
   >    signed 16-bit offset from _SDA_BASE_.
   > 
   > In that case, it sounds to me like _SDA_BASE_ was set to an
   > inappropriate value.  _SDA_BASE_ should be set to something like the
   > address where the first .sdata section is stored plus 32768.  The
   > address where the first .sdata section is stored may have a non-zero
   > output_offset.
   > 
   > Personally, I think something like _SDA_BASE_ should be set in the
   > linker script.  That is what linker scripts are for.  However, I see
   > that the PowerPC backend appears to be trying to set it directly.
   > Perhaps that is the problem.  How does the PowerPC backend set
   > _SDA_BASE_?

   It's created in elf32-ppc.c:ppc_elf_create_linker_section() with offset
   32768. And if this section is not the first to be output, it gets wrong
   value.

Yes, I see what you mean.  The linker_section code appears to be
assuming that it will create the very first input section of the given
name.  That is normally true, of course, since it is called by the
check_relocs routine.  But if the first object seen in the link also
has sections of the same name, then the section created by the
linker_section code will not be the first one in the link, and the
offset will be incorrect.

I don't see a particularly clean fix.  I've never actually understood
the linker_section stuff.  It was introduced with the PowerPC backend,
and the PowerPC is the only backend which actually uses it.

Ian

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