[llvm] r307882 - [llvm-objdump] Correctly distinguish between the MachO upper/lower16 relocations
Martin Storsjo via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 12 22:54:08 PDT 2017
Author: mstorsjo
Date: Wed Jul 12 22:54:08 2017
New Revision: 307882
URL: http://llvm.org/viewvc/llvm-project?rev=307882&view=rev
Log:
[llvm-objdump] Correctly distinguish between the MachO upper/lower16 relocations
All other code in MachODump.cpp uses the same comparison,
((r_length & 0x1) == 1), for distinguishing between the two,
while the code in llvm-objdump.cpp seemed to be incorrect.
Differential Revision: https://reviews.llvm.org/D35240
Added:
llvm/trunk/test/tools/llvm-objdump/ARM/Inputs/reloc-half.obj.macho-arm
llvm/trunk/test/tools/llvm-objdump/ARM/macho-reloc-half.test
Modified:
llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
Added: llvm/trunk/test/tools/llvm-objdump/ARM/Inputs/reloc-half.obj.macho-arm
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objdump/ARM/Inputs/reloc-half.obj.macho-arm?rev=307882&view=auto
==============================================================================
Binary files llvm/trunk/test/tools/llvm-objdump/ARM/Inputs/reloc-half.obj.macho-arm (added) and llvm/trunk/test/tools/llvm-objdump/ARM/Inputs/reloc-half.obj.macho-arm Wed Jul 12 22:54:08 2017 differ
Added: llvm/trunk/test/tools/llvm-objdump/ARM/macho-reloc-half.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objdump/ARM/macho-reloc-half.test?rev=307882&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-objdump/ARM/macho-reloc-half.test (added)
+++ llvm/trunk/test/tools/llvm-objdump/ARM/macho-reloc-half.test Wed Jul 12 22:54:08 2017
@@ -0,0 +1,4 @@
+RUN: llvm-objdump -r %p/Inputs/reloc-half.obj.macho-arm | FileCheck %s
+
+CHECK-DAG: 00000004 ARM_RELOC_HALF :upper16:(_stringbuf)
+CHECK-DAG: 00000000 ARM_RELOC_HALF :lower16:(_stringbuf)
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=307882&r1=307881&r2=307882&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp (original)
+++ llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp Wed Jul 12 22:54:08 2017
@@ -1032,7 +1032,7 @@ static std::error_code getRelocationValu
case MachO::ARM_RELOC_HALF_SECTDIFF: {
// Half relocations steal a bit from the length field to encode
// whether this is an upper16 or a lower16 relocation.
- bool isUpper = Obj->getAnyRelocationLength(RE) >> 1;
+ bool isUpper = (Obj->getAnyRelocationLength(RE) & 0x1) == 1;
if (isUpper)
fmt << ":upper16:(";
More information about the llvm-commits
mailing list