+--- elfutils/libdwfl/ChangeLog
++++ elfutils/libdwfl/ChangeLog
+@@ -256,6 +256,11 @@
+ * dwfl_module_getdwarf.c (open_elf): Clear errno before CBFAIL.
+ Reported by Kurt Roeckx <kurt@roeckx.be>.
+
++2011-03-23 Petr Machata <pmachata@redhat.com>
++
++ * relocate.c (relocate_section): Use gelf_fsize instead of relying
++ on shdr->sh_entsize.
++
+ 2011-02-11 Roland McGrath <roland@redhat.com>
+
+ * linux-kernel-modules.c (try_kernel_name): Try .gz, .bz2, .xz
+--- elfutils/libdwfl/relocate.c
++++ elfutils/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
+ }
+ }
+
+- 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
+ 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);
+ }
+