aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2007-03-24 06:49:03 +0000
committerAlan Modra <amodra@gmail.com>2007-03-24 06:49:03 +0000
commit34711ca3dd782370e5eeab35b78b2500cf4122f0 (patch)
tree72bf23c8eb30753534d6322fa17164201f01645d
parent4146fd53c038b90fd48e64999ffbb7f98175b758 (diff)
downloadgdb-34711ca3dd782370e5eeab35b78b2500cf4122f0.zip
gdb-34711ca3dd782370e5eeab35b78b2500cf4122f0.tar.gz
gdb-34711ca3dd782370e5eeab35b78b2500cf4122f0.tar.bz2
ld/
* ldlang.c (lang_insert_orphan): Provide start/stop loadaddr syms rather than defining unconditionally. (lang_leave_overlay_section): Likewise. * ld.texinfo (Overlay Description): Update description and examples for start/stop syms. ld/testsuite/ * ld-elf/overlay.d: -u symbols we want to see in the output.
-rw-r--r--ld/ChangeLog8
-rw-r--r--ld/ld.texinfo12
-rw-r--r--ld/ldlang.c24
-rw-r--r--ld/testsuite/ChangeLog4
-rw-r--r--ld/testsuite/ld-elf/overlay.d2
5 files changed, 33 insertions, 17 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 1912285..2b9a4d7 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,11 @@
+2007-03-24 Alan Modra <amodra@bigpond.net.au>
+
+ * ldlang.c (lang_insert_orphan): Provide start/stop loadaddr syms
+ rather than defining unconditionally.
+ (lang_leave_overlay_section): Likewise.
+ * ld.texinfo (Overlay Description): Update description and examples
+ for start/stop syms.
+
2007-03-22 Joseph Myers <joseph@codesourcery.com>
* ld.texinfo: Include VERSION_PACKAGE when reporting version.
diff --git a/ld/ld.texinfo b/ld/ld.texinfo
index 9fd9c44..770b305 100644
--- a/ld/ld.texinfo
+++ b/ld/ld.texinfo
@@ -4030,7 +4030,7 @@ section to refer directly to another. @xref{Miscellaneous Commands,
NOCROSSREFS}.
For each section within the @code{OVERLAY}, the linker automatically
-defines two symbols. The symbol @code{__load_start_@var{secname}} is
+provides two symbols. The symbol @code{__load_start_@var{secname}} is
defined as the starting load address of the section. The symbol
@code{__load_stop_@var{secname}} is defined as the final load address of
the section. Any characters within @var{secname} which are not legal
@@ -4055,7 +4055,7 @@ Here is an example. Remember that this would appear inside a
This will define both @samp{.text0} and @samp{.text1} to start at
address 0x1000. @samp{.text0} will be loaded at address 0x4000, and
@samp{.text1} will be loaded immediately after @samp{.text0}. The
-following symbols will be defined: @code{__load_start_text0},
+following symbols will be defined if referenced: @code{__load_start_text0},
@code{__load_stop_text0}, @code{__load_start_text1},
@code{__load_stop_text1}.
@@ -4077,11 +4077,11 @@ example could have been written identically as follows.
@smallexample
@group
.text0 0x1000 : AT (0x4000) @{ o1/*.o(.text) @}
- __load_start_text0 = LOADADDR (.text0);
- __load_stop_text0 = LOADADDR (.text0) + SIZEOF (.text0);
+ PROVIDE (__load_start_text0 = LOADADDR (.text0));
+ PROVIDE (__load_stop_text0 = LOADADDR (.text0) + SIZEOF (.text0));
.text1 0x1000 : AT (0x4000 + SIZEOF (.text0)) @{ o2/*.o(.text) @}
- __load_start_text1 = LOADADDR (.text1);
- __load_stop_text1 = LOADADDR (.text1) + SIZEOF (.text1);
+ PROVIDE (__load_start_text1 = LOADADDR (.text1));
+ PROVIDE (__load_stop_text1 = LOADADDR (.text1) + SIZEOF (.text1));
. = 0x1000 + MAX (SIZEOF (.text0), SIZEOF (.text1));
@end group
@end smallexample
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 6a25ea3..b223b58 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -1490,8 +1490,9 @@ lang_insert_orphan (asection *s,
e_align = exp_unop (ALIGN_K,
exp_intop ((bfd_vma) 1 << s->alignment_power));
lang_add_assignment (exp_assop ('=', ".", e_align));
- lang_add_assignment (exp_assop ('=', symname,
- exp_nameop (NAME, ".")));
+ lang_add_assignment (exp_provide (symname,
+ exp_nameop (NAME, "."),
+ FALSE));
}
}
@@ -1521,8 +1522,9 @@ lang_insert_orphan (asection *s,
symname = (char *) xmalloc (ps - secname + sizeof "__stop_" + 1);
symname[0] = bfd_get_symbol_leading_char (output_bfd);
sprintf (symname + (symname[0] != 0), "__stop_%s", secname);
- lang_add_assignment (exp_assop ('=', symname,
- exp_nameop (NAME, ".")));
+ lang_add_assignment (exp_provide (symname,
+ exp_nameop (NAME, "."),
+ FALSE));
}
/* Restore the global list pointer. */
@@ -6436,15 +6438,17 @@ lang_leave_overlay_section (fill_type *fill,
buf = xmalloc (strlen (clean) + sizeof "__load_start_");
sprintf (buf, "__load_start_%s", clean);
- lang_add_assignment (exp_assop ('=', buf,
- exp_nameop (LOADADDR, name)));
+ lang_add_assignment (exp_provide (buf,
+ exp_nameop (LOADADDR, name),
+ FALSE));
buf = xmalloc (strlen (clean) + sizeof "__load_stop_");
sprintf (buf, "__load_stop_%s", clean);
- lang_add_assignment (exp_assop ('=', buf,
- exp_binop ('+',
- exp_nameop (LOADADDR, name),
- exp_nameop (SIZEOF, name))));
+ lang_add_assignment (exp_provide (buf,
+ exp_binop ('+',
+ exp_nameop (LOADADDR, name),
+ exp_nameop (SIZEOF, name)),
+ FALSE));
free (clean);
}
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index fc929c6..dfcd3ea 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2007-03-24 Alan Modra <amodra@bigpond.net.au>
+
+ * ld-elf/overlay.d: -u symbols we want to see in the output.
+
2007-03-23 Alan Modra <amodra@bigpond.net.au>
* ld-spu/ovl.s (f4_a2): Tail call.
diff --git a/ld/testsuite/ld-elf/overlay.d b/ld/testsuite/ld-elf/overlay.d
index b491ca4..00d25d5 100644
--- a/ld/testsuite/ld-elf/overlay.d
+++ b/ld/testsuite/ld-elf/overlay.d
@@ -1,4 +1,4 @@
-# ld: -T overlay.t
+# ld: -T overlay.t -u __load_start_text1 -u __load_start_text2 -u __load_stop_text1 -u __load_stop_text2
#readelf: -s
#...