ELF, Program Header, convert virtual addresses to physical addresses

Ian Lance Taylor ian@airs.com
Thu Aug 18 18:22:00 GMT 2005

Torsten Mohr <tmohr@s.netic.de> writes:

> > Evidently Green Hills doesn't use p_paddr at all.  Presumably for them
> > p_paddr is always the same as p_vaddr.
> So isn't that a bug?  How can other tools like objcopy
> then convert such an ELF file?

I've never used the Green Hills toolchain.  They must have some way to
describe loading a program at one address and running it another.  I
don't know how they describe that in the ELF file.

> Isn't there a rule how to convert virtual addresses to
> physical addresses?

For the GNU toolchain, it's the rule you said: find the offset in the
segment from p_vaddr, and add that offset to p_paddr.

This is not something which the ELF standard spells out.  The p_paddr
field was put there for use on embedded systems without virtual
memory.  The ELF standard only explicitly describes usage on Unix
systems, for which p_paddr is meaningless.


More information about the Binutils mailing list