[PATCH] D35240: [llvm-objdump] Correctly distinguish between the MachO upper/lower16 relocations
Martin Storsjö via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 11 02:40:25 PDT 2017
mstorsjo created this revision.
Herald added a subscriber: javed.absar.
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.
https://reviews.llvm.org/D35240
Files:
test/tools/llvm-objdump/ARM/Inputs/reloc-half.obj.macho-arm
test/tools/llvm-objdump/ARM/macho-reloc-half.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
@@ -1035,7 +1035,7 @@
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:(";
Index: test/tools/llvm-objdump/ARM/macho-reloc-half.test
===================================================================
--- /dev/null
+++ test/tools/llvm-objdump/ARM/macho-reloc-half.test
@@ -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)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35240.105981.patch
Type: text/x-patch
Size: 983 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170711/5da33a88/attachment.bin>
More information about the llvm-commits
mailing list