summaryrefslogtreecommitdiffstats
path: root/src/strip.c
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2015-10-04 23:47:47 +0200
committerMark Wielaard <[email protected]>2015-10-09 11:22:00 +0200
commit3a45dbbe7e1862e72bc886fa7f12a5c5c09311e0 (patch)
treeb83ebacc89bfeedb8402e4efcdd71a3a91590bf9 /src/strip.c
parent86ed7f7f53179d7a893329e6b9851dbb75aba405 (diff)
strip: Only sanity check symbols to not discarded sections for debug file.
We can only sanity check the symbols to discarded sections when creating a debug file. Otherwise we won't keep track of debug_data. This can trigger erroneously when there are relocation symbols in the symtab for a .debug section but we are not putting those symbols in a separate .debug file. Adjust run-strip-test.sh to always run in-place strip size check even for ET_REL files. Before this fix the sanity check would trigger for some ET_REL files because they contained such relocation symbols to .debug sections (but debug_data would be NULL because -f wasn't used). Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'src/strip.c')
-rw-r--r--src/strip.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/strip.c b/src/strip.c
index 41169eda..6fdb3bf9 100644
--- a/src/strip.c
+++ b/src/strip.c
@@ -1379,9 +1379,11 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname,
shdr_info[cnt].shdr.sh_info = destidx - 1;
}
}
- else if (debug_fname == NULL
- || shdr_info[cnt].debug_data == NULL)
- /* This is a section or group signature symbol
+ else if (debug_fname != NULL
+ && shdr_info[cnt].debug_data == NULL)
+ /* The symbol points to a section that is discarded
+ but isn't preserved in the debug file. Check that
+ this is a section or group signature symbol
for a section which has been removed. */
{
size_t sidx = (sym->st_shndx != SHN_XINDEX