|
1 | | -;; With +relax, J below needs a relocation to ensure the target is correct |
2 | | -;; after linker relaxation. See https://github.com/ClangBuiltLinux/linux/issues/1965 |
3 | 1 |
|
4 | 2 | ; RUN: llc -mtriple=riscv64 -mattr=-relax -filetype=obj < %s \ |
5 | 3 | ; RUN: | llvm-objdump -d -r - | FileCheck %s --check-prefixes=CHECK,NORELAX |
6 | 4 | ; RUN: llc -mtriple=riscv64 -mattr=+relax -filetype=obj < %s \ |
7 | 5 | ; RUN: | llvm-objdump -d -r - | FileCheck %s --check-prefixes=CHECK,RELAX |
8 | 6 |
|
| 7 | +;; With +relax, All `j` instructions below need a relocation to ensure the target is correct |
| 8 | +;; after linker relaxation. See https://github.com/ClangBuiltLinux/linux/issues/1965 |
| 9 | + |
9 | 10 | ; CHECK: j {{.*}} |
10 | 11 | ; RELAX-NEXT: R_RISCV_JAL {{.*}} |
| 12 | +; RELAX-NOT: R_RISCV_RELAX |
11 | 13 | ; CHECK-NEXT: auipc ra, 0x0 |
12 | 14 | ; CHECK-NEXT: R_RISCV_CALL_PLT f |
13 | 15 | ; RELAX-NEXT: R_RISCV_RELAX *ABS* |
14 | 16 | ; CHECK-NEXT: jalr ra |
15 | 17 | ; CHECK-NEXT: j {{.*}} |
| 18 | +; RELAX-NEXT: R_RISCV_JAL {{.*}} |
| 19 | +; RELAX-NOT: R_RISCV_RELAX |
16 | 20 | ; CHECK-NEXT: j {{.*}} |
17 | | -; RELAX-NEXT: R_RISCV_JAL .L0 |
| 21 | +; RELAX-NEXT: R_RISCV_JAL {{.*}} |
| 22 | +; RELAX-NEXT: R_RISCV_RELAX *ABS* |
18 | 23 | ; NORELAX-NEXT: li a0, 0x0 |
19 | 24 | ; RELAX-EMPTY: |
20 | 25 |
|
21 | 26 | define dso_local noundef signext i32 @main() local_unnamed_addr #0 { |
22 | 27 | entry: |
23 | | - callbr void asm sideeffect ".option push\0A.option norelax\0Aj $0\0A.option pop\0A", "!i"() |
24 | | - to label %asm.fallthrough [label %label] |
| 28 | + callbr void asm sideeffect " |
| 29 | + .option push |
| 30 | + .option norelax |
| 31 | + j $0 |
| 32 | + .option pop", |
| 33 | + "!i"() to label %asm.fallthrough [label %label] |
25 | 34 |
|
26 | 35 | asm.fallthrough: ; preds = %entry |
27 | 36 | tail call void @f() |
28 | | - callbr void asm sideeffect ".option push\0A.option norelax\0Aj $0\0A.option pop\0A", "!i"() |
29 | | - to label %asm.fallthrough [label %label] |
| 37 | + callbr void asm sideeffect " |
| 38 | + .option push |
| 39 | + .option norelax |
| 40 | + j $0 |
| 41 | + .option pop", |
| 42 | + "!i"() to label %asm.fallthrough [label %label] |
30 | 43 | br label %label |
31 | 44 |
|
32 | 45 | label: ; preds = %asm.fallthrough, %entry |
|
0 commit comments