xref: /llvm-project/llvm/test/MC/Mips/coff-relocs.ll (revision be68f35bf55baf6150180170ec17371f0be90689)
1; RUN: llc -mtriple mipsel-windows -filetype=obj < %s | obj2yaml | FileCheck %s
2
3; CHECK:  Machine:         IMAGE_FILE_MACHINE_R4000
4
5
6
7; CHECK:  - Name:            .text
8; CHECK:    Relocations:
9
10declare void @bar()
11define i32 @foo_jmp() {
12  call i32 @bar()
13; CHECK:      - VirtualAddress:  8
14; CHECK:        SymbolName:      bar
15; CHECK:        Type:            IMAGE_REL_MIPS_JMPADDR
16  ret i32 0
17}
18
19@var = external global i32
20define i32 @foo_var() {
21  %1 = load i32, i32* @var
22; CHECK:      - VirtualAddress:  32
23; CHECK:        SymbolName:      var
24; CHECK:        Type:            IMAGE_REL_MIPS_REFHI
25; CHECK:      - VirtualAddress:  32
26; CHECK:        SymbolName:      .text
27; CHECK:        Type:            IMAGE_REL_MIPS_PAIR
28; CHECK:      - VirtualAddress:  40
29; CHECK:        SymbolName:      var
30; CHECK:        Type:            IMAGE_REL_MIPS_REFLO
31  ret i32 %1
32}
33
34
35
36; CHECK:  - Name:            .data
37; CHECK:    Relocations:
38
39%struct._PTR = type { ptr }
40
41@var1 = internal global %struct._PTR { ptr @var2 }
42@var2 = external global i32
43; CHECK:      - VirtualAddress:  0
44; CHECK:        SymbolName:      var2
45; CHECK:        Type:            IMAGE_REL_MIPS_REFWORD
46
47
48
49
50; CHECK:  - Name:            '.debug$S'
51; CHECK:    Relocations:
52
53!llvm.dbg.cu = !{!0}
54!llvm.module.flags = !{!2, !3, !4}
55
56!0 = distinct !DICompileUnit(language: DW_LANG_C11, file: !1, emissionKind: FullDebug)
57!1 = !DIFile(filename: "dummy.c", directory: "/tmp/private")
58!2 = !{i32 2, !"CodeView", i32 1}
59!3 = !{i32 2, !"Debug Info Version", i32 3}
60!4 = !{i32 1, !"wchar_size", i32 2}
61!5 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !6, scopeLine: 2, spFlags: DISPFlagDefinition, unit: !0)
62!6 = !DISubroutineType(types: !7)
63!7 = !{null}
64!8 = !DILocation(line: 3, scope: !5)
65
66define dso_local void @foo_dbg() #0 !dbg !5 {
67  ret void, !dbg !8
68; CHECK:      - VirtualAddress:  92
69; CHECK:        SymbolName:      foo_dbg
70; CHECK:        Type:            IMAGE_REL_MIPS_SECREL
71; CHECK:      - VirtualAddress:  96
72; CHECK:        SymbolName:      foo_dbg
73; CHECK:        Type:            IMAGE_REL_MIPS_SECTION
74; CHECK:      - VirtualAddress:  148
75; CHECK:        SymbolName:      foo_dbg
76; CHECK:        Type:            IMAGE_REL_MIPS_SECREL
77; CHECK:      - VirtualAddress:  152
78; CHECK:        SymbolName:      foo_dbg
79; CHECK:        Type:            IMAGE_REL_MIPS_SECTION
80}
81
82