This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: ld - NOCROSSREFS
- From: John Walsh <john dot walsh at mini-net dot co dot uk>
- To: Ian Lance Taylor <iant at google dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Wed, 18 Jun 2008 11:37:37 +0100
- Subject: Re: ld - NOCROSSREFS
- References: <4857ED5E.6060502@mini-net.co.uk> <m3y75367en.fsf@google.com>
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.