[PATCH] D62848: [llvm-objdump] - Disassemble non-executable sections if specifically requested.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 4 03:30:35 PDT 2019


grimar updated this revision to Diff 202894.
grimar added a comment.

- Updated test case.


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

https://reviews.llvm.org/D62848

Files:
  test/tools/llvm-objdump/X86/section-filter-relocs.test
  tools/llvm-objdump/llvm-objdump.cpp


Index: tools/llvm-objdump/llvm-objdump.cpp
===================================================================
--- tools/llvm-objdump/llvm-objdump.cpp
+++ tools/llvm-objdump/llvm-objdump.cpp
@@ -1095,7 +1095,8 @@
   array_pod_sort(AbsoluteSymbols.begin(), AbsoluteSymbols.end());
 
   for (const SectionRef &Section : ToolSectionFilter(*Obj)) {
-    if (!DisassembleAll && (!Section.isText() || Section.isVirtual()))
+    if (FilterSections.empty() && !DisassembleAll &&
+        (!Section.isText() || Section.isVirtual()))
       continue;
 
     uint64_t SectionAddr = Section.getAddress();
Index: test/tools/llvm-objdump/X86/section-filter-relocs.test
===================================================================
--- test/tools/llvm-objdump/X86/section-filter-relocs.test
+++ test/tools/llvm-objdump/X86/section-filter-relocs.test
@@ -5,12 +5,8 @@
 ## and that only the specified executable sections are disassembled.
 ## Also show that no relocation sections are dumped because none are
 ## specified.
-## FIXME: This is different behaviour to GNU objdump, which dumps the non-
-##        executable sections if requested explicitly.
-##        See https://bugs.llvm.org/show_bug.cgi?id=41897.
 # RUN: llvm-objdump -d -r %t.o --section=.text --section=.rodata \
-# RUN:   | FileCheck %s --check-prefixes=DISASM,RELOC --implicit-check-not=.text2 \
-# RUN:           --implicit-check-not=.rodata
+# RUN:   | FileCheck %s --check-prefixes=DISASM,RELOC --implicit-check-not=.text2
 
 # DISASM:       Disassembly of section .text:
 # DISASM-EMPTY:
@@ -18,6 +14,12 @@
 # DISASM-NEXT:  400: e8 00 00 00 00                callq   0 <.text+0x5>
 # RELOC-NEXT:                      00000401:  R_X86_64_PC32        foo+1
 # RELOC-NEXT:                      00000401:  R_X86_64_GOT32       foo
+# DISASM:       Disassembly of section .rodata:
+# DISASM-EMPTY:
+# DISASM-NEXT:  0000000000000000 .rodata:
+# DISASM-NEXT:  0: 00 00                           addb    %al, (%rax)
+# RELOC-NEXT:              0000000000000000:  R_X86_64_NONE        foo
+# DISASM-NEXT:  2: 00 00                           addb    %al, (%rax)
 
 --- !ELF
 FileHeader:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62848.202894.patch
Type: text/x-patch
Size: 2143 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190604/904eaf44/attachment.bin>


More information about the llvm-commits mailing list