|
| 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 | +// RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj \ |
| 7 | +// RUN: -o - - <<<".globl defined, undefined; defined:" | \ |
| 8 | +// RUN: ld.lld /dev/stdin -o - --hash-style=gnu -export-dynamic -shared \ |
| 9 | +// RUN: -z nosectionheader -o %t.gnu |
| 10 | +// RUN: %lldb %t.gnu -b \ |
| 11 | +// RUN: -o "image dump objfile" \ |
| 12 | +// RUN: | FileCheck %s --dump-input=always --check-prefix=GNU |
| 13 | +// GNU: (lldb) image dump objfile |
| 14 | +// GNU: Dumping headers for 1 module(s). |
| 15 | +// GNU: ObjectFileELF, file = |
| 16 | +// GNU: ELF Header |
| 17 | +// GNU: e_type = 0x0003 ET_DYN |
| 18 | +// Make sure there are no section headers |
| 19 | +// GNU: e_shnum = 0x00000000 |
| 20 | +// Make sure we were able to load the symbols |
| 21 | +// GNU: Symtab, file = {{.*}}elf-dynsym.test.tmp.gnu, num_symbols = 2: |
| 22 | +// GNU-DAG: undefined |
| 23 | +// GNU-DAG: defined |
| 24 | + |
| 25 | +// RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj \ |
| 26 | +// RUN: -o - - <<<".globl defined, undefined; defined:" | \ |
| 27 | +// RUN: ld.lld /dev/stdin -o - --hash-style=sysv -export-dynamic -shared \ |
| 28 | +// RUN: -z nosectionheader -o %t.sysv |
| 29 | +// RUN: %lldb %t.sysv -b \ |
| 30 | +// RUN: -o "image dump objfile" \ |
| 31 | +// RUN: | FileCheck %s --dump-input=always --check-prefix=HASH |
| 32 | +// HASH: (lldb) image dump objfile |
| 33 | +// HASH: Dumping headers for 1 module(s). |
| 34 | +// HASH: ObjectFileELF, file = |
| 35 | +// HASH: ELF Header |
| 36 | +// HASH: e_type = 0x0003 ET_DYN |
| 37 | +// Make sure there are no section headers |
| 38 | +// HASH: e_shnum = 0x00000000 |
| 39 | +// Make sure we were able to load the symbols |
| 40 | +// HASH: Symtab, file = {{.*}}elf-dynsym.test.tmp.sysv, num_symbols = 2: |
| 41 | +// HASH-DAG: undefined |
| 42 | +// HASH-DAG: defined |
0 commit comments