141 lines · plain
1# REQUIRES: x86, zlib2# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t1.o3# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/gdb-index.s -o %t2.o4# RUN: ld.lld --gdb-index %t1.o %t2.o -o %t5 6# RUN: llvm-objdump -d %t | FileCheck %s --check-prefix=DISASM7# RUN: llvm-dwarfdump -gdb-index %t | FileCheck %s --check-prefix=DWARF8 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 %t112# RUN: llvm-readelf --sections %t1 | FileCheck %s --check-prefix=SECTION13 14# SECTION-NOT: .debug_gnu_pubnames15# SECTION-NOT: .debug_gnu_pubtypes16 17# RUN: llvm-mc -compress-debug-sections=zlib -filetype=obj -triple=x86_64-pc-linux \18# RUN: %p/Inputs/gdb-index.s -o %t2.o19# RUN: ld.lld --gdb-index %t1.o %t2.o -o %t20 21# RUN: llvm-objdump -d %t | FileCheck %s --check-prefix=DISASM22# RUN: llvm-dwarfdump -gdb-index %t | FileCheck %s --check-prefix=DWARF23# RUN: llvm-readelf -S %t | FileCheck %s --check-prefix=SECTION24 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 %}30 31# DISASM: Disassembly of section .text:32# DISASM-EMPTY:33# DISASM: <entrypoint>:34# DISASM-CHECK: 201000: 90 nop35# DISASM-CHECK: 201001: cc int336# DISASM-CHECK: 201002: cc int337# DISASM-CHECK: 201003: cc int338# DISASM: <aaaaaaaaaaaaaaaa>:39# DISASM-CHECK: 201004: 90 nop40# DISASM-CHECK: 201005: 90 nop41 42# DWARF: .gdb_index contents:43# DWARF-NEXT: Version = 744# DWARF: CU list offset = 0x18, has 2 entries:45# DWARF-NEXT: 0: Offset = 0x0, Length = 0x3446# DWARF-NEXT: 1: Offset = 0x34, Length = 0x3447# DWARF: Address area offset = 0x38, has 2 entries:48# DWARF-NEXT: Low/High address = [0x201120, 0x201121) (Size: 0x1), CU id = 049# DWARF-NEXT: Low/High address = [0x201124, 0x201126) (Size: 0x2), CU id = 150# DWARF: Symbol table offset = 0x60, size = 1024, filled slots:51# DWARF-NEXT: 512: Name offset = 0x1c, CU vector offset = 0x052# DWARF-NEXT: String name: aaaaaaaaaaaaaaaa, CU vector index: 053# DWARF-NEXT: 754: Name offset = 0x38, CU vector offset = 0x1054# DWARF-NEXT: String name: int, CU vector index: 255# DWARF-NEXT: 822: Name offset = 0x2d, CU vector offset = 0x856# DWARF-NEXT: String name: entrypoint, CU vector index: 157# DWARF: Constant pool offset = 0x2060, has 3 CU vectors:58# DWARF-NEXT: 0(0x0): 0x3000000159# DWARF-NEXT: 1(0x8): 0x3000000060# DWARF-NEXT: 2(0x10): 0x90000000 0x9000000161 62# RUN: ld.lld --gdb-index --no-gdb-index %t1.o %t2.o -o %t263# RUN: llvm-readobj --sections %t2 | FileCheck -check-prefix=NOGDB %s64# NOGDB-NOT: Name: .gdb_index65 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- -68 69.text70.Ltext0:71.globl entrypoint72.type entrypoint, @function73entrypoint:74 nop75.Letext0:76 77.section .debug_info,"",@progbits78.long 0x3079.value 0x480.long 081.byte 0x882.uleb128 0x183.quad .Ltext084.quad .Letext0-.Ltext085.long 086.long 087.long 088.long 089.byte 0x6390.byte 0x8891.byte 0xb492.byte 0x6193.byte 0xaa94.byte 0xb695.byte 0xb096.byte 0x6797 98.section .debug_abbrev,"",@progbits99.uleb128 0x1100.uleb128 0x11101.byte 0102.uleb128 0x11103.uleb128 0x1104.uleb128 0x12105.uleb128 0x7106.uleb128 0x10107.uleb128 0x17108.uleb128 0x2130109.uleb128 0xe110.uleb128 0x1b111.uleb128 0xe112.uleb128 0x2134113.uleb128 0x19114.uleb128 0x2133115.uleb128 0x17116.uleb128 0x2131117.uleb128 0x7118.byte 0119.byte 0120.byte 0121 122.section .debug_gnu_pubnames,"",@progbits123.long 0x1e124.value 0x2125.long .debug_info126.long 0x33127.long 0x18128.byte 0x30129.string "entrypoint"130.long 0131 132.section .debug_gnu_pubtypes,"",@progbits133.long 0x17134.value 0x2135.long .debug_info136.long 0x33137.long 0x2b138.byte 0x90139.string "int"140.long 0141