SHA256
1
0
forked from pool/elfutils
elfutils/libelf-ignore-NOBITS-sh_offset.patch

25 lines
864 B
Diff

---
libelf/elf32_updatenull.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
Index: b/libelf/elf32_updatenull.c
===================================================================
--- a/libelf/elf32_updatenull.c
+++ b/libelf/elf32_updatenull.c
@@ -331,10 +331,11 @@ __elfw2(LIBELFBITS,updatenull) (Elf *elf
if (elf->flags & ELF_F_LAYOUT)
{
- size = MAX ((GElf_Word) size,
- shdr->sh_offset
- + (shdr->sh_type != SHT_NOBITS
- ? shdr->sh_size : 0));
+ /* Even the sh_offset is only the "conceptual" possition
+ in the file. So completely ignore NOBITS sections. */
+ if (shdr->sh_type != SHT_NOBITS)
+ size = MAX ((GElf_Word) size,
+ shdr->sh_offset + shdr->sh_size);
/* The alignment must be a power of two. This is a
requirement from the ELF specification. Additionally