This is the mail archive of the binutils@sourceware.org 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]

Incorrect LMA of .text section in section header


Hi,
I have an eval board where I require that code section should have a VMA of 0x0 and LMA of 0x11fd0000 and similarly the data memory should have a VMA of 0x10000010 and LMA of 0x12800000.


My linker script looks like this

vectmem = 0x11fd0000;
codemem = 0x11fd0100;
datamem = 0x12800010;
virtdata = 0x10000010;

   MEMORY
   {
           ram_vectors : o = 0x0, l = 64K
           ram_data : o = 0x10000010, l = 8K
           prog_mem : o = 0x11fd0000, l = 64K
           data_mem : o = 0x12800000, l = 8K
   }

   SECTIONS
   {

           .vect 0x0 : AT(vectmem) {
                   ivt.o(*)
           }

           .text (0x0 + SIZEOF(.vect)) : AT(vectmem + SIZEOF(.vect)) {
                   __text_start = .;
                   *(.text)
                   etext = .;
                   _etext = .;
           }
           __text_end = .;



     .data  virtdata : AT(datamem) { __ro_start = .; *(.rodata)
   *(.rodata.*)  __data_start = .; *(.data) edata = .; _edata = .; }

Despite specifying an LMA for the .text section, the output of objdump -ph is as follows

Program Header:
LOAD off 0x00000074 vaddr 0x00000000 paddr 0x11fd0000 align 2**0
filesz 0x000006f2 memsz 0x00000379 flags rwx
LOAD off 0x00000770 vaddr 0x10000010 paddr 0x12800010 align 2**4
filesz 0x0000004e memsz 0x00000059 flags rw-
Sections:
Idx Name Size VMA LMA File off Algn
0 .vect 0000007d 00000000 11fd0000 00000074 2**0
CONTENTS, ALLOC, LOAD, RELOC, CODE
1 .text 000002fc 0000007d 0000007d 0000016e 2**0
CONTENTS, ALLOC, LOAD, RELOC, CODE
2 .data 00000027 10000010 12800010 00000770 2**0
CONTENTS, ALLOC, LOAD, DATA
3 .bss 00000030 10000010 10000010 000007c0 2**4
ALLOC
4 .stack 00000000 10000049 10000049 000007c0 2**0
CONTENTS
5 .comment 00000012 00000000 00000000 000007c0 2**0
CONTENTS, READONLY



As can be seen here, the program headers generated are correct but the section header for .text is incorrect. I am using a slightly old version of binutils (2.13.1). Because of this gdb which uses bfd_map_over_sections to load the program into the target loads .text at incorrect address. Can anybody help me understand the mistake on my part.


Regards
Alok


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