.data.rel Section Contains Both Data and Relocatable Symbols
Alan Modra
amodra@bigpond.net.au
Thu Mar 29 01:12:00 GMT 2007
More information about the Binutils mailing list
Thu Mar 29 01:12:00 GMT 2007
- Previous message (by thread): .data.rel Section Contains Both Data and Relocatable Symbols
- Next message (by thread): .data.rel Section Contains Both Data and Relocatable Symbols
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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. Which is wrong, as you have found. > 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? By inspecting the relocations at link time. You'd then need to pass that information to your loader somehow. One possibility is to link your code as a shared library. Your loader would then need to process the dynamic relocations. > Is this an issue with GCC? No. -- Alan Modra IBM OzLabs - Linux Technology Centre
- Previous message (by thread): .data.rel Section Contains Both Data and Relocatable Symbols
- Next message (by thread): .data.rel Section Contains Both Data and Relocatable Symbols
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list