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