ld/
authorNathan Sidwell <nathan@codesourcery.com>
Sat, 6 Jan 2007 22:03:46 +0000 (22:03 +0000)
committerNathan Sidwell <nathan@codesourcery.com>
Sat, 6 Jan 2007 22:03:46 +0000 (22:03 +0000)
* 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.

ld/ChangeLog
ld/ldexp.c
ld/testsuite/ChangeLog
ld/testsuite/ld-scripts/expr.exp [new file with mode: 0644]
ld/testsuite/ld-scripts/expr1.d [new file with mode: 0644]
ld/testsuite/ld-scripts/expr1.s [new file with mode: 0644]
ld/testsuite/ld-scripts/expr1.t [new file with mode: 0644]

index 60e2d79a452dd4e20ded5252f7e24688a006e683..798d2fc5e526a56d525a824093b18747e65875db 100644 (file)
@@ -1,3 +1,7 @@
+2007-01-06  Nathan Sidwell  <nathan@codesourcery.com>
+
+       * ldexp.c (fold_name): Issue error on undefined sections.
+
 2007-01-02  Alan Modra  <amodra@bigpond.net.au>
 
        * pe-dll.c: Include pe-dll.h.
index 4f279b853b70d93cc2728a257228adf3fb449560..eb6451be72b266afcaafb4bf906901a2cb553bf3 100644 (file)
@@ -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);
        }
index 2ff0c39945a39f6d76e814209ed2e0b7186a5d16..e7ac70c60eb2ae4aa6b07a18c03f40d082ec9517 100644 (file)
@@ -1,3 +1,10 @@
+2007-01-06  Nathan Sidwell  <nathan@codesourcery.com>
+
+       * ld-scripts/expr.exp: New.
+       * ld-scripts/expr1.s: New.
+       * ld-scripts/expr1.d: New.
+       * ld-scripts/expr1.t: New.
+
 2006-12-29  H.J. Lu  <hongjiu.lu@intel.com>
 
        * ld-elf/wrap.exp: New file.
diff --git a/ld/testsuite/ld-scripts/expr.exp b/ld/testsuite/ld-scripts/expr.exp
new file mode 100644 (file)
index 0000000..43ca1c6
--- /dev/null
@@ -0,0 +1,20 @@
+# Test ALIGN in a linker script.
+# By Nathan Sidwell, CodeSourcery LLC
+#   Copyright 2006
+#   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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+
+run_dump_test expr1
diff --git a/ld/testsuite/ld-scripts/expr1.d b/ld/testsuite/ld-scripts/expr1.d
new file mode 100644 (file)
index 0000000..d96dfc1
--- /dev/null
@@ -0,0 +1,2 @@
+# ld: -T expr1.t
+# error: undefined section .* in expression
diff --git a/ld/testsuite/ld-scripts/expr1.s b/ld/testsuite/ld-scripts/expr1.s
new file mode 100644 (file)
index 0000000..ec0ce90
--- /dev/null
@@ -0,0 +1,2 @@
+       .word 0
+
diff --git a/ld/testsuite/ld-scripts/expr1.t b/ld/testsuite/ld-scripts/expr1.t
new file mode 100644 (file)
index 0000000..e0810ba
--- /dev/null
@@ -0,0 +1,12 @@
+ENTRY(RAM)
+
+MEMORY
+{
+  ram (rwx) : ORIGIN = 0, LENGTH = 0x1000000
+}
+
+SECTIONS
+{
+.text : { } >ram
+}
+RAM = ADDR(ram);