[memprof] Remove an unused using directive (#117004)
[llvm-project.git] / lld / test / ELF / gdb-index.s
blob6d91a2e52acfbd687c1c5cdb8f21d9c6f2564a6b
1 # REQUIRES: x86, zlib
2 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t1.o
3 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/gdb-index.s -o %t2.o
4 # RUN: ld.lld --gdb-index %t1.o %t2.o -o %t
6 # RUN: llvm-objdump -d %t | FileCheck %s --check-prefix=DISASM
7 # RUN: llvm-dwarfdump -gdb-index %t | FileCheck %s --check-prefix=DWARF
9 ## Drop .debug_gnu_pubnames and .debug_gnu_pubtypes.
10 ## Also drop their relocation sections if --emit-relocs is specified.
11 # RUN: ld.lld --gdb-index --emit-relocs %t1.o %t2.o -o %t1
12 # RUN: llvm-readelf --sections %t1 | FileCheck %s --check-prefix=SECTION
14 # SECTION-NOT: .debug_gnu_pubnames
15 # SECTION-NOT: .debug_gnu_pubtypes
17 # RUN: llvm-mc -compress-debug-sections=zlib -filetype=obj -triple=x86_64-pc-linux \
18 # RUN: %p/Inputs/gdb-index.s -o %t2.o
19 # RUN: ld.lld --gdb-index %t1.o %t2.o -o %t
21 # RUN: llvm-objdump -d %t | FileCheck %s --check-prefix=DISASM
22 # RUN: llvm-dwarfdump -gdb-index %t | FileCheck %s --check-prefix=DWARF
23 # RUN: llvm-readelf -S %t | FileCheck %s --check-prefix=SECTION
25 # RUN: %if zstd %{ llvm-mc -compress-debug-sections=zlib -filetype=obj -triple=x86_64 %p/Inputs/gdb-index.s -o %t2.o %}
26 # RUN: %if zstd %{ ld.lld --gdb-index %t1.o %t2.o -o %t %}
27 # RUN: %if zstd %{ llvm-objdump -d %t | FileCheck %s --check-prefix=DISASM %}
28 # RUN: %if zstd %{ llvm-dwarfdump --gdb-index %t | FileCheck %s --check-prefix=DWARF %}
29 # RUN: %if zstd %{ llvm-readelf -S %t | FileCheck %s --check-prefix=SECTION %}
31 # DISASM: Disassembly of section .text:
32 # DISASM-EMPTY:
33 # DISASM: <entrypoint>:
34 # DISASM-CHECK: 201000: 90 nop
35 # DISASM-CHECK: 201001: cc int3
36 # DISASM-CHECK: 201002: cc int3
37 # DISASM-CHECK: 201003: cc int3
38 # DISASM: <aaaaaaaaaaaaaaaa>:
39 # DISASM-CHECK: 201004: 90 nop
40 # DISASM-CHECK: 201005: 90 nop
42 # DWARF: .gdb_index contents:
43 # DWARF-NEXT: Version = 7
44 # DWARF: CU list offset = 0x18, has 2 entries:
45 # DWARF-NEXT: 0: Offset = 0x0, Length = 0x34
46 # DWARF-NEXT: 1: Offset = 0x34, Length = 0x34
47 # DWARF: Address area offset = 0x38, has 2 entries:
48 # DWARF-NEXT: Low/High address = [0x201120, 0x201121) (Size: 0x1), CU id = 0
49 # DWARF-NEXT: Low/High address = [0x201124, 0x201126) (Size: 0x2), CU id = 1
50 # DWARF: Symbol table offset = 0x60, size = 1024, filled slots:
51 # DWARF-NEXT: 512: Name offset = 0x1c, CU vector offset = 0x0
52 # DWARF-NEXT: String name: aaaaaaaaaaaaaaaa, CU vector index: 0
53 # DWARF-NEXT: 754: Name offset = 0x38, CU vector offset = 0x10
54 # DWARF-NEXT: String name: int, CU vector index: 2
55 # DWARF-NEXT: 822: Name offset = 0x2d, CU vector offset = 0x8
56 # DWARF-NEXT: String name: entrypoint, CU vector index: 1
57 # DWARF: Constant pool offset = 0x2060, has 3 CU vectors:
58 # DWARF-NEXT: 0(0x0): 0x30000001
59 # DWARF-NEXT: 1(0x8): 0x30000000
60 # DWARF-NEXT: 2(0x10): 0x90000000 0x90000001
62 # RUN: ld.lld --gdb-index --no-gdb-index %t1.o %t2.o -o %t2
63 # RUN: llvm-readobj --sections %t2 | FileCheck -check-prefix=NOGDB %s
64 # NOGDB-NOT: Name: .gdb_index
66 ## The following section contents are created by this using gcc 7.1.0:
67 ## echo 'int entrypoint() { return 0; }' | gcc -gsplit-dwarf -xc++ -S -o- -
69 .text
70 .Ltext0:
71 .globl entrypoint
72 .type entrypoint, @function
73 entrypoint:
74 nop
75 .Letext0:
77 .section .debug_info,"",@progbits
78 .long 0x30
79 .value 0x4
80 .long 0
81 .byte 0x8
82 .uleb128 0x1
83 .quad .Ltext0
84 .quad .Letext0-.Ltext0
85 .long 0
86 .long 0
87 .long 0
88 .long 0
89 .byte 0x63
90 .byte 0x88
91 .byte 0xb4
92 .byte 0x61
93 .byte 0xaa
94 .byte 0xb6
95 .byte 0xb0
96 .byte 0x67
98 .section .debug_abbrev,"",@progbits
99 .uleb128 0x1
100 .uleb128 0x11
101 .byte 0
102 .uleb128 0x11
103 .uleb128 0x1
104 .uleb128 0x12
105 .uleb128 0x7
106 .uleb128 0x10
107 .uleb128 0x17
108 .uleb128 0x2130
109 .uleb128 0xe
110 .uleb128 0x1b
111 .uleb128 0xe
112 .uleb128 0x2134
113 .uleb128 0x19
114 .uleb128 0x2133
115 .uleb128 0x17
116 .uleb128 0x2131
117 .uleb128 0x7
118 .byte 0
119 .byte 0
120 .byte 0
122 .section .debug_gnu_pubnames,"",@progbits
123 .long 0x1e
124 .value 0x2
125 .long .debug_info
126 .long 0x33
127 .long 0x18
128 .byte 0x30
129 .string "entrypoint"
130 .long 0
132 .section .debug_gnu_pubtypes,"",@progbits
133 .long 0x17
134 .value 0x2
135 .long .debug_info
136 .long 0x33
137 .long 0x2b
138 .byte 0x90
139 .string "int"
140 .long 0