aboutsummaryrefslogtreecommitdiff
path: root/ld/ldexp.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2007-01-06 22:03:46 +0000
committerNathan Sidwell <nathan@codesourcery.com>2007-01-06 22:03:46 +0000
commitcc3e2771c5def765623e1fb173f8211ddbe5ccb6 (patch)
tree58c3ada104bb4380a55083caa365178481eee8f5 /ld/ldexp.c
parent2e4dc0578090605ab0c5e5a097bbdf000a4cfc51 (diff)
downloadgdb-cc3e2771c5def765623e1fb173f8211ddbe5ccb6.zip
gdb-cc3e2771c5def765623e1fb173f8211ddbe5ccb6.tar.gz
gdb-cc3e2771c5def765623e1fb173f8211ddbe5ccb6.tar.bz2
ld/
* ldexp.c (fold_name): Issue error on undefined sections. ld/testsuite/ * ld-scripts/expr.exp: New. * ld-scripts/expr1.s: New. * ld-scripts/expr1.d: New. * ld-scripts/expr1.t: New.
Diffstat (limited to 'ld/ldexp.c')
-rw-r--r--ld/ldexp.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/ld/ldexp.c b/ld/ldexp.c
index 4f279b8..eb6451b 100644
--- a/ld/ldexp.c
+++ b/ld/ldexp.c
@@ -563,7 +563,13 @@ fold_name (etree_type *tree)
lang_output_section_statement_type *os;
os = lang_output_section_find (tree->name.name);
- if (os != NULL && os->processed_vma)
+ if (os == NULL)
+ {
+ if (expld.phase == lang_final_phase_enum)
+ einfo (_("%F%S: undefined section `%s' referenced in expression\n"),
+ tree->name.name);
+ }
+ else if (os->processed_vma)
new_rel (0, NULL, os->bfd_section);
}
break;
@@ -574,7 +580,13 @@ fold_name (etree_type *tree)
lang_output_section_statement_type *os;
os = lang_output_section_find (tree->name.name);
- if (os != NULL && os->processed_lma)
+ if (os == NULL)
+ {
+ if (expld.phase == lang_final_phase_enum)
+ einfo (_("%F%S: undefined section `%s' referenced in expression\n"),
+ tree->name.name);
+ }
+ else if (os->processed_lma)
{
if (os->load_base == NULL)
new_abs (os->bfd_section->lma);
@@ -592,7 +604,12 @@ fold_name (etree_type *tree)
os = lang_output_section_find (tree->name.name);
if (os == NULL)
- new_abs (0);
+ {
+ if (expld.phase == lang_final_phase_enum)
+ einfo (_("%F%S: undefined section `%s' referenced in expression\n"),
+ tree->name.name);
+ new_abs (0);
+ }
else if (os->processed_vma)
new_abs (os->bfd_section->size / opb);
}