[PATCH] D39021: [llvm-objcopy] Add support for --only-keep/-j and --keep

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 28 02:15:30 PST 2017


jhenderson added a comment.

Almost ready to go in, but I've thought of one more test that I think would be worth having:

- --only-keep + --strip-sections. Test that the kept section contents are still in the ELF, but not those of .shstrtab. This is to show that the if statement at line 267 does not prevent stripping of the section header strings.

I was also going to suggest the following test. However, I realise that with the current behaviour of llvm-objcopy, it's not necessary, because IIRC, --strip-sections does not strip the .shstrtab contents, unless explicitly asked to do so. Is this correct? If so, I suspect that this behaviour needs to change. objcopy rebuilds the section header string table from scratch (and if necessary, splits it from the symbol string table, if the two are merged, like they are in clang's output), removing any redundant entries as it goes. If the section headers have been removed (e.g. via --strip-all), then it completely strips .shstrtab's contents. This is important, because in some cases, leaving the section header strings in the ELF could leak sensitive data to an end user.

- --keep .shstrtab + --strip-sections. Test that the section header strings are still present in the ELF somewhere, even though the section headers have been removed.


Repository:
  rL LLVM

https://reviews.llvm.org/D39021





More information about the llvm-commits mailing list