libdwfl: Treat R_*_NONE reloc as no reloc.
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index 54ac53f..a9f36d9 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -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
diff --git a/libdwfl/relocate.c b/libdwfl/relocate.c
index 121a481..0075c7f 100644
--- a/libdwfl/relocate.c
+++ b/libdwfl/relocate.c
@@ -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 @@
{
/* 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;