[PATCH] D68303: [llvm-objdump] Also suppress --dyn-relocs when --disassemble is provided
Jordan Rupprecht via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 1 14:36:41 PDT 2019
rupprecht created this revision.
rupprecht added a reviewer: jhenderson.
Herald added subscribers: llvm-commits, seiya.
Herald added a project: LLVM.
This suppression is currently enabled for --relocs, but not --dyn-relocs. Apply it there for consistency, as well as matching GNU objdump behavior.
Split off from D68066 <https://reviews.llvm.org/D68066> which rearranges objdump sections.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D68303
Files:
llvm/test/tools/llvm-objdump/X86/elf-disassemble-dynamic-relocs.test
llvm/tools/llvm-objdump/llvm-objdump.cpp
Index: llvm/tools/llvm-objdump/llvm-objdump.cpp
===================================================================
--- llvm/tools/llvm-objdump/llvm-objdump.cpp
+++ llvm/tools/llvm-objdump/llvm-objdump.cpp
@@ -2085,7 +2085,7 @@
disassembleObject(O, Relocations);
if (Relocations && !Disassemble)
printRelocations(O);
- if (DynamicRelocations)
+ if (DynamicRelocations && !Disassemble)
printDynamicRelocations(O);
if (PrivateHeaders || FirstPrivateHeader)
printPrivateFileHeaders(O, FirstPrivateHeader);
Index: llvm/test/tools/llvm-objdump/X86/elf-disassemble-dynamic-relocs.test
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-objdump/X86/elf-disassemble-dynamic-relocs.test
@@ -0,0 +1,61 @@
+## Show that --disassemble + --dynamic-reloc prints relocations inline and
+## does not dump the relocation sections.
+
+# RUN: yaml2obj %s -o %t.o
+# RUN: llvm-objdump %t.o --dynamic-reloc | \
+# RUN: FileCheck %s --check-prefix=DYN-RELOC --implicit-check-not=Disassembly
+# RUN: llvm-objdump %t.o --disassemble --dynamic-reloc | \
+# RUN: FileCheck %s --implicit-check-not="DYNAMIC RELOCATION RECORDS"
+
+# DYN-RELOC: DYNAMIC RELOCATION RECORDS
+
+# CHECK: Disassembly of section .text:
+# CHECK: e8 55 00 00 00 callq 85 <bar at plt>
+
+--- !ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_DYN
+ Machine: EM_X86_64
+Sections:
+ - Name: .rela.plt
+ Type: SHT_RELA
+ Flags: [ SHF_ALLOC ]
+ Address: 0x0000000000000400
+ Link: .dynsym
+ Info: .got.plt
+ Relocations:
+ - Offset: 0x0000000000003838
+ Symbol: bar
+ Type: R_X86_64_JUMP_SLOT
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ Address: 0x0000000000001520
+ Content: 488D3DF1220000488D05EA2200004839F87415488B05BE1200004885C07409FFE00F1F8000000000C30F1F8000000000488D3DC1220000488D35BA2200004829FE48C1FE034889F048C1E83F4801C648D1FE7414488B05851200004885C07408FFE0660F1F440000C30F1F8000000000803DA922000000752F5548833D66120000004889E5740C488B3D62220000E87D000000E868FFFFFFC60581220000015DC30F1F8000000000C30F1F8000000000E97BFFFFFFCCCCCCCCCCCCCCCCCCCCCC554889E5B000E855000000C3
+ - Name: .plt
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ Address: 0x0000000000001620
+ Content: FF35FA210000FF25FC2100000F1F4000FF25FA2100006800000000E9E0FFFFFFFF25F22100006801000000E9D0FFFFFF
+ - Name: .dynamic
+ Type: SHT_DYNAMIC
+ Flags: [ SHF_WRITE, SHF_ALLOC ]
+ Link: .dynstr
+ EntSize: 0x0000000000000010
+ Entries:
+ - Tag: DT_JMPREL
+ Value: 0x0000000000000400
+ - Tag: DT_NULL
+ Value: 0x0000000000000000
+ - Name: .got.plt
+ Type: SHT_PROGBITS
+DynamicSymbols:
+ - Name: bar
+ Binding: STB_GLOBAL
+ - Name: foo
+ Type: STT_FUNC
+ Section: .text
+ Binding: STB_GLOBAL
+ Value: 0x00000000000015E0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68303.222713.patch
Type: text/x-patch
Size: 3346 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191001/1f0f7bf1/attachment.bin>
More information about the llvm-commits
mailing list