2 ## Test that we can handle --emit-relocs while relaxing.
4 # RUN: llvm-mc --filetype=obj --triple=loongarch32 --mattr=+relax %s -o %t.32.o
5 # RUN: llvm-mc --filetype=obj --triple=loongarch64 --mattr=+relax %s -o %t.64.o
6 # RUN: ld.lld -Ttext=0x10000 --emit-relocs %t.32.o -o %t.32
7 # RUN: ld.lld -Ttext=0x10000 --emit-relocs %t.64.o -o %t.64
8 # RUN: llvm-objdump -dr %t.32 | FileCheck %s
9 # RUN: llvm-objdump -dr %t.64 | FileCheck %s
11 ## -r should keep original relocations.
12 # RUN: ld.lld -r %t.64.o -o %t.64.r
13 # RUN: llvm-objdump -dr %t.64.r | FileCheck %s --check-prefix=CHECKR
15 ## --no-relax should keep original relocations.
16 ## TODO Due to R_LARCH_RELAX is not relaxed, it plays same as --relax now.
17 # RUN: ld.lld -Ttext=0x10000 --emit-relocs --no-relax %t.64.o -o %t.64.norelax
18 # RUN: llvm-objdump -dr %t.64.norelax | FileCheck %s
20 # CHECK: 00010000 <_start>:
21 # CHECK-NEXT: pcalau12i $a0, 0
22 # CHECK-NEXT: R_LARCH_PCALA_HI20 _start
23 # CHECK-NEXT: R_LARCH_RELAX *ABS*
24 # CHECK-NEXT: addi.{{[dw]}} $a0, $a0, 0
25 # CHECK-NEXT: R_LARCH_PCALA_LO12 _start
26 # CHECK-NEXT: R_LARCH_RELAX *ABS*
28 # CHECK-NEXT: R_LARCH_ALIGN *ABS*+0xc
33 # CHECKR-NEXT: pcalau12i $a0, 0
34 # CHECKR-NEXT: R_LARCH_PCALA_HI20 _start
35 # CHECKR-NEXT: R_LARCH_RELAX *ABS*
36 # CHECKR-NEXT: addi.d $a0, $a0, 0
37 # CHECKR-NEXT: R_LARCH_PCALA_LO12 _start
38 # CHECKR-NEXT: R_LARCH_RELAX *ABS*
40 # CHECKR-NEXT: R_LARCH_ALIGN *ABS*+0xc