[PATCH] D61672: [llvm-objcopy] Allow strip symtab in executables and DSOs
Eugene Leviant via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 14 04:13:58 PDT 2019
evgeny777 added a comment.
> I'm still a bit unclear. Does it strip symbols that are duplicates of symbols in .dynsym? Does it just get rid of the the whole symbol table no matter what?
For ET_DYN/EXEC GNU objcopy strips all symbols from .symtab when they're not referenced by relocations. Given DYN/EXEC is a product of a static linker there're no such
symbols, so effectively all symbols from .symtab are stripped. As a result symtab section becomes empty and is not emitted to output binary.
> I think --strip-unneeded already strips debug sections as well
llvm-objcopy --help
...
-strip-unneeded Remove all symbols not needed by relocations
...
> Also what "strip unneeded" means is a bit unclear.
I think it's pretty clear. You remove symbols not referenced by relocations compacting both .symtab and .strtab
> There unfortunately isn't a spec anywhere nor is the use case implied by "needed" defined. We just have to match GNU objcopy.
I couldn't find any docs on the subject, so I can only suggest taking a look at GNU objcopy `filter_symbols`.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D61672/new/
https://reviews.llvm.org/D61672
More information about the llvm-commits
mailing list