This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
Specifying LMA's after unallocated sections?
- To: binutils at sourceware dot cygnus dot com
- Subject: Specifying LMA's after unallocated sections?
- From: Jonathan Larmour <jlarmour at redhat dot co dot uk>
- Date: Thu, 06 Apr 2000 23:13:06 +0100
- Organization: Red Hat UK Ltd.
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