What's wrong with this linker script?
Steve Snyder
steves@formation.com
Wed Mar 13 08:54:00 GMT 2002
Hmm, you make a good point. Suppose I replace segment FLASHCODE with the
section ".burn_flash_code" like this:
__DATA_ROM = ADDR(.text) + SIZEOF(.text);
__DATA_RAM = ADDR(.burn_flash_code);
__DATA_END = ADDR(.burn_flash_code) + SIZEOF(.burn_flash_code);
Doing this gives me a different linker error:
ldppc -X -N -M -Map egu_diag.map -o egu_diag -Tegu_diag.cmd obj1.o obj2.o
ldppc: ADDR forward reference of section .burn_flash_code
Given that section .burn_flash_code is located in segment FLASHCODE, that
should satisfy the linker, yet it doesn't.
Any further advice?
Thanks for the response.
-----Original Message-----
From: Ian Lance Taylor [mailto:ian@airs.com]
Sent: Wednesday, March 13, 2002 11:37 AM
To: Steve Snyder
Cc: binutils@sources.redhat.com
Subject: Re: What's wrong with this linker script?
"Steve Snyder" <steves@formation.com> writes:
> Below is a linker script that I inherited from another project using the
> same hardware. That project was done using the Diab toolset, whereas my
> project is using the Gnu toolset for development. At link time ld
> complaints about this script:
>
> ldppc -X -N -M -Map egu_diag.map -o egu_diag -Tegu_diag.cmd obj1.o
> obj2.o
> ldppc: ADDR uses undefined section FLASHCODE
>
> Hmmm... "undefined section"? It looks good to me.
...
> MEMORY
> {
> DRAM : ORIGIN = 0x00000000, LENGTH = 0x00200000
> GLOBALS : ORIGIN = 0x00200000, LENGTH = 0x00200000
> FLASHCODE : ORIGIN = 0x00400000, LENGTH = 0x00200000
> PLD : ORIGIN = 0x00600000, LENGTH = 0x00000010
> EUMB : ORIGIN = 0x00600020, LENGTH = 0x00100000
> FLASH1 : ORIGIN = 0xFFF00000, LENGTH = 0x00020000
> }
>
> SECTIONS
> {
> .text :
> {
> *(.boot_init) *(.text)
> } > FLASH1
> .burn_flash_code (ADDR(.text) + SIZEOF(.text)) : {} > FLASHCODE
> .bss : {} > DRAM
> .sdram : {} > GLOBALS
> .epic : {} > EUMB
> .pld : {} > PLD
> .sdata : {} > DRAM
> .data : {} > DRAM
> }
>
> /* This section defines the beginning and ending of the burn flash code
> to be moved to DRAM prior of using */
>
> __DATA_ROM = ADDR(.text) + SIZEOF(.text);
> __DATA_RAM = ADDR(FLASHCODE);
> __DATA_END = ADDR(FLASHCODE) + SIZEOF(.burn_flash_code);
>
> ___DATA_ROM = __DATA_ROM;
> ___DATA_RAM = __DATA_RAM;
> ___DATA_END = __DATA_END;
ADDR takes a the name of a section. You are giving it the name of a
memory segment. Maybe it should work, but it doesn't.
Ian
More information about the Binutils
mailing list