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; Check that a difference between two symbols in the same fragment
7; causes relocations to be emitted.
8;
9; This specific test is checking that the size of the function in
10; the debug information is represented by a relocation. This isn't
11; an assembly test as the assembler takes a different path through
12; LLVM, which is already covered by the fixups-expr.s test.
13
14source_filename = "tmp.c"
15target datalayout = "e-m:e-p:32:32-i64:64-n32-S128"
16target triple = "riscv32"
17
18define i32 @main() !dbg !7 {
19entry:
20  %retval = alloca i32, align 4
21  store i32 0, i32* %retval, align 4
22  ret i32 0
23}
24
25; CHECK:      Section {{.*}} .rela.debug_info {
26; CHECK:        0x22 R_RISCV_ADD32 - 0x0
27; CHECK-NEXT:   0x22 R_RISCV_SUB32 - 0x0
28; CHECK:        0x2B R_RISCV_ADD32 - 0x0
29; CHECK-NEXT:   0x2B R_RISCV_SUB32 - 0x0
30; CHECK:      }
31
32; CHECK:      Section {{.*}} .rela.eh_frame {
33; CHECK:        0x1C R_RISCV_32_PCREL - 0x0
34; CHECK:        0x20 R_RISCV_ADD32 - 0x0
35; CHECK-NEXT:   0x20 R_RISCV_SUB32 - 0x0
36; CHECK:      }
37
38!llvm.dbg.cu = !{!0}
39!llvm.module.flags = !{!3, !4, !5}
40!llvm.ident = !{!6}
41
42!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
43!1 = !DIFile(filename: "fixups-diff.ll", directory: "test/MC/RISCV")
44!2 = !{}
45!3 = !{i32 2, !"Dwarf Version", i32 4}
46!4 = !{i32 2, !"Debug Info Version", i32 3}
47!5 = !{i32 1, !"wchar_size", i32 4}
48!6 = !{!"clang"}
49!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)
50!8 = !DISubroutineType(types: !9)
51!9 = !{!10}
52!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
53!11 = !DILocation(line: 2, column: 3, scope: !7)
54