Home | History | Annotate | Download | only in ELF
      1 // RUN: llvm-mc -g -dwarf-version 2 -triple  i686-pc-linux-gnu %s -filetype=obj -o - | llvm-readobj -r | FileCheck %s
      2 // RUN: not llvm-mc -g -dwarf-version 1  -triple  i686-pc-linux-gnu %s -filetype=asm -o - 2>&1 | FileCheck --check-prefix=DWARF1 %s
      3 // RUN: llvm-mc -g -dwarf-version 2 -triple  i686-pc-linux-gnu %s -filetype=asm -o - | FileCheck --check-prefix=ASM --check-prefix=DWARF2 %s
      4 // RUN: llvm-mc -g -dwarf-version 3 -triple  i686-pc-linux-gnu %s -filetype=asm -o - | FileCheck --check-prefix=ASM --check-prefix=DWARF3 %s
      5 // RUN: llvm-mc -g -triple  i686-pc-linux-gnu %s -filetype=asm -o - | FileCheck --check-prefix=ASM --check-prefix=DWARF4 %s
      6 // RUN: not llvm-mc -g -dwarf-version 5  -triple  i686-pc-linux-gnu %s -filetype=asm -o - 2>&1 | FileCheck --check-prefix=DWARF5 %s
      7 
      8 
      9 // Test that on ELF:
     10 // 1. the debug info has a relocation to debug_abbrev and one to to debug_line.
     11 // 2. the debug_aranges has relocations to text and debug_line.
     12 
     13 
     14     .text
     15     .globl foo
     16     .type foo, @function
     17     .align 4
     18 foo:
     19     ret
     20     .size foo, .-foo
     21 
     22 // CHECK:      Relocations [
     23 // CHECK:        Section ({{[^ ]+}}) .rel.debug_info {
     24 // CHECK-NEXT:     0x6 R_386_32 .debug_abbrev 0x0
     25 // CHECK-NEXT:     0xC R_386_32 .debug_line 0x0
     26 // CHECK:        }
     27 // CHECK-NEXT:   Section ({{[^ ]+}}) .rel.debug_aranges {
     28 // CHECK-NEXT:     0x6 R_386_32 .debug_info 0x0
     29 // CHECK-NEXT:     0x10 R_386_32 .text 0x0
     30 // CHECK-NEXT:   }
     31 // CHECK:      ]
     32 
     33 // First instance of the section is just to give it a label for debug_aranges to refer to
     34 // ASM: .section .debug_info
     35 
     36 // ASM: .section .debug_abbrev
     37 // ASM-NEXT: [[ABBREV_LABEL:.Ltmp[0-9]+]]
     38 
     39 // Second instance of the section has the CU
     40 // ASM: .section .debug_info
     41 // Dwarf version
     42 // DWARF2: .short 2
     43 // DWARF3: .short 3
     44 // DWARF4: .short 4
     45 // ASM-NEXT: .long [[ABBREV_LABEL]]
     46 // First .byte 1 is the abbreviation number for the compile_unit abbrev
     47 // ASM: .byte 1
     48 // ASM-NEXT: .long [[LINE_LABEL:.L[a-z0-9]+]]
     49 
     50 // ASM: .section .debug_line
     51 // ASM-NEXT: [[LINE_LABEL]]
     52 
     53 // DWARF1: Dwarf version 1 is not supported.
     54 // DWARF5: Dwarf version 5 is not supported.
     55