[llvm] r345703 - [llvm-objdump] Add --reloc alias for -r (PR39407)
Kristina Brooks via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 31 02:34:08 PDT 2018
Author: kristina
Date: Wed Oct 31 02:34:08 2018
New Revision: 345703
URL: http://llvm.org/viewvc/llvm-project?rev=345703&view=rev
Log:
[llvm-objdump] Add --reloc alias for -r (PR39407)
This addresses PR39407 (https://bugs.llvm.org/show_bug.cgi?id=39407)
improving compatibility with GNU binutils counterparts.
Reviewed By: kristina
Patch by Higuoxing (Xing).
Differential Revision: https://reviews.llvm.org/D53804
Added:
llvm/trunk/test/tools/llvm-objdump/relocations-elf.test
Modified:
llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
Added: llvm/trunk/test/tools/llvm-objdump/relocations-elf.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objdump/relocations-elf.test?rev=345703&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-objdump/relocations-elf.test (added)
+++ llvm/trunk/test/tools/llvm-objdump/relocations-elf.test Wed Oct 31 02:34:08 2018
@@ -0,0 +1,73 @@
+# RUN: yaml2obj %s > %t
+# RUN: llvm-objdump --reloc %t | FileCheck %s
+# RUN: llvm-objdump -r %t | FileCheck %s
+
+# CHECK: RELOCATION RECORDS FOR [.rel.text]:
+# CHECK: 0000000000000001 R_X86_64_32 glob1
+# CHECK: 0000000000000001 R_X86_64_32S glob2
+# CHECK: 0000000000000002 R_X86_64_64 loc1
+
+# CHECK: RELOCATION RECORDS FOR [.rela.text]:
+# CHECK: 0000000000000001 R_X86_64_32 glob1+1
+# CHECK: 0000000000000001 R_X86_64_32S glob2+2
+# CHECK: 0000000000000002 R_X86_64_64 loc1+3
+
+!ELF
+FileHeader: !FileHeader
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_X86_64
+
+Sections:
+- Name: .text
+ Type: SHT_PROGBITS
+ Content: "0000000000000000"
+ AddressAlign: 16
+ Flags: [SHF_ALLOC]
+
+- Name: .rel.text
+ Type: SHT_REL
+ Info: .text
+ AddressAlign: 4
+ Relocations:
+ - Offset: 0x1
+ Symbol: glob1
+ Type: R_X86_64_32
+ - Offset: 0x1
+ Symbol: glob2
+ Type: R_X86_64_32S
+ - Offset: 0x2
+ Symbol: loc1
+ Type: R_X86_64_64
+
+- Name: .rela.text
+ Type: SHT_RELA
+ Link: .symtab
+ Info: .text
+ AddressAlign: 4
+ Relocations:
+ - Offset: 0x1
+ Addend: 1
+ Symbol: glob1
+ Type: R_X86_64_32
+ - Offset: 0x1
+ Addend: 2
+ Symbol: glob2
+ Type: R_X86_64_32S
+ - Offset: 0x2
+ Addend: 3
+ Symbol: loc1
+ Type: R_X86_64_64
+
+Symbols:
+ Local:
+ - Name: loc1
+ - Name: loc2
+ Global:
+ - Name: glob1
+ Section: .text
+ Value: 0x0
+ Size: 4
+ - Name: glob2
+
Modified: llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp?rev=345703&r1=345702&r2=345703&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp (original)
+++ llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp Wed Oct 31 02:34:08 2018
@@ -106,7 +106,11 @@ DisassembleFunctions("df",
static StringSet<> DisasmFuncsSet;
cl::opt<bool>
-llvm::Relocations("r", cl::desc("Display the relocation entries in the file"));
+llvm::Relocations("reloc",
+ cl::desc("Display the relocation entries in the file"));
+static cl::alias RelocationsShort("r", cl::desc("Alias for --reloc"),
+ cl::NotHidden,
+ cl::aliasopt(llvm::Relocations));
cl::opt<bool>
llvm::DynamicRelocations("dynamic-reloc",
More information about the llvm-commits
mailing list