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