From 68e8b84743bdb389776e3aa2bae27aba7f435fdb Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Wed, 1 Aug 2018 16:51:03 +0200 Subject: libebl: Use elf_getshdrstrndx in ebl_section_strip_p. The ebl_section_strip_p function used the Ehdr e_shstrndx field to get at the name of the (debug) sections. This is not correct if there are more than SHN_LORESERVE sections. Use elf_getshdrstrndx to get at the shstrtab section. And drop the Ehdr argument that isn't necessary anymore. Signed-off-by: Mark Wielaard --- src/strip.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/strip.c') diff --git a/src/strip.c b/src/strip.c index 1367de77..dc712364 100644 --- a/src/strip.c +++ b/src/strip.c @@ -817,7 +817,7 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, /* 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, + : (ebl_section_strip_p (ebl, &shdr_info[cnt].shdr, shdr_info[cnt].name, remove_comment, remove_debug) || cnt == ehdr->e_shstrndx @@ -978,7 +978,7 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, original table in the debug file. Unless it is a redundant data marker to a debug (data only) section. */ - if (! (ebl_section_strip_p (ebl, ehdr, + if (! (ebl_section_strip_p (ebl, &shdr_info[scnidx].shdr, shdr_info[scnidx].name, remove_comment, -- cgit v1.2.3