diff options
author | Lewis Revill <lewis.revill@embecosm.com> | 2019-04-23 14:46:13 +0000 |
---|---|---|
committer | Lewis Revill <lewis.revill@embecosm.com> | 2019-04-23 14:46:13 +0000 |
commit | df3cb477a314a3c3abbbfbbfa2e88245bcfa325f (patch) | |
tree | 00e1c3f3f730e4bbd7647e1c00f4c0bab3228197 /llvm/test/MC | |
parent | 9fc422830a9003eaf9d649e07486e4d985d68a8f (diff) | |
download | bcm5719-llvm-df3cb477a314a3c3abbbfbbfa2e88245bcfa325f.tar.gz bcm5719-llvm-df3cb477a314a3c3abbbfbbfa2e88245bcfa325f.zip |
[RISCV] Support assembling %tls_{ie,gd}_pcrel_hi modifiers
This patch adds support for parsing and assembling the %tls_ie_pcrel_hi
and %tls_gd_pcrel_hi modifiers.
Differential Revision: https://reviews.llvm.org/D55342
llvm-svn: 358994
Diffstat (limited to 'llvm/test/MC')
-rw-r--r-- | llvm/test/MC/RISCV/relocations.s | 32 | ||||
-rw-r--r-- | llvm/test/MC/RISCV/rv32i-invalid.s | 12 |
2 files changed, 38 insertions, 6 deletions
diff --git a/llvm/test/MC/RISCV/relocations.s b/llvm/test/MC/RISCV/relocations.s index 44a5d08f81e..10a28903906 100644 --- a/llvm/test/MC/RISCV/relocations.s +++ b/llvm/test/MC/RISCV/relocations.s @@ -129,6 +129,38 @@ sb t1, %pcrel_lo(.L2)(a2) # INSTR: sb t1, %pcrel_lo(.L2)(a2) # FIXUP: fixup A - offset: 0, value: %pcrel_lo(.L2), kind: fixup_riscv_pcrel_lo12_s +.L3: +auipc t1, %tls_ie_pcrel_hi(foo) +# RELOC: R_RISCV_TLS_GOT_HI20 foo 0x0 +# INSTR: auipc t1, %tls_ie_pcrel_hi(foo) +# FIXUP: fixup A - offset: 0, value: %tls_ie_pcrel_hi(foo), kind: fixup_riscv_tls_got_hi20 + +addi t1, t1, %pcrel_lo(.L3) +# RELOC: R_RISCV_PCREL_LO12_I .L3 0x0 +# INSTR: addi t1, t1, %pcrel_lo(.L3) +# FIXUP: fixup A - offset: 0, value: %pcrel_lo(.L3), kind: fixup_riscv_pcrel_lo12_i + +sb t1, %pcrel_lo(.L3)(a2) +# RELOC: R_RISCV_PCREL_LO12_S .L3 0x0 +# INSTR: sb t1, %pcrel_lo(.L3)(a2) +# FIXUP: fixup A - offset: 0, value: %pcrel_lo(.L3), kind: fixup_riscv_pcrel_lo12_s + +.L4: +auipc t1, %tls_gd_pcrel_hi(foo) +# RELOC: R_RISCV_TLS_GD_HI20 foo 0x0 +# INSTR: auipc t1, %tls_gd_pcrel_hi(foo) +# FIXUP: fixup A - offset: 0, value: %tls_gd_pcrel_hi(foo), kind: fixup_riscv_tls_gd_hi20 + +addi t1, t1, %pcrel_lo(.L4) +# RELOC: R_RISCV_PCREL_LO12_I .L4 0x0 +# INSTR: addi t1, t1, %pcrel_lo(.L4) +# FIXUP: fixup A - offset: 0, value: %pcrel_lo(.L4), kind: fixup_riscv_pcrel_lo12_i + +sb t1, %pcrel_lo(.L4)(a2) +# RELOC: R_RISCV_PCREL_LO12_S .L4 0x0 +# INSTR: sb t1, %pcrel_lo(.L4)(a2) +# FIXUP: fixup A - offset: 0, value: %pcrel_lo(.L4), kind: fixup_riscv_pcrel_lo12_s + add t1, t1, tp, %tprel_add(foo) # RELOC: R_RISCV_TPREL_ADD foo 0x0 # INSTR: add t1, t1, tp, %tprel_add(foo) diff --git a/llvm/test/MC/RISCV/rv32i-invalid.s b/llvm/test/MC/RISCV/rv32i-invalid.s index dcd9b965564..e8be186997f 100644 --- a/llvm/test/MC/RISCV/rv32i-invalid.s +++ b/llvm/test/MC/RISCV/rv32i-invalid.s @@ -40,7 +40,7 @@ bgeu t0, t1, -13 # CHECK: :[[@LINE]]:14: error: immediate must be a multiple of ## uimm20 lui a0, -1 # CHECK: :[[@LINE]]:9: error: operand must be a symbol with %hi/%tprel_hi modifier or an integer in the range [0, 1048575] lui s0, 1048576 # CHECK: :[[@LINE]]:9: error: operand must be a symbol with %hi/%tprel_hi modifier or an integer in the range [0, 1048575] -auipc zero, -0xf # CHECK: :[[@LINE]]:13: error: operand must be a symbol with a %pcrel_hi/%got_pcrel_hi modifier or an integer in the range [0, 1048575] +auipc zero, -0xf # CHECK: :[[@LINE]]:13: error: operand must be a symbol with a %pcrel_hi/%got_pcrel_hi/%tls_ie_pcrel_hi/%tls_gd_pcrel_hi modifier or an integer in the range [0, 1048575] ## simm21_lsb0 jal gp, -1048578 # CHECK: :[[@LINE]]:9: error: immediate must be a multiple of 2 bytes in the range [-1048576, 1048574] @@ -105,7 +105,7 @@ bgeu t0, t1, %pcrel_lo(d) # CHECK: :[[@LINE]]:14: error: immediate must be a mul ## uimm20 lui a0, %lo(1) # CHECK: :[[@LINE]]:9: error: operand must be a symbol with %hi/%tprel_hi modifier or an integer in the range [0, 1048575] -auipc a1, %lo(foo) # CHECK: :[[@LINE]]:11: error: operand must be a symbol with a %pcrel_hi/%got_pcrel_hi modifier or an integer in the range [0, 1048575] +auipc a1, %lo(foo) # CHECK: :[[@LINE]]:11: error: operand must be a symbol with a %pcrel_hi/%got_pcrel_hi/%tls_ie_pcrel_hi/%tls_gd_pcrel_hi modifier or an integer in the range [0, 1048575] ## simm21_lsb0 jal gp, %lo(1) # CHECK: :[[@LINE]]:9: error: immediate must be a multiple of 2 bytes in the range [-1048576, 1048574] @@ -125,10 +125,10 @@ lui a0, %lo(foo) # CHECK: :[[@LINE]]:9: error: operand must be a symbol with %hi lui a0, %pcrel_lo(foo) # CHECK: :[[@LINE]]:9: error: operand must be a symbol with %hi/%tprel_hi modifier or an integer in the range [0, 1048575] lui a0, %pcrel_hi(foo) # CHECK: :[[@LINE]]:9: error: operand must be a symbol with %hi/%tprel_hi modifier or an integer in the range [0, 1048575] -auipc a0, foo # CHECK: :[[@LINE]]:11: error: operand must be a symbol with a %pcrel_hi/%got_pcrel_hi modifier or an integer in the range [0, 1048575] -auipc a0, %lo(foo) # CHECK: :[[@LINE]]:11: error: operand must be a symbol with a %pcrel_hi/%got_pcrel_hi modifier or an integer in the range [0, 1048575] -auipc a0, %hi(foo) # CHECK: :[[@LINE]]:11: error: operand must be a symbol with a %pcrel_hi/%got_pcrel_hi modifier or an integer in the range [0, 1048575] -auipc a0, %pcrel_lo(foo) # CHECK: :[[@LINE]]:11: error: operand must be a symbol with a %pcrel_hi/%got_pcrel_hi modifier or an integer in the range [0, 1048575] +auipc a0, foo # CHECK: :[[@LINE]]:11: error: operand must be a symbol with a %pcrel_hi/%got_pcrel_hi/%tls_ie_pcrel_hi/%tls_gd_pcrel_hi modifier or an integer in the range [0, 1048575] +auipc a0, %lo(foo) # CHECK: :[[@LINE]]:11: error: operand must be a symbol with a %pcrel_hi/%got_pcrel_hi/%tls_ie_pcrel_hi/%tls_gd_pcrel_hi modifier or an integer in the range [0, 1048575] +auipc a0, %hi(foo) # CHECK: :[[@LINE]]:11: error: operand must be a symbol with a %pcrel_hi/%got_pcrel_hi/%tls_ie_pcrel_hi/%tls_gd_pcrel_hi modifier or an integer in the range [0, 1048575] +auipc a0, %pcrel_lo(foo) # CHECK: :[[@LINE]]:11: error: operand must be a symbol with a %pcrel_hi/%got_pcrel_hi/%tls_ie_pcrel_hi/%tls_gd_pcrel_hi modifier or an integer in the range [0, 1048575] # TP-relative symbol names require a %tprel_add modifier. add a0, a0, tp, zero # CHECK: :[[@LINE]]:17: error: expected '%' for operand modifier |