diff options
author | Roland McGrath <roland@redhat.com> | 2010-04-26 13:09:33 -0700 |
---|---|---|
committer | Roland McGrath <roland@redhat.com> | 2010-04-26 13:09:33 -0700 |
commit | d17f9de52545417d7fec051b8e1b144234956021 (patch) | |
tree | a31b9c383ca179c3b3a06f9b07855f10042061d8 /libdwfl | |
parent | 55195e58ba85adc5c7f4cb6902c462854093c153 (diff) | |
download | elfutils-d17f9de52545417d7fec051b8e1b144234956021.tar.gz |
libdwfl: Treat R_*_NONE reloc as no reloc.
Diffstat (limited to 'libdwfl')
-rw-r--r-- | libdwfl/ChangeLog | 6 | ||||
-rw-r--r-- | libdwfl/relocate.c | 11 |
2 files changed, 16 insertions, 1 deletions
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index 54ac53fa..a9f36d96 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 121a481b..0075c7f9 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 @@ 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; |