[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Patch] Region assignment to overlay sections
From: |
Nick Clifton |
Subject: |
[Patch] Region assignment to overlay sections |
Date: |
19 Jul 2001 17:18:12 +0100 |
Hi Guys,
I am applying the patch below (to the mainline and the branch) to fix
a bug in the linker's assignment of memory regions to sections inside
an overlay. At the moment if the overlay is assigned to a region but
its sections are not, they will be assigned to the default region.
This negates the use of the overlay region assignment entirely. For
example with a script like this:
MEMORY
{
CPURAM (A) : ORIGIN = 0x03000000, LENGTH = 32K - 1K
}
SECTIONS
{
OVERLAY :
{
.bss0 { obj1.o(.bss) }
.bss1 { obj2.o(.bss) }
.bss2 { obj3.o(.bss) }
} > CPURAM
.bss :
{
*(.bss)
} > CPURAM
}
The .bbs0 .bss1 and .bss2 sections will be assigned to the default
memory region instead of the CPURAM memory region. The patch below
fixes this.
Cheers
Nick
2001-07-19 Nick Clifton <address@hidden>
* ldlang.c (lang_leave_overlay): If a region is specified assign
it to all sections inside the overlay unless they have been
assigned to the own, non-default, memory region.
Index: ld/ldlang.c
===================================================================
RCS file: /cvs/src/src/ld/ldlang.c,v
retrieving revision 1.54
diff -p -r1.54 ldlang.c
*** ldlang.c 2001/06/19 19:57:39 1.54
--- ldlang.c 2001/07/19 16:11:35
*************** lang_leave_overlay (fill, memspec, phdrs
*** 4818,4827 ****
--- 4818,4830 ----
const char *lma_memspec;
{
lang_memory_region_type *region;
+ lang_memory_region_type * default_region;
lang_memory_region_type *lma_region;
struct overlay_list *l;
struct lang_nocrossref *nocrossref;
+ default_region = lang_memory_region_lookup ("*default*");
+
if (memspec == NULL)
region = NULL;
else
*************** lang_leave_overlay (fill, memspec, phdrs
*** 4841,4848 ****
if (fill != 0 && l->os->fill == 0)
l->os->fill = fill;
! if (region != NULL && l->os->region == NULL)
l->os->region = region;
/* We only set lma_region for the first overlay section, as
subsequent overlay sections will have load_base set relative
to the first section. Also, don't set lma_region if
--- 4844,4858 ----
if (fill != 0 && l->os->fill == 0)
l->os->fill = fill;
!
! /* Assign a region to the sections, if one has been specified.
! Override the assignment of the default section, but not
! other sections. */
! if (region != NULL &&
! (l->os->region == NULL ||
! l->os->region == default_region))
l->os->region = region;
+
/* We only set lma_region for the first overlay section, as
subsequent overlay sections will have load_base set relative
to the first section. Also, don't set lma_region if
*************** lang_leave_overlay (fill, memspec, phdrs
*** 4852,4857 ****
--- 4862,4868 ----
if (lma_region != NULL && l->os->lma_region == NULL
&& l->next == NULL && l->os->load_base == NULL)
l->os->lma_region = lma_region;
+
if (phdrs != NULL && l->os->phdrs == NULL)
l->os->phdrs = phdrs;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Patch] Region assignment to overlay sections,
Nick Clifton <=