summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDavid Peixotto <dpeixott@codeaurora.org>2013-12-04 22:43:20 +0000
committerDavid Peixotto <dpeixott@codeaurora.org>2013-12-04 22:43:20 +0000
commit0fc8c68b11a05aa276a066922d3c076034f1e37a (patch)
tree15f325e4c4ef45d1af86a649894de6fa679231a1 /test
parent6b2011a4a3e5dc10af33407b3f2a5c7e53274b49 (diff)
downloadllvm-0fc8c68b11a05aa276a066922d3c076034f1e37a.tar.gz
llvm-0fc8c68b11a05aa276a066922d3c076034f1e37a.tar.bz2
llvm-0fc8c68b11a05aa276a066922d3c076034f1e37a.tar.xz
Add support for parsing ARM symbol variants on ELF targets
ARM symbol variants are written with parens instead of @ like this: .word __GLOBAL_I_a(target1) This commit adds support for parsing these symbol variants in expressions. We introduce a new flag to MCAsmInfo that indicates the parser should use parens to parse the symbol variant. The expression parser is modified to look for symbol variants using parens instead of @ when the corresponding MCAsmInfo flag is true. The MCAsmInfo parens flag is enabled only for ARM on ELF. By adding this flag to MCAsmInfo, we are able to get rid of redundant ARM-specific symbol variants and use the generic variants instead (e.g. VK_GOT instead of VK_ARM_GOT). We use the new UseParensForSymbolVariant attribute in MCAsmInfo to correctly print the symbol variants for arm. To achive this we need to keep a handle to the MCAsmInfo in the MCSymbolRefExpr class that we can check when printing the symbol variant. Updated Tests: Changed case of symbol variant to match the generic kind. test/CodeGen/ARM/tls-models.ll test/CodeGen/ARM/tls1.ll test/CodeGen/ARM/tls2.ll test/CodeGen/Thumb2/tls1.ll test/CodeGen/Thumb2/tls2.ll PR18080 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196424 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/CodeGen/ARM/tls-models.ll32
-rw-r--r--test/CodeGen/ARM/tls1.ll2
-rw-r--r--test/CodeGen/ARM/tls2.ll4
-rw-r--r--test/CodeGen/Thumb2/tls1.ll2
-rw-r--r--test/CodeGen/Thumb2/tls2.ll4
-rw-r--r--test/MC/ARM/symbol-variants-errors.s23
-rw-r--r--test/MC/ARM/symbol-variants.s67
7 files changed, 112 insertions, 22 deletions
diff --git a/test/CodeGen/ARM/tls-models.ll b/test/CodeGen/ARM/tls-models.ll
index ccc9032313..42c1ba9110 100644
--- a/test/CodeGen/ARM/tls-models.ll
+++ b/test/CodeGen/ARM/tls-models.ll
@@ -22,9 +22,9 @@ entry:
; Non-PIC code can use initial-exec, PIC code has to use general dynamic.
; CHECK-NONPIC-LABEL: f1:
- ; CHECK-NONPIC: external_gd(gottpoff)
+ ; CHECK-NONPIC: external_gd(GOTTPOFF)
; CHECK-PIC-LABEL: f1:
- ; CHECK-PIC: external_gd(tlsgd)
+ ; CHECK-PIC: external_gd(TLSGD)
}
define i32* @f2() {
@@ -34,9 +34,9 @@ entry:
; Non-PIC code can use local exec, PIC code can use local dynamic,
; but that is not implemented, so falls back to general dynamic.
; CHECK-NONPIC-LABEL: f2:
- ; CHECK-NONPIC: internal_gd(tpoff)
+ ; CHECK-NONPIC: internal_gd(TPOFF)
; CHECK-PIC-LABEL: f2:
- ; CHECK-PIC: internal_gd(tlsgd)
+ ; CHECK-PIC: internal_gd(TLSGD)
}
@@ -49,9 +49,9 @@ entry:
; Non-PIC code can use initial exec, PIC should use local dynamic,
; but that is not implemented, so falls back to general dynamic.
; CHECK-NONPIC-LABEL: f3:
- ; CHECK-NONPIC: external_ld(gottpoff)
+ ; CHECK-NONPIC: external_ld(GOTTPOFF)
; CHECK-PIC-LABEL: f3:
- ; CHECK-PIC: external_ld(tlsgd)
+ ; CHECK-PIC: external_ld(TLSGD)
}
define i32* @f4() {
@@ -61,9 +61,9 @@ entry:
; Non-PIC code can use local exec, PIC code can use local dynamic,
; but that is not implemented, so it falls back to general dynamic.
; CHECK-NONPIC-LABEL: f4:
- ; CHECK-NONPIC: internal_ld(tpoff)
+ ; CHECK-NONPIC: internal_ld(TPOFF)
; CHECK-PIC-LABEL: f4:
- ; CHECK-PIC: internal_ld(tlsgd)
+ ; CHECK-PIC: internal_ld(TLSGD)
}
@@ -75,9 +75,9 @@ entry:
; Non-PIC and PIC code will use initial exec as specified.
; CHECK-NONPIC-LABEL: f5:
- ; CHECK-NONPIC: external_ie(gottpoff)
+ ; CHECK-NONPIC: external_ie(GOTTPOFF)
; CHECK-PIC-LABEL: f5:
- ; CHECK-PIC: external_ie(gottpoff)
+ ; CHECK-PIC: external_ie(GOTTPOFF)
}
define i32* @f6() {
@@ -86,9 +86,9 @@ entry:
; Non-PIC code can use local exec, PIC code use initial exec as specified.
; CHECK-NONPIC-LABEL: f6:
- ; CHECK-NONPIC: internal_ie(tpoff)
+ ; CHECK-NONPIC: internal_ie(TPOFF)
; CHECK-PIC-LABEL: f6:
- ; CHECK-PIC: internal_ie(gottpoff)
+ ; CHECK-PIC: internal_ie(GOTTPOFF)
}
@@ -100,9 +100,9 @@ entry:
; Non-PIC and PIC code will use local exec as specified.
; CHECK-NONPIC-LABEL: f7:
- ; CHECK-NONPIC: external_le(tpoff)
+ ; CHECK-NONPIC: external_le(TPOFF)
; CHECK-PIC-LABEL: f7:
- ; CHECK-PIC: external_le(tpoff)
+ ; CHECK-PIC: external_le(TPOFF)
}
define i32* @f8() {
@@ -111,7 +111,7 @@ entry:
; Non-PIC and PIC code will use local exec as specified.
; CHECK-NONPIC-LABEL: f8:
- ; CHECK-NONPIC: internal_le(tpoff)
+ ; CHECK-NONPIC: internal_le(TPOFF)
; CHECK-PIC-LABEL: f8:
- ; CHECK-PIC: internal_le(tpoff)
+ ; CHECK-PIC: internal_le(TPOFF)
}
diff --git a/test/CodeGen/ARM/tls1.ll b/test/CodeGen/ARM/tls1.ll
index ec4278ce72..a1ca0b758b 100644
--- a/test/CodeGen/ARM/tls1.ll
+++ b/test/CodeGen/ARM/tls1.ll
@@ -1,5 +1,5 @@
; RUN: llc < %s -march=arm -mtriple=arm-linux-gnueabi | \
-; RUN: grep "i(tpoff)"
+; RUN: grep "i(TPOFF)"
; RUN: llc < %s -march=arm -mtriple=arm-linux-gnueabi | \
; RUN: grep "__aeabi_read_tp"
; RUN: llc < %s -march=arm -mtriple=arm-linux-gnueabi \
diff --git a/test/CodeGen/ARM/tls2.ll b/test/CodeGen/ARM/tls2.ll
index f048125831..24b4794b06 100644
--- a/test/CodeGen/ARM/tls2.ll
+++ b/test/CodeGen/ARM/tls2.ll
@@ -8,7 +8,7 @@
define i32 @f() {
; CHECK-NONPIC-LABEL: f:
; CHECK-NONPIC: ldr {{r.}}, [pc, {{r.}}]
-; CHECK-NONPIC: i(gottpoff)
+; CHECK-NONPIC: i(GOTTPOFF)
; CHECK-PIC-LABEL: f:
; CHECK-PIC: __tls_get_addr
entry:
@@ -19,7 +19,7 @@ entry:
define i32* @g() {
; CHECK-NONPIC-LABEL: g:
; CHECK-NONPIC: ldr {{r.}}, [pc, {{r.}}]
-; CHECK-NONPIC: i(gottpoff)
+; CHECK-NONPIC: i(GOTTPOFF)
; CHECK-PIC-LABEL: g:
; CHECK-PIC: __tls_get_addr
entry:
diff --git a/test/CodeGen/Thumb2/tls1.ll b/test/CodeGen/Thumb2/tls1.ll
index d91e3b32f9..40973562d2 100644
--- a/test/CodeGen/Thumb2/tls1.ll
+++ b/test/CodeGen/Thumb2/tls1.ll
@@ -1,5 +1,5 @@
; RUN: llc < %s -mtriple=thumbv7-linux-gnueabi | \
-; RUN: grep "i(tpoff)"
+; RUN: grep "i(TPOFF)"
; RUN: llc < %s -mtriple=thumbv7-linux-gnueabi | \
; RUN: grep "__aeabi_read_tp"
; RUN: llc < %s -mtriple=thumbv7-linux-gnueabi \
diff --git a/test/CodeGen/Thumb2/tls2.ll b/test/CodeGen/Thumb2/tls2.ll
index 6cb019ff00..e6bed2f65a 100644
--- a/test/CodeGen/Thumb2/tls2.ll
+++ b/test/CodeGen/Thumb2/tls2.ll
@@ -8,7 +8,7 @@ entry:
; CHECK-NOT-PIC-LABEL: f:
; CHECK-NOT-PIC: add r0, pc
; CHECK-NOT-PIC: ldr r1, [r0]
-; CHECK-NOT-PIC: i(gottpoff)
+; CHECK-NOT-PIC: i(GOTTPOFF)
; CHECK-PIC-LABEL: f:
; CHECK-PIC: bl __tls_get_addr(PLT)
@@ -21,7 +21,7 @@ entry:
; CHECK-NOT-PIC-LABEL: g:
; CHECK-NOT-PIC: add r0, pc
; CHECK-NOT-PIC: ldr r1, [r0]
-; CHECK-NOT-PIC: i(gottpoff)
+; CHECK-NOT-PIC: i(GOTTPOFF)
; CHECK-PIC-LABEL: g:
; CHECK-PIC: bl __tls_get_addr(PLT)
diff --git a/test/MC/ARM/symbol-variants-errors.s b/test/MC/ARM/symbol-variants-errors.s
new file mode 100644
index 0000000000..03401cd98b
--- /dev/null
+++ b/test/MC/ARM/symbol-variants-errors.s
@@ -0,0 +1,23 @@
+@ RUN: not llvm-mc < %s -triple armv7-none-linux-gnueabi 2>&1 | FileCheck %s
+
+@ check for invalid variant
+f1:
+ bl bar(blargh)
+@CHECK: error: invalid variant 'blargh'
+@CHECK: bl bar(blargh)
+@CHECK: ^
+
+@ check for missing closed paren
+f2:
+ .word bar(got
+@CHECK: error: unexpected token in variant, expected ')'
+@CHECK: .word bar(got
+@CHECK: ^
+
+@ check for invalid symbol before variant end
+f3:
+ .word bar(got+2)
+
+@CHECK: error: unexpected token in variant, expected ')'
+@CHECK: .word bar(got+2)
+@CHECK: ^
diff --git a/test/MC/ARM/symbol-variants.s b/test/MC/ARM/symbol-variants.s
new file mode 100644
index 0000000000..d24d5c790f
--- /dev/null
+++ b/test/MC/ARM/symbol-variants.s
@@ -0,0 +1,67 @@
+@ RUN: llvm-mc < %s -triple armv7-none-linux-gnueabi -filetype=obj | llvm-objdump -triple armv7-none-linux-gnueabi -r - | FileCheck %s --check-prefix=CHECK --check-prefix=ARM
+@ RUN: llvm-mc < %s -triple thumbv7-none-linux-gnueabi -filetype=obj | llvm-objdump -triple thumbv7-none-linux-gnueabi -r - | FileCheck %s --check-prefix=CHECK --check-prefix=THUMB
+
+@ CHECK-LABEL: RELOCATION RECORDS FOR [.rel.text]
+
+@ empty
+.word f00
+.word f01
+@CHECK: 0 R_ARM_ABS32 f00
+@CHECK: 4 R_ARM_ABS32 f01
+
+@ none
+.word f02(NONE)
+.word f03(none)
+@CHECK: 8 R_ARM_NONE f02
+@CHECK: 12 R_ARM_NONE f03
+
+@ plt
+bl f04(PLT)
+bl f05(plt)
+@ARM: 16 R_ARM_PLT32 f04
+@ARM: 20 R_ARM_PLT32 f05
+@THUMB: 16 R_ARM_THM_CALL f04
+@THUMB: 20 R_ARM_THM_CALL f05
+
+@ got
+.word f06(GOT)
+.word f07(got)
+@CHECK: 24 R_ARM_GOT_BREL f06
+@CHECK: 28 R_ARM_GOT_BREL f07
+
+@ gotoff
+.word f08(GOTOFF)
+.word f09(gotoff)
+@CHECK: 32 R_ARM_GOTOFF32 f08
+@CHECK: 36 R_ARM_GOTOFF32 f09
+
+@ tpoff
+.word f10(TPOFF)
+.word f11(tpoff)
+@CHECK: 40 R_ARM_TLS_LE32 f10
+@CHECK: 44 R_ARM_TLS_LE32 f11
+
+@ tlsgd
+.word f12(TLSGD)
+.word f13(tlsgd)
+@CHECK: 48 R_ARM_TLS_GD32 f12
+@CHECK: 52 R_ARM_TLS_GD32 f13
+
+@ target1
+.word f14(TARGET1)
+.word f15(target1)
+@CHECK: 56 R_ARM_TARGET1 f14
+@CHECK: 60 R_ARM_TARGET1 f15
+
+@ target2
+.word f16(TARGET2)
+.word f17(target2)
+@CHECK: 64 R_ARM_TARGET2 f16
+@CHECK: 68 R_ARM_TARGET2 f17
+
+@ prel31
+.word f18(PREL31)
+.word f19(prel31)
+@CHECK: 72 R_ARM_PREL31 f18
+@CHECK: 76 R_ARM_PREL31 f19
+