aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorZack Weinberg <zackw@panix.com>2005-02-17 20:57:01 +0000
committerZack Weinberg <zackw@panix.com>2005-02-17 20:57:01 +0000
commitfbbb9ac52fc2cca745356239a4a1e7cd11539c11 (patch)
treeaed50b6745b6a6128c9330639bccba8ef9fef294 /ld
parentf397e30345ade7e6fcdf186693715ca227508511 (diff)
downloadfsf-binutils-gdb-fbbb9ac52fc2cca745356239a4a1e7cd11539c11.zip
fsf-binutils-gdb-fbbb9ac52fc2cca745356239a4a1e7cd11539c11.tar.gz
fsf-binutils-gdb-fbbb9ac52fc2cca745356239a4a1e7cd11539c11.tar.bz2
* ldexp.c (assigning_to_dot): New global flag.
(fold_name): If assigning_to_dot is true, object immediately to an undefined symbol. (exp_fold_tree): Set and clear assigning_to_dot around the recursive call to exp_fold_tree to process the right-hand side of an assignment to the location counter. testsuite: * ld-scripts/align.exp: Rename existing "ALIGN" test to "align1". Add dump tests "align2a", "align2b", "align2c". * ld-scripts/align2.t, ld-scripts/align2a.s, ld-scripts/align2a.d * ld-scripts/align2b.s, ld-scripts/align2b.d * ld-scripts/align2c.s, ld-scripts/align2c.d: New files.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog13
-rw-r--r--ld/ldexp.c13
-rw-r--r--ld/testsuite/ChangeLog12
-rw-r--r--ld/testsuite/ld-scripts/align.exp6
-rw-r--r--ld/testsuite/ld-scripts/align2.t6
-rw-r--r--ld/testsuite/ld-scripts/align2a.d13
-rw-r--r--ld/testsuite/ld-scripts/align2a.s4
-rw-r--r--ld/testsuite/ld-scripts/align2b.d13
-rw-r--r--ld/testsuite/ld-scripts/align2b.s4
-rw-r--r--ld/testsuite/ld-scripts/align2c.d2
-rw-r--r--ld/testsuite/ld-scripts/align2c.s4
11 files changed, 82 insertions, 8 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 10f2c95..8214cfc 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,12 @@
+2005-02-17 Zack Weinberg <zack@codesourcery.com>
+
+ * ldexp.c (assigning_to_dot): New global flag.
+ (fold_name): If assigning_to_dot is true, object immediately to
+ an undefined symbol.
+ (exp_fold_tree): Set and clear assigning_to_dot around the
+ recursive call to exp_fold_tree to process the right-hand side
+ of an assignment to the location counter.
+
2005-02-17 Paul Brook <paul@codesourcery.com>
* scripttempl/armbpabi.sc: Add dummy name to version block.
@@ -14,7 +23,7 @@
not defined.
(gld${EMULATION_NAME}_parse_ld_so_conf_include): Do not use glob
if HAVE_GLOB is not defined.
-
+
2005-02-16 Kaz Kojima <kkojima@rr.iij4u.or.jp>
* emultempl/elf32.em (gld${EMULATION_NAME}_after_open): Define
@@ -32,7 +41,7 @@
* ldlex.l (YY_NO_UNPUT): Define so that the yy_unput function is
not declared. It is not used and its presence causes a compile
time warning.
-
+
2005-02-11 Zack Weinberg <zack@codesourcery.com>
* emultempl/elf32.em (gld${EMULATION_NAME}_stat_needed):
diff --git a/ld/ldexp.c b/ld/ldexp.c
index 3335e37..5ac1162 100644
--- a/ld/ldexp.c
+++ b/ld/ldexp.c
@@ -50,6 +50,9 @@ struct exp_data_seg exp_data_seg;
segment_type *segments;
+/* Principally used for diagnostics. */
+static bfd_boolean assigning_to_dot = FALSE;
+
/* Print the string representation of the given token. Surround it
with spaces if INFIX_P is TRUE. */
@@ -596,7 +599,8 @@ fold_name (etree_type *tree,
}
}
}
- else if (allocation_done == lang_final_phase_enum)
+ else if (allocation_done == lang_final_phase_enum
+ || assigning_to_dot)
einfo (_("%F%S: undefined symbol `%s' referenced in expression\n"),
tree->name.name);
else if (h->type == bfd_link_hash_new)
@@ -755,10 +759,13 @@ exp_fold_tree (etree_type *tree,
|| (allocation_done == lang_final_phase_enum
&& current_section == abs_output_section))
{
+ /* Notify the folder that this is an assignment to dot. */
+ assigning_to_dot = TRUE;
result = exp_fold_tree (tree->assign.src,
current_section,
- allocation_done, dot,
- dotp);
+ allocation_done, dot, dotp);
+ assigning_to_dot = FALSE;
+
if (! result.valid_p)
einfo (_("%F%S invalid assignment to location counter\n"));
else
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 376e44d..a827a37 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2005-02-17 Zack Weinberg <zack@codesourcery.com>
+
+ * ld-scripts/align.exp: Rename existing "ALIGN" test to "align1".
+ Add dump tests "align2a", "align2b", "align2c".
+ * ld-scripts/align2.t, ld-scripts/align2a.s, ld-scripts/align2a.d
+ * ld-scripts/align2b.s, ld-scripts/align2b.d
+ * ld-scripts/align2c.s, ld-scripts/align2c.d: New files.
+
2005-02-17 Alexandre Oliva <aoliva@redhat.com>
* ld-frv/fdpic-static-6.d: Update.
@@ -5,7 +13,7 @@
spelling of errors and warnings.
2005-02-15 Nigel Stephens <nigel@mips.com>
- Maciej W. Rozycki <macro@mips.com>
+ Maciej W. Rozycki <macro@mips.com>
* ld-mips-elf/mips16-hilo.d: New test for the R_MIPS16_HI16 and
R_MIPS16_LO16 relocs.
@@ -216,7 +224,7 @@
2004-12-21 Tomer Levi <Tomer.Levi@nsc.com>
- * ld-crx/reloc-abs32.d: Update reference file according
+ * ld-crx/reloc-abs32.d: Update reference file according
to disassembler printing method.
* ld-crx/reloc-rel16.d: Likewise.
* ld-crx/reloc-rel24.d: Likewise.
diff --git a/ld/testsuite/ld-scripts/align.exp b/ld/testsuite/ld-scripts/align.exp
index f7664ca..dbaaaf3 100644
--- a/ld/testsuite/ld-scripts/align.exp
+++ b/ld/testsuite/ld-scripts/align.exp
@@ -22,7 +22,7 @@ if [istarget "rs6000-*-aix*"] {
return
}
-set testname "ALIGN"
+set testname "align1"
if ![ld_assemble $as $srcdir/$subdir/align.s tmpdir/align.o] {
unresolved $testname
@@ -34,3 +34,7 @@ if ![ld_simple_link $ld tmpdir/align "-T $srcdir/$subdir/align.t tmpdir/align.o"
} else {
pass $testname
}
+
+run_dump_test align2a
+run_dump_test align2b
+run_dump_test align2c
diff --git a/ld/testsuite/ld-scripts/align2.t b/ld/testsuite/ld-scripts/align2.t
new file mode 100644
index 0000000..73818a8
--- /dev/null
+++ b/ld/testsuite/ld-scripts/align2.t
@@ -0,0 +1,6 @@
+SECTIONS
+{
+ .text : {*(.text)}
+ . = ALIGN(data_align);
+ .data : {*(.data)}
+}
diff --git a/ld/testsuite/ld-scripts/align2a.d b/ld/testsuite/ld-scripts/align2a.d
new file mode 100644
index 0000000..2c5df45
--- /dev/null
+++ b/ld/testsuite/ld-scripts/align2a.d
@@ -0,0 +1,13 @@
+# ld: --defsym data_align=16 -T align2.t
+# objdump: --section-headers
+
+[^:]+: +file format.*
+
+Sections:
+Idx +Name +Size +VMA +LMA +File +off +Algn
+ +0 +\.text +00000004 +00000000 +00000000 +00001000 +2\*\*2
+ +CONTENTS, +ALLOC, +LOAD, +READONLY, +CODE
+ +1 +\.data +00000004 +00000010 +00000010 +00001010 +2\*\*2
+ +CONTENTS, +ALLOC, +LOAD, +DATA
+ +2 +\.bss +00000000 +00000014 +00000014 +00001014 +2\*\*2
+ +ALLOC
diff --git a/ld/testsuite/ld-scripts/align2a.s b/ld/testsuite/ld-scripts/align2a.s
new file mode 100644
index 0000000..4e56d4a
--- /dev/null
+++ b/ld/testsuite/ld-scripts/align2a.s
@@ -0,0 +1,4 @@
+ .text
+ .long 0
+ .data
+ .long 0x12345678
diff --git a/ld/testsuite/ld-scripts/align2b.d b/ld/testsuite/ld-scripts/align2b.d
new file mode 100644
index 0000000..c74d3ab
--- /dev/null
+++ b/ld/testsuite/ld-scripts/align2b.d
@@ -0,0 +1,13 @@
+# ld: --defsym data_align=32 -T align2.t
+# objdump: --section-headers
+
+[^:]+: +file +format.*
+
+Sections:
+Idx +Name +Size +VMA +LMA +File off +Algn
+ +0 +\.text +00000004 +00000000 +00000000 +00001000 +2\*\*2
+ +CONTENTS, +ALLOC, +LOAD, +READONLY, +CODE
+ +1 +\.data +00000004 +00000020 +00000020 +00001020 +2\*\*2
+ +CONTENTS, +ALLOC, +LOAD, +DATA
+ +2 +\.bss +00000000 +00000024 +00000024 +00001024 +2\*\*2
+ +ALLOC
diff --git a/ld/testsuite/ld-scripts/align2b.s b/ld/testsuite/ld-scripts/align2b.s
new file mode 100644
index 0000000..4e56d4a
--- /dev/null
+++ b/ld/testsuite/ld-scripts/align2b.s
@@ -0,0 +1,4 @@
+ .text
+ .long 0
+ .data
+ .long 0x12345678
diff --git a/ld/testsuite/ld-scripts/align2c.d b/ld/testsuite/ld-scripts/align2c.d
new file mode 100644
index 0000000..16a4245
--- /dev/null
+++ b/ld/testsuite/ld-scripts/align2c.d
@@ -0,0 +1,2 @@
+# ld: -T align2.t
+# error: undefined symbol.*in expression
diff --git a/ld/testsuite/ld-scripts/align2c.s b/ld/testsuite/ld-scripts/align2c.s
new file mode 100644
index 0000000..4e56d4a
--- /dev/null
+++ b/ld/testsuite/ld-scripts/align2c.s
@@ -0,0 +1,4 @@
+ .text
+ .long 0
+ .data
+ .long 0x12345678