llvm-6502/test/MC/ARM/symbol-variants.s
David Peixotto 0fc8c68b11 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
2013-12-04 22:43:20 +00:00

68 lines
1.4 KiB
ArmAsm

@ 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