Skip to content

Commit c41282e

Browse files
Merge pull request llvm#3520 from adrian-prantl/85093828
Support looking up absolute symbols
2 parents 7646d73 + f71c162 commit c41282e

File tree

3 files changed

+98
-1
lines changed

3 files changed

+98
-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: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# RUN: yaml2obj %s -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+
# Created from:
7+
# .globl absolute_symbol
8+
# absolute_symbol = 0x12345678
9+
--- !mach-o
10+
FileHeader:
11+
magic: 0xFEEDFACF
12+
cputype: 0x100000C
13+
cpusubtype: 0x0
14+
filetype: 0x1
15+
ncmds: 4
16+
sizeofcmds: 280
17+
flags: 0x0
18+
reserved: 0x0
19+
LoadCommands:
20+
- cmd: LC_SEGMENT_64
21+
cmdsize: 152
22+
segname: ''
23+
vmaddr: 0
24+
vmsize: 0
25+
fileoff: 312
26+
filesize: 0
27+
maxprot: 7
28+
initprot: 7
29+
nsects: 1
30+
flags: 0
31+
Sections:
32+
- sectname: __text
33+
segname: __TEXT
34+
addr: 0x0
35+
size: 0
36+
offset: 0x138
37+
align: 0
38+
reloff: 0x0
39+
nreloc: 0
40+
flags: 0x80000000
41+
reserved1: 0x0
42+
reserved2: 0x0
43+
reserved3: 0x0
44+
content: ''
45+
- cmd: LC_BUILD_VERSION
46+
cmdsize: 24
47+
platform: 1
48+
minos: 786432
49+
sdk: 0
50+
ntools: 0
51+
- cmd: LC_SYMTAB
52+
cmdsize: 24
53+
symoff: 312
54+
nsyms: 2
55+
stroff: 344
56+
strsize: 24
57+
- cmd: LC_DYSYMTAB
58+
cmdsize: 80
59+
ilocalsym: 0
60+
nlocalsym: 1
61+
iextdefsym: 1
62+
nextdefsym: 1
63+
iundefsym: 2
64+
nundefsym: 0
65+
tocoff: 0
66+
ntoc: 0
67+
modtaboff: 0
68+
nmodtab: 0
69+
extrefsymoff: 0
70+
nextrefsyms: 0
71+
indirectsymoff: 0
72+
nindirectsyms: 0
73+
extreloff: 0
74+
nextrel: 0
75+
locreloff: 0
76+
nlocrel: 0
77+
LinkEditData:
78+
NameList:
79+
- n_strx: 17
80+
n_type: 0xE
81+
n_sect: 1
82+
n_desc: 0
83+
n_value: 0
84+
- n_strx: 1
85+
n_type: 0x3
86+
n_sect: 0
87+
n_desc: 0
88+
n_value: 305419896
89+
StringTable:
90+
- ''
91+
- absolute_symbol
92+
- ltmp0
93+
- ''
94+
...
95+

0 commit comments

Comments
 (0)