]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
More relaxation for unloaded reloc sections.
authorUlrich Drepper <drepper@redhat.com>
Sun, 4 Dec 2005 16:47:24 +0000 (16:47 +0000)
committerUlrich Drepper <drepper@redhat.com>
Sun, 4 Dec 2005 16:47:24 +0000 (16:47 +0000)
src/ChangeLog
src/elflint.c

index 4c668c231fea4124c635aaba47c4989d339ecae8..e03f056d28f37868b52292228cf5e01594788d7c 100644 (file)
@@ -1,3 +1,9 @@
+2005-12-04  Ulrich Drepper  <drepper@redhat.com>
+
+       * elflint.c (check_one_reloc): If relocation section is not loaded,
+       don't check whether the relocations modify read-only sections or
+       loaded and unloaded sections.
+
 2005-11-28  Ulrich Drepper  <drepper@redhat.com>
 
        * elflint.c (check_one_reloc): Take additional parameters.  Use
index 227a463cdff885b25fb8bf94191e17c3d879de9e..32d52976a466e56bd9bcc47fee8e320393bef146 100644 (file)
@@ -1205,37 +1205,41 @@ section [%2d] '%s': relocation %zu: offset out of bounds\n"),
                                   buf, sizeof (buf)));
     }
 
-  bool in_loaded_seg = false;
-  while (loaded != NULL)
+  if ((ehdr->e_type != ET_EXEC && ehdr->e_type != ET_DYN)
+      || (relshdr->sh_flags & SHF_ALLOC) != 0)
     {
-      if (r_offset < loaded->to
-         && r_offset + (sym == NULL ? 0 : sym->st_size) >= loaded->from)
+      bool in_loaded_seg = false;
+      while (loaded != NULL)
        {
-         /* The symbol is in this segment.  */
-         if  (loaded->read_only)
+         if (r_offset < loaded->to
+             && r_offset + (sym == NULL ? 0 : sym->st_size) >= loaded->from)
            {
-             if (textrel)
-               needed_textrel = true;
-             else
-               ERROR (gettext ("section [%2d] '%s': relocation %zu: read-only section modified but text relocation flag not set\n"),
-                      idx, section_name (ebl, idx), cnt);
+             /* The symbol is in this segment.  */
+             if  (loaded->read_only)
+               {
+                 if (textrel)
+                   needed_textrel = true;
+                 else
+                   ERROR (gettext ("section [%2d] '%s': relocation %zu: read-only section modified but text relocation flag not set\n"),
+                          idx, section_name (ebl, idx), cnt);
+               }
+
+             in_loaded_seg = true;
            }
 
-         in_loaded_seg = true;
+         loaded = loaded->next;
        }
 
-      loaded = loaded->next;
-    }
-
-  if (*statep == state_undecided)
-    *statep = in_loaded_seg ? state_loaded : state_unloaded;
-  else if ((*statep == state_unloaded && in_loaded_seg)
-          || (*statep == state_loaded && !in_loaded_seg))
-    {
-      ERROR (gettext ("\
+      if (*statep == state_undecided)
+       *statep = in_loaded_seg ? state_loaded : state_unloaded;
+      else if ((*statep == state_unloaded && in_loaded_seg)
+              || (*statep == state_loaded && !in_loaded_seg))
+       {
+         ERROR (gettext ("\
 section [%2d] '%s': relocations are against loaded and unloaded data\n"),
-            idx, section_name (ebl, idx));
-      *statep = state_error;
+                idx, section_name (ebl, idx));
+         *statep = state_error;
+       }
     }
 }