diff options
author | Alex Bradbury <asb@lowrisc.org> | 2019-03-22 06:05:52 +0000 |
---|---|---|
committer | Alex Bradbury <asb@lowrisc.org> | 2019-03-22 06:05:52 +0000 |
commit | f8c785bf12136fb6590a144ff1edd3bc9be61ccf (patch) | |
tree | 230c21db8663e13a0d64e03bc9aa8dc9bb429720 /llvm/test/MC/RISCV | |
parent | b865084ef39c64638d95da3dde2039a9fbfec338 (diff) | |
download | bcm5719-llvm-f8c785bf12136fb6590a144ff1edd3bc9be61ccf.tar.gz bcm5719-llvm-f8c785bf12136fb6590a144ff1edd3bc9be61ccf.zip |
[RISCV][NFC] Expand test/MC/RISCV/linker-relaxation.s tests
Add more complete CHECK lines for the relocations generated when relaxation is
enabled, and add cases where a locally defined symbol is referenced.
Two instances of pcrel_lo(defined_symbol) are commented out, as they will
produce an error. A follow-up patch will fix this.
llvm-svn: 356734
Diffstat (limited to 'llvm/test/MC/RISCV')
-rw-r--r-- | llvm/test/MC/RISCV/linker-relaxation.s | 67 |
1 files changed, 62 insertions, 5 deletions
diff --git a/llvm/test/MC/RISCV/linker-relaxation.s b/llvm/test/MC/RISCV/linker-relaxation.s index d4cd6f8ff7d..2455f3bae70 100644 --- a/llvm/test/MC/RISCV/linker-relaxation.s +++ b/llvm/test/MC/RISCV/linker-relaxation.s @@ -13,7 +13,6 @@ .long foo -.L1: call foo # NORELAX-RELOC: R_RISCV_CALL foo 0x0 # NORELAX-RELOC-NOT: R_RISCV_RELAX @@ -21,14 +20,11 @@ call foo # RELAX-RELOC: R_RISCV_RELAX - 0x0 # RELAX-FIXUP: fixup A - offset: 0, value: foo, kind: fixup_riscv_call # RELAX-FIXUP: fixup B - offset: 0, value: 0, kind: fixup_riscv_relax -beq s1, s1, .L1 -# RELAX-RELOC: R_RISCV_BRANCH .L1 0x0 -# RELAX-FIXUP: fixup A - offset: 0, value: .L1, kind: fixup_riscv_branch -# RELAX-FIXUP-NOT: fixup B - offset: 0, value: 0, kind: fixup_riscv_relax lui t1, %hi(foo) # NORELAX-RELOC: R_RISCV_HI20 foo 0x0 # NORELAX-RELOC-NOT: R_RISCV_RELAX +# RELAX-RELOC: R_RISCV_HI20 foo 0x0 # RELAX-RELOC: R_RISCV_RELAX - 0x0 # RELAX-FIXUP: fixup A - offset: 0, value: %hi(foo), kind: fixup_riscv_hi20 # RELAX-FIXUP: fixup B - offset: 0, value: 0, kind: fixup_riscv_relax @@ -36,6 +32,7 @@ lui t1, %hi(foo) addi t1, t1, %lo(foo) # NORELAX-RELOC: R_RISCV_LO12_I foo 0x0 # NORELAX-RELOC-NOT: R_RISCV_RELAX +# RELAX-RELOC: R_RISCV_LO12_I foo 0x0 # RELAX-RELOC: R_RISCV_RELAX - 0x0 # RELAX-FIXUP: fixup A - offset: 0, value: %lo(foo), kind: fixup_riscv_lo12_i # RELAX-FIXUP: fixup B - offset: 0, value: 0, kind: fixup_riscv_relax @@ -43,6 +40,7 @@ addi t1, t1, %lo(foo) sb t1, %lo(foo)(a2) # NORELAX-RELOC: R_RISCV_LO12_S foo 0x0 # NORELAX-RELOC-NOT: R_RISCV_RELAX +# RELAX-RELOC: R_RISCV_LO12_S foo 0x0 # RELAX-RELOC: R_RISCV_RELAX - 0x0 # RELAX-FIXUP: fixup A - offset: 0, value: %lo(foo), kind: fixup_riscv_lo12_s # RELAX-FIXUP: fixup B - offset: 0, value: 0, kind: fixup_riscv_relax @@ -50,6 +48,7 @@ sb t1, %lo(foo)(a2) auipc t1, %pcrel_hi(foo) # NORELAX-RELOC: R_RISCV_PCREL_HI20 foo 0x0 # NORELAX-RELOC-NOT: R_RISCV_RELAX +# RELAX-RELOC: R_RISCV_PCREL_HI20 foo 0x0 # RELAX-RELOC: R_RISCV_RELAX - 0x0 # RELAX-FIXUP: fixup A - offset: 0, value: %pcrel_hi(foo), kind: fixup_riscv_pcrel_hi20 # RELAX-FIXUP: fixup B - offset: 0, value: 0, kind: fixup_riscv_relax @@ -57,6 +56,7 @@ auipc t1, %pcrel_hi(foo) addi t1, t1, %pcrel_lo(foo) # NORELAX-RELOC: R_RISCV_PCREL_LO12_I foo 0x0 # NORELAX-RELOC-NOT: R_RISCV_RELAX +# RELAX-RELOC: R_RISCV_PCREL_LO12_I foo 0x0 # RELAX-RELOC: R_RISCV_RELAX - 0x0 # RELAX-FIXUP: fixup A - offset: 0, value: %pcrel_lo(foo), kind: fixup_riscv_pcrel_lo12_i # RELAX-FIXUP: fixup B - offset: 0, value: 0, kind: fixup_riscv_relax @@ -64,6 +64,63 @@ addi t1, t1, %pcrel_lo(foo) sb t1, %pcrel_lo(foo)(a2) # NORELAX-RELOC: R_RISCV_PCREL_LO12_S foo 0x0 # NORELAX-RELOC-NOT: R_RISCV_RELAX +# RELAX-RELOC: R_RISCV_PCREL_LO12_S foo 0x0 # RELAX-RELOC: R_RISCV_RELAX - 0x0 # RELAX-FIXUP: fixup A - offset: 0, value: %pcrel_lo(foo), kind: fixup_riscv_pcrel_lo12_s # RELAX-FIXUP: fixup B - offset: 0, value: 0, kind: fixup_riscv_relax + + +# Check behaviour when a locally defined symbol is referenced. +bar: + +beq s1, s1, bar +# NORELAX-RELOC-NOT: R_RISCV_BRANCH +# RELAX-RELOC: R_RISCV_BRANCH bar 0x0 +# RELAX-FIXUP: fixup A - offset: 0, value: bar, kind: fixup_riscv_branch +# RELAX-FIXUP-NOT: fixup B - offset: 0, value: 0, kind: fixup_riscv_relax + +call bar +# NORELAX-RELOC-NOT: R_RISCV_CALL +# NORELAX-RELOC-NOT: R_RISCV_RELAX +# RELAX-RELOC: R_RISCV_CALL bar 0x0 +# RELAX-RELOC: R_RISCV_RELAX - 0x0 +# RELAX-FIXUP: fixup A - offset: 0, value: bar, kind: fixup_riscv_call +# RELAX-FIXUP: fixup B - offset: 0, value: 0, kind: fixup_riscv_relax + +lui t1, %hi(bar) +# NORELAX-RELOC: R_RISCV_HI20 bar 0x0 +# NORELAX-RELOC-NOT: R_RISCV_RELAX +# RELAX-RELOC: R_RISCV_HI20 bar 0x0 +# RELAX-RELOC: R_RISCV_RELAX - 0x0 +# RELAX-FIXUP: fixup A - offset: 0, value: %hi(bar), kind: fixup_riscv_hi20 +# RELAX-FIXUP: fixup B - offset: 0, value: 0, kind: fixup_riscv_relax + +addi t1, t1, %lo(bar) +# NORELAX-RELOC: R_RISCV_LO12_I bar 0x0 +# NORELAX-RELOC-NOT: R_RISCV_RELAX +# RELAX-RELOC: R_RISCV_LO12_I bar 0x0 +# RELAX-RELOC: R_RISCV_RELAX - 0x0 +# RELAX-FIXUP: fixup A - offset: 0, value: %lo(bar), kind: fixup_riscv_lo12_i +# RELAX-FIXUP: fixup B - offset: 0, value: 0, kind: fixup_riscv_relax + +sb t1, %lo(bar)(a2) +# NORELAX-RELOC: R_RISCV_LO12_S bar 0x0 +# NORELAX-RELOC-NOT: R_RISCV_RELAX +# RELAX-RELOC: R_RISCV_LO12_S bar 0x0 +# RELAX-RELOC: R_RISCV_RELAX - 0x0 +# RELAX-FIXUP: fixup A - offset: 0, value: %lo(bar), kind: fixup_riscv_lo12_s +# RELAX-FIXUP: fixup B - offset: 0, value: 0, kind: fixup_riscv_relax + +auipc t1, %pcrel_hi(bar) +# NORELAX-RELOC-NOT: R_RISCV_PCREL_HI20 +# NORELAX-RELOC-NOT: R_RISCV_RELAX +# RELAX-RELOC: R_RISCV_PCREL_HI20 bar 0x0 +# RELAX-RELOC: R_RISCV_RELAX - 0x0 +# RELAX-FIXUP: fixup A - offset: 0, value: %pcrel_hi(bar), kind: fixup_riscv_pcrel_hi20 +# RELAX-FIXUP: fixup B - offset: 0, value: 0, kind: fixup_riscv_relax + +# TODO/FIXME: %pcrel_lo(bar) will produce an error finding the corresponding +# %pcrel_hi. + +#addi t1, t1, %pcrel_lo(bar) +#sb t1, %pcrel_lo(bar)(a2) |