Use addr_mask to check VMA and LMA
authorH.J. Lu <hjl.tools@gmail.com>
Tue, 14 Mar 2017 16:09:54 +0000 (09:09 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Tue, 14 Mar 2017 16:09:54 +0000 (09:09 -0700)
Since BFD64 may be used on 32-bit address, we need to apply addr_mask
to check VMA and LMA.

* ldlang.c (lang_check_section_addresses): Use addr_mask to
check VMA and LMA.

ld/ChangeLog
ld/ldlang.c

index eb0c309..df8bb32 100644 (file)
@@ -1,3 +1,8 @@
+2017-03-14  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * ldlang.c (lang_check_section_addresses): Use addr_mask to
+       check VMA and LMA.
+
 2017-03-13  Nick Clifton  <nickc@redhat.com>
 
        PR binutils/21202
index a0638ea..8c1d829 100644 (file)
@@ -4783,13 +4783,13 @@ lang_check_section_addresses (void)
   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)
+      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)
+         if (s_end != 0 && s_end < (s->lma & addr_mask))
            einfo (_("%X%P: section %s LMA wraps around address space\n"),
                   s->name);
        }