* ldlang.c (lang_record_phdrs): Give a fatal error if no sections
authorAlan Modra <amodra@gmail.com>
Fri, 31 Aug 2007 00:39:53 +0000 (00:39 +0000)
committerAlan Modra <amodra@gmail.com>
Fri, 31 Aug 2007 00:39:53 +0000 (00:39 +0000)
assigned to phdrs.  Avoid multiple forward scans for a section
with phdr assignment.

ld/ChangeLog
ld/ldlang.c

index a2bee5fc4f4b7acf4c1a10ffc7d8ea49bbe5e650..8a94b2e1e56f0810e1599047993427bcb2c7fbfd 100644 (file)
@@ -1,3 +1,9 @@
+2007-08-31  Alan Modra  <amodra@bigpond.net.au>
+
+       * ldlang.c (lang_record_phdrs): Give a fatal error if no sections
+       assigned to phdrs.  Avoid multiple forward scans for a section
+       with phdr assignment.
+
 2007-08-28  Mark Shinwell  <shinwell@codesourcery.com>
             Joseph Myers  <joseph@codesourcery.com>
 
index 1fcb991ae329fe4bd9e4484cf4f8136c0a00a4ae..f247a173315fcc8f0ffbb464c802eb458dc6968c 100644 (file)
@@ -6263,9 +6263,7 @@ lang_record_phdrs (void)
                  || (os->bfd_section->flags & SEC_ALLOC) == 0)
                continue;
 
-             if (last)
-               pl = last;
-             else
+             if (last == NULL)
                {
                  lang_output_section_statement_type * tmp_os;
 
@@ -6279,9 +6277,14 @@ lang_record_phdrs (void)
                     http://sourceware.org/ml/binutils/2007-02/msg00291.html  */
                  for (tmp_os = os; tmp_os; tmp_os = tmp_os->next)
                    if (tmp_os->phdrs)
-                     break;
-                 pl = tmp_os->phdrs;
+                     {
+                       last = tmp_os->phdrs;
+                       break;
+                     }
+                 if (last == NULL)
+                   einfo (_("%F%P: no sections assigned to phdrs\n"));
                }
+             pl = last;
            }
 
          if (os->bfd_section == NULL)