This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Patch to fix problems with memory regions and OVERLAYs
Alan Modra <amodra@bigpond.net.au> writes:
> On Wed, May 01, 2002 at 07:05:45PM +0100, Richard Sandiford wrote:
> > [ld/]
> > * ldlang.h (lang_output_section_statement_type): Add update_dot_tree.
> > (lang_enter_overlay): Remove the last two parameters.
> > (lang_leave_overlay): Take them here instead.
> > * ldgram.y (memspec_at_opt): Set $$ to null if no region is given.
> > (section): Pass LMA and crossref flag to lang_leave_overlay rather
> > than lang_enter_overlay.
> > * ldlang.c (lang_memory_region_lookup): Return null for null names.
> > (lang_output_section_statement_lookup): Initialize update_dot_tree.
> > (lang_size_sections_1): Evaluate it.
> > (lang_leave_output_section_statement): Rework LMA lookup.
> > (overlay_lma, overlay_nocrossrefs): Remove.
> > (lang_enter_overlay): Remove LMA and corssref arguments.
> > (lang_enter_overlay_section): Don't set the LMA here.
> > (lang_leave_overlay): Take LMA and crossref arguments. Move the '.'
> > assignment to the last section's update_dot_tree. Unconditionally
> > use the load and run-time regions specified in the OVERLAY statement.
> > Likewise the first section's LMA. Only set the other sections' LMAs
> > when no load region is given.
> >
> > [ld/testsuite/]
> > * lib/ld-lib.exp (run_dump_test): Add -L$srcdir/$subdir.
> > (is_elf_format): New, extracted from...
> > * ld-scripts/weak.exp: ...here.
> > * ld-scripts/overlay-size.exp: New test.
> > * ld-scripts/overlay-size.[tsd],
> > * ld-scripts/overlay-size-map.d: New files for it.
>
> Looks reasonable to me.
For archive purposes, here's what I checked in. The only change is
to the objdump test, which doesn't check the LMAs of the overlaid
BSS sections. See the thread starting at:
<http://sources.redhat.com/ml/binutils/2002-05/msg00004.html>
for the reasons why.
Richard
[Same ChangeLog]
Index: ldlang.h
===================================================================
RCS file: /cvs/src/src/ld/ldlang.h,v
retrieving revision 1.18
diff -c -d -p -r1.18 ldlang.h
*** ldlang.h 15 Feb 2002 02:11:05 -0000 1.18
--- ldlang.h 7 May 2002 10:57:57 -0000
*************** typedef struct lang_output_section_state
*** 135,140 ****
--- 135,146 ----
union etree_union *load_base;
+ /* If non-null, an expression to evaluate after setting the section's
+ size. The expression is evaluated inside REGION (above) with '.'
+ set to the end of the section. Used in the last overlay section
+ to move '.' past all the overlaid sections. */
+ union etree_union *update_dot_tree;
+
struct lang_output_section_phdr_list *phdrs;
} lang_output_section_statement_type;
*************** extern void lang_new_phdr
*** 456,468 ****
PARAMS ((const char *, etree_type *, boolean, boolean, etree_type *,
etree_type *));
extern void lang_add_nocrossref PARAMS ((struct lang_nocrossref *));
! extern void lang_enter_overlay PARAMS ((etree_type *, etree_type *, int));
extern void lang_enter_overlay_section PARAMS ((const char *));
extern void lang_leave_overlay_section
PARAMS ((fill_type *, struct lang_output_section_phdr_list *));
extern void lang_leave_overlay
! PARAMS ((fill_type *, const char *, struct lang_output_section_phdr_list *,
! const char *));
extern struct bfd_elf_version_tree *lang_elf_version_info;
--- 462,474 ----
PARAMS ((const char *, etree_type *, boolean, boolean, etree_type *,
etree_type *));
extern void lang_add_nocrossref PARAMS ((struct lang_nocrossref *));
! extern void lang_enter_overlay PARAMS ((etree_type *));
extern void lang_enter_overlay_section PARAMS ((const char *));
extern void lang_leave_overlay_section
PARAMS ((fill_type *, struct lang_output_section_phdr_list *));
extern void lang_leave_overlay
! PARAMS ((etree_type *, int, fill_type *, const char *,
! struct lang_output_section_phdr_list *, const char *));
extern struct bfd_elf_version_tree *lang_elf_version_info;
Index: ldgram.y
===================================================================
RCS file: /cvs/src/src/ld/ldgram.y,v
retrieving revision 1.20
diff -c -d -p -r1.20 ldgram.y
*** ldgram.y 17 Apr 2002 13:05:55 -0000 1.20
--- ldgram.y 7 May 2002 10:57:57 -0000
*************** exp :
*** 820,826 ****
memspec_at_opt:
AT '>' NAME { $$ = $3; }
! | { $$ = "*default*"; }
;
opt_at:
--- 820,826 ----
memspec_at_opt:
AT '>' NAME { $$ = $3; }
! | { $$ = 0; }
;
opt_at:
*************** section: NAME { ldlex_expression(); }
*** 851,857 ****
{ ldlex_popstate (); ldlex_script (); }
'{'
{
! lang_enter_overlay ($3, $5, (int) $4);
}
overlay_section
'}'
--- 851,857 ----
{ ldlex_popstate (); ldlex_script (); }
'{'
{
! lang_enter_overlay ($3);
}
overlay_section
'}'
*************** section: NAME { ldlex_expression(); }
*** 859,865 ****
memspec_opt memspec_at_opt phdr_opt fill_opt
{
ldlex_popstate ();
! lang_leave_overlay ($15, $12, $14, $13);
}
opt_comma
| /* The GROUP case is just enough to support the gcc
--- 859,866 ----
memspec_opt memspec_at_opt phdr_opt fill_opt
{
ldlex_popstate ();
! lang_leave_overlay ($5, (int) $4,
! $15, $12, $14, $13);
}
opt_comma
| /* The GROUP case is just enough to support the gcc
Index: ldlang.c
===================================================================
RCS file: /cvs/src/src/ld/ldlang.c,v
retrieving revision 1.82
diff -c -d -p -r1.82 ldlang.c
*** ldlang.c 3 May 2002 13:48:55 -0000 1.82
--- ldlang.c 7 May 2002 10:57:58 -0000
*************** lang_memory_region_lookup (name)
*** 617,622 ****
--- 617,626 ----
{
lang_memory_region_type *p;
+ /* NAME is NULL for LMA memspecs if no region was specified. */
+ if (name == NULL)
+ return NULL;
+
for (p = lang_memory_region_list;
p != (lang_memory_region_type *) NULL;
p = p->next)
*************** lang_output_section_statement_lookup (na
*** 738,743 ****
--- 742,748 ----
lookup->subsection_alignment = -1;
lookup->section_alignment = -1;
lookup->load_base = (union etree_union *) NULL;
+ lookup->update_dot_tree = NULL;
lookup->phdrs = NULL;
lang_statement_append (&lang_output_section_statement,
*************** lang_size_sections_1 (s, output_section_
*** 3009,3017 ****
--- 3014,3027 ----
else
os->bfd_section->_raw_size =
(after - os->bfd_section->vma) * opb;
+
dot = os->bfd_section->vma + os->bfd_section->_raw_size / opb;
os->processed = true;
+ if (os->update_dot_tree != 0)
+ exp_fold_tree (os->update_dot_tree, abs_output_section,
+ lang_allocating_phase_enum, dot, &dot);
+
/* Update dot in the region ?
We only do this if the section is going to be allocated,
since unallocated sections do not contribute to the region's
*************** lang_leave_output_section_statement (fil
*** 4514,4527 ****
{
current_section->fill = fill;
current_section->region = lang_memory_region_lookup (memspec);
! if (strcmp (lma_memspec, "*default*") != 0)
! {
! current_section->lma_region = lang_memory_region_lookup (lma_memspec);
! /* If no runtime region has been given, but the load region has
! been, use the load region. */
! if (strcmp (memspec, "*default*") == 0)
! current_section->region = lang_memory_region_lookup (lma_memspec);
! }
current_section->phdrs = phdrs;
stat_ptr = &statement_list;
}
--- 4524,4536 ----
{
current_section->fill = fill;
current_section->region = lang_memory_region_lookup (memspec);
! current_section->lma_region = lang_memory_region_lookup (lma_memspec);
!
! /* If no runtime region has been given, but the load region has
! been, use the load region. */
! if (current_section->lma_region != 0 && strcmp (memspec, "*default*") == 0)
! current_section->region = current_section->lma_region;
!
current_section->phdrs = phdrs;
stat_ptr = &statement_list;
}
*************** lang_add_nocrossref (l)
*** 4803,4814 ****
/* The overlay virtual address. */
static etree_type *overlay_vma;
- /* The overlay load address. */
- static etree_type *overlay_lma;
-
- /* Whether nocrossrefs is set for this overlay. */
- static int overlay_nocrossrefs;
-
/* An expression for the maximum section size seen so far. */
static etree_type *overlay_max;
--- 4812,4817 ----
*************** static struct overlay_list *overlay_list
*** 4824,4847 ****
/* Start handling an overlay. */
void
! lang_enter_overlay (vma_expr, lma_expr, nocrossrefs)
etree_type *vma_expr;
- etree_type *lma_expr;
- int nocrossrefs;
{
/* The grammar should prevent nested overlays from occurring. */
! ASSERT (overlay_vma == NULL
! && overlay_lma == NULL
! && overlay_list == NULL
! && overlay_max == NULL);
overlay_vma = vma_expr;
- overlay_lma = lma_expr;
- overlay_nocrossrefs = nocrossrefs;
}
/* Start a section in an overlay. We handle this by calling
! lang_enter_output_section_statement with the correct VMA and LMA. */
void
lang_enter_overlay_section (name)
--- 4827,4844 ----
/* Start handling an overlay. */
void
! lang_enter_overlay (vma_expr)
etree_type *vma_expr;
{
/* The grammar should prevent nested overlays from occurring. */
! ASSERT (overlay_vma == NULL && overlay_max == NULL);
overlay_vma = vma_expr;
}
/* Start a section in an overlay. We handle this by calling
! lang_enter_output_section_statement with the correct VMA.
! lang_leave_overlay sets up the LMA and memory regions. */
void
lang_enter_overlay_section (name)
*************** lang_enter_overlay_section (name)
*** 4851,4866 ****
etree_type *size;
lang_enter_output_section_statement (name, overlay_vma, normal_section,
! 0, 0, 0, overlay_lma);
! /* If this is the first section, then base the VMA and LMA of future
sections on this one. This will work correctly even if `.' is
used in the addresses. */
if (overlay_list == NULL)
! {
! overlay_vma = exp_nameop (ADDR, name);
! overlay_lma = exp_nameop (LOADADDR, name);
! }
/* Remember the section. */
n = (struct overlay_list *) xmalloc (sizeof *n);
--- 4848,4860 ----
etree_type *size;
lang_enter_output_section_statement (name, overlay_vma, normal_section,
! 0, 0, 0, 0);
! /* If this is the first section, then base the VMA of future
sections on this one. This will work correctly even if `.' is
used in the addresses. */
if (overlay_list == NULL)
! overlay_vma = exp_nameop (ADDR, name);
/* Remember the section. */
n = (struct overlay_list *) xmalloc (sizeof *n);
*************** lang_enter_overlay_section (name)
*** 4870,4878 ****
size = exp_nameop (SIZEOF, name);
- /* Adjust the LMA for the next section. */
- overlay_lma = exp_binop ('+', overlay_lma, size);
-
/* Arrange to work out the maximum section end address. */
if (overlay_max == NULL)
overlay_max = size;
--- 4864,4869 ----
*************** lang_leave_overlay_section (fill, phdrs)
*** 4895,4902 ****
name = current_section->name;
! lang_leave_output_section_statement (fill, "*default*",
! phdrs, "*default*");
/* Define the magic symbols. */
--- 4886,4895 ----
name = current_section->name;
! /* For now, assume that "*default*" is the run-time memory region and
! that no load-time region has been specified. It doesn't really
! matter what we say here, since lang_leave_overlay will override it. */
! lang_leave_output_section_statement (fill, "*default*", phdrs, 0);
/* Define the magic symbols. */
*************** lang_leave_overlay_section (fill, phdrs)
*** 4926,4957 ****
looks through all the sections in the overlay and sets them. */
void
! lang_leave_overlay (fill, memspec, phdrs, lma_memspec)
fill_type *fill;
const char *memspec;
struct lang_output_section_phdr_list *phdrs;
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
! region = lang_memory_region_lookup (memspec);
!
! if (lma_memspec == NULL)
! lma_region = NULL;
! else
! lma_region = lang_memory_region_lookup (lma_memspec);
nocrossref = NULL;
l = overlay_list;
while (l != NULL)
{
--- 4919,4948 ----
looks through all the sections in the overlay and sets them. */
void
! lang_leave_overlay (lma_expr, nocrossrefs, fill, memspec, phdrs, lma_memspec)
! etree_type *lma_expr;
! int nocrossrefs;
fill_type *fill;
const char *memspec;
struct lang_output_section_phdr_list *phdrs;
const char *lma_memspec;
{
lang_memory_region_type *region;
lang_memory_region_type *lma_region;
struct overlay_list *l;
struct lang_nocrossref *nocrossref;
! region = lang_memory_region_lookup (memspec);
! lma_region = lang_memory_region_lookup (lma_memspec);
nocrossref = NULL;
+ /* After setting the size of the last section, set '.' to end of the
+ overlay region. */
+ if (overlay_list != NULL)
+ overlay_list->os->update_dot_tree
+ = exp_assop ('=', ".", exp_binop ('+', overlay_vma, overlay_max));
+
l = overlay_list;
while (l != NULL)
{
*************** lang_leave_overlay (fill, memspec, phdrs
*** 4960,4987 ****
if (fill != (fill_type *) 0 && l->os->fill == (fill_type *) 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
! load_base is specified. FIXME: There should really be a test
! that `AT ( LDADDR )' doesn't conflict with `AT >LMA_REGION'
! rather than letting LDADDR simply override LMA_REGION. */
! 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;
! if (overlay_nocrossrefs)
{
struct lang_nocrossref *nc;
--- 4951,4974 ----
if (fill != (fill_type *) 0 && l->os->fill == (fill_type *) 0)
l->os->fill = fill;
! l->os->region = region;
! l->os->lma_region = lma_region;
! /* The first section has the load address specified in the
! OVERLAY statement. The rest are worked out from that.
! The base address is not needed (and should be null) if
! an LMA region was specified. */
! if (l->next == 0)
! l->os->load_base = lma_expr;
! else if (lma_region == 0)
! l->os->load_base = exp_binop ('+',
! exp_nameop (LOADADDR, l->next->os->name),
! exp_nameop (SIZEOF, l->next->os->name));
if (phdrs != NULL && l->os->phdrs == NULL)
l->os->phdrs = phdrs;
! if (nocrossrefs)
{
struct lang_nocrossref *nc;
*************** lang_leave_overlay (fill, memspec, phdrs
*** 4999,5011 ****
if (nocrossref != NULL)
lang_add_nocrossref (nocrossref);
- /* Update . for the end of the overlay. */
- lang_add_assignment (exp_assop ('=', ".",
- exp_binop ('+', overlay_vma, overlay_max)));
-
overlay_vma = NULL;
- overlay_lma = NULL;
- overlay_nocrossrefs = 0;
overlay_list = NULL;
overlay_max = NULL;
}
--- 4986,4992 ----
Index: testsuite/lib/ld-lib.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/lib/ld-lib.exp,v
retrieving revision 1.13
diff -c -d -p -r1.13 ld-lib.exp
*** testsuite/lib/ld-lib.exp 31 Jan 2002 03:57:52 -0000 1.13
--- testsuite/lib/ld-lib.exp 7 May 2002 11:01:49 -0000
*************** proc default_ld_nm { nm nmflags object }
*** 323,328 ****
--- 323,351 ----
}
#
+ # is_elf_format
+ # true if the object format is known to be ELF
+ #
+ proc is_elf_format {} {
+ if { ![istarget *-*-sysv4*] \
+ && ![istarget *-*-unixware*] \
+ && ![istarget *-*-elf*] \
+ && ![istarget *-*-eabi*] \
+ && ![istarget *-*-linux*] \
+ && ![istarget *-*-irix5*] \
+ && ![istarget *-*-irix6*] \
+ && ![istarget *-*-solaris2*] } {
+ return 0
+ }
+
+ if { [istarget *-*-linux*aout*] \
+ || [istarget *-*-linux*oldld*] } {
+ return 0
+ }
+ return 1
+ }
+
+ #
# simple_diff
# compares two files line-by-line
# returns differences if exist
*************** proc run_dump_test { name } {
*** 685,691 ****
# Perhaps link the file(s).
if { $run_ld } {
set objfile "tmpdir/dump"
! set cmd "$LD $LDFLAGS $opts(ld) -o $objfile $objfiles"
send_log "$cmd\n"
set cmdret [catch "exec $cmd" comp_output]
--- 708,718 ----
# Perhaps link the file(s).
if { $run_ld } {
set objfile "tmpdir/dump"
!
! # Add -L$srcdir/$subdir so that the linker command can use
! # linker scripts in the source directory.
! set cmd "$LD $LDFLAGS -L$srcdir/$subdir \
! $opts(ld) -o $objfile $objfiles"
send_log "$cmd\n"
set cmdret [catch "exec $cmd" comp_output]
Index: testsuite/ld-scripts/weak.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-scripts/weak.exp,v
retrieving revision 1.5
diff -c -d -p -r1.5 weak.exp
*** testsuite/ld-scripts/weak.exp 13 Mar 2001 06:14:28 -0000 1.5
--- testsuite/ld-scripts/weak.exp 7 May 2002 11:01:49 -0000
*************** set testname "weak symbols"
*** 21,42 ****
# This test only works for ELF targets. It ought to work for some
# a.out targets, but it doesn't.
!
! if { ![istarget *-*-sysv4*] \
! && ![istarget *-*-unixware*] \
! && ![istarget *-*-elf*] \
! && ![istarget *-*-eabi*] \
! && ![istarget *-*-linux*] \
! && ![istarget *-*-irix5*] \
! && ![istarget *-*-irix6*] \
! && ![istarget *-*-solaris2*] } then {
return
}
- if { [istarget *-*-linux*aout*] \
- || [istarget *-*-linux*oldld*] } {
- return
- }
if {! [ld_assemble $as $srcdir/$subdir/weak1.s tmpdir/weak1.o]
|| ! [ld_assemble $as $srcdir/$subdir/weak2.s tmpdir/weak2.o]} then {
--- 21,30 ----
# This test only works for ELF targets. It ought to work for some
# a.out targets, but it doesn't.
! if ![is_elf_format] {
return
}
if {! [ld_assemble $as $srcdir/$subdir/weak1.s tmpdir/weak1.o]
|| ! [ld_assemble $as $srcdir/$subdir/weak2.s tmpdir/weak2.o]} then {
*** /dev/null Tue Nov 14 21:44:43 2000
--- testsuite/ld-scripts/overlay-size.d Tue May 7 12:01:42 2002
***************
*** 0 ****
--- 1,29 ----
+ # ld: -T overlay-size.t -Map tmpdir/overlay-size.map
+ # name: overlay size
+ # objdump: --headers
+ #
+ # The .bss[123] LMAs are deliberately blanked out. We can't
+ # reliably map overlaid sections to segments.
+ #...
+ 0 \.bss1 +0+010 +0+20000 .*
+ #...
+ 1 \.bss2 +0+030 +0+20000 .*
+ #...
+ 2 \.bss3 +0+020 +0+20000 .*
+ #...
+ 3 \.mtext +0+020 +0+10000 +0+30000 .*
+ #...
+ 4 \.mbss +0+230 +0+20030 +0+20060 .*
+ #...
+ 5 \.text1 +0+080 +0+10020 +0+30020 .*
+ #...
+ 6 \.text2 +0+040 +0+10020 +0+300a0 .*
+ #...
+ 7 \.text3 +0+020 +0+10020 +0+300e0 .*
+ #...
+ 8 \.data1 +0+030 +0+20260 +0+30100 .*
+ #...
+ 9 \.data2 +0+040 +0+20260 +0+30130 .*
+ #...
+ 10 \.data3 +0+050 +0+20260 +0+30170 .*
+ #pass
*** /dev/null Tue Nov 14 21:44:43 2000
--- testsuite/ld-scripts/overlay-size.exp Wed May 1 19:00:37 2002
***************
*** 0 ****
--- 1,31 ----
+ # Test the OVERLAY statement.
+ # Copyright 2002 Free Software Foundation, Inc.
+ #
+ # This file is free software; you can redistribute it and/or modify
+ # it under the terms of the GNU General Public License as published by
+ # the Free Software Foundation; either version 2 of the License, or
+ # (at your option) any later version.
+ #
+ # This program is distributed in the hope that it will be useful,
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ # GNU General Public License for more details.
+ #
+ # You should have received a copy of the GNU General Public License
+ # along with this program; if not, write to the Free Software
+ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ if ![is_elf_format] {
+ return
+ }
+
+ run_dump_test overlay-size
+
+ set testname "overlay size (map check)"
+
+ if [regexp_diff "tmpdir/overlay-size.map" \
+ "$srcdir/$subdir/overlay-size-map.d"] {
+ fail $testname
+ } else {
+ pass $testname
+ }
*** /dev/null Tue Nov 14 21:44:43 2000
--- testsuite/ld-scripts/overlay-size-map.d Wed May 1 18:36:59 2002
***************
*** 0 ****
--- 1,23 ----
+ #...
+ \.bss1 *0x0*20000 *0x10
+ #...
+ \.bss2 *0x0*20000 *0x30 load address 0x0*20010
+ #...
+ \.bss3 *0x0*20000 *0x20 load address 0x0*20040
+ #...
+ \.mtext *0x0*10000 *0x20 load address 0x0*30000
+ #...
+ \.mbss *0x0*20030 *0x230 load address 0x0*20060
+ #...
+ \.text1 *0x0*10020 *0x80 load address 0x0*30020
+ #...
+ \.text2 *0x0*10020 *0x40 load address 0x0*300a0
+ #...
+ \.text3 *0x0*10020 *0x20 load address 0x0*300e0
+ #...
+ \.data1 *0x0*20260 *0x30 load address 0x0*30100
+ #...
+ \.data2 *0x0*20260 *0x40 load address 0x0*30130
+ #...
+ \.data3 *0x0*20260 *0x50 load address 0x0*30170
+ #pass
*** /dev/null Tue Nov 14 21:44:43 2000
--- testsuite/ld-scripts/overlay-size.s Wed May 1 18:10:48 2002
***************
*** 0 ****
--- 1,25 ----
+ .section .bss1, "aw", "nobits"
+ .space 0x10
+ .section .bss2, "aw", "nobits"
+ .space 0x30
+ .section .bss3, "aw", "nobits"
+ .space 0x20
+
+ .section .text1, "ax", "progbits"
+ .space 0x80
+ .section .text2, "ax", "progbits"
+ .space 0x40
+ .section .text3, "ax", "progbits"
+ .space 0x20
+
+ .section .data1, "aw", "progbits"
+ .space 0x30
+ .section .data2, "aw", "progbits"
+ .space 0x40
+ .section .data3, "aw", "progbits"
+ .space 0x50
+
+ .section .mtext, "ax", "progbits"
+ .space 0x20
+ .section .mbss, "aw", "nobits"
+ .space 0x30
*** /dev/null Tue Nov 14 21:44:43 2000
--- testsuite/ld-scripts/overlay-size.t Wed May 1 18:11:07 2002
***************
*** 0 ****
--- 1,57 ----
+ MEMORY
+ {
+ TEXTMEM (ARX) : ORIGIN = 0x10000, LENGTH = 32K
+ DATAMEM (AW) : ORIGIN = 0x20000, LENGTH = 32K
+ LOADMEM (AW) : ORIGIN = 0x30000, LENGTH = 32K
+ }
+
+ /* Map should be:
+
+ SIZE VMA LMA
+ .bss1 10 20000 20000
+ .bss2 30 20000 20010
+ .bss3 20 20000 20040
+ .mbss 230 20030 20060
+
+ .mtext 20 10000 30000
+ .text1 80 10020 30020
+ .text2 40 10020 300a0
+ .text3 20 10020 300e0
+
+ .data1 30 20260 30100
+ .data2 40 20260 30130
+ .data3 50 20260 30170 */
+
+ SECTIONS
+ {
+ OVERLAY :
+ {
+ .bss1 { *(.bss1) }
+ .bss2 { *(.bss2) }
+ .bss3 { *(.bss3) }
+ } > DATAMEM
+
+ .mtext : { *(.mtext) } > TEXTMEM AT > LOADMEM
+
+ .mbss : AT (__load_stop_bss3)
+ {
+ *(.mbss)
+ . += 0x200;
+ } > DATAMEM
+
+ OVERLAY :
+ {
+ .text1 { *(.text1) }
+ .text2 { *(.text2) }
+ .text3 { *(.text3) }
+ } > TEXTMEM AT > LOADMEM
+
+ OVERLAY :
+ {
+ .data1 { *(.data1) }
+ .data2 { *(.data2) }
+ .data3 { *(.data3) }
+ } > DATAMEM AT > LOADMEM
+
+ . = 0x8000;
+ }