This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Overlay problem


Alan...thanks for looking at this.  LMA makes a little more sense now. 
At the level of understanding I'm at, I disagree with your statement
that the code is a *little* confusing :-).  I take it that the reason to
use LDADDR vs. LMA_REGION is if you want to specify an address vs.
letting the linker to automatically put things into a region?  A problem
with the patch is that if a LDADDR is specified, the original error
still occurs since a load region and absolute address are initialized. 
A small change to your patch to add a check if load_base had been
initialized corrected this (sorry this isn't a patch file).

-      if (lma_region != NULL && l->os->lma_region == NULL && l->next ==
NULL)
+      if (lma_region != NULL && l->os->lma_region == NULL && l->next ==
NULL && 	+	  l->os->load_base == NULL)

Alan Modra wrote:
> 
> 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;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]