ld - NOCROSSREFS

John Walsh john.walsh@mini-net.co.uk
Wed Jun 18 10:38:00 GMT 2008


Hi Ian,

>> Can anyone point me at better (ie. full) documentation, or some
>> examples of, using NOCROSSREFS in a linker script ?
> 
> There are examples in the linker testsuite, e.g.:
> 
> http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-scripts/cross1.t?rev=1.5&content-type=text/x-cvsweb-markup&cvsroot=src
> 
> Ian

Thanks - that cleared things up and I have it working now.

I am writing a self-FLASH upgrader - so a device that auto updates
itself.

The usual problem of having code that overwrite itself...

So the 'upgrade' code runs in SRAM - new sections in linker for
that, and writes the new code into the FLASH memory.

In adding 'NOCROSSREFS' to block any accidental code/data cross
referencing - then the main code can not call the 'ugrade' code.

To get around this, I have one special section 'bootloader_link',
which is allowed to cross-ref between the main code and the bootloader
code. There is 1 function in there, thats starts up the bootloader
and jumps to it.

Thanks,
John.



More information about the Gcc-help mailing list