This is the mail archive of the 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: ARM ELF p_paddr is not put to zero

Drasko DRASKOVIC <> writes:

> On Wed, Jun 22, 2011 at 9:43 PM, Ian Lance Taylor <> wrote:
>> Drasko DRASKOVIC <> writes:
>>>> That is the default behaviour for the GNU tools, so that it is possible
>>>> to represent a load address separate from the virtual address.
>>> What do you exactly mean by this default behaviour ? To put p_paddr =
>>> p_vaddr ? In which situations ?
>> Conceptually, every section has a virtual address (the address where the
>> section should live when the program is run) and a load address (the
>> address where the section should be loaded). ÂOn a virtual memory
>> machine these are normally the same. ÂOn a device without virtual memory
>> and with ROM, it is often useful to load the initialized data section at
>> one address (in ROM) but to run with the data at another address (in
>> RAM). ÂGiven that, it becomes useful to use some mechanism for
>> representing both the load address and the virtual address in a linked
>> executable. ÂThe GNU tools normally store the load address in the
>> p_paddr field and the virtual address in the p_vaddr field.
> thanks for clarifications. I think that p_vaddr can be affected with
> by --entry flag and  explicit address, as it sound logical to me that
> it is set to this value. Is this correct ? Does this flag however also
> affects p_paddr at the same time ?

With the GNU tools, unless you use a linker script with an AT clause,
p_paddr will always == p_vaddr.

> How do we specify p_paddr (I am talking about ROM and noMMU devices)?
> I.e. how do we tell at which address binary should be loaded ? Is this
> done only via linker script or there are some command line options
> with which we can define lma ?

Only via a linker script.  Well, actually, you can use objcopy
--change-section-lma.  Maybe there is some other way that I'm
forgetting.  Most people use a linker script.

> Third question is - what happens if we do not define load address at
> all, just provide address at we want to link, i.e. address of the
> first symbol (if this does not affect p_paddr just p_vaddr) ? How does
> ld manage this internally - would it equalize p_paddr to p_vaddr
> during the process and spit out binary with p_paddr = p_vaddr ?



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