
On Fri, 25 Jul 2008 11:21:12 -0400 Jerry Van Baren gerald.vanbaren@ge.com wrote:
The relocation information is in the ELF file until and unless we remove it. "Normal" ELF executables retain that relocation information... that is exactly what the "L" (it) is for. The linux loader (elf loader) loads an executable into an arbitrary memory location and relocates it by fixing up addresses based on the relocation table.
You're mixing two different relocation tables. Statically linked executables (like u-boot) normally don't have any relocation information in them after they are fully linked. Dynamically linked executables, position-independent executables (PIE) and shared libraries have dynamic relocations which are not only in the ELF file, but in a loadable segment so that they can be accessed at run time.
The relocation information from the .o files are not preserved in the final executable unless you specify the --emit-relocs flags, which exists purely for debugging purposes. The relocations used by the dynamic loader come from an entirely different, simpler set of relocation types which are normally not found in .o files.
Why do you think objdump has two different options for dumping normal (-r) vs. dynamic (-R) relocations?
And no, Linux ELF executables can _not_ be loaded into an arbitrary memory location unless they are PIE. Shared libraries, however, can be loaded at arbitrary memory locations, though things like pre-linking might make it more optimal to try to place them at the same address everywhere.
Ok, I'll stop the chest-beating now. But please stop trying to tell people that adding a powerpc-specific option (which nobody seems to know how really works) to the command line will work on any other architectures than powerpc.
Haavard