This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
[Bug tools/21525] Multiple .shstrtab sections since eu-readelf 0.166
- From: "mark at klomp dot org" <sourceware-bugzilla at sourceware dot org>
- To: elfutils-devel at sourceware dot org
- Date: Fri, 02 Jun 2017 12:43:22 +0000
- Subject: [Bug tools/21525] Multiple .shstrtab sections since eu-readelf 0.166
- Auto-submitted: auto-generated
- References: <bug-21525-10460@http.sourceware.org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=21525
Mark Wielaard <mark at klomp dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mark at klomp dot org
--- Comment #1 from Mark Wielaard <mark at klomp dot org> ---
Thanks so much for identifying the bad commit.
The issue is this hunk from src/strip.c:
@@ -1035,9 +1037,10 @@ handle_elf (int fd, Elf *elf, const char *prefix, const
char *fname,
}
}
- /* Mark the section header string table as unused, we will create
- a new one. */
- shdr_info[shstrndx].idx = 0;
+ /* Although we always create a new section header string table we
+ don't explicitly mark the existing one as unused. It can still
+ be used through a symbol table section we are keeping. If not it
+ will already be marked as unused. */
That comment makes a wrong assumption. We never actually mark the original
.shstrtab as possible removal candidate. So now it is always kept whether or
not there are other references to that sections.
I am testing the following patch which does mark .shsstrtab as a section that
could possibly be removed:
diff --git a/src/strip.c b/src/strip.c
index f747441..4015db5 100644
--- a/src/strip.c
+++ b/src/strip.c
@@ -711,11 +711,13 @@ handle_elf (int fd, Elf *elf, const char *prefix, const
char *fname,
in the sh_link or sh_info element it cannot be removed either
*/
for (cnt = 1; cnt < shnum; ++cnt)
- /* Check whether the section can be removed. */
+ /* Check whether the section can be removed. Since we will create
+ a new .shstrtab assume it will be removed too. */
if (remove_shdrs ? !(shdr_info[cnt].shdr.sh_flags & SHF_ALLOC)
- : ebl_section_strip_p (ebl, ehdr, &shdr_info[cnt].shdr,
- shdr_info[cnt].name, remove_comment,
- remove_debug))
+ : (ebl_section_strip_p (ebl, ehdr, &shdr_info[cnt].shdr,
+ shdr_info[cnt].name, remove_comment,
+ remove_debug)
+ || cnt == ehdr->e_shstrndx))
{
/* For now assume this section will be removed. */
shdr_info[cnt].idx = 0;
--
You are receiving this mail because:
You are on the CC list for the bug.