What's wrong with this linker script?

Ian Lance Taylor ian@airs.com
Wed Mar 13 09:26:00 GMT 2002


"Steve Snyder" <steves@formation.com> writes:

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

It's because the address of .burn_flash_code is being set based on a
computation involving ADDR and SIZEOF.  Actually, it looks like you
are setting the address of .burn_flash_code in two ways; I'm not sure
why.  Perhaps if you removed that computation, and just put
.burn_flash_code in the memory segment without setting the address, it
would work.  I'm not sure.

Ian



More information about the Binutils mailing list