xref: /llvm-project/llvm/test/CodeGen/RISCV/fixups-diff.ll (revision bf67610a8ac07ec143f243f129eecd456aa63383)
1; RUN: llc -filetype=obj -mtriple=riscv32 -mattr=+relax %s -o - \
2; RUN:     | llvm-readobj -r - | FileCheck %s
3; RUN: llc -filetype=obj -mtriple=riscv32 -mattr=-relax %s -o - \
4; RUN:     | llvm-readobj -r - | FileCheck %s
5
6;; b-a in the inline asm is unaffected by linker relaxation, so we don't emit
7;; relocations.
8
9;; b-a in the inline asm and DW_AT_high_pc are unaffected by linker relaxation,
10;; so we don't emit ADD/SUB relocations.
11;; See also MC/RISCV/fixups-expr.s.
12
13source_filename = "tmp.c"
14target datalayout = "e-m:e-p:32:32-i64:64-n32-S128"
15target triple = "riscv32"
16
17define i32 @main() !dbg !7 {
18entry:
19  %retval = alloca i32, align 4
20  store i32 0, ptr %retval, align 4
21  call void asm sideeffect "a:\0Ab:\0A.dword b-a", ""()
22  ret i32 0
23}
24
25; CHECK:      Section {{.*}} .rela.debug_info {
26; CHECK-NOT:         R_RISCV_ADD32
27; CHECK:      }
28
29; CHECK:      Section {{.*}} .rela.eh_frame {
30; CHECK-NEXT:   0x1C R_RISCV_32_PCREL .L0  0x0
31; CHECK-NEXT: }
32
33!llvm.dbg.cu = !{!0}
34!llvm.module.flags = !{!3, !4, !5}
35!llvm.ident = !{!6}
36
37!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
38!1 = !DIFile(filename: "fixups-diff.ll", directory: "test/MC/RISCV")
39!2 = !{}
40!3 = !{i32 2, !"Dwarf Version", i32 4}
41!4 = !{i32 2, !"Debug Info Version", i32 3}
42!5 = !{i32 1, !"wchar_size", i32 4}
43!6 = !{!"clang"}
44!7 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 1, type: !8, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, unit: !0)
45!8 = !DISubroutineType(types: !9)
46!9 = !{!10}
47!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
48!11 = !DILocation(line: 2, column: 3, scope: !7)
49