]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
libdwfl: Treat R_*_NONE reloc as no reloc.
authorRoland McGrath <roland@redhat.com>
Mon, 26 Apr 2010 20:09:33 +0000 (13:09 -0700)
committerRoland McGrath <roland@redhat.com>
Mon, 26 Apr 2010 20:09:33 +0000 (13:09 -0700)
libdwfl/ChangeLog
libdwfl/relocate.c

index 54ac53faca669635b614292727bfbe3571a60168..a9f36d96d2d3d1901cc32a2670fc943004267bc7 100644 (file)
@@ -1,3 +1,9 @@
+2010-04-26  Roland McGrath  <roland@redhat.com>
+
+       * relocate.c (relocate_section): Treat R_*_NONE reloc as no reloc.
+       Works around probably-wrong ld -r behavior for case of a DWARF address
+       constant that refers to a discarded SHF_ALLOC section.
+
 2010-04-14  Roland McGrath  <roland@redhat.com>
 
        * link_map.c (report_r_debug): Limit iterations on the l_next chain to
index 121a481be2ec07152443a40cd63c848c6215237b..0075c7f90291b82d98389837712908dfa5197278 100644 (file)
@@ -1,5 +1,5 @@
 /* Relocate debug information.
-   Copyright (C) 2005-2009 Red Hat, Inc.
+   Copyright (C) 2005-2010 Red Hat, Inc.
    This file is part of Red Hat elfutils.
 
    Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -325,6 +325,15 @@ relocate_section (Dwfl_Module *mod, Elf *relocated, const GElf_Ehdr *ehdr,
   {
     /* First see if this is a reloc we can handle.
        If we are skipping it, don't bother resolving the symbol.  */
+
+    if (unlikely (rtype == 0))
+      /* In some odd situations, the linker can leave R_*_NONE relocs
+        behind.  This is probably bogus ld -r behavior, but the only
+        cases it's known to appear in are harmless: DWARF data
+        referring to addresses in a section that has been discarded.
+        So we just pretend it's OK without further relocation.  */
+      return DWFL_E_NOERROR;
+
     Elf_Type type = ebl_reloc_simple_type (mod->ebl, rtype);
     if (unlikely (type == ELF_T_NUM))
       return DWFL_E_BADRELTYPE;