[PATCH] D49016: [llvm-objdump] Add dynamic section printing to private-headers option

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 24 02:31:36 PDT 2018


jhenderson added inline comments.


================
Comment at: include/llvm/Object/ELF.h:513
+template <class ELFT>
+Expected<typename ELFT::DynRange> ELFFile<ELFT>::dynamicEntries() const {
+  ArrayRef<Elf_Dyn> Dyn;
----------------
paulsemel wrote:
> jhenderson wrote:
> > jhenderson wrote:
> > > Again, this should be moved to the source file.
> > You've marked this as done but `dynamicEntries` is still in the header file...
> Oops.. 
How about moving this into the source file too!?


================
Comment at: test/tools/llvm-objdump/private-headers-dynamic-section.test:1
+# RUN: llvm-objdump -p %p/Inputs/private-headers-x86_64.elf | FileCheck %s
+
----------------
paulsemel wrote:
> jhenderson wrote:
> > jhenderson wrote:
> > > One more test suggestion: use llvm-objcopy to remove the section headers for this test input and then run the same dump. It should produce the same output.
> > Sorry, I guess I wasn't clear. I was expecting these to be in the same test file. So the run commands would look something like:
> > 
> > 
> > ```
> > # RUN: llvm-objdump -p %p/Inputs/private-headers-x86_64.elf | FileCheck %s
> > # RUN: llvm-objcopy <insert appropriate arguments here> %p/Inputs/private-headers-x86_64.elf %t-stripped.elf
> > # RUN: llvm-objdump -p %t-stripped.elf | FileCheck %s
> > ```
> > 
> > This means that you can show that the output is identical with and without the section headers.
> You can't just strip the section header entry and not the whole section with llvm-objcopy (which make sense). I had to craft the binary by hand.. So this is not really possible
You can strip all section headers. Use llvm-objcopy --strip-sections to do it. This will preserve the section contents, but remove the section headers (and the section header string table, if I'm not mistaken).


Repository:
  rL LLVM

https://reviews.llvm.org/D49016





More information about the llvm-commits mailing list