public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] possible bug in configtool or whatever is generating "target.ld" file
@ 2012-09-27  3:46 Ken Yee
  2012-09-27  7:28 ` [ECOS] " John Dallaway
  0 siblings, 1 reply; 3+ messages in thread
From: Ken Yee @ 2012-09-27  3:46 UTC (permalink / raw)
  To: ecos-discuss

When you link your app, the symptom is you see this when you link your application:

/home/ecos/gnutools/arm-eabi/bin/../lib/gcc/arm-eabi/4.6.2/../../../../arm-eabi/bin/ld:target.ld:17: syntax error
collect2: ld returned 1 exit status

It's a bit of a cryptic error because target.ld is not in the path indicated.
It's actually in your your ecos_install/lib directory.
If you open the target.ld file, you'll see this:

==============
...
SECTIONS
{
    .debug_aranges 0 : { *(.debug_aranges) } .debug_pubnames 0 : { *(.debug_pubnames) } .debug_info 0 : { *(.debug_info) } .debug_abbrev 0 : { *(.debug_abbrev) } .debug_line 0 : { *(.debug_line) } .debug_frame 0 : { *(.debug_frame) } .debug_str 0 : { *(.debug_str) } .debug_loc 0 : { *(.debug_loc) } .debug_macinfo 0 : { *(.debug_macinfo) } .note.arm.ident 0 : { KEEP (*(.note.arm.ident)) } /DISCARD/ 0 : { *(.fini_array*) }
    .fixed_vectors 0x20 : { . = .; KEEP (*(.fixed_vectors)) } > sram
    SECTION_sram_code (sram, ALIGN (0x4), )
    .rom_vectors 0x02008000 : { __rom_vectors_vma = ABSOLUTE(.); . = .; KEEP (*(.vectors)) } > ram __rom_vectors_lma = LOADADDR(.rom_vectors);
...
================

The offending line 17 is the one that starts with SECTION_sram_code; delete this line to fix the link error.
That looks like the syntax for the .ldi file instead of the target.ld file.

Anyways, thought I'd mention how to find/fix this so the mailing list search engine can find it.  I found a few cases where other people hit the same quirky linker error and didn't know what to do to fix it...

p.s., I can supply the ecos.ecc file if that would help anyone reproduce/fix the bug...

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ECOS] Re: possible bug in configtool or whatever is generating "target.ld" file
  2012-09-27  3:46 [ECOS] possible bug in configtool or whatever is generating "target.ld" file Ken Yee
@ 2012-09-27  7:28 ` John Dallaway
  0 siblings, 0 replies; 3+ messages in thread
From: John Dallaway @ 2012-09-27  7:28 UTC (permalink / raw)
  To: Ken Yee; +Cc: eCos Discussion

Hi Ken

On 27/09/12 04:46, Ken Yee wrote:

> When you link your app, the symptom is you see this when you link your application:
> 
> /home/ecos/gnutools/arm-eabi/bin/../lib/gcc/arm-eabi/4.6.2/../../../../arm-eabi/bin/ld:target.ld:17: syntax error
> collect2: ld returned 1 exit status
> 
> It's a bit of a cryptic error because target.ld is not in the path indicated.
> It's actually in your your ecos_install/lib directory.
> If you open the target.ld file, you'll see this:
> 
> ==============
> ...
> SECTIONS
> {
>     .debug_aranges 0 : { *(.debug_aranges) } .debug_pubnames 0 : { *(.debug_pubnames) } .debug_info 0 : { *(.debug_info) } .debug_abbrev 0 : { *(.debug_abbrev) } .debug_line 0 : { *(.debug_line) } .debug_frame 0 : { *(.debug_frame) } .debug_str 0 : { *(.debug_str) } .debug_loc 0 : { *(.debug_loc) } .debug_macinfo 0 : { *(.debug_macinfo) } .note.arm.ident 0 : { KEEP (*(.note.arm.ident)) } /DISCARD/ 0 : { *(.fini_array*) }
>     .fixed_vectors 0x20 : { . = .; KEEP (*(.fixed_vectors)) } > sram
>     SECTION_sram_code (sram, ALIGN (0x4), )
>     .rom_vectors 0x02008000 : { __rom_vectors_vma = ABSOLUTE(.); . = .; KEEP (*(.vectors)) } > ram __rom_vectors_lma = LOADADDR(.rom_vectors);
> ...
> ================
> 
> The offending line 17 is the one that starts with SECTION_sram_code; delete this
> line to fix the link error.
> That looks like the syntax for the .ldi file instead of the target.ld file.

The eCos build system runs the C preprocessor over a target-specific
.ldi file to generate the final linker script file (target.ld). The
macros such as SECTION_data and SECTION_bss are defined in an
architecture-specific .ld file located in the relevant architecture HAL
package. For example, the Cortex-M architectural HAL package provides
the file src/cortexm.ld containing these definitions.

The various .ldi files provided by the platform HAL packages should use
only those macros defined in the relevant architecture-specific .ld
file. The fact that "SECTION_sram_code" appears in your target.ld output
suggests that this macro is used in the target-specific .ldi file but is
not defined in the architecture-specific .ld file and is therefore not
being replaced by the C preprocessor.

I hope this helps...

John Dallaway
eCos maintainer
http://www.dallaway.org.uk/john

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ECOS] Re: possible bug in configtool or whatever is generating "target.ld" file
@ 2012-09-27 21:34 Ken Yee
  0 siblings, 0 replies; 3+ messages in thread
From: Ken Yee @ 2012-09-27 21:34 UTC (permalink / raw)
  To: ecos-discuss

John Dallaway wrote:
> The fact that "SECTION_sram_code" appears in your target.ld output
> suggests that this macro is used in the target-specific .ldi file but is
> not defined in the architecture-specific .ld file and is therefore not
> being replaced by the C preprocessor.

That was it...thanks much :-)

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-09-27 21:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-27  3:46 [ECOS] possible bug in configtool or whatever is generating "target.ld" file Ken Yee
2012-09-27  7:28 ` [ECOS] " John Dallaway
2012-09-27 21:34 Ken Yee

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).