Bläddra i källkod

AArch64: print correct annotation for ADRP addresses.

The immediate on an ADRP MCInst needs to be multiplied by 0x1000 to obtain the
actual PC-offset that will be calculated.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333525 91177308-0d34-0410-b5e6-96231b3b80d8
Tim Northover 7 år sedan
förälder
incheckning
adcf643e71

+ 2 - 2
lib/Target/AArch64/Disassembler/AArch64ExternalSymbolizer.cpp

@@ -99,8 +99,8 @@ bool AArch64ExternalSymbolizer::tryAddingSymbolicOperand(
         EncodedInst |= MCRI.getEncodingValue(MI.getOperand(0).getReg()); // reg
         EncodedInst |= MCRI.getEncodingValue(MI.getOperand(0).getReg()); // reg
         SymbolLookUp(DisInfo, EncodedInst, &ReferenceType, Address,
         SymbolLookUp(DisInfo, EncodedInst, &ReferenceType, Address,
                      &ReferenceName);
                      &ReferenceName);
-        CommentStream << format("0x%llx",
-                                0xfffffffffffff000LL & (Address + Value));
+        CommentStream << format("0x%llx", (0xfffffffffffff000LL & Address) +
+                                              Value * 0x1000);
     } else if (MI.getOpcode() == AArch64::ADDXri ||
     } else if (MI.getOpcode() == AArch64::ADDXri ||
                MI.getOpcode() == AArch64::LDRXui ||
                MI.getOpcode() == AArch64::LDRXui ||
                MI.getOpcode() == AArch64::LDRXl ||
                MI.getOpcode() == AArch64::LDRXl ||

+ 9 - 0
test/MC/AArch64/adrp-annotation.s

@@ -0,0 +1,9 @@
+; RUN: llvm-mc -triple aarch64-apple-ios %s -filetype=obj -o %t.o
+; RUN: llvm-objdump -macho -d %t.o | FileCheck %s
+
+  .data_region
+  .space 0x4124
+  .end_data_region
+
+  ; CHECK: 4124{{.*}}adrp x0, 5 ; 0x9000
+  adrp x0, #0x5000