[PATCH] D66358: [llvm-readobj] Fallback to PT_NOTE if file doesn't have sections

Jordan Rupprecht via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 16 12:20:04 PDT 2019


rupprecht added a reviewer: MaskRay.
rupprecht added a comment.

I can't reproduce the test case -- it seems llvm-readelf already prints the `NT_GNU_BUILD_ID` when I follow the test steps.



================
Comment at: llvm/test/tools/llvm-readobj/gnu-notes.test:6
 # RUN: llvm-readobj --notes %t1.so | FileCheck %s --check-prefix=LLVM
+# RUN: llvm-objcopy --strip-all %t1.so
+# RUN: llvm-readobj --notes %t1.so | FileCheck %s --check-prefix=LLVM-STRIPPED
----------------
Copy this to %t2.so so the original %t1.so is unaffected - e.g. if someone reruns one of these commands to debug a test failure, they should get the unstripped one with %t1.so even if the rest of the test case runs.


================
Comment at: llvm/test/tools/llvm-readobj/gnu-notes.test:7
+# RUN: llvm-objcopy --strip-all %t1.so
+# RUN: llvm-readobj --notes %t1.so | FileCheck %s --check-prefix=LLVM-STRIPPED
 
----------------
Can you add the corresponding FileCheck for llvm-readelf?


================
Comment at: llvm/tools/llvm-readobj/ELFDumper.cpp:4505
 
-  if (Obj->getHeader()->e_type == ELF::ET_CORE) {
+  if (Obj->getHeader()->e_type == ELF::ET_CORE || Obj->sections()->empty()) {
     for (const auto &P :
----------------
Can you add this to `LLVMStyle<ELFT>::printNotes` too?


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66358/new/

https://reviews.llvm.org/D66358





More information about the llvm-commits mailing list