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