Skip to content

Commit 3a153b6

Browse files
committed
Support looking up absolute symbols
The Swift stdlib uses absolute symbols in the dylib to communicate feature flags to the process. LLDB's expression evaluator needs to be able to find them. This wires up absolute symbols so they show up in the symtab lookup command, which is also all that's needed for them to be visible to the expression evaluator JIT. rdar://85093828 Differential Revision: https://reviews.llvm.org/D113445 (cherry picked from commit c9881c7)
1 parent bfd3cb1 commit 3a153b6

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

lldb/source/Symbol/Symbol.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ void Symbol::Clear() {
115115
}
116116

117117
bool Symbol::ValueIsAddress() const {
118-
return m_addr_range.GetBaseAddress().GetSection().get() != nullptr;
118+
return m_addr_range.GetBaseAddress().GetSection().get() != nullptr ||
119+
m_type == eSymbolTypeAbsolute;
119120
}
120121

121122
ConstString Symbol::GetDisplayName() const {

lldb/source/Symbol/Symtab.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,6 +1096,7 @@ void Symtab::FindFunctionSymbols(ConstString name, uint32_t name_type_mask,
10961096
case eSymbolTypeCode:
10971097
case eSymbolTypeResolver:
10981098
case eSymbolTypeReExported:
1099+
case eSymbolTypeAbsolute:
10991100
symbol_indexes.push_back(temp_symbol_indexes[i]);
11001101
break;
11011102
default:
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# RUN: %clang %s -g -c -o %t.o
2+
# RUN: %lldb -b -o 'target modules lookup -s absolute_symbol' %t.o | FileCheck %s
3+
# CHECK: 1 symbols match 'absolute_symbol'
4+
# CHECK: Address: 0x0000000012345678 (0x0000000012345678)
5+
# CHECK: Summary: 0x0000000012345678
6+
.globl absolute_symbol
7+
absolute_symbol = 0x12345678

0 commit comments

Comments
 (0)