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
This commit is contained in:
Adrian Prantl 2021-11-08 17:01:21 -08:00
parent 196554d42d
commit c9881c7d99
3 changed files with 10 additions and 1 deletions

View File

@ -115,7 +115,8 @@ void Symbol::Clear() {
}
bool Symbol::ValueIsAddress() const {
return m_addr_range.GetBaseAddress().GetSection().get() != nullptr;
return m_addr_range.GetBaseAddress().GetSection().get() != nullptr ||
m_type == eSymbolTypeAbsolute;
}
ConstString Symbol::GetDisplayName() const {

View File

@ -1100,6 +1100,7 @@ void Symtab::FindFunctionSymbols(ConstString name, uint32_t name_type_mask,
case eSymbolTypeCode:
case eSymbolTypeResolver:
case eSymbolTypeReExported:
case eSymbolTypeAbsolute:
symbol_indexes.push_back(temp_symbol_indexes[i]);
break;
default:

View File

@ -0,0 +1,7 @@
# RUN: %clang %s -g -c -o %t.o
# RUN: %lldb -b -o 'target modules lookup -s absolute_symbol' %t.o | FileCheck %s
# CHECK: 1 symbols match 'absolute_symbol'
# CHECK: Address: 0x0000000012345678 (0x0000000012345678)
# CHECK: Summary: 0x0000000012345678
.globl absolute_symbol
absolute_symbol = 0x12345678