[llvm] r193534 - Convert a llc -filetype=obj test into a llvm-mc test.
Rafael Espindola
rafael.espindola at gmail.com
Mon Oct 28 13:40:20 PDT 2013
Author: rafael
Date: Mon Oct 28 15:40:20 2013
New Revision: 193534
URL: http://llvm.org/viewvc/llvm-project?rev=193534&view=rev
Log:
Convert a llc -filetype=obj test into a llvm-mc test.
Added:
llvm/trunk/test/MC/AArch64/basic-pic.s
Modified:
llvm/trunk/test/CodeGen/AArch64/basic-pic.ll
Modified: llvm/trunk/test/CodeGen/AArch64/basic-pic.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/basic-pic.ll?rev=193534&r1=193533&r2=193534&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/AArch64/basic-pic.ll (original)
+++ llvm/trunk/test/CodeGen/AArch64/basic-pic.ll Mon Oct 28 15:40:20 2013
@@ -1,10 +1,7 @@
; RUN: llc -mtriple=aarch64-none-linux-gnu -verify-machineinstrs -relocation-model=pic %s -o - | FileCheck %s
-; RUN: llc -mtriple=aarch64-none-linux-gnu -verify-machineinstrs -relocation-model=pic -filetype=obj %s -o -| llvm-objdump -r - | FileCheck --check-prefix=CHECK-ELF %s
@var = global i32 0
-; CHECK-ELF: RELOCATION RECORDS FOR [.rela.text]
-
define i32 @get_globalvar() {
; CHECK-LABEL: get_globalvar:
@@ -13,8 +10,6 @@ define i32 @get_globalvar() {
; CHECK: ldr x[[GOTLOC:[0-9]+]], [x[[GOTHI]], #:got_lo12:var]
; CHECK: ldr w0, [x[[GOTLOC]]]
-; CHECK-ELF: R_AARCH64_ADR_GOT_PAGE var
-; CHECK-ELF: R_AARCH64_LD64_GOT_LO12_NC var
ret i32 %val
}
@@ -25,8 +20,6 @@ define i32* @get_globalvaraddr() {
; CHECK: adrp x[[GOTHI:[0-9]+]], :got:var
; CHECK: ldr x0, [x[[GOTHI]], #:got_lo12:var]
-; CHECK-ELF: R_AARCH64_ADR_GOT_PAGE var
-; CHECK-ELF: R_AARCH64_LD64_GOT_LO12_NC var
ret i32* @var
}
@@ -39,8 +32,6 @@ define i32 @get_hiddenvar() {
; CHECK: adrp x[[HI:[0-9]+]], hiddenvar
; CHECK: ldr w0, [x[[HI]], #:lo12:hiddenvar]
-; CHECK-ELF: R_AARCH64_ADR_PREL_PG_HI21 hiddenvar
-; CHECK-ELF: R_AARCH64_LDST32_ABS_LO12_NC hiddenvar
ret i32 %val
}
@@ -51,8 +42,6 @@ define i32* @get_hiddenvaraddr() {
; CHECK: adrp [[HI:x[0-9]+]], hiddenvar
; CHECK: add x0, [[HI]], #:lo12:hiddenvar
-; CHECK-ELF: R_AARCH64_ADR_PREL_PG_HI21 hiddenvar
-; CHECK-ELF: R_AARCH64_ADD_ABS_LO12_NC hiddenvar
ret i32* @hiddenvar
}
@@ -62,9 +51,4 @@ define void()* @get_func() {
ret void()* bitcast(void()*()* @get_func to void()*)
; CHECK: adrp x[[GOTHI:[0-9]+]], :got:get_func
; CHECK: ldr x0, [x[[GOTHI]], #:got_lo12:get_func]
-
- ; Particularly important that the ADRP gets a relocation, LLVM tends to think
- ; it can relax it because it knows where get_func is. It can't!
-; CHECK-ELF: R_AARCH64_ADR_GOT_PAGE get_func
-; CHECK-ELF: R_AARCH64_LD64_GOT_LO12_NC get_func
}
Added: llvm/trunk/test/MC/AArch64/basic-pic.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AArch64/basic-pic.s?rev=193534&view=auto
==============================================================================
--- llvm/trunk/test/MC/AArch64/basic-pic.s (added)
+++ llvm/trunk/test/MC/AArch64/basic-pic.s Mon Oct 28 15:40:20 2013
@@ -0,0 +1,98 @@
+// RUN: llvm-mc -triple=aarch64-none-linux-gnu -filetype=obj %s -o -| llvm-objdump -r - | FileCheck %s
+
+// CHECK: RELOCATION RECORDS FOR [.rela.text]
+
+ .file "/home/espindola/llvm/llvm/test/CodeGen/AArch64/basic-pic.ll"
+ .text
+ .globl get_globalvar
+ .type get_globalvar, at function
+get_globalvar: // @get_globalvar
+ .cfi_startproc
+// BB#0:
+ adrp x0, :got:var
+ ldr x0, [x0, #:got_lo12:var]
+ ldr w0, [x0]
+ ret
+.Ltmp0:
+ .size get_globalvar, .Ltmp0-get_globalvar
+ .cfi_endproc
+
+// CHECK: R_AARCH64_ADR_GOT_PAGE var
+// CHECK: R_AARCH64_LD64_GOT_LO12_NC var
+
+ .globl get_globalvaraddr
+ .type get_globalvaraddr, at function
+get_globalvaraddr: // @get_globalvaraddr
+ .cfi_startproc
+// BB#0:
+ adrp x0, :got:var
+ ldr x0, [x0, #:got_lo12:var]
+ ret
+.Ltmp1:
+ .size get_globalvaraddr, .Ltmp1-get_globalvaraddr
+ .cfi_endproc
+// CHECK: R_AARCH64_ADR_GOT_PAGE var
+// CHECK: R_AARCH64_LD64_GOT_LO12_NC var
+
+ .globl get_hiddenvar
+ .type get_hiddenvar, at function
+get_hiddenvar: // @get_hiddenvar
+ .cfi_startproc
+// BB#0:
+ adrp x0, hiddenvar
+ ldr w0, [x0, #:lo12:hiddenvar]
+ ret
+.Ltmp2:
+ .size get_hiddenvar, .Ltmp2-get_hiddenvar
+ .cfi_endproc
+// CHECK: R_AARCH64_ADR_PREL_PG_HI21 hiddenvar
+// CHECK: R_AARCH64_LDST32_ABS_LO12_NC hiddenvar
+
+ .globl get_hiddenvaraddr
+ .type get_hiddenvaraddr, at function
+get_hiddenvaraddr: // @get_hiddenvaraddr
+ .cfi_startproc
+// BB#0:
+ adrp x0, hiddenvar
+ add x0, x0, #:lo12:hiddenvar
+ ret
+.Ltmp3:
+ .size get_hiddenvaraddr, .Ltmp3-get_hiddenvaraddr
+ .cfi_endproc
+// CHECK: R_AARCH64_ADR_PREL_PG_HI21 hiddenvar
+// CHECK: R_AARCH64_ADD_ABS_LO12_NC hiddenvar
+
+ .globl get_func
+ .type get_func, at function
+get_func: // @get_func
+ .cfi_startproc
+// BB#0:
+ adrp x0, :got:get_func
+ ldr x0, [x0, #:got_lo12:get_func]
+ ret
+.Ltmp4:
+ .size get_func, .Ltmp4-get_func
+ .cfi_endproc
+
+// Particularly important that the ADRP gets a relocation, LLVM tends to think
+// it can relax it because it knows where get_func is. It can't!
+// CHECK: R_AARCH64_ADR_GOT_PAGE get_func
+// CHECK: R_AARCH64_LD64_GOT_LO12_NC get_func
+
+ .type var, at object // @var
+ .bss
+ .globl var
+ .align 2
+var:
+ .word 0 // 0x0
+ .size var, 4
+
+ .hidden hiddenvar // @hiddenvar
+ .type hiddenvar, at object
+ .globl hiddenvar
+ .align 2
+hiddenvar:
+ .word 0 // 0x0
+ .size hiddenvar, 4
+
+
More information about the llvm-commits
mailing list