* ldlang.c (lang_size_sections_1): Don't warn on backwards dot
authorAlan Modra <amodra@gmail.com>
Tue, 6 Feb 2007 13:56:38 +0000 (13:56 +0000)
committerAlan Modra <amodra@gmail.com>
Tue, 6 Feb 2007 13:56:38 +0000 (13:56 +0000)
move unless section size is non-zero.

ld/ChangeLog
ld/ldlang.c

index 4155b2a05289327e127418faf6ea7053df18b822..c7eade5ef58456cbd75187c2e4b7780bf666fdfb 100644 (file)
@@ -1,3 +1,8 @@
+2007-02-06  Alan Modra  <amodra@bigpond.net.au>
+
+       * ldlang.c (lang_size_sections_1): Don't warn on backwards dot
+       move unless section size is non-zero.
+
 2007-02-05  Dave Brolley  <brolley@redhat.com>
 
        * Makefile.am (ALL_EMULATIONS): Add support for Toshiba MeP.
index 030887dad62c9f8abfd0ca50a9d23951ce470c18..ac680a5e43595c379c909bac5190273031c9a63c 100644 (file)
@@ -1,6 +1,6 @@
 /* Linker command language support.
    Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-   2001, 2002, 2003, 2004, 2005, 2006
+   2001, 2002, 2003, 2004, 2005, 2006, 2007
    Free Software Foundation, Inc.
 
    This file is part of GLD, the Gnu Linker.
@@ -4413,7 +4413,8 @@ lang_size_sections_1
                   an explicit assignment to the section LMA (ie.
                   os->load_base set) because backwards moves normally
                   create overlapping LMAs.  */
-               if (dot < last->vma)
+               if (dot < last->vma
+                   && os->bfd_section->size != 0)
                  {
                    einfo (_("%P: warning: dot moved backwards before `%s'\n"),
                           os->name);
@@ -4463,8 +4464,11 @@ lang_size_sections_1
                 || (os->bfd_section->flags & SEC_THREAD_LOCAL) == 0)
                && (os->bfd_section->flags & SEC_ALLOC) != 0
                && (os->bfd_section->size != 0
-                   || os->bfd_section->vma != os->bfd_section->lma
-                   || r->last_os != NULL)
+                   || (r->last_os == NULL
+                       && os->bfd_section->vma != os->bfd_section->lma)
+                   || (r->last_os != NULL
+                       && dot >= (r->last_os->output_section_statement
+                                  .bfd_section->vma))
                && os->lma_region == NULL
                && !link_info.relocatable)
              r->last_os = s;