This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Overlay problem
- To: Jim Driftmyer <jdrift at stny dot rr dot com>
- Subject: Re: Overlay problem
- From: Alan Modra <alan at linuxcare dot com dot au>
- Date: Tue, 23 Jan 2001 22:45:04 +1100 (EST)
- cc: binutils at sourceware dot cygnus dot com
On Thu, 18 Jan 2001, Jim Driftmyer wrote:
> I'm having a problem with overlays. Using the m68k-coff target, when
> using an overlay, I get an error message of "use an absolute load
> address or a load memory region, not both".
This patch fixes the problem, and I believe it's quite a reasonable thing
to do as opposed to just being a fudge.
The syntax for an overlay (skipping details for overlay_section) is:
OVERLAY [START] : [NOCROSSREFS] [AT ( LDADDR )]
{
overlay_section
...
} [>REGION] [AT >LMA_REGION] [:PHDR...] [=FILL]
with code for the undocumented `AT >LMA_REGION' causing a problem. We
were trying to set all overlay section LMAs from the default since no
explicit LMA can be specified in `overlay_section'. Normally that
wouldn't be a big deal as the default region, "*default*" doesn't do much.
However, if someone were to actually specify `AT >LMA_REGION', you would
end up trying to set all LMAs for overlay sections to the same address,
which is probably not so useful. (At least, I think so. Some of this
code is a wee bit confusing.)
ld/ChangeLog
* ldlang.c (lang_leave_overlay): Only set lma_region from the
default for the first section of a group of overlay sections.
Alan Modra
--
Linuxcare. Support for the Revolution.
Index: ld/ldlang.c
===================================================================
RCS file: /cvs/src/src/ld/ldlang.c,v
retrieving revision 1.38
diff -u -p -r1.38 ldlang.c
--- ldlang.c 2001/01/16 21:04:29 1.38
+++ ldlang.c 2001/01/23 10:44:08
@@ -4780,7 +4780,10 @@ lang_leave_overlay (fill, memspec, phdrs
l->os->fill = fill;
if (region != NULL && l->os->region == NULL)
l->os->region = region;
- if (lma_region != NULL && l->os->lma_region == NULL)
+ /* We only set lma_region for the first overlay section, as
+ subsequent overlay sections will have load_base set relative
+ to the first section. */
+ if (lma_region != NULL && l->os->lma_region == NULL && l->next == NULL)
l->os->lma_region = lma_region;
if (phdrs != NULL && l->os->phdrs == NULL)
l->os->phdrs = phdrs;