Ian Lance Taylor-3 wrote: > > "Jeffi Edward.J" <j.jeffi@xxxxxxxxxxx> writes: > >> Ian Lance Taylor-3 wrote: >>> >>> "Jeffi Edward.J" <j.jeffi@xxxxxxxxxxx> writes: >>> >>>> I'm supposed to get the start address of image as 0x8450020 (start of >>>> LMA >>>> of >>>> .data) and the end address of image as the value of image_end symbol. >>>> >>>> But I get the start address of image as VMA of .data (i.e the value of >>>> symbol ram_data_start), which is wrong. >>> >>> What do you mean by "the start address?" What object file format are >>> you using? >>> >>> Ian >>> >>> >> >> Am using ELF object file format. >> In my understanding, the image contains the .text, .rodata, etc..and the >> initialized data section .data, .sdata etc. It doesn't contain .bss, >> .sbss, >> .etc. >> >> So by the word "image" i mean the combination of code as well as >> initialized >> data section. >> Here in this example, my initialized data (LMA of .data ) begins at the >> address 0x8450020. The code segment follows this address space. So my >> image >> contains the address space ranging from 0x8450020 till the end of .text >> section. > > Thanks. You didn't really explain what you mean by "start address." > I don't understand what is actually going wrong. In ELF, the LMA is > reflected in the p_paddr field of the segments. Perhaps you could > show use the readelf -l output of your executable and tell us which > values you want to be different. > > Ian > > Hi, Sorry for the delayed reply as I had to work on different assignment. I meant "start address" as the beginning address of the image address space. The term start address which I used is not a standard technical term..I didnt mean _start symbol too. Here the begining of the image address space (which i meant as start address) should be 0x8450020 and the end of the image address space should be the end of text segment. But with my linker script, the beginning of the image address space is interpreted as the .sbss section. Here is the output of reasdelf -l on my .out file. ----------- Entry point 0x8450d60 There are three program headers starting at offset 52 Program Headers: Type Offset Virtaddr PhysAddr FileSiz MemSiz Flg Align LOAD 0x010010 0x8050010 0x8050010 0x0 0x17e70 RW 0x10000 LOAD 0x007e80 0x8067e80 0x8450020 0xd40 0xd40 RW 0x10000 LOAD 0x010d60 0x8450d60 0x8450d60 0x22524 0x22524 RWX 0x10000 Section to Segment mapping: Segment Sections... 00 .sbss, .bss 01 .data, .sdata 02 .text, .text.main, .text.__init_main, ........, .init, .fini, .rodata, .rodata.str1.4, .rodata.cst4, .got2, .ctors, .dtors, .got, .rel.data I really wonder why .sbss, .bss section are considered as loadable section. Since they are considered as loadable section, my image beginning address (lower address) is considered as 0x0x8050010 and the image end address (upper address) is considered as 0x8473284 ( 0x8450d60 + 0x22524). But I need the image beginning address as 0x8450020 and the end address as 0x8473284. -- View this message in context: http://old.nabble.com/How-to-split-memory-in-linker-script-to-get-the-lower-address-as-start-of-.text--tp28251238p28432036.html Sent from the gcc - Help mailing list archive at Nabble.com.