|
| 1 | +; RUN: llc --filetype=obj --mtriple=loongarch64 --mattr=-relax %s -o %t.o |
| 2 | +; RUN: llvm-readobj -r %t.o | FileCheck --check-prefixes=RELOCS-BOTH,RELOCS-NORL %s |
| 3 | +; RUN: llvm-objdump --source %t.o | FileCheck --check-prefix=SOURCE %s |
| 4 | +; RUN: llvm-dwarfdump --debug-info --debug-line %t.o | FileCheck --check-prefix=DWARF %s |
| 5 | + |
| 6 | +; RUN: llc --filetype=obj --mtriple=loongarch64 --mattr=+relax %s -o %t.r.o |
| 7 | +; RUN: llvm-readobj -r %t.r.o | FileCheck --check-prefixes=RELOCS-BOTH,RELOCS-ENRL %s |
| 8 | +; RUN: llvm-objdump --source %t.r.o | FileCheck --check-prefix=SOURCE %s |
| 9 | +; RUN: llvm-dwarfdump --debug-info --debug-line %t.r.o | FileCheck --check-prefix=DWARF %s |
| 10 | + |
| 11 | +; RELOCS-BOTH: Relocations [ |
| 12 | +; RELOCS-BOTH-NEXT: Section ({{.*}}) .rela.text { |
| 13 | +; RELOCS-BOTH-NEXT: 0x14 R_LARCH_PCALA_HI20 sym 0x0 |
| 14 | +; RELOCS-ENRL-NEXT: 0x14 R_LARCH_RELAX - 0x0 |
| 15 | +; RELOCS-BOTH-NEXT: 0x18 R_LARCH_PCALA_LO12 sym 0x0 |
| 16 | +; RELOCS-ENRL-NEXT: 0x18 R_LARCH_RELAX - 0x0 |
| 17 | +; RELOCS-BOTH-NEXT: } |
| 18 | +; RELOCS-BOTH: Section ({{.*}}) .rela.debug_frame { |
| 19 | +; RELOCS-NORL-NEXT: 0x1C R_LARCH_32 .debug_frame 0x0 |
| 20 | +; RELOCS-NORL-NEXT: 0x20 R_LARCH_64 .text 0x0 |
| 21 | +; RELOCS-ENRL-NEXT: 0x1C R_LARCH_32 <null> 0x0 |
| 22 | +; RELOCS-ENRL-NEXT: 0x20 R_LARCH_64 <null> 0x0 |
| 23 | +; RELOCS-ENRL-NEXT: 0x28 R_LARCH_ADD64 <null> 0x0 |
| 24 | +; RELOCS-ENRL-NEXT: 0x28 R_LARCH_SUB64 <null> 0x0 |
| 25 | +; RELOCS-ENRL-NEXT: 0x3F R_LARCH_ADD6 <null> 0x0 |
| 26 | +; RELOCS-ENRL-NEXT: 0x3F R_LARCH_SUB6 <null> 0x0 |
| 27 | +; RELOCS-BOTH-NEXT: } |
| 28 | +; RELOCS-BOTH: Section ({{.*}}) .rela.debug_line { |
| 29 | +; RELOCS-BOTH-NEXT: 0x22 R_LARCH_32 .debug_line_str 0x0 |
| 30 | +; RELOCS-BOTH-NEXT: 0x31 R_LARCH_32 .debug_line_str 0x2 |
| 31 | +; RELOCS-BOTH-NEXT: 0x46 R_LARCH_32 .debug_line_str 0x1B |
| 32 | +; RELOCS-NORL-NEXT: 0x4F R_LARCH_64 .text 0x0 |
| 33 | +; RELOCS-ENRL-NEXT: 0x4F R_LARCH_64 <null> 0x0 |
| 34 | +; RELOCS-ENRL-NEXT: 0x5F R_LARCH_ADD16 <null> 0x0 |
| 35 | +; RELOCS-ENRL-NEXT: 0x5F R_LARCH_SUB16 <null> 0x0 |
| 36 | +; RELOCS-BOTH-NEXT: } |
| 37 | +; RELOCS-BOTH-NEXT: ] |
| 38 | + |
| 39 | +; SOURCE: 0000000000000000 <foo>: |
| 40 | +; SOURCE: ; { |
| 41 | +; SOURCE: ; asm volatile( |
| 42 | +; SOURCE: ; return 0; |
| 43 | + |
| 44 | +; DWARF: DW_AT_producer ("clang") |
| 45 | +; DWARF: DW_AT_name ("dwarf-loongarch-relocs.c") |
| 46 | +; DWARF: DW_AT_comp_dir (".") |
| 47 | +; DWARF: DW_AT_name ("foo") |
| 48 | +; DWARF-NEXT: DW_AT_decl_file ("{{.*}}dwarf-loongarch-relocs.c") |
| 49 | +; DWARF-NEXT: DW_AT_decl_line (1) |
| 50 | +; DWARF-NEXT: DW_AT_type (0x00000032 "int") |
| 51 | +; DWARF: DW_AT_name ("int") |
| 52 | +; DWARF-NEXT: DW_AT_encoding (DW_ATE_signed) |
| 53 | +; DWARF-NEXT: DW_AT_byte_size (0x04) |
| 54 | +; DWARF: .debug_line contents: |
| 55 | +; DWARF-NEXT: debug_line[0x00000000] |
| 56 | +; DWARF-NEXT: Line table prologue: |
| 57 | +; DWARF-NEXT: total_length: {{.*}} |
| 58 | +; DWARF-NEXT: format: DWARF32 |
| 59 | +; DWARF-NEXT: version: 5 |
| 60 | +; DWARF-NEXT: address_size: 8 |
| 61 | +; DWARF-NEXT: seg_select_size: 0 |
| 62 | +; DWARF-NEXT: prologue_length: 0x0000003e |
| 63 | +; DWARF-NEXT: min_inst_length: 1 |
| 64 | +; DWARF-NEXT: max_ops_per_inst: 1 |
| 65 | +; DWARF-NEXT: default_is_stmt: 1 |
| 66 | +; DWARF-NEXT: line_base: -5 |
| 67 | +; DWARF-NEXT: line_range: 14 |
| 68 | +; DWARF-NEXT: opcode_base: 13 |
| 69 | +; DWARF-NEXT: standard_opcode_lengths[DW_LNS_copy] = 0 |
| 70 | +; DWARF-NEXT: standard_opcode_lengths[DW_LNS_advance_pc] = 1 |
| 71 | +; DWARF-NEXT: standard_opcode_lengths[DW_LNS_advance_line] = 1 |
| 72 | +; DWARF-NEXT: standard_opcode_lengths[DW_LNS_set_file] = 1 |
| 73 | +; DWARF-NEXT: standard_opcode_lengths[DW_LNS_set_column] = 1 |
| 74 | +; DWARF-NEXT: standard_opcode_lengths[DW_LNS_negate_stmt] = 0 |
| 75 | +; DWARF-NEXT: standard_opcode_lengths[DW_LNS_set_basic_block] = 0 |
| 76 | +; DWARF-NEXT: standard_opcode_lengths[DW_LNS_const_add_pc] = 0 |
| 77 | +; DWARF-NEXT: standard_opcode_lengths[DW_LNS_fixed_advance_pc] = 1 |
| 78 | +; DWARF-NEXT: standard_opcode_lengths[DW_LNS_set_prologue_end] = 0 |
| 79 | +; DWARF-NEXT: standard_opcode_lengths[DW_LNS_set_epilogue_begin] = 0 |
| 80 | +; DWARF-NEXT: standard_opcode_lengths[DW_LNS_set_isa] = 1 |
| 81 | +; DWARF-NEXT: include_directories[ 0] = "." |
| 82 | +; DWARF-NEXT: file_names[ 0]: |
| 83 | +; DWARF-NEXT: name: "dwarf-loongarch-relocs.c" |
| 84 | +; DWARF-NEXT: dir_index: 0 |
| 85 | +; DWARF-NEXT: md5_checksum: f44d6d71bc4da58b4abe338ca507c007 |
| 86 | +; DWARF-NEXT: source: "{{.*}}" |
| 87 | +; DWARF-EMPTY: |
| 88 | +; DWARF-NEXT: Address Line Column File ISA Discriminator OpIndex Flags |
| 89 | +; DWARF-NEXT: ------------------ ------ ------ ------ --- ------------- ------- ------------- |
| 90 | +; DWARF-NEXT: 0x0000000000000000 2 0 0 0 0 0 is_stmt |
| 91 | +; DWARF-NEXT: 0x0000000000000010 3 3 0 0 0 0 is_stmt prologue_end |
| 92 | +; DWARF-NEXT: 0x0000000000000020 10 3 0 0 0 0 is_stmt |
| 93 | +; DWARF-NEXT: 0x000000000000002c 10 3 0 0 0 0 epilogue_begin |
| 94 | +; DWARF-NEXT: 0x0000000000000034 10 3 0 0 0 0 end_sequence |
| 95 | + |
| 96 | +; ModuleID = 'dwarf-loongarch-relocs.c' |
| 97 | +source_filename = "dwarf-loongarch-relocs.c" |
| 98 | +target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n64-S128" |
| 99 | +target triple = "loongarch64" |
| 100 | + |
| 101 | +; Function Attrs: noinline nounwind optnone |
| 102 | +define dso_local signext i32 @foo() #0 !dbg !8 { |
| 103 | + call void asm sideeffect ".cfi_remember_state\0A\09.cfi_adjust_cfa_offset 16\0A\09nop\0A\09la.pcrel $$t0, sym\0A\09nop\0A\09.cfi_restore_state\0A\09", ""() #1, !dbg !12, !srcloc !13 |
| 104 | + ret i32 0, !dbg !14 |
| 105 | +} |
| 106 | + |
| 107 | +attributes #0 = { noinline nounwind optnone "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="loongarch64" "target-features"="+64bit,+d,+f,+ual" } |
| 108 | +attributes #1 = { nounwind } |
| 109 | + |
| 110 | +!llvm.dbg.cu = !{!0} |
| 111 | +!llvm.module.flags = !{!2, !3, !4, !5, !6} |
| 112 | +!llvm.ident = !{!7} |
| 113 | + |
| 114 | +!0 = distinct !DICompileUnit(language: DW_LANG_C11, file: !1, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None) |
| 115 | +!1 = !DIFile(filename: "dwarf-loongarch-relocs.c", directory: ".", checksumkind: CSK_MD5, checksum: "f44d6d71bc4da58b4abe338ca507c007", source: "int foo()\0A{\0A asm volatile(\0A \22.cfi_remember_state\\n\\t\22\0A \22.cfi_adjust_cfa_offset 16\\n\\t\22\0A \22nop\\n\\t\22\0A \22la.pcrel $t0, sym\\n\\t\22\0A \22nop\\n\\t\22\0A \22.cfi_restore_state\\n\\t\22);\0A return 0;\0A}\0A") |
| 116 | +!2 = !{i32 7, !"Dwarf Version", i32 5} |
| 117 | +!3 = !{i32 2, !"Debug Info Version", i32 3} |
| 118 | +!4 = !{i32 1, !"wchar_size", i32 4} |
| 119 | +!5 = !{i32 7, !"direct-access-external-data", i32 0} |
| 120 | +!6 = !{i32 7, !"frame-pointer", i32 2} |
| 121 | +!7 = !{!"clang"} |
| 122 | +!8 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !9, scopeLine: 2, spFlags: DISPFlagDefinition, unit: !0) |
| 123 | +!9 = !DISubroutineType(types: !10) |
| 124 | +!10 = !{!11} |
| 125 | +!11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) |
| 126 | +!12 = !DILocation(line: 3, column: 3, scope: !8) |
| 127 | +!13 = !{i64 34, i64 56, i64 92, i64 106, i64 134, i64 148, i64 177} |
| 128 | +!14 = !DILocation(line: 10, column: 3, scope: !8) |
0 commit comments