[BUG] LMA in link map versus object file

Sterling Augustine sterling@tensilica.com
Fri Jan 22 21:29:00 GMT 2010


Hello,

The enclosed test case (boiled down from something vastly more complex) 
demonstrates a bug where the LMA of a section as printed in the mapfile 
disagrees with the LMA of the section as it finally appears in the 
output file.

It fails with x86-linux binutils top of trunk as of this morning. The 
LMA for secB is 0x4 according to the mapfile, but is actually 0x5 in the 
elf file.

It isn't clear to me which LMA should win, but at the very least the two 
should agree. I'm happy to try my hand at a patch if I know what the 
proper behavior is.

Thanks for any insight,

Sterling


[jaw] bash$ cat lmabug.t                                               PHDRS
{
   aphdr PT_LOAD;
}

SECTIONS
{

   secA : AT(asymbol)
   {
     BYTE(0)
   } :aphdr

   secB : AT(LOADADDR(secA) + SIZEOF(secA)) ALIGN(2)
   {
     BYTE(0)
   } :aphdr

   asymbol = .;
}
[jaw] bash$ ld -T lmabug.t empty.o -M | grep secB
secB            0x00000002        0x1 load address 0x00000004
[jaw] bash$ objdump -h a.out | grep secB
   1 secB          00000001  00000002  00000005  00001002  2**1



More information about the Binutils mailing list