What's wrong with this linker script?

Ian Lance Taylor ian@airs.com
Wed Mar 13 08:37:00 GMT 2002


"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