@@ -2231,6 +2231,7 @@ size_t ObjectFileMachO::ParseSymtab() {
2231
2231
2232
2232
llvm::MachO::symtab_command symtab_load_command = {0 , 0 , 0 , 0 , 0 , 0 };
2233
2233
llvm::MachO::linkedit_data_command function_starts_load_command = {0 , 0 , 0 , 0 };
2234
+ llvm::MachO::linkedit_data_command exports_trie_load_command = {0 , 0 , 0 , 0 };
2234
2235
llvm::MachO::dyld_info_command dyld_info = {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 };
2235
2236
// The data element of type bool indicates that this entry is thumb
2236
2237
// code.
@@ -2308,11 +2309,19 @@ size_t ObjectFileMachO::ParseSymtab() {
2308
2309
}
2309
2310
} break ;
2310
2311
2312
+ case LC_DYLD_EXPORTS_TRIE:
2313
+ exports_trie_load_command.cmd = lc.cmd ;
2314
+ exports_trie_load_command.cmdsize = lc.cmdsize ;
2315
+ if (m_data.GetU32 (&offset, &exports_trie_load_command.dataoff , 2 ) ==
2316
+ nullptr ) // fill in offset and size fields
2317
+ memset (&exports_trie_load_command, 0 ,
2318
+ sizeof (exports_trie_load_command));
2319
+ break ;
2311
2320
case LC_FUNCTION_STARTS:
2312
2321
function_starts_load_command.cmd = lc.cmd ;
2313
2322
function_starts_load_command.cmdsize = lc.cmdsize ;
2314
2323
if (m_data.GetU32 (&offset, &function_starts_load_command.dataoff , 2 ) ==
2315
- nullptr ) // fill in symoff, nsyms, stroff, strsize fields
2324
+ nullptr ) // fill in data offset and size fields
2316
2325
memset (&function_starts_load_command, 0 ,
2317
2326
sizeof (function_starts_load_command));
2318
2327
break ;
@@ -2456,16 +2465,24 @@ size_t ObjectFileMachO::ParseSymtab() {
2456
2465
dyld_info.export_off += linkedit_slide;
2457
2466
m_dysymtab.indirectsymoff += linkedit_slide;
2458
2467
function_starts_load_command.dataoff += linkedit_slide;
2468
+ exports_trie_load_command.dataoff += linkedit_slide;
2459
2469
}
2460
2470
2461
2471
nlist_data.SetData (m_data, symtab_load_command.symoff ,
2462
2472
nlist_data_byte_size);
2463
2473
strtab_data.SetData (m_data, symtab_load_command.stroff ,
2464
2474
strtab_data_byte_size);
2465
2475
2476
+ // We shouldn't have exports data from both the LC_DYLD_INFO command
2477
+ // AND the LC_DYLD_EXPORTS_TRIE command in the same binary:
2478
+ lldbassert (!((dyld_info.export_size > 0 )
2479
+ && (exports_trie_load_command.datasize > 0 )));
2466
2480
if (dyld_info.export_size > 0 ) {
2467
2481
dyld_trie_data.SetData (m_data, dyld_info.export_off ,
2468
2482
dyld_info.export_size );
2483
+ } else if (exports_trie_load_command.datasize > 0 ) {
2484
+ dyld_trie_data.SetData (m_data, exports_trie_load_command.dataoff ,
2485
+ exports_trie_load_command.datasize );
2469
2486
}
2470
2487
2471
2488
if (m_dysymtab.nindirectsyms != 0 ) {
0 commit comments