ld: check overflow only for allocated sections.
authorTristan Gingold <gingold@adacore.com>
Fri, 17 Mar 2017 10:12:05 +0000 (11:12 +0100)
committerTristan Gingold <gingold@adacore.com>
Tue, 21 Mar 2017 11:00:30 +0000 (12:00 +0100)
* ldlang.c (lang_check_section_addresses): Check only for
allocated sections.

ld/ChangeLog
ld/ldlang.c

index 4af309bf58408894fe2a5de4515327c3e82375ec..e42df3833754edd81874bae4b27a121cedc01c1e 100644 (file)
@@ -1,3 +1,8 @@
+2017-03-21  gingold  <gingold@gingold-Precision-7510>
+
+       * ldlang.c (lang_check_section_addresses): Check only for
+       allocated sections.
+
 2017-03-17  Alan Modra  <amodra@gmail.com>
 
        * testsuite/ld-elf/sec64k.exp: Don't run on h8300 and ip2k.
index 8c1d8299c374f0ca8ce7f70df7cbbabc89b344ae..5a4265967434c6631b4bbab096f0ee3d1e649955 100644 (file)
@@ -4776,24 +4776,25 @@ lang_check_section_addresses (void)
   lang_memory_region_type *m;
   bfd_boolean overlays;
 
-  /* Detect address space overflow.  */
+  /* Detect address space overflow on allocated sections.  */
   addr_mask = ((bfd_vma) 1 <<
               (bfd_arch_bits_per_address (link_info.output_bfd) - 1)) - 1;
   addr_mask = (addr_mask << 1) + 1;
   for (s = link_info.output_bfd->sections; s != NULL; s = s->next)
-    {
-      s_end = (s->vma + s->size) & addr_mask;
-      if (s_end != 0 && s_end < (s->vma & addr_mask))
-       einfo (_("%X%P: section %s VMA wraps around address space\n"),
-              s->name);
-      else
-       {
-         s_end = (s->lma + s->size) & addr_mask;
-         if (s_end != 0 && s_end < (s->lma & addr_mask))
-           einfo (_("%X%P: section %s LMA wraps around address space\n"),
-                  s->name);
-       }
-    }
+    if ((s->flags & SEC_ALLOC) != 0)
+      {
+       s_end = (s->vma + s->size) & addr_mask;
+       if (s_end != 0 && s_end < (s->vma & addr_mask))
+         einfo (_("%X%P: section %s VMA wraps around address space\n"),
+                s->name);
+       else
+         {
+           s_end = (s->lma + s->size) & addr_mask;
+           if (s_end != 0 && s_end < (s->lma & addr_mask))
+             einfo (_("%X%P: section %s LMA wraps around address space\n"),
+                    s->name);
+         }
+      }
 
   if (bfd_count_sections (link_info.output_bfd) <= 1)
     return;
This page took 0.030393 seconds and 4 git commands to generate.