This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Change in .ld syntax or a bug?
- From: Andrew Lunn <andrew dot lunn at ascom dot ch>
- To: binutils at sources dot redhat dot com
- Date: Thu, 15 Sep 2005 14:17:08 +0200
- Subject: Change in .ld syntax or a bug?
Hi Folks
Debian unstable is using binutils 2.16.1cvs20050902. I've found that
this causes problem with the RTOS eCos.
gcc -finline-limit=7000 -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -nostdlib -Wl,-r -Wl,--whole-archive -o /home/lunn/eCos/work/install/lib/extras.o /home/lunn/eCos/work/install/lib/libextras.a
gcc -L/home/lunn/eCos/work/install/lib -Ttarget.ld -o /home/lunn/eCos/work/install/tests/hal/common/current/tests/context tests/context.o -g -nostdlib -Wl,--gc-sections -Wl,-static
/usr/bin/ld: address 0x28b3 of /home/lunn/eCos/work/install/tests/hal/common/current/tests/context section .text is not within region rom
/usr/bin/ld: address 0x328b of /home/lunn/eCos/work/install/tests/hal/common/current/tests/context section .rodata is not within region rom
/usr/bin/ld: address 0x3304 of /home/lunn/eCos/work/install/tests/hal/common/current/tests/context section .eh_frame is not within region rom
/usr/bin/ld: address 0x28b3 of /home/lunn/eCos/work/install/tests/hal/common/current/tests/context section .text is not within region rom
/usr/bin/ld: address 0x328b of /home/lunn/eCos/work/install/tests/hal/common/current/tests/context section .rodata is not within region rom
/usr/bin/ld: address 0x32ec of /home/lunn/eCos/work/install/tests/hal/common/current/tests/context section .eh_frame is not within region rom
collect2: ld returned 1 exit status
If i downgrade to an older version of binutils, eg 2.16.1 it links OK.
target.ld contains:
STARTUP(vectors.o)
ENTRY(_start)
INPUT(extras.o)
GROUP(libtarget.a libgcc.a libsupc++.a libgcc_eh.a)
MEMORY
{
rom : ORIGIN = 0x1000000, LENGTH = 0x800000
ram : ORIGIN = 0x2000000, LENGTH = 0x800000
}
SECTIONS
{
.vectors 0x1000000 : { . = .; KEEP(*(.vectors)) } > rom
.text ALIGN (0x4) : { _stext = .; *(.text*) *(.gnu.warning) *(.gnu.linkonce.t.*) *(.init) } > rom _etext = .; PROVIDE (etext = .);
.fini ALIGN (0x4) : { . = .; *(.fini) } > rom
.rodata1 ALIGN (0x8) : { . = .; *(.rodata1) } > rom
.rodata ALIGN (0x8) : { . = .; *(.rodata*) *(.gnu.linkonce.r.*) } > rom
.fixup ALIGN (0x4) : { _FIXUP_START_ = ABSOLUTE(.); *(.fixup) _FIXUP_END_ =
ABSOLUTE(.);} > rom
.rel.text : { *(.rel.text) *(.rel.text.*) *(.rel.gnu.linkonce.t*) } > rom .rela.text : { *(.rela.text) *(.rela.text.*) *(.rela.gnu.linkonce.t*) } > rom .rel.data : { *(.rel.data) *(.rel.data.*) *(.rel.gnu.linkonce.d*) } > rom .rela.data : { *(.rela.data) *(.rela.data.*) *(.rela.gnu.linkonce.d*) } > rom .rel.rodata
: { *(.rel.rodata) *(.rel.rodata.*) *(.rel.gnu.linkonce.r*) } > rom .rela.rodata : { *(.rela.rodata) *(.rela.rodata.*) *(.rela.gnu.linkonce.r*) } > rom .rel.got : { *(.rel.got) } > rom .rela.got : { *(.rela.got) } > rom .rel.ctors : { *(.rel.ctors) } > rom .rela.ctors : { *(.rela.ctors) } > rom .rel.dtors : { *(.rel.dtors) } > rom .rela.dtors : { *(.rela.dtors) } > rom .rel.init : { *(.rel.init) } > rom .rela.init : { *(.rela.init) } > rom .rel.fini : { *(.rel.fini) } > rom .rela.fini : { *(.rela.fini) } > rom .rel.bss : { *(.rel.bss) } > rom .rela.bss : { *(.rela.bss) } > rom .rel.plt : { *(.rel.plt) } > rom .rela.plt : { *(.rela.plt) } > rom .rel.dyn : { *(.rel.dyn) } > rom
.eh_frame ALIGN (0x4) : { . = .; __EH_FRAME_BEGIN__ = .; KEEP(*(.eh_frame))
__FRAME_END__ = .; . = . + 8; } > rom = 0
.rel.got ALIGN (0x1) : { *(.rel.got) } > rom
.gcc_except_table ALIGN (0x1) : { _EXCEPT_START_ = ABSOLUTE(.); *(.gcc_except_table) _EXCEPT_END_ = ABSOLUTE(.);} > rom
.data 0x2000000 : { __ram_data_start = ABSOLUTE(.); *(.data*) *(.gnu.linkonce.d.*) _GOT1_START_ = ABSOLUTE(.); *(.got1) _GOT1_END_ = ABSOLUTE(.); . = ALIGN(8); __CTOR_LIST__ = ABSOLUTE(.); KEEP(*(SORT(.ctors*))) __CTOR_END__ = ABSOLUTE(.); __DTOR_LIST__ = ABSOLUTE(.); KEEP(*(SORT(.dtors*))) __DTOR_END__ = ABSOLUTE(.); . = ALIGN(32); KEEP(*( SORT (.ecos.table.*))); _GOT2_START_ = ABSOLUTE(.); *(.got2) _GOT2_END_ = ABSOLUTE(.); _GOT_START_ = ABSOLUTE(.); _GLOBAL_OFFSET_TABLE_ = ABSOLUTE(. + 32768); _SDA_BASE_ = ABSOLUTE(.); *(.got.plt) *(.got) _GOT_END_ = ABSOLUTE(.); *(.dynamic) _SDATA_START_ = ABSOLUTE(.); *(.sdata*) *(.gnu.linkonce.s.*) } > ram __rom_data_start = LOADADDR(.data); __ram_data_end = .; PROVIDE(__ram_data_end = .); _edata = .; PROVIDE (edata = .);
.sbss ALIGN (0x4) : { __bss_start = ABSOLUTE (.); _SBSS_START_ = ABSOLUTE(.); *(.sbss*) *(.gnu.linkonce.sb.*) _SBSS_END_ = ABSOLUTE(.); *(.scommon*) } > ram .bss ALIGN (0x10) : { . = .; *(.dynbss*) *(.bss*) *(COMMON) *(.gnu.linkonce.b.*) } > ram __bss_end = .;
__heap1 = ALIGN (0x10);
. = ALIGN(4); _end = .; PROVIDE (end = .);
}
It looks like ld is happy with sections which explicit set there
address, eg .vectors and .data, but sections which just follow on from
the previous section it is not happy with and seems to put them
outside of memory.
Has there recently been a change in syntax? Or is this a bug?
Thanks
Andrew