[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
Wed Jul 12 22:54:42 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL307882: [llvm-objdump] Correctly distinguish between the MachO upper/lower16 relocations (authored by mstorsjo).

Changed prior to commit:
  https://reviews.llvm.org/D35240?vs=105981&id=106379#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D35240

Files:
  llvm/trunk/test/tools/llvm-objdump/ARM/Inputs/reloc-half.obj.macho-arm
  llvm/trunk/test/tools/llvm-objdump/ARM/macho-reloc-half.test
  llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp


Index: llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
===================================================================
--- llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
+++ llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
@@ -1032,7 +1032,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: llvm/trunk/test/tools/llvm-objdump/ARM/macho-reloc-half.test
===================================================================
--- llvm/trunk/test/tools/llvm-objdump/ARM/macho-reloc-half.test
+++ llvm/trunk/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.106379.patch
Type: text/x-patch
Size: 1089 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170713/344c2b1c/attachment.bin>


More information about the llvm-commits mailing list