* [ld] Inferred section LMA in the absence of AT> or AT()
@ 2020-04-01 18:31 Fangrui Song
2020-04-02 23:07 ` Alan Modra
0 siblings, 1 reply; 2+ messages in thread
From: Fangrui Song @ 2020-04-01 18:31 UTC (permalink / raw)
To: binutils
https://sourceware.org/binutils/docs/ld/Output-Section-LMA.html#Output-Section-LMA says
> If the section has a specific VMA address, then this is used as the LMA address as well.
However, the behavior seems different from the documentation.
cat > a.s <<e
.globl _start; _start: ret;
.section .a,"a"; .byte 0;
.section .b,"a"; .byte 0;
.section .c,"a"; .byte 0;
.section .d,"a"; .byte 0;
.data; .byte 0
e
cat > a.x <<e
SECTIONS {
. = 0x1000;
.a : { *(.a) }
.b : AT(0x2005) { *(.b) }
/* "If the section has a specific VMA address, then this is used as the LMA address as well." is not obeyed */
.c 0x1006 : { *(.c) }
.d : AT(0x2007) { *(.d) }
/* "If the section has a specific VMA address, then this is used as the LMA address as well." is not obeyed */
.data 0x2008 : { *(.data) }
}
e
as a.s -o a.o
ld.bfd -T a.x a.o -o a
readelf -Wl a
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
LOAD 0x001000 0x0000000000001000 0x0000000000001000 0x000002 0x000002 R E 0x1000
LOAD 0x001002 0x0000000000001002 0x0000000000002005 0x000001 0x000001 R 0x1000
LOAD 0x001007 0x0000000000001007 0x0000000000002007 0x000001 0x000001 R 0x1000
LOAD 0x002006 0x0000000000001006 0x0000000000002009 0x000001 0x000001 R 0x1000
LOAD 0x002008 0x0000000000002008 0x0000000000003008 0x000001 0x000001 RW 0x1000
Section to Segment mapping:
Segment Sections...
00 .text .a
01 .b
02 .d
03 .c
04 .data
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [ld] Inferred section LMA in the absence of AT> or AT()
2020-04-01 18:31 [ld] Inferred section LMA in the absence of AT> or AT() Fangrui Song
@ 2020-04-02 23:07 ` Alan Modra
0 siblings, 0 replies; 2+ messages in thread
From: Alan Modra @ 2020-04-02 23:07 UTC (permalink / raw)
To: Fangrui Song; +Cc: binutils
On Wed, Apr 01, 2020 at 11:31:43AM -0700, Fangrui Song wrote:
> https://sourceware.org/binutils/docs/ld/Output-Section-LMA.html#Output-Section-LMA says
>
> > If the section has a specific VMA address, then this is used as the LMA address as well.
>
> However, the behavior seems different from the documentation.
Yes, the documentation isn't up to date. ldlang.c:5743
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-04-02 23:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-01 18:31 [ld] Inferred section LMA in the absence of AT> or AT() Fangrui Song
2020-04-02 23:07 ` Alan Modra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).