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:
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- -
72 .type entrypoint, @function
77 .section .debug_info,"",@progbits
84 .quad .Letext0-.Ltext0
98 .section .debug_abbrev,"",@progbits
122 .section .debug_gnu_pubnames,"",@progbits
132 .section .debug_gnu_pubtypes,"",@progbits