[clang-tidy][modernize-use-starts-ends-with] Fix operator rewriting false negative...
[llvm-project.git] / lld / test / ELF / loongarch-relax-emit-relocs.s
blobba414e8c93f0fb0b48cb98b9be085007d569b4bd
1 # REQUIRES: loongarch
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*
27 # CHECK-NEXT: nop
28 # CHECK-NEXT: R_LARCH_ALIGN *ABS*+0xc
29 # CHECK-NEXT: nop
30 # CHECK-NEXT: ret
32 # CHECKR: <_start>:
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*
39 # CHECKR-NEXT: nop
40 # CHECKR-NEXT: R_LARCH_ALIGN *ABS*+0xc
41 # CHECKR-NEXT: nop
42 # CHECKR-NEXT: nop
43 # CHECKR-NEXT: ret
45 .global _start
46 _start:
47 la.pcrel $a0, _start
48 .p2align 4
49 ret