summaryrefslogtreecommitdiffstats
path: root/libelf/elf32_offscn.c
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2012-04-02 17:11:25 +0200
committerMark Wielaard <[email protected]>2012-04-02 17:11:25 +0200
commit191d1f0b9163593eee8c4f5cbe3e95cabf6ae9a9 (patch)
tree7d435274549f268ae4273457eaec575e4ec62cb1 /libelf/elf32_offscn.c
parent738c18312e0db36dce5e1cd2cddaf66eb8947f1a (diff)
elf32_offscn.c: Do not match SHT_NOBITS sections at OFFSET.
readelf -d doesn't work if a SHT_NOBITS section is right before the actual .dynamic section at the same offset. elflint also fails on such binaries. So skip SHT_NOBITS sections at the same offset in [g]elf[32|64]_offscn().
Diffstat (limited to 'libelf/elf32_offscn.c')
-rw-r--r--libelf/elf32_offscn.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libelf/elf32_offscn.c b/libelf/elf32_offscn.c
index 86eff8b1..5dcfc4a1 100644
--- a/libelf/elf32_offscn.c
+++ b/libelf/elf32_offscn.c
@@ -101,7 +101,8 @@ elfw2(LIBELFBITS,offscn) (elf, offset)
/* If this section is empty, the following one has the same
sh_offset. We presume the caller is looking for a nonempty
section, so keep looking if this one is empty. */
- if (runp->data[i].shdr.ELFW(e,LIBELFBITS)->sh_size != 0)
+ if (runp->data[i].shdr.ELFW(e,LIBELFBITS)->sh_size != 0
+ && runp->data[i].shdr.ELFW(e,LIBELFBITS)->sh_type != SHT_NOBITS)
goto out;
}