How does objdump calculate the physical address (LMA) of elf sections? As far as I can tell, the elf section headings contain only the virtual address (VMA) of the sections [1].
Usually VMA and LMA are the same. But for initialized data sections (.data), VMA is the location of the RAM variables, and LMA is the location of the ROM where the initial values ββare located. Crt0 is responsible for copying the initial values ββto RAM before calling main (). For instance:
$ objdump -h my.elf Sections: Idx Name Size VMA LMA File off Algn 0 .text 0003c3d0 00080000 00080000 00010000 2**2 CONTENTS, ALLOC, LOAD, READONLY, CODE 5 .data 000008d0 40000000 000d08d4 00060000 2**3 CONTENTS, ALLOC, LOAD, DATA
-Tom
[1] http://www.ouah.org/RevEng/x430.htm
source share