VMA vs LMA?



Hi!

What is the difference between VMA (Virtual Memory Address) and LMA
(Load Memory Address)?

The Gnu ld documentation has the following explanation:
"Every loadable or allocatable output section has two addresses. The
first is the VMA, or virtual memory address. This is the address the
section will have when the output file is run. The second is the LMA,
or load memory address. This is the address at which the section will
be loaded. In most cases the two addresses will be the same. An
example of when they might be different is when a data section is
loaded into ROM, and then copied into RAM when the program starts up
(this technique is often used to initialize global variables in a ROM
based system). In this case the ROM address would be the LMA, and the
RAM address would be the VMA. "

In the above, "who" copies the data section from ROM to RAM? Isn't
this the same as when a program that is started from a shell is copied
from the harddrive to RAM by a loader, i.e. normal procedure?

As far as I have understood things the loader loads the executable
into RAM (from secondary storage) and then execution starts. So to me
the address of a section when it is run (VMA) is the same as the
address to where the section is loaded (LMA)?

If a section can be loaded to one address and then moved to another
section when run, who then moves the section from the load address
(LMA) to the run address (VMA)?

When is the LMA referenced (and by who) and when is the VMA referenced
(and by who)?

BRs!

.



Relevant Pages

  • Re: VMA vs LMA?
    ... What is the difference between VMA (Virtual Memory Address) and LMA ... or load memory address. ...
    (comp.arch.embedded)
  • Re: VMA vs LMA?
    ... LMA/VMA are the same, because you are running entirely from RAM. ... the LMA and the VMA are the same - the program runs directly from the flash it resides in. ... The only exception is that the startup code also refers to the LMA of the data section, so that it can do the initial copy. ...
    (comp.arch.embedded)
  • Re: VMA vs LMA?
    ... When writing a program where one wants different LMA and VMA sections ... Why does crt0 have code that copies data from LMA to ...
    (comp.arch.embedded)
  • Re: 2.6.9-mm1 : compile error & question
    ... This has been changed so that LMA (Load memory address) reflects the ... This looks like a problem with the older binutils package. ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • Re: 2.6.9-mm1 : compile error & question
    ... > This has been changed so that LMA (Load memory address) reflects the ... Does it mean that the .text LMA start address is going to be definitively 0010 ... > This looks like a problem with the older binutils package. ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)