xref: /llvm-project/lldb/test/Shell/ObjectFile/ELF/elf-dynsym.test (revision c526eb891bda371c0481fcdc1507adc496431d03)
1// This test verifies that loading an ELF file that has no section headers can
2// load the dynamic symbol table using the DT_SYMTAB, DT_SYMENT, DT_HASH or
3// the DT_GNU_HASH .dynamic key/value pairs that are loaded via the PT_DYNAMIC
4// segment.
5
6// REQUIRES: x86-registered-Target
7// RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj \
8// RUN:   -o - - <<<".globl defined, undefined; defined:" | \
9// RUN:   ld.lld /dev/stdin -o - --hash-style=gnu -export-dynamic -shared \
10// RUN:   -o %t.gnu
11// RUN: llvm-strip --strip-sections %t.gnu
12// RUN: %lldb %t.gnu -b \
13// RUN:   -o "image dump objfile" \
14// RUN:   | FileCheck %s --dump-input=always --check-prefix=GNU
15// GNU: (lldb) image dump objfile
16// GNU: Dumping headers for 1 module(s).
17// GNU: ObjectFileELF, file =
18// GNU: ELF Header
19// GNU: e_type      = 0x0003 ET_DYN
20// Make sure there are no section headers
21// GNU: e_shnum = 0x00000000
22// Make sure we were able to load the symbols
23// GNU: Symtab, file = {{.*}}elf-dynsym.test.tmp.gnu, num_symbols = 2:
24// GNU-DAG: undefined
25// GNU-DAG: defined
26
27// RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj \
28// RUN:   -o - - <<<".globl defined, undefined; defined:" | \
29// RUN:   ld.lld /dev/stdin -o - --hash-style=sysv -export-dynamic -shared \
30// RUN:   -o %t.sysv
31// RUN: llvm-strip --strip-sections %t.sysv
32// RUN: %lldb %t.sysv -b \
33// RUN:   -o "image dump objfile" \
34// RUN:   | FileCheck %s --dump-input=always --check-prefix=HASH
35// HASH: (lldb) image dump objfile
36// HASH: Dumping headers for 1 module(s).
37// HASH: ObjectFileELF, file =
38// HASH: ELF Header
39// HASH: e_type      = 0x0003 ET_DYN
40// Make sure there are no section headers
41// HASH: e_shnum = 0x00000000
42// Make sure we were able to load the symbols
43// HASH: Symtab, file = {{.*}}elf-dynsym.test.tmp.sysv, num_symbols = 2:
44// HASH-DAG: undefined
45// HASH-DAG: defined
46