title: virtual and physical addresses of sections in elf files
body: <p>How does objdump compute the physical address (LMA) of elf sections?  As far as I can tell, elf section headers only contain the virtual address (VMA) of sections [1].</p>
  
  <p>Usually, VMA and LMA are the same.  But for initialized data sections (.data), the VMA is the RAM location of the variables and LMA is the ROM location where the initial values are located.  Crt0 is responsible for copying the initial values into RAM before main() is called.  For example:</p>
  
  <pre><code>$ 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
  </code></pre>
  
  <p>-Tom</p>
  
  <p>[1] <a href="http://www.ouah.org/RevEng/x430.htm" rel="noreferrer">http://www.ouah.org/RevEng/x430.htm</a></p>