1 ; RUN: llc -filetype=obj -mtriple=csky %s -o %t.o
2 ; RUN: llvm-readobj -r %t.o | FileCheck -check-prefix=READOBJ-RELOCS %s
3 ; RUN: llvm-objdump --source %t.o | FileCheck --check-prefix=OBJDUMP-SOURCE %s
4 ; RUN: llvm-dwarfdump --debug-info --debug-line %t.o | \
5 ; RUN: FileCheck -check-prefix=DWARF-DUMP %s
7 ; Check that we actually have relocations, otherwise this is kind of pointless.
8 ; READOBJ-RELOCS: Section ({{.*}}) .rela.debug_info {
9 ; READOBJ-RELOCS: 0x8 R_CKCORE_ADDR32 .debug_abbrev 0x0
10 ; READOBJ-RELOCS-NEXT: 0x11 R_CKCORE_ADDR32 .debug_str_offsets 0x8
11 ; READOBJ-RELOCS-NEXT: 0x15 R_CKCORE_ADDR32 .debug_line 0x0
12 ; READOBJ-RELOCS-NEXT: 0x1F R_CKCORE_ADDR32 .debug_addr 0x8
13 ; READOBJ-RELOCS: Section ({{.*}}) .rela.debug_frame {
14 ; READOBJ-RELOCS: 0x18 R_CKCORE_ADDR32 .debug_frame 0x0
15 ; READOBJ-RELOCS-NEXT: 0x1C R_CKCORE_ADDR32 .text 0x0
16 ; READOBJ-RELOCS: Section ({{.*}}) .rela.debug_line {
17 ; READOBJ-RELOCS: 0x22 R_CKCORE_ADDR32 .debug_line_str 0x0
18 ; READOBJ-RELOCS-NEXT: 0x31 R_CKCORE_ADDR32 .debug_line_str 0x2
19 ; READOBJ-RELOCS-NEXT: 0x46 R_CKCORE_ADDR32 .debug_line_str 0x16
20 ; READOBJ-RELOCS-NEXT: 0x4F R_CKCORE_ADDR32 .text 0x0
22 ; Check that we can print the source, even with relocations.
23 ; OBJDUMP-SOURCE: Disassembly of section .text:
24 ; OBJDUMP-SOURCE-EMPTY:
25 ; OBJDUMP-SOURCE-NEXT: 00000000 <main>:
27 ; OBJDUMP-SOURCE: ; return 0;
29 ; Check that we correctly dump the DWARF info, even with relocations.
30 ; DWARF-DUMP: DW_AT_name ("dwarf-csky-relocs.c")
31 ; DWARF-DUMP: DW_AT_comp_dir (".")
32 ; DWARF-DUMP: DW_AT_name ("main")
33 ; DWARF-DUMP: DW_AT_decl_file ("{{.*}}dwarf-csky-relocs.c")
34 ; DWARF-DUMP: DW_AT_decl_line (2)
35 ; DWARF-DUMP: DW_AT_type (0x00000032 "int")
36 ; DWARF-DUMP: DW_AT_name ("int")
37 ; DWARF-DUMP: DW_AT_encoding (DW_ATE_signed)
38 ; DWARF-DUMP: DW_AT_byte_size (0x04)
40 ; DWARF-DUMP: .debug_line contents:
41 ; DWARF-DUMP-NEXT: debug_line[0x00000000]
42 ; DWARF-DUMP-NEXT: Line table prologue:
43 ; DWARF-DUMP-NEXT: total_length: 0x0000005c
44 ; DWARF-DUMP-NEXT: format: DWARF32
45 ; DWARF-DUMP-NEXT: version: 5
46 ; DWARF-DUMP-NEXT: address_size: 4
47 ; DWARF-DUMP-NEXT: seg_select_size: 0
48 ; DWARF-DUMP-NEXT: prologue_length: 0x0000003e
49 ; DWARF-DUMP-NEXT: min_inst_length: 1
50 ; DWARF-DUMP-NEXT: max_ops_per_inst: 1
51 ; DWARF-DUMP-NEXT: default_is_stmt: 1
52 ; DWARF-DUMP-NEXT: line_base: -5
53 ; DWARF-DUMP-NEXT: line_range: 14
54 ; DWARF-DUMP-NEXT: opcode_base: 13
55 ; DWARF-DUMP-NEXT: standard_opcode_lengths[DW_LNS_copy] = 0
56 ; DWARF-DUMP-NEXT: standard_opcode_lengths[DW_LNS_advance_pc] = 1
57 ; DWARF-DUMP-NEXT: standard_opcode_lengths[DW_LNS_advance_line] = 1
58 ; DWARF-DUMP-NEXT: standard_opcode_lengths[DW_LNS_set_file] = 1
59 ; DWARF-DUMP-NEXT: standard_opcode_lengths[DW_LNS_set_column] = 1
60 ; DWARF-DUMP-NEXT: standard_opcode_lengths[DW_LNS_negate_stmt] = 0
61 ; DWARF-DUMP-NEXT: standard_opcode_lengths[DW_LNS_set_basic_block] = 0
62 ; DWARF-DUMP-NEXT: standard_opcode_lengths[DW_LNS_const_add_pc] = 0
63 ; DWARF-DUMP-NEXT: standard_opcode_lengths[DW_LNS_fixed_advance_pc] = 1
64 ; DWARF-DUMP-NEXT: standard_opcode_lengths[DW_LNS_set_prologue_end] = 0
65 ; DWARF-DUMP-NEXT: standard_opcode_lengths[DW_LNS_set_epilogue_begin] = 0
66 ; DWARF-DUMP-NEXT: standard_opcode_lengths[DW_LNS_set_isa] = 1
67 ; DWARF-DUMP-NEXT: include_directories[ 0] = "."
68 ; DWARF-DUMP-NEXT: file_names[ 0]:
69 ; DWARF-DUMP-NEXT: name: "dwarf-csky-relocs.c"
70 ; DWARF-DUMP-NEXT: dir_index: 0
71 ; DWARF-DUMP-NEXT: md5_checksum: ba6dbc7dc09162edb18beacd8474bcd3
72 ; DWARF-DUMP-NEXT: source: "int main()\n{\n return 0;\n}\n"
74 ; DWARF-DUMP-NEXT: Address Line Column File ISA Discriminator OpIndex Flags
75 ; DWARF-DUMP-NEXT: ------------------ ------ ------ ------ --- ------------- ------- -------------
76 ; DWARF-DUMP-NEXT: 0x0000000000000000 2 0 0 0 0 0 is_stmt
77 ; DWARF-DUMP-NEXT: 0x000000000000000e 3 3 0 0 0 0 is_stmt prologue_end
78 ; DWARF-DUMP-NEXT: 0x0000000000000016 3 3 0 0 0 0 epilogue_begin
79 ; DWARF-DUMP-NEXT: 0x000000000000001a 3 3 0 0 0 0 end_sequence
81 ; ModuleID = 'dwarf-csky-relocs.c'
82 source_filename = "dwarf-csky-relocs.c"
83 target datalayout = "e-m:e-S32-p:32:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:32:32-v128:32:32-a:0:32-Fi32-n32"
84 target triple = "csky-unknown-linux"
86 ; Function Attrs: noinline nounwind optnone
87 define dso_local i32 @main() #0 !dbg !9 {
89 %retval = alloca i32, align 4
90 store i32 0, ptr %retval, align 4
94 attributes #0 = { noinline nounwind optnone "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="ck810" "target-features"="+2e3,+3e7,+7e10,+cache,+dsp1e2,+dspe60,+e1,+e2,+edsp,+elrw,+hard-tp,+high-registers,+hwdiv,+mp,+mp1e2,+nvic,+trust" }
97 !llvm.module.flags = !{!2, !3, !4, !5, !6, !7}
100 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None)
101 !1 = !DIFile(filename: "dwarf-csky-relocs.c", directory: ".", checksumkind: CSK_MD5, checksum: "ba6dbc7dc09162edb18beacd8474bcd3", source: "int main()\0A{\0A return 0;\0A}\0A")
102 !2 = !{i32 7, !"Dwarf Version", i32 5}
103 !3 = !{i32 2, !"Debug Info Version", i32 3}
104 !4 = !{i32 1, !"wchar_size", i32 4}
105 !5 = !{i32 7, !"PIC Level", i32 2}
106 !6 = !{i32 7, !"PIE Level", i32 2}
107 !7 = !{i32 7, !"frame-pointer", i32 2}
109 !9 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 2, type: !10, scopeLine: 2, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !13)
110 !10 = !DISubroutineType(types: !11)
112 !12 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
114 !14 = !DILocation(line: 3, column: 3, scope: !9)