File: gen-dwarf.s

package info (click to toggle)
llvm-toolchain-14 1%3A14.0.6-12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,496,180 kB
  • sloc: cpp: 5,593,972; ansic: 986,872; asm: 585,869; python: 184,223; objc: 72,530; lisp: 31,119; f90: 27,793; javascript: 9,780; pascal: 9,762; sh: 9,482; perl: 7,468; ml: 5,432; awk: 3,523; makefile: 2,538; xml: 953; cs: 573; fortran: 567
file content (62 lines) | stat: -rw-r--r-- 2,404 bytes parent folder | download | duplicates (19)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// RUN: llvm-mc -g -dwarf-version 2 -triple  i686-pc-linux-gnu %s -filetype=obj -o - | llvm-readobj -r - | FileCheck %s
// RUN: not llvm-mc -g -dwarf-version 1  -triple  i686-pc-linux-gnu %s -filetype=asm -o - 2>&1 | FileCheck --check-prefix=DWARF1 %s
// RUN: llvm-mc -g -dwarf-version 2 -triple  i686-pc-linux-gnu %s -filetype=asm -o - | FileCheck --check-prefix=ASM --check-prefix=DWARF2 %s
// RUN: llvm-mc -g -dwarf-version 3 -triple  i686-pc-linux-gnu %s -filetype=asm -o - | FileCheck --check-prefix=ASM --check-prefix=DWARF3 %s
// RUN: llvm-mc -g -triple  i686-pc-linux-gnu %s -filetype=asm -o - | FileCheck --check-prefix=ASM --check-prefix=DWARF4 %s
// RUN: llvm-mc -g -dwarf-version 5  -triple  i686-pc-linux-gnu %s -filetype=asm -o - 2>&1 | FileCheck --check-prefix=DWARF5 %s
// RUN: not llvm-mc -g -dwarf-version 6  -triple  i686-pc-linux-gnu %s -filetype=asm -o - 2>&1 | FileCheck --check-prefix=DWARF6 %s


// Test that on ELF:
// 1. the debug info has a relocation to debug_abbrev and one to debug_line.
// 2. the debug_aranges has relocations to text and debug_line.


    .text
    .globl foo
    .type foo, @function
    .align 4
foo:
    ret
    .size foo, .-foo

// CHECK:      Relocations [
// CHECK:        Section ({{[^ ]+}}) .rel.debug_info {
// CHECK-NEXT:     0x6 R_386_32 .debug_abbrev
// CHECK-NEXT:     0xC R_386_32 .debug_line
// CHECK:        }
// CHECK-NEXT:   Section ({{[^ ]+}}) .rel.debug_aranges {
// CHECK-NEXT:     0x6 R_386_32 .debug_info
// CHECK-NEXT:     0x10 R_386_32 .text
// CHECK-NEXT:   }
// CHECK:      ]

// First instance of the section is just to give it a label for debug_aranges to refer to
// ASM: .section .debug_info

// ASM: .section .debug_abbrev
// ASM-NEXT: [[ABBREV_LABEL:.Ltmp[0-9]+]]
// DWARF5: .section .debug_abbrev
// DWARF5-NEXT: [[ABBREV_LABEL:.Ltmp[0-9]+]]

// Second instance of the section has the CU
// ASM: .section .debug_info
// Dwarf version
// DWARF2: .short 2
// DWARF3: .short 3
// DWARF4: .short 4
// ASM-NEXT: .long [[ABBREV_LABEL]]
// DWARF5: .short 5
// DWARF5-NEXT: .byte 1
// DWARF5-NEXT: .byte 4
// DWARF5-NEXT: .long [[ABBREV_LABEL]]

// First .byte 1 is the abbreviation number for the compile_unit abbrev
// ASM: .byte 1
// ASM-NEXT: .long [[LINE_LABEL:.L[a-z0-9]+]]

// ASM: .section .debug_line
// ASM-NEXT: [[LINE_LABEL]]

// DWARF1: Dwarf version 1 is not supported.
// DWARF6: Dwarf version 6 is not supported.