brintos

brintos / llvm-project-archived public Read only

0
0
Text · 6.9 KiB · 6aaedf4 Raw
140 lines · plain
1; RUN: llc -filetype=obj -mtriple=riscv32 -mattr=+relax %s -o %t.o2; RUN: llvm-readobj -r %t.o | FileCheck -check-prefix=RELOC %s3; RUN: llvm-objdump --source %t.o | FileCheck --check-prefix=OBJDUMP-SOURCE %s4; RUN: llvm-dwarfdump --debug-info -debug-line -v %t.o | \5; RUN:     FileCheck -check-prefix=DWARF %s6 7; RELOC:       .rela.debug_info {8; RELOC-NEXT:    0x8 R_RISCV_32 .debug_abbrev 0x09; RELOC-NEXT:    0x11 R_RISCV_32 .L0  0x010; RELOC-NEXT:    0x15 R_RISCV_32 .Lline_table_start0 0x011; RELOC-NEXT:    0x1B R_RISCV_ADD32 .L0  0x012; RELOC-NEXT:    0x1B R_RISCV_SUB32 .L0  0x013; RELOC-NEXT:    0x1F R_RISCV_32 .L0  0x014; RELOC-NEXT:    0x25 R_RISCV_ADD32 .L0  0x015; RELOC-NEXT:    0x25 R_RISCV_SUB32 .L0  0x016; RELOC-NEXT:  }17; RELOC-NEXT:  .rela.debug_str_offsets {18; RELOC-NEXT:    0x8 R_RISCV_32 .L0  0x019; RELOC-NEXT:    0xC R_RISCV_32 .L0  0x020; RELOC-NEXT:    0x10 R_RISCV_32 .L0  0x021; RELOC-NEXT:    0x14 R_RISCV_32 .L0  0x022; RELOC-NEXT:    0x18 R_RISCV_32 .L0  0x023; RELOC-NEXT:  }24; RELOC-NEXT:  .rela.debug_addr {25; RELOC-NEXT:    0x8 R_RISCV_32 .L0  0x026; RELOC-NEXT:  }27; RELOC-NEXT:  .rela.debug_frame {28; RELOC-NEXT:    0x18 R_RISCV_32 .L0  0x029; RELOC-NEXT:    0x1C R_RISCV_32 .L0  0x030; RELOC-NEXT:    0x20 R_RISCV_ADD32 .L0  0x031; RELOC-NEXT:    0x20 R_RISCV_SUB32 .L0  0x032; RELOC-NEXT:    0x33 R_RISCV_SET6 .L0  0x033; RELOC-NEXT:    0x33 R_RISCV_SUB6 .L0  0x034; RELOC-NEXT:  }35; RELOC-NEXT:  .rela.debug_line {36; RELOC-NEXT:    0x22 R_RISCV_32 .debug_line_str 0x037; RELOC-NEXT:    0x31 R_RISCV_32 .debug_line_str 0x238; RELOC-NEXT:    0x46 R_RISCV_32 .debug_line_str 0x1739; RELOC-NEXT:    0x4F R_RISCV_32 .L0  0x040; RELOC-NEXT:    0x5B R_RISCV_ADD16 .L0  0x041; RELOC-NEXT:    0x5B R_RISCV_SUB16 .L0  0x042; RELOC-NEXT:  }43 44; Check that we can print the source, even with relocations.45; OBJDUMP-SOURCE: Disassembly of section .text:46; OBJDUMP-SOURCE-EMPTY:47; OBJDUMP-SOURCE-NEXT: 00000000 <main>:48; OBJDUMP-SOURCE: ; {49; OBJDUMP-SOURCE: ; return 0;50 51; DWARF: .debug_line contents:52; DWARF-NEXT: debug_line[0x00000000]53; DWARF-NEXT: Line table prologue:54; DWARF-NEXT:     total_length: 0x0000006255; DWARF-NEXT:           format: DWARF3256; DWARF-NEXT:          version: 557; DWARF-NEXT:     address_size: 458; DWARF-NEXT:  seg_select_size: 059; DWARF-NEXT:  prologue_length: 0x0000003e60; DWARF-NEXT:  min_inst_length: 161; DWARF-NEXT: max_ops_per_inst: 162; DWARF-NEXT:  default_is_stmt: 163; DWARF-NEXT:        line_base: -564; DWARF-NEXT:       line_range: 1465; DWARF-NEXT:      opcode_base: 1366; DWARF-NEXT: standard_opcode_lengths[DW_LNS_copy] = 067; DWARF-NEXT: standard_opcode_lengths[DW_LNS_advance_pc] = 168; DWARF-NEXT: standard_opcode_lengths[DW_LNS_advance_line] = 169; DWARF-NEXT: standard_opcode_lengths[DW_LNS_set_file] = 170; DWARF-NEXT: standard_opcode_lengths[DW_LNS_set_column] = 171; DWARF-NEXT: standard_opcode_lengths[DW_LNS_negate_stmt] = 072; DWARF-NEXT: standard_opcode_lengths[DW_LNS_set_basic_block] = 073; DWARF-NEXT: standard_opcode_lengths[DW_LNS_const_add_pc] = 074; DWARF-NEXT: standard_opcode_lengths[DW_LNS_fixed_advance_pc] = 175; DWARF-NEXT: standard_opcode_lengths[DW_LNS_set_prologue_end] = 076; DWARF-NEXT: standard_opcode_lengths[DW_LNS_set_epilogue_begin] = 077; DWARF-NEXT: standard_opcode_lengths[DW_LNS_set_isa] = 178; DWARF-NEXT: include_directories[  0] = .debug_line_str[0x00000000] = "."79; DWARF-NEXT: file_names[  0]:80; DWARF-NEXT:            name: .debug_line_str[0x00000002] = "dwarf-riscv-relocs.c"81; DWARF-NEXT:       dir_index: 082; DWARF-NEXT:    md5_checksum: 05ab89f5481bc9f2d037e7886641e91983; DWARF-NEXT:          source: .debug_line_str[0x00000017] = "int main()\n{\n    return 0;\n}\n"84; DWARF-EMPTY:85; DWARF-NEXT:            Address            Line   Column File   ISA Discriminator OpIndex Flags86; DWARF-NEXT:            ------------------ ------ ------ ------ --- ------------- ------- -------------87; DWARF-NEXT:0x0000004a: 04 DW_LNS_set_file (0)88; DWARF-NEXT:0x0000004c: 00 DW_LNE_set_address (0x00000000)89; DWARF-NEXT:0x00000053: 13 address += 0,  line += 1,  op-index += 090; DWARF-NEXT:            0x0000000000000000      2      0      0   0             0       0  is_stmt91; DWARF-NEXT:0x00000054: 05 DW_LNS_set_column (5)92; DWARF-NEXT:0x00000056: 0a DW_LNS_set_prologue_end93; DWARF-NEXT:0x00000057: f3 address += 16,  line += 1,  op-index += 094; DWARF-NEXT:            0x0000000000000010      3      5      0   0             0       0  is_stmt prologue_end95; DWARF-NEXT:0x00000058: 03 DW_LNS_advance_line (4)96; DWARF-NEXT:0x0000005a: 09 DW_LNS_fixed_advance_pc (addr += 0x0010, op-index = 0)97; DWARF-NEXT:0x0000005d: 01 DW_LNS_copy98; DWARF-NEXT:            0x0000000000000020      4      5      0   0             0       0  is_stmt99; DWARF-NEXT:0x0000005e: 06 DW_LNS_negate_stmt100; DWARF-NEXT:0x0000005f: 0b DW_LNS_set_epilogue_begin101; DWARF-NEXT:0x00000060: 4a address += 4,  line += 0,  op-index += 0102; DWARF-NEXT:            0x0000000000000024      4      5      0   0             0       0  epilogue_begin103; DWARF-NEXT:0x00000061: 02 DW_LNS_advance_pc (addr += 16, op-index += 0)104; DWARF-NEXT:0x00000063: 00 DW_LNE_end_sequence105; DWARF-NEXT:            0x0000000000000034      4      5      0   0             0       0  end_sequence106 107; ModuleID = 'dwarf-riscv-relocs.c'108source_filename = "dwarf-riscv-relocs.c"109target datalayout = "e-m:e-p:32:32-i64:64-n32-S128"110target triple = "riscv32"111 112; Function Attrs: noinline nounwind optnone113define dso_local i32 @main() #0 !dbg !7 {114entry:115  call void asm sideeffect ".cfi_remember_state\0A\09.cfi_adjust_cfa_offset 16\0A\09nop\0A\09call ext\0A\09nop\0A\09.cfi_restore_state\0A\09", ""() #1, !dbg !11116  ret i32 0, !dbg !12117}118 119declare void @ext()120 121attributes #0 = { noinline nounwind optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "frame-pointer"="all" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+relax" "use-soft-float"="false" }122 123!llvm.dbg.cu = !{!0}124!llvm.module.flags = !{!3, !4, !5}125!llvm.ident = !{!6}126 127!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)128!1 = !DIFile(filename: "dwarf-riscv-relocs.c", directory: ".", checksumkind: CSK_MD5, checksum: "05ab89f5481bc9f2d037e7886641e919", source: "int main()\0A{\0A    return 0;\0A}\0A")129!2 = !{}130!3 = !{i32 2, !"Dwarf Version", i32 5}131!4 = !{i32 2, !"Debug Info Version", i32 3}132!5 = !{i32 1, !"wchar_size", i32 4}133!6 = !{!"clang"}134!7 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 1, type: !8, scopeLine: 2, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)135!8 = !DISubroutineType(types: !9)136!9 = !{!10}137!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)138!11 = !DILocation(line: 3, column: 5, scope: !7)139!12 = !DILocation(line: 4, column: 5, scope: !7)140