]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
libebl: SHT_(INIT|FINI|PREINIT)_ARRAY are valid targets for relocation.
authorMark Wielaard <mjw@redhat.com>
Fri, 12 Jun 2015 10:50:14 +0000 (12:50 +0200)
committerMark Wielaard <mjw@redhat.com>
Sun, 14 Jun 2015 21:09:56 +0000 (23:09 +0200)
Seen in run-elflint-self.sh for size.o when build with --enable-gcov.
https://bugzilla.redhat.com/show_bug.cgi?id=1230798

Signed-off-by: Mark Wielaard <mjw@redhat.com>
libebl/ChangeLog
libebl/eblcheckreloctargettype.c

index 51ae60f2bbe08774706ab92feb2d5b1dd8baf470..4305cf6dc16365f89ab03705db6e99297d36f19a 100644 (file)
@@ -1,3 +1,8 @@
+2015-06-12  Mark Wielaard  <mjw@redhat.com>
+
+       * eblcheckreloctargettype.c (ebl_check_reloc_target_type): Allow
+       SHT_INIT_ARRAY, SHT_FINI_ARRAY and SHT_PREINIT_ARRAY.
+
 2015-05-17  Mark Wielaard  <mjw@redhat.com>
 
        * eblobjnote.c (ebl_object_note): If allocation buf is large, then
index e135f8a360a9795b4584b449fd60f1c3ddd38475..e0d57c1443c82fd8b0d4f4f57f2ddf8ddde523c6 100644 (file)
@@ -1,5 +1,5 @@
 /* Check whether a section type is a valid target for relocation.
-   Copyright (C) 2014 Red Hat, Inc.
+   Copyright (C) 2014, 2015 Red Hat, Inc.
    This file is part of elfutils.
 
    This file is free software; you can redistribute it and/or modify
@@ -39,8 +39,16 @@ ebl_check_reloc_target_type (Ebl *ebl, Elf64_Word sh_type)
   if (ebl->check_reloc_target_type (ebl, sh_type))
     return true;
 
-  if (sh_type == SHT_PROGBITS || sh_type == SHT_NOBITS)
-    return true;
-
-  return false;
+  switch (sh_type)
+    {
+      case SHT_PROGBITS:
+      case SHT_NOBITS:
+      case SHT_INIT_ARRAY:
+      case SHT_FINI_ARRAY:
+      case SHT_PREINIT_ARRAY:
+       return true;
+
+      default:
+       return false;
+    }
 }