Specifying LMA's after unallocated sections?
Jonathan Larmour
jlarmour@redhat.co.uk
Thu Apr 6 15:13:00 GMT 2000
I've encountered a trivial linker script issue where I can't think of a
generalized solution but know there must surely be one:
Imagine you have two sections to be relocated (LMA != VMA) in the linker
script for an ELF target:
.foo 0x1000 : AT 0xf000 { *(.foo) }
.bar 0x2000 : AT (LOADADDR(.foo) + SIZEOF(.foo)) { *(.bar) }
So .bar follows .foo in e.g. a ROM image, but they get relocated to
different places.
But what happens if there are no .foo input sections? Then the section
doesn't get defined and both LOADADDR(.foo) and SIZEOF(.foo) are invalid.
There is a workaround (which is what eCos has been using so far), which is
to force the sections to be output anyway using e.g.
.foo 0x1000 : AT 0xf000 { . = . ; *(.foo) }
but this isn't really the right way to do it, but what is?
Jifl
--
Red Hat, 35 Cambridge Place, Cambridge, UK. CB2 1NS Tel: +44 (1223) 728762
"Plan to be spontaneous tomorrow." || These opinions are all my own fault
More information about the Binutils
mailing list