2017-12-15 10:47:01 +01:00
|
|
|
# RUN: llvm-mc -triple riscv32 -riscv-no-aliases < %s -show-encoding \
|
2017-09-28 10:26:24 +02:00
|
|
|
# RUN: | FileCheck -check-prefix=CHECK-FIXUP %s
|
|
|
|
# RUN: llvm-mc -filetype=obj -triple riscv32 < %s \
|
[RISCV] Support llvm-objdump -M no-aliases and -M numeric
Summary:
Now that llvm-objdump allows target-specific options, we match the
`no-aliases` and `numeric` options for RISC-V, as supported by GNU objdump.
This is done by overriding the variables used for the command-line options, so
that the command-line options are still supported.
This patch updates all tests using `llvm-objdump -riscv-no-aliases` to use
`llvm-objdump -M no-aliases`.
Reviewers: luismarques, asb
Reviewed By: luismarques, asb
Subscribers: pzheng, hiraditya, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, kito-cheng, shiva0217, jrtc27, MaskRay, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, Jim, s.egerton, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66139
llvm-svn: 371534
2019-09-10 18:24:03 +02:00
|
|
|
# RUN: | llvm-objdump -M no-aliases -d - \
|
2017-12-15 10:47:01 +01:00
|
|
|
# RUN: | FileCheck -check-prefix=CHECK-INSTR %s
|
2017-09-28 10:26:24 +02:00
|
|
|
# RUN: llvm-mc -filetype=obj -triple=riscv32 %s \
|
2020-07-20 09:39:14 +02:00
|
|
|
# RUN: | llvm-readobj -r - | FileCheck %s -check-prefix=CHECK-REL
|
2017-09-28 10:26:24 +02:00
|
|
|
|
|
|
|
# Checks that fixups that can be resolved within the same object file are
|
|
|
|
# applied correctly
|
|
|
|
|
|
|
|
.LBB0:
|
|
|
|
lui t1, %hi(val)
|
|
|
|
# CHECK-FIXUP: fixup A - offset: 0, value: %hi(val), kind: fixup_riscv_hi20
|
|
|
|
# CHECK-INSTR: lui t1, 74565
|
|
|
|
|
|
|
|
lw a0, %lo(val)(t1)
|
|
|
|
# CHECK-FIXUP: fixup A - offset: 0, value: %lo(val), kind: fixup_riscv_lo12_i
|
|
|
|
# CHECK-INSTR: lw a0, 1656(t1)
|
|
|
|
addi a1, t1, %lo(val)
|
|
|
|
# CHECK-FIXUP: fixup A - offset: 0, value: %lo(val), kind: fixup_riscv_lo12_i
|
|
|
|
# CHECK-INSTR: addi a1, t1, 1656
|
|
|
|
sw a0, %lo(val)(t1)
|
|
|
|
# CHECK-FIXUP: fixup A - offset: 0, value: %lo(val), kind: fixup_riscv_lo12_s
|
|
|
|
# CHECK-INSTR: sw a0, 1656(t1)
|
|
|
|
|
2018-12-20 15:52:15 +01:00
|
|
|
1:
|
|
|
|
auipc t1, %pcrel_hi(.LBB0)
|
|
|
|
# CHECK-FIXUP: fixup A - offset: 0, value: %pcrel_hi(.LBB0), kind: fixup_riscv_pcrel_hi20
|
|
|
|
# CHECK-INSTR: auipc t1, 0
|
|
|
|
addi t1, t1, %pcrel_lo(1b)
|
|
|
|
# CHECK-FIXUP: fixup A - offset: 0, value: %pcrel_lo(.Ltmp0), kind: fixup_riscv_pcrel_lo12_i
|
|
|
|
# CHECK-INSTR: addi t1, t1, -16
|
|
|
|
sw t1, %pcrel_lo(1b)(t1)
|
|
|
|
# CHECK-FIXUP: fixup A - offset: 0, value: %pcrel_lo(.Ltmp0), kind: fixup_riscv_pcrel_lo12_s
|
|
|
|
# CHECK-INSTR: sw t1, -16(t1)
|
|
|
|
|
2017-09-28 10:26:24 +02:00
|
|
|
jal zero, .LBB0
|
|
|
|
# CHECK-FIXUP: fixup A - offset: 0, value: .LBB0, kind: fixup_riscv_jal
|
2018-12-20 15:52:15 +01:00
|
|
|
# CHECK-INSTR: jal zero, -28
|
2017-09-28 10:26:24 +02:00
|
|
|
jal zero, .LBB2
|
|
|
|
# CHECK-FIXUP: fixup A - offset: 0, value: .LBB2, kind: fixup_riscv_jal
|
|
|
|
# CHECK-INSTR: jal zero, 330996
|
|
|
|
beq a0, a1, .LBB0
|
|
|
|
# CHECK-FIXUP: fixup A - offset: 0, value: .LBB0, kind: fixup_riscv_branch
|
2018-12-20 15:52:15 +01:00
|
|
|
# CHECK-INSTR: beq a0, a1, -36
|
2017-09-28 10:26:24 +02:00
|
|
|
blt a0, a1, .LBB1
|
|
|
|
# CHECK-FIXUP: fixup A - offset: 0, value: .LBB1, kind: fixup_riscv_branch
|
|
|
|
# CHECK-INSTR: blt a0, a1, 1108
|
|
|
|
|
|
|
|
.fill 1104
|
|
|
|
|
|
|
|
.LBB1:
|
|
|
|
|
|
|
|
.fill 329876
|
|
|
|
addi zero, zero, 0
|
|
|
|
.LBB2:
|
|
|
|
|
|
|
|
.set val, 0x12345678
|
|
|
|
|
|
|
|
# CHECK-REL-NOT: R_RISCV
|
2018-05-30 03:16:36 +02:00
|
|
|
|
2019-12-17 12:42:32 +01:00
|
|
|
# Testing the function call offset could resolved by assembler
|
2018-05-30 03:16:36 +02:00
|
|
|
# when the function and the callsite within the same compile unit
|
|
|
|
# and the linker relaxation is disabled.
|
|
|
|
func:
|
|
|
|
.fill 100
|
|
|
|
call func
|
|
|
|
# CHECK-FIXUP: fixup A - offset: 0, value: func, kind: fixup_riscv_call
|
|
|
|
# CHECK-INSTR: auipc ra, 0
|
2019-07-16 06:56:43 +02:00
|
|
|
# CHECK-INSTR: jalr ra, -100(ra)
|
2018-05-30 03:16:36 +02:00
|
|
|
|
|
|
|
.fill 10000
|
|
|
|
call func
|
|
|
|
# CHECK-FIXUP: fixup A - offset: 0, value: func, kind: fixup_riscv_call
|
|
|
|
# CHECK-INSTR: auipc ra, 1048574
|
2019-07-16 06:56:43 +02:00
|
|
|
# CHECK-INSTR: jalr ra, -1916(ra)
|
2018-05-30 03:16:36 +02:00
|
|
|
|
|
|
|
.fill 20888
|
|
|
|
call func
|
|
|
|
# CHECK-FIXUP: fixup A - offset: 0, value: func, kind: fixup_riscv_call
|
|
|
|
# CHECK-INSTR: auipc ra, 1048568
|
2019-07-16 06:56:43 +02:00
|
|
|
# CHECK-INSTR: jalr ra, 1764(ra)
|