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: .data.rel Section Contains Both Data and Relocatable Symbols


On Wed, Mar 28, 2007 at 10:06:13AM -0400, Anthony DeRosa wrote:
> I am writing position independent code for a MIPS embedded system.  When
> our embedded bootloader loads our code, it fixes up the .data.rel
> section by adding the base address of the code to every 4-byte word in
> that section.  In other words, it treats everything in that section as a
> symbol that needs to be relocated.  However, this means that only
> relocatable symbols can exist in that .data.rel section.  But what
> happens when  we have a global structure that contains both plain data
> and relocatable symbols?  The entire structure will be put in the
> .data.rel section, and the data part of the structure will incorrectly
> be modified by the bootloader, which thinks the data is a relocatable
> symbol.  How do we know what part of the .data.rel section needs to be
> relocated and which part is data?  Is this an issue with GCC?  Is there
> another way to do this?

If you ignore the relocation entries, you get what you deserve :-)
You need to process the ELF relocation sections.  See readelf -r for
more information, or the ELF generic ABI (gABI).

-- 
Daniel Jacobowitz
CodeSourcery


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