From: Jan Pohanka <xhpohanka@gmail.com>
To: binutils@sourceware.org
Subject: Strange linker problem after updating binutils and gcc
Date: Thu, 17 Feb 2011 13:44:00 -0000 [thread overview]
Message-ID: <AANLkTi=mpJQn85ThrjzDtqWCKpVUropYj2MvGKeUdd6e@mail.gmail.com> (raw)
Hello,
I'm using gcc with binutils in Rowley Crossworks for ARM 1.7 IDE for
arm development. Unfortunately there is very old version of gcc
(4.1.1) and binutils (2.17) in this IDE, so I decided to upgrade to
gcc 4.4.4 and binutils 20.20.51 (I tried more versions but all are
affected)
Unfortunately there is a problem with linking in new version.
In first try, linker generated warning "dot moved backwards before..."
so I solved it with proper ordering of sections in ld script,
unfortunately there is still an error because the generated elf file
is wrong - some data are written in high addresses, resulting bin file
has size of 500MB instead of 500kB.
ld is invoked with following params:
ld -X -nostdlib -ereset_handler --omagic --fatal-warnings -EL
-Te:/_dev/_kamera/JR1_git/_tmp_JR615 Flash Debug/JR615 Flash
Debug.1.8.23.2.h263.ld -Map _JR615 Flash Debug//JR615 Flash
Debug.1.8.23.2.h263.map -u_vectors -o _JR615 Flash Debug//JR615 Flash
Debug.1.8.23.2.h263.elf --start-group ...
and ld script:
MEMORY
{
UNPLACED_SECTIONS (wx) : ORIGIN = 0x100000000, LENGTH = 0
SDRAM (wx) : ORIGIN = 0x20000000, LENGTH = 0x02000000
Reserved (wx) : ORIGIN = 0x90000000, LENGTH = 0x60000000
SRAM1 (wx) : ORIGIN = 0x00300000, LENGTH = 0x00001000
SRAM0 (wx) : ORIGIN = 0x00200000, LENGTH = 0x00001000
}
INTERNAL_SRAM_START_ADDRESS = 0x00200000;
SDRAM_START_ADDRESS = 0x20000000;
SDRAM_LENGTH = 0x02000000;
SECTIONS
{
__SDRAM_segment_start__ = 0x20000000;
__SDRAM_segment_end__ = 0x22000000;
__Reserved_segment_start__ = 0x90000000;
__Reserved_segment_end__ = 0xf0000000;
__SRAM1_segment_start__ = 0x00300000;
__SRAM1_segment_end__ = 0x00301000;
__SRAM0_segment_start__ = 0x00200000;
__SRAM0_segment_end__ = 0x00201000;
__STACKSIZE__ = 512000;
__STACKSIZE_IRQ__ = 128000;
__STACKSIZE_FIQ__ = 4096;
__STACKSIZE_SVC__ = 4096;
__STACKSIZE_ABT__ = 4096;
__STACKSIZE_UND__ = 4096;
__HEAPSIZE__ = 4000000;
__vectors_ram_load_start__ = 0x00200000;
.vectors_ram 0x00200000 (NOLOAD) :
{
__vectors_ram_start__ = .;
*(.vectors_ram)
. = MAX(__vectors_ram_start__ + 0x3C , .);
}
__vectors_ram_end__ = __vectors_ram_start__ + SIZEOF(.vectors_ram);
. = ASSERT(__vectors_ram_end__ >= __SRAM0_segment_start__ &&
__vectors_ram_end__ <= (__SRAM0_segment_start__ + 0x00001000) ,
"error: .vectors_ram is too large to fit in SRAM0 memory segment");
__sram_noninit_data_load_start__ = 0x00200040;
.sram_noninit_data 0x00200040 (NOLOAD) :
{
__sram_noninit_data_start__ = .;
*(.sram_noninit_data)
. = MAX(__sram_noninit_data_start__ + 0xbb8 , .);
}
__sram_noninit_data_end__ = __sram_noninit_data_start__ +
SIZEOF(.sram_noninit_data);
. = ASSERT(__sram_noninit_data_end__ >= __SRAM0_segment_start__ &&
__sram_noninit_data_end__ <= (__SRAM0_segment_start__ + 0x00001000) ,
"error: .sram_noninit_data is too large to fit in SRAM0 memory
segment");
. = ASSERT(__vectors_ram_end__ <= __sram_noninit_data_start__ ,
"error: section .vectors_ram overlaps absolute placed section
.sram_noninit_data");
__reserved_debug_handler_load_start__ = 0x00200c00;
.reserved_debug_handler 0x00200c00 (NOLOAD) :
{
__reserved_debug_handler_start__ = .;
*(.reserved_debug_handler)
. = MAX(__reserved_debug_handler_start__ + 0x400 , .);
}
__reserved_debug_handler_end__ = __reserved_debug_handler_start__ +
SIZEOF(.reserved_debug_handler);
__SRAM0_segment_used_end__ = 0x00200c00 + SIZEOF(.reserved_debug_handler);
. = ASSERT(__reserved_debug_handler_end__ >= __SRAM0_segment_start__
&& __reserved_debug_handler_end__ <= (__SRAM0_segment_start__ +
0x00001000) , "error: .reserved_debug_handler is too large to fit in
SRAM0 memory segment");
. = ASSERT(__sram_noninit_data_end__ <=
__reserved_debug_handler_start__ , "error: section .sram_noninit_data
overlaps absolute placed section .reserved_debug_handler");
__reserved_mmu_load_start__ = ALIGN(__SDRAM_segment_start__ , 4);
.reserved_mmu ALIGN(__SDRAM_segment_start__ , 4) (NOLOAD) :
{
__reserved_mmu_start__ = .;
*(.reserved_mmu)
. = ALIGN(MAX(__reserved_mmu_start__ + 0x4000 , .), 4);
}
__reserved_mmu_end__ = __reserved_mmu_start__ + SIZEOF(.reserved_mmu);
. = ASSERT(__reserved_mmu_end__ >= __SDRAM_segment_start__ &&
__reserved_mmu_end__ <= (__SDRAM_segment_start__ + 0x02000000) ,
"error: .reserved_mmu is too large to fit in SDRAM memory segment");
__boot_load_start__ = __reserved_mmu_end__;
.boot __reserved_mmu_end__ :
{
__boot_start__ = .;
*(.boot)
. = MAX(__boot_start__ + 0x80e8 , .);
}
__boot_end__ = __boot_start__ + SIZEOF(.boot);
. = ASSERT(__boot_end__ >= __SDRAM_segment_start__ && __boot_end__
<= (__SDRAM_segment_start__ + 0x02000000) , "error: .boot is too large
to fit in SDRAM memory segment");
__vectors_load_start__ = ALIGN(__boot_end__ , 4);
.vectors ALIGN(__boot_end__ , 4) :
{
__vectors_start__ = .;
*(.vectors .vectors.*)
. = ALIGN(MAX(__vectors_start__ + 0x108 , .), 4);
}
__vectors_end__ = __vectors_start__ + SIZEOF(.vectors);
. = ASSERT(__vectors_end__ >= __SDRAM_segment_start__ &&
__vectors_end__ <= (__SDRAM_segment_start__ + 0x02000000) , "error:
.vectors is too large to fit in SDRAM memory segment");
__localization_load_start__ = __vectors_end__;
.localization __vectors_end__ :
{
__localization_start__ = .;
*(.localization)
. = MAX(__localization_start__ + 0x40f8 , .);
}
__localization_end__ = __localization_start__ + SIZEOF(.localization);
. = ASSERT(__localization_end__ >= __SDRAM_segment_start__ &&
__localization_end__ <= (__SDRAM_segment_start__ + 0x02000000) ,
"error: .localization is too large to fit in SDRAM memory segment");
__init_load_start__ = ALIGN(__localization_end__ , 4);
.init ALIGN(__localization_end__ , 4) :
{
__init_start__ = .;
*(.init .init.*)
}
__init_end__ = __init_start__ + SIZEOF(.init);
. = ASSERT(__init_end__ >= __SDRAM_segment_start__ && __init_end__
<= (__SDRAM_segment_start__ + 0x02000000) , "error: .init is too large
to fit in SDRAM memory segment");
__text_load_start__ = ALIGN(__init_end__ , 4);
.text ALIGN(__init_end__ , 4) :
{
__text_start__ = .;
*(.text .text.* .glue_7t .glue_7 .gnu.linkonce.t.*)
}
__text_end__ = __text_start__ + SIZEOF(.text);
. = ASSERT(__text_end__ >= __SDRAM_segment_start__ && __text_end__
<= (__SDRAM_segment_start__ + 0x02000000) , "error: .text is too large
to fit in SDRAM memory segment");
__dtors_load_start__ = ALIGN(__text_end__ , 4);
.dtors ALIGN(__text_end__ , 4) :
{
__dtors_start__ = .;
KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors))
}
__dtors_end__ = __dtors_start__ + SIZEOF(.dtors);
. = ASSERT(__dtors_end__ >= __SDRAM_segment_start__ && __dtors_end__
<= (__SDRAM_segment_start__ + 0x02000000) , "error: .dtors is too
large to fit in SDRAM memory segment");
__ctors_load_start__ = ALIGN(__dtors_end__ , 4);
.ctors ALIGN(__dtors_end__ , 4) :
{
__ctors_start__ = .;
KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors))
}
__ctors_end__ = __ctors_start__ + SIZEOF(.ctors);
. = ASSERT(__ctors_end__ >= __SDRAM_segment_start__ && __ctors_end__
<= (__SDRAM_segment_start__ + 0x02000000) , "error: .ctors is too
large to fit in SDRAM memory segment");
__fast_load_start__ = ALIGN(__ctors_end__ , 4);
.fast ALIGN(__SRAM1_segment_start__ , 4) : AT(ALIGN(__ctors_end__ , 4))
{
__fast_start__ = .;
*(.fast .fast.*)
}
__fast_end__ = __fast_start__ + SIZEOF(.fast);
__fast_load_end__ = __fast_load_start__ + SIZEOF(.fast);
. = ASSERT((__fast_load_start__ + SIZEOF(.fast)) >=
__SDRAM_segment_start__ && (__fast_load_start__ + SIZEOF(.fast)) <=
(__SDRAM_segment_start__ + 0x02000000) , "error: .fast is too large to
fit in SDRAM memory segment");
.fast_run ALIGN(__SRAM1_segment_start__ , 4) (NOLOAD) :
{
__fast_run_start__ = .;
. = MAX(__fast_run_start__ + SIZEOF(.fast), .);
}
__fast_run_end__ = __fast_run_start__ + SIZEOF(.fast_run);
__SRAM1_segment_used_end__ = ALIGN(__SRAM1_segment_start__ , 4) +
SIZEOF(.fast_run);
. = ASSERT(__fast_run_end__ >= __SRAM1_segment_start__ &&
__fast_run_end__ <= (__SRAM1_segment_start__ + 0x00001000) , "error:
.fast_run is too large to fit in SRAM1 memory segment");
__data_load_start__ = ALIGN(__fast_load_start__ + SIZEOF(.fast) , 4);
.data ALIGN(__fast_load_start__ + SIZEOF(.fast) , 4) :
{
__data_start__ = .;
*(.data .data.* .gnu.linkonce.d.*)
}
__data_end__ = __data_start__ + SIZEOF(.data);
. = ASSERT(__data_end__ >= __SDRAM_segment_start__ && __data_end__
<= (__SDRAM_segment_start__ + 0x02000000) , "error: .data is too large
to fit in SDRAM memory segment");
__rodata_load_start__ = ALIGN(__data_end__ , 4);
.rodata ALIGN(__data_end__ , 4) :
{
__rodata_start__ = .;
*(.rodata .rodata.* .gnu.linkonce.r.*)
}
__rodata_end__ = __rodata_start__ + SIZEOF(.rodata);
. = ASSERT(__rodata_end__ >= __SDRAM_segment_start__ &&
__rodata_end__ <= (__SDRAM_segment_start__ + 0x02000000) , "error:
.rodata is too large to fit in SDRAM memory segment");
__bss_load_start__ = ALIGN(__rodata_end__ , 4);
.bss ALIGN(__rodata_end__ , 4) (NOLOAD) :
{
__bss_start__ = .;
*(.bss .bss.* .gnu.linkonce.b.*) *(COMMON)
}
__bss_end__ = __bss_start__ + SIZEOF(.bss);
. = ASSERT(__bss_end__ >= __SDRAM_segment_start__ && __bss_end__ <=
(__SDRAM_segment_start__ + 0x02000000) , "error: .bss is too large to
fit in SDRAM memory segment");
__text_user_load_start__ = ALIGN(__bss_end__ , 4);
.text_user ALIGN(__bss_end__ , 4) (NOLOAD) :
{
__text_user_start__ = .;
*(.text_user)
}
__text_user_end__ = __text_user_start__ + SIZEOF(.text_user);
. = ASSERT(__text_user_end__ >= __SDRAM_segment_start__ &&
__text_user_end__ <= (__SDRAM_segment_start__ + 0x02000000) , "error:
.text_user is too large to fit in SDRAM memory segment");
__non_init_load_start__ = ALIGN(__text_user_end__ , 4);
.non_init ALIGN(__text_user_end__ , 4) (NOLOAD) :
{
__non_init_start__ = .;
*(.non_init .non_init.*)
}
__non_init_end__ = __non_init_start__ + SIZEOF(.non_init);
. = ASSERT(__non_init_end__ >= __SDRAM_segment_start__ &&
__non_init_end__ <= (__SDRAM_segment_start__ + 0x02000000) , "error:
.non_init is too large to fit in SDRAM memory segment");
__heap_load_start__ = ALIGN(__non_init_end__ , 4);
.heap ALIGN(__non_init_end__ , 4) (NOLOAD) :
{
__heap_start__ = .;
*(.heap)
. = ALIGN(MAX(__heap_start__ + __HEAPSIZE__ , .), 4);
}
__heap_end__ = __heap_start__ + SIZEOF(.heap);
. = ASSERT(__heap_end__ >= __SDRAM_segment_start__ && __heap_end__
<= (__SDRAM_segment_start__ + 0x02000000) , "error: .heap is too large
to fit in SDRAM memory segment");
__stack_load_start__ = ALIGN(__heap_end__ , 4);
.stack ALIGN(__heap_end__ , 4) (NOLOAD) :
{
__stack_start__ = .;
*(.stack)
. = ALIGN(MAX(__stack_start__ + __STACKSIZE__ , .), 4);
}
__stack_end__ = __stack_start__ + SIZEOF(.stack);
. = ASSERT(__stack_end__ >= __SDRAM_segment_start__ && __stack_end__
<= (__SDRAM_segment_start__ + 0x02000000) , "error: .stack is too
large to fit in SDRAM memory segment");
__stack_irq_load_start__ = ALIGN(__stack_end__ , 4);
.stack_irq ALIGN(__stack_end__ , 4) (NOLOAD) :
{
__stack_irq_start__ = .;
*(.stack_irq)
. = ALIGN(MAX(__stack_irq_start__ + __STACKSIZE_IRQ__ , .), 4);
}
__stack_irq_end__ = __stack_irq_start__ + SIZEOF(.stack_irq);
. = ASSERT(__stack_irq_end__ >= __SDRAM_segment_start__ &&
__stack_irq_end__ <= (__SDRAM_segment_start__ + 0x02000000) , "error:
.stack_irq is too large to fit in SDRAM memory segment");
__stack_fiq_load_start__ = ALIGN(__stack_irq_end__ , 4);
.stack_fiq ALIGN(__stack_irq_end__ , 4) (NOLOAD) :
{
__stack_fiq_start__ = .;
*(.stack_fiq)
. = ALIGN(MAX(__stack_fiq_start__ + __STACKSIZE_FIQ__ , .), 4);
}
__stack_fiq_end__ = __stack_fiq_start__ + SIZEOF(.stack_fiq);
. = ASSERT(__stack_fiq_end__ >= __SDRAM_segment_start__ &&
__stack_fiq_end__ <= (__SDRAM_segment_start__ + 0x02000000) , "error:
.stack_fiq is too large to fit in SDRAM memory segment");
__stack_svc_load_start__ = ALIGN(__stack_fiq_end__ , 4);
.stack_svc ALIGN(__stack_fiq_end__ , 4) (NOLOAD) :
{
__stack_svc_start__ = .;
*(.stack_svc)
. = ALIGN(MAX(__stack_svc_start__ + __STACKSIZE_SVC__ , .), 4);
}
__stack_svc_end__ = __stack_svc_start__ + SIZEOF(.stack_svc);
. = ASSERT(__stack_svc_end__ >= __SDRAM_segment_start__ &&
__stack_svc_end__ <= (__SDRAM_segment_start__ + 0x02000000) , "error:
.stack_svc is too large to fit in SDRAM memory segment");
__stack_abt_load_start__ = ALIGN(__stack_svc_end__ , 4);
.stack_abt ALIGN(__stack_svc_end__ , 4) (NOLOAD) :
{
__stack_abt_start__ = .;
*(.stack_abt)
. = ALIGN(MAX(__stack_abt_start__ + __STACKSIZE_ABT__ , .), 4);
}
__stack_abt_end__ = __stack_abt_start__ + SIZEOF(.stack_abt);
. = ASSERT(__stack_abt_end__ >= __SDRAM_segment_start__ &&
__stack_abt_end__ <= (__SDRAM_segment_start__ + 0x02000000) , "error:
.stack_abt is too large to fit in SDRAM memory segment");
__stack_und_load_start__ = ALIGN(__stack_abt_end__ , 4);
.stack_und ALIGN(__stack_abt_end__ , 4) (NOLOAD) :
{
__stack_und_start__ = .;
*(.stack_und)
. = ALIGN(MAX(__stack_und_start__ + __STACKSIZE_UND__ , .), 4);
}
__stack_und_end__ = __stack_und_start__ + SIZEOF(.stack_und);
. = ASSERT(__stack_und_end__ >= __SDRAM_segment_start__ &&
__stack_und_end__ <= (__SDRAM_segment_start__ + 0x02000000) , "error:
.stack_und is too large to fit in SDRAM memory segment");
__exceptions_log_load_start__ = 0x21eff000;
.exceptions_log 0x21eff000 (NOLOAD) :
{
__exceptions_log_start__ = .;
*(.exceptions_log)
. = MAX(__exceptions_log_start__ + 0x1000 , .);
}
__exceptions_log_end__ = __exceptions_log_start__ + SIZEOF(.exceptions_log);
. = ASSERT(__exceptions_log_end__ >= __SDRAM_segment_start__ &&
__exceptions_log_end__ <= (__SDRAM_segment_start__ + 0x02000000) ,
"error: .exceptions_log is too large to fit in SDRAM memory segment");
. = ASSERT(__stack_und_end__ <= __exceptions_log_start__ , "error:
section .stack_und overlaps absolute placed section .exceptions_log");
__nocache_load_start__ = 0x21f00000;
.nocache 0x21f00000 (NOLOAD) :
{
__nocache_start__ = .;
*(.nocache)
}
__nocache_end__ = __nocache_start__ + SIZEOF(.nocache);
__SDRAM_segment_used_end__ = 0x21f00000 + SIZEOF(.nocache);
. = ASSERT(__nocache_end__ >= __SDRAM_segment_start__ &&
__nocache_end__ <= (__SDRAM_segment_start__ + 0x02000000) , "error:
.nocache is too large to fit in SDRAM memory segment");
. = ASSERT(__exceptions_log_end__ <= __nocache_start__ , "error:
section .exceptions_log overlaps absolute placed section .nocache");
}
Could anyone please give me any hint how to solve this problem?
best regards
Jan
next reply other threads:[~2011-02-17 13:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-17 13:44 Jan Pohanka [this message]
2011-02-21 7:33 ` Jan Pohanka
2011-02-22 15:04 ` Nick Clifton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='AANLkTi=mpJQn85ThrjzDtqWCKpVUropYj2MvGKeUdd6e@mail.gmail.com' \
--to=xhpohanka@gmail.com \
--cc=binutils@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).