summaryrefslogtreecommitdiffstats
path: root/libdwfl/relocate.c
diff options
context:
space:
mode:
Diffstat (limited to 'libdwfl/relocate.c')
-rw-r--r--libdwfl/relocate.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/libdwfl/relocate.c b/libdwfl/relocate.c
index f8a5fcfa..7afbea18 100644
--- a/libdwfl/relocate.c
+++ b/libdwfl/relocate.c
@@ -1,5 +1,5 @@
/* Relocate debug information.
- Copyright (C) 2005-2010 Red Hat, Inc.
+ Copyright (C) 2005-2011 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -456,7 +456,10 @@ relocate_section (Dwfl_Module *mod, Elf *relocated, const GElf_Ehdr *ehdr,
}
}
- size_t nrels = shdr->sh_size / shdr->sh_entsize;
+ size_t sh_entsize
+ = gelf_fsize (relocated, shdr->sh_type == SHT_REL ? ELF_T_REL : ELF_T_RELA,
+ 1, EV_CURRENT);
+ size_t nrels = shdr->sh_size / sh_entsize;
size_t complete = 0;
if (shdr->sh_type == SHT_REL)
for (size_t relidx = 0; !result && relidx < nrels; ++relidx)
@@ -558,7 +561,7 @@ relocate_section (Dwfl_Module *mod, Elf *relocated, const GElf_Ehdr *ehdr,
nrels = next;
}
- shdr->sh_size = reldata->d_size = nrels * shdr->sh_entsize;
+ shdr->sh_size = reldata->d_size = nrels * sh_entsize;
gelf_update_shdr (scn, shdr);
}