aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2012-03-14 05:24:02 +0000
committerAlan Modra <amodra@gmail.com>2012-03-14 05:24:02 +0000
commitec8460b5bac24867500e840a88a6ee36fbc2dff2 (patch)
tree75b6f21cb6dc75350fa0ef93927b8d6235510cbd /ld
parent51e40b125fca4d48b283e535955f683dce935046 (diff)
downloadgdb-ec8460b5bac24867500e840a88a6ee36fbc2dff2.zip
gdb-ec8460b5bac24867500e840a88a6ee36fbc2dff2.tar.gz
gdb-ec8460b5bac24867500e840a88a6ee36fbc2dff2.tar.bz2
PR ld/13839
* ldexp.c (fold_name): Ignore undefined symbols when assigning to dot in mark phase. (exp_fold_tree_1): Evaluate assignment to dot expressions even when discarding result, for side effects. Fix typo in error message.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog8
-rw-r--r--ld/ldexp.c22
2 files changed, 19 insertions, 11 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index daba2fd..a61012b 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,11 @@
+2012-03-14 Alan Modra <amodra@gmail.com>
+
+ PR ld/13839
+ * ldexp.c (fold_name): Ignore undefined symbols when assigning to
+ dot in mark phase.
+ (exp_fold_tree_1): Evaluate assignment to dot expressions even when
+ discarding result, for side effects. Fix typo in error message.
+
2012-03-08 Tristan Gingold <gingold@adacore.com>
* ldexp.c (exp_print_tree): Special case for SEGMENT_START.
diff --git a/ld/ldexp.c b/ld/ldexp.c
index 59743ea..3bddc81 100644
--- a/ld/ldexp.c
+++ b/ld/ldexp.c
@@ -606,7 +606,8 @@ fold_name (etree_type *tree)
output_section);
}
else if (expld.phase == lang_final_phase_enum
- || expld.assigning_to_dot)
+ || (expld.phase != lang_mark_phase_enum
+ && expld.assigning_to_dot))
einfo (_("%F%S: undefined symbol `%s'"
" referenced in expression\n"),
tree, tree->name.name);
@@ -797,14 +798,7 @@ exp_fold_tree_1 (etree_type *tree)
if (tree->type.node_class != etree_assign)
einfo (_("%F%S can not PROVIDE assignment to"
" location counter\n"), tree);
- /* After allocation, assignment to dot should not be done inside
- an output section since allocation adds a padding statement
- that effectively duplicates the assignment. */
- if (expld.phase == lang_mark_phase_enum
- || expld.phase == lang_allocating_phase_enum
- || ((expld.phase == lang_assigning_phase_enum
- || expld.phase == lang_final_phase_enum)
- && expld.section == bfd_abs_section_ptr))
+ if (expld.phase != lang_first_phase_enum)
{
/* Notify the folder that this is an assignment to dot. */
expld.assigning_to_dot = TRUE;
@@ -819,8 +813,14 @@ exp_fold_tree_1 (etree_type *tree)
}
else if (expld.dotp == NULL)
einfo (_("%F%S assignment to location counter"
- " invalid outside of SECTION\n"), tree);
- else
+ " invalid outside of SECTIONS\n"), tree);
+
+ /* After allocation, assignment to dot should not be
+ done inside an output section since allocation adds a
+ padding statement that effectively duplicates the
+ assignment. */
+ else if (expld.phase <= lang_allocating_phase_enum
+ || expld.section == bfd_abs_section_ptr)
{
bfd_vma nextdot;