2014-05-27 20:55:40 +08:00
|
|
|
# RUN: llvm-mc %s -triple=mips-unknown-linux -show-encoding -mcpu=mips32r6 \
|
|
|
|
# RUN: | FileCheck %s -check-prefix=CHECK-FIXUP
|
|
|
|
# RUN: llvm-mc %s -filetype=obj -triple=mips-unknown-linux -mcpu=mips32r6 \
|
2020-07-20 15:39:14 +08:00
|
|
|
# RUN: | llvm-readobj -r - | FileCheck %s -check-prefix=CHECK-ELF
|
2014-05-27 20:55:40 +08:00
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# Check that the assembler can handle the documented syntax for fixups.
|
|
|
|
#------------------------------------------------------------------------------
|
2017-09-12 02:34:04 +08:00
|
|
|
# CHECK-FIXUP: lapc $2, bar # encoding: [0xec,0b01000AAA,A,A]
|
2014-06-12 20:40:00 +08:00
|
|
|
# CHECK-FIXUP: # fixup A - offset: 0,
|
|
|
|
# CHECK-FIXUP: value: bar, kind: fixup_MIPS_PC19_S2
|
2014-05-27 20:55:40 +08:00
|
|
|
# CHECK-FIXUP: beqc $5, $6, bar # encoding: [0x20,0xa6,A,A]
|
|
|
|
# CHECK-FIXUP: # fixup A - offset: 0,
|
2015-06-23 21:54:42 +08:00
|
|
|
# CHECK-FIXUP: value: bar-4, kind: fixup_Mips_PC16
|
2014-05-27 20:55:40 +08:00
|
|
|
# CHECK-FIXUP: bnec $5, $6, bar # encoding: [0x60,0xa6,A,A]
|
|
|
|
# CHECK-FIXUP: # fixup A - offset: 0,
|
2015-06-23 21:54:42 +08:00
|
|
|
# CHECK-FIXUP: value: bar-4, kind: fixup_Mips_PC16
|
2014-05-27 20:55:40 +08:00
|
|
|
# CHECK-FIXUP: beqzc $9, bar # encoding: [0xd9,0b001AAAAA,A,A]
|
|
|
|
# CHECK-FIXUP: # fixup A - offset: 0,
|
2015-06-23 21:54:42 +08:00
|
|
|
# CHECK-FIXUP: value: bar-4, kind: fixup_MIPS_PC21_S2
|
2014-05-27 20:55:40 +08:00
|
|
|
# CHECK-FIXUP: bnezc $9, bar # encoding: [0xf9,0b001AAAAA,A,A]
|
|
|
|
# CHECK-FIXUP: # fixup A - offset: 0,
|
2015-06-23 21:54:42 +08:00
|
|
|
# CHECK-FIXUP: value: bar-4, kind: fixup_MIPS_PC21_S2
|
2014-05-27 20:55:40 +08:00
|
|
|
# CHECK-FIXUP: balc bar # encoding: [0b111010AA,A,A,A]
|
|
|
|
# CHECK-FIXUP: # fixup A - offset: 0,
|
2015-06-23 21:54:42 +08:00
|
|
|
# CHECK-FIXUP: value: bar-4, kind: fixup_MIPS_PC26_S2
|
2014-05-27 20:55:40 +08:00
|
|
|
# CHECK-FIXUP: bc bar # encoding: [0b110010AA,A,A,A]
|
|
|
|
# CHECK-FIXUP: # fixup A - offset: 0,
|
2015-06-23 21:54:42 +08:00
|
|
|
# CHECK-FIXUP: value: bar-4, kind: fixup_MIPS_PC26_S2
|
2014-05-27 22:58:51 +08:00
|
|
|
# CHECK-FIXUP: aluipc $2, %pcrel_hi(bar) # encoding: [0xec,0x5f,A,A]
|
|
|
|
# CHECK-FIXUP: # fixup A - offset: 0,
|
2016-05-03 21:35:44 +08:00
|
|
|
# CHECK-FIXUP: value: %pcrel_hi(bar),
|
2014-05-27 22:58:51 +08:00
|
|
|
# CHECK-FIXUP: kind: fixup_MIPS_PCHI16
|
|
|
|
# CHECK-FIXUP: addiu $2, $2, %pcrel_lo(bar) # encoding: [0x24,0x42,A,A]
|
|
|
|
# CHECK-FIXUP: # fixup A - offset: 0,
|
2016-05-03 21:35:44 +08:00
|
|
|
# CHECK-FIXUP: value: %pcrel_lo(bar),
|
2014-05-27 22:58:51 +08:00
|
|
|
# CHECK-FIXUP: kind: fixup_MIPS_PCLO16
|
2017-09-12 02:34:04 +08:00
|
|
|
# CHECK-FIXUP: lapc $2, bar # encoding: [0xec,0b01000AAA,A,A]
|
|
|
|
# CHECK-FIXUP: # fixup A - offset: 0,
|
|
|
|
# CHECK-FIXUP: value: bar, kind: fixup_MIPS_PC19_S2
|
2014-06-12 20:40:00 +08:00
|
|
|
# CHECK-FIXUP: lwpc $2, bar # encoding: [0xec,0b01001AAA,A,A]
|
|
|
|
# CHECK-FIXUP: # fixup A - offset: 0,
|
|
|
|
# CHECK-FIXUP: value: bar, kind: fixup_MIPS_PC19_S2
|
2019-10-03 20:08:26 +08:00
|
|
|
# CHECK-FIXUP: jialc $5, bar # encoding: [0xf8,0x05,A,A]
|
|
|
|
# CHECK-FIXUP: # fixup A - offset: 0,
|
|
|
|
# CHECK-FIXUP: value: bar, kind: fixup_Mips_LO16
|
|
|
|
# CHECK-FIXUP: jic $5, bar # encoding: [0xd8,0x05,A,A]
|
|
|
|
# CHECK-FIXUP: # fixup A - offset: 0,
|
|
|
|
# CHECK-FIXUP: value: bar, kind: fixup_Mips_LO16
|
2014-05-27 20:55:40 +08:00
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# Check that the appropriate relocations were created.
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# CHECK-ELF: Relocations [
|
2014-06-12 20:40:00 +08:00
|
|
|
# CHECK-ELF: 0x0 R_MIPS_PC19_S2 bar 0x0
|
2014-05-27 20:55:40 +08:00
|
|
|
# CHECK-ELF: 0x4 R_MIPS_PC16 bar 0x0
|
2014-06-12 20:40:00 +08:00
|
|
|
# CHECK-ELF: 0x8 R_MIPS_PC16 bar 0x0
|
2014-05-27 20:55:40 +08:00
|
|
|
# CHECK-ELF: 0xC R_MIPS_PC21_S2 bar 0x0
|
2014-06-12 20:40:00 +08:00
|
|
|
# CHECK-ELF: 0x10 R_MIPS_PC21_S2 bar 0x0
|
2014-05-27 20:55:40 +08:00
|
|
|
# CHECK-ELF: 0x14 R_MIPS_PC26_S2 bar 0x0
|
2014-06-12 20:40:00 +08:00
|
|
|
# CHECK-ELF: 0x18 R_MIPS_PC26_S2 bar 0x0
|
|
|
|
# CHECK-ELF: 0x1C R_MIPS_PCHI16 bar 0x0
|
|
|
|
# CHECK-ELF: 0x20 R_MIPS_PCLO16 bar 0x0
|
|
|
|
# CHECK-ELF: 0x24 R_MIPS_PC19_S2 bar 0x0
|
|
|
|
# CHECK-ELF: 0x28 R_MIPS_PC19_S2 bar 0x0
|
2019-10-03 20:08:26 +08:00
|
|
|
# CHECK-ELF: 0x2C R_MIPS_LO16 bar 0x0
|
|
|
|
# CHECK-ELF: 0x30 R_MIPS_LO16 bar 0x0
|
2014-05-27 20:55:40 +08:00
|
|
|
# CHECK-ELF: ]
|
|
|
|
|
2014-06-12 20:40:00 +08:00
|
|
|
addiupc $2,bar
|
2014-05-27 20:55:40 +08:00
|
|
|
beqc $5, $6, bar
|
|
|
|
bnec $5, $6, bar
|
|
|
|
beqzc $9, bar
|
|
|
|
bnezc $9, bar
|
|
|
|
balc bar
|
|
|
|
bc bar
|
2014-05-27 22:58:51 +08:00
|
|
|
aluipc $2, %pcrel_hi(bar)
|
|
|
|
addiu $2, $2, %pcrel_lo(bar)
|
2017-09-12 02:34:04 +08:00
|
|
|
lapc $2,bar
|
2014-06-12 20:40:00 +08:00
|
|
|
lwpc $2,bar
|
2019-10-03 20:08:26 +08:00
|
|
|
jialc $5, bar
|
|
|
|
jic $5, bar
|