]>
Commit | Line | Data |
---|---|---|
156767db PS |
1 | commit 738c18312e0db36dce5e1cd2cddaf66eb8947f1a |
2 | Author: Roland McGrath <roland@hack.frob.com> | |
3 | Date: Wed Mar 28 15:01:49 2012 -0700 | |
4 | ||
5 | elflint: Accept SHF_INFO_LINK for reloc sections. | |
6 | ||
7 | commit 191d1f0b9163593eee8c4f5cbe3e95cabf6ae9a9 | |
8 | Author: Mark Wielaard <mjw@redhat.com> | |
9 | Date: Mon Apr 2 17:11:25 2012 +0200 | |
10 | ||
11 | elf32_offscn.c: Do not match SHT_NOBITS sections at OFFSET. | |
12 | ||
13 | readelf -d doesn't work if a SHT_NOBITS section is right before the actual | |
14 | .dynamic section at the same offset. elflint also fails on such binaries. | |
15 | So skip SHT_NOBITS sections at the same offset in [g]elf[32|64]_offscn(). | |
16 | ||
17 | diff --git a/src/elflint.c b/src/elflint.c | |
18 | index abca8b7..a03caac 100644 | |
19 | --- a/src/elflint.c | |
20 | +++ b/src/elflint.c | |
21 | @@ -3357,8 +3357,8 @@ static const struct | |
22 | { ".note", 6, SHT_NOTE, atleast, 0, SHF_ALLOC }, | |
23 | { ".plt", 5, SHT_PROGBITS, unused, 0, 0 }, // XXX more tests | |
24 | { ".preinit_array", 15, SHT_PREINIT_ARRAY, exact, SHF_ALLOC | SHF_WRITE, 0 }, | |
25 | - { ".rela", 5, SHT_RELA, atleast, 0, SHF_ALLOC }, // XXX more tests | |
26 | - { ".rel", 4, SHT_REL, atleast, 0, SHF_ALLOC }, // XXX more tests | |
27 | + { ".rela", 5, SHT_RELA, atleast, 0, SHF_ALLOC | SHF_INFO_LINK }, // XXX more tests | |
28 | + { ".rel", 4, SHT_REL, atleast, 0, SHF_ALLOC | SHF_INFO_LINK }, // XXX more tests | |
29 | { ".rodata", 8, SHT_PROGBITS, atleast, SHF_ALLOC, SHF_MERGE | SHF_STRINGS }, | |
30 | { ".rodata1", 9, SHT_PROGBITS, atleast, SHF_ALLOC, SHF_MERGE | SHF_STRINGS }, | |
31 | { ".shstrtab", 10, SHT_STRTAB, exact, 0, 0 }, | |
32 | diff --git a/libelf/elf32_offscn.c b/libelf/elf32_offscn.c | |
33 | index 86eff8b..5dcfc4a 100644 | |
34 | --- a/libelf/elf32_offscn.c | |
35 | +++ b/libelf/elf32_offscn.c | |
36 | @@ -101,7 +101,8 @@ elfw2(LIBELFBITS,offscn) (elf, offset) | |
37 | /* If this section is empty, the following one has the same | |
38 | sh_offset. We presume the caller is looking for a nonempty | |
39 | section, so keep looking if this one is empty. */ | |
40 | - if (runp->data[i].shdr.ELFW(e,LIBELFBITS)->sh_size != 0) | |
41 | + if (runp->data[i].shdr.ELFW(e,LIBELFBITS)->sh_size != 0 | |
42 | + && runp->data[i].shdr.ELFW(e,LIBELFBITS)->sh_type != SHT_NOBITS) | |
43 | goto out; | |
44 | } | |
45 |