diff options
| -rw-r--r-- | libdwfl/ChangeLog | 7 | ||||
| -rw-r--r-- | libdwfl/dwfl_module_getsym.c | 4 | ||||
| -rw-r--r-- | libdwfl/relocate.c | 8 |
3 files changed, 14 insertions, 5 deletions
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index d420e3c9..91c2f315 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,3 +1,10 @@ +2009-04-08 Roland McGrath <[email protected]> + + * relocate.c (__libdwfl_relocate_value): Don't adjust a value from + a non-SHF_ALLOC section. + (relocate_getsym): Test st_shndx for SHN_* values, not *SHNDX. + * dwfl_module_getsym.c (dwfl_module_getsym): Likewise. + 2009-03-09 Roland McGrath <[email protected]> * dwfl_module_build_id.c (__libdwfl_find_build_id): Move SHSTRNDX diff --git a/libdwfl/dwfl_module_getsym.c b/libdwfl/dwfl_module_getsym.c index 5f289ccb..a4ce2844 100644 --- a/libdwfl/dwfl_module_getsym.c +++ b/libdwfl/dwfl_module_getsym.c @@ -1,5 +1,5 @@ /* Find debugging and symbol information for a module in libdwfl. - Copyright (C) 2006,2007 Red Hat, Inc. + Copyright (C) 2006,2007,2009 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -77,7 +77,7 @@ dwfl_module_getsym (Dwfl_Module *mod, int ndx, if (shndxp != NULL) *shndxp = shndx; - switch (shndx) + switch (sym->st_shndx) { case SHN_ABS: case SHN_UNDEF: diff --git a/libdwfl/relocate.c b/libdwfl/relocate.c index ef1daeee..e809a979 100644 --- a/libdwfl/relocate.c +++ b/libdwfl/relocate.c @@ -95,8 +95,10 @@ __libdwfl_relocate_value (Dwfl_Module *mod, Elf *elf, size_t *shstrndx, return DWFL_E_LIBELF; } - /* Apply the adjustment. */ - *value += refshdr->sh_addr + mod->main.bias; + if (refshdr->sh_flags & SHF_ALLOC) + /* Apply the adjustment. */ + *value += refshdr->sh_addr + mod->main.bias; + return DWFL_E_NOERROR; } @@ -183,7 +185,7 @@ relocate_getsym (Dwfl_Module *mod, if (sym->st_shndx != SHN_XINDEX) *shndx = sym->st_shndx; - switch (*shndx) + switch (sym->st_shndx) { case SHN_ABS: case SHN_UNDEF: |
