xref: /llvm-project/llvm/test/MC/RISCV/align-non-executable.s (revision 7b45c549670a8e8b6fe90f4382b0699dd20707d3)
1## A label difference separated by an alignment directive, when the
2## referenced symbols are in a non-executable section with instructions,
3## should generate ADD/SUB relocations.
4## https://github.com/llvm/llvm-project/pull/76552
5
6# RUN: llvm-mc --filetype=obj --triple=riscv64 --mattr=+relax %s \
7# RUN:     | llvm-readobj -r - | FileCheck --check-prefixes=CHECK,RELAX %s
8# RUN: llvm-mc --filetype=obj --triple=riscv64 --mattr=-relax %s \
9# RUN:     | llvm-readobj -r - | FileCheck %s
10
11.section ".dummy", "a"
12.L1:
13  call func
14.p2align 3
15.L2:
16.dword .L2 - .L1
17
18# CHECK:       Relocations [
19# CHECK-NEXT:    Section ({{.*}}) .rela.dummy {
20# CHECK-NEXT:      0x0 R_RISCV_CALL_PLT func 0x0
21# RELAX-NEXT:      0x0 R_RISCV_RELAX - 0x0
22# CHECK-NEXT:      0x8 R_RISCV_ADD64 .L2 0x0
23# CHECK-NEXT:      0x8 R_RISCV_SUB64 .L1 0x0
24# CHECK-NEXT:    }
25# CHECK-NEXT:  ]
26