Skip to content

Commit a174d9b

Browse files
committed
Switch testing over to using llvm-mv + lld.
1 parent c9ff87a commit a174d9b

File tree

3 files changed

+43
-632
lines changed

3 files changed

+43
-632
lines changed

lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3999,7 +3999,7 @@ std::optional<uint32_t> ObjectFileELF::GetNumSymbolsFromDynamicGnuHash() {
39993999
}
40004000
}
40014001
if (num_symbols > 0)
4002-
return ++num_symbols; // First symbol is always all zeros
4002+
return num_symbols;
40034003

40044004
return std::nullopt;
40054005
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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

Comments
 (0)