]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
dwarflint: Don't actually relocate values in non-ET_REL files
authorPetr Machata <pmachata@redhat.com>
Tue, 21 Apr 2009 11:45:41 +0000 (13:45 +0200)
committerPetr Machata <pmachata@redhat.com>
Tue, 21 Apr 2009 12:47:39 +0000 (14:47 +0200)
* still do all the checking, just skip actual relocation computation

src/dwarflint.c

index 675de71c78163a333fcf800fbba08082cbd538bd..d289ab06e7dfcf4ac1c62f175583e4a3199dffe7 100644 (file)
@@ -2648,8 +2648,6 @@ relocate_one (struct relocation_data *reloc, struct relocation *rel,
          sym_value = reloc->file->sec[section_index].shdr.sh_addr;
        }
 
-      *value = rel->addend + sym_value;
-
       /* It's target value, not section offset.  */
       if (offset_into == rel_value
          || offset_into == rel_address
@@ -2717,6 +2715,15 @@ relocate_one (struct relocation_data *reloc, struct relocation *rel,
                free (wh1);
            }
        }
+
+      /* Only do the actual relocation if we have ET_REL files.  For
+        non-ET_REL files, only do the above checking.  */
+      if (reloc->file->ehdr.e_type == ET_REL)
+       {
+         *value = rel->addend + sym_value;
+         if (rel_width == 4)
+           *value = *value & (uint64_t)(uint32_t)-1;
+       }
     }
 }