[llvm] r333525 - AArch64: print correct annotation for ADRP addresses.

Tim Northover via llvm-commits llvm-commits at lists.llvm.org
Wed May 30 02:55:00 PDT 2018


Author: tnorthover
Date: Wed May 30 02:54:59 2018
New Revision: 333525

URL: http://llvm.org/viewvc/llvm-project?rev=333525&view=rev
Log:
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.

Added:
    llvm/trunk/test/MC/AArch64/adrp-annotation.s
Modified:
    llvm/trunk/lib/Target/AArch64/Disassembler/AArch64ExternalSymbolizer.cpp

Modified: llvm/trunk/lib/Target/AArch64/Disassembler/AArch64ExternalSymbolizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/Disassembler/AArch64ExternalSymbolizer.cpp?rev=333525&r1=333524&r2=333525&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/Disassembler/AArch64ExternalSymbolizer.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/Disassembler/AArch64ExternalSymbolizer.cpp Wed May 30 02:54:59 2018
@@ -99,8 +99,8 @@ bool AArch64ExternalSymbolizer::tryAddin
         EncodedInst |= MCRI.getEncodingValue(MI.getOperand(0).getReg()); // reg
         SymbolLookUp(DisInfo, EncodedInst, &ReferenceType, Address,
                      &ReferenceName);
-        CommentStream << format("0x%llx",
-                                0xfffffffffffff000LL & (Address + Value));
+        CommentStream << format("0x%llx", (0xfffffffffffff000LL & Address) +
+                                              Value * 0x1000);
     } else if (MI.getOpcode() == AArch64::ADDXri ||
                MI.getOpcode() == AArch64::LDRXui ||
                MI.getOpcode() == AArch64::LDRXl ||

Added: llvm/trunk/test/MC/AArch64/adrp-annotation.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AArch64/adrp-annotation.s?rev=333525&view=auto
==============================================================================
--- llvm/trunk/test/MC/AArch64/adrp-annotation.s (added)
+++ llvm/trunk/test/MC/AArch64/adrp-annotation.s Wed May 30 02:54:59 2018
@@ -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




More information about the llvm-commits mailing list