@@ -2231,6 +2231,7 @@ size_t ObjectFileMachO::ParseSymtab() {
22312231
22322232 llvm::MachO::symtab_command symtab_load_command = {0 , 0 , 0 , 0 , 0 , 0 };
22332233 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 };
22342235 llvm::MachO::dyld_info_command dyld_info = {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 };
22352236 // The data element of type bool indicates that this entry is thumb
22362237 // code.
@@ -2308,11 +2309,19 @@ size_t ObjectFileMachO::ParseSymtab() {
23082309 }
23092310 } break ;
23102311
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 ;
23112320 case LC_FUNCTION_STARTS:
23122321 function_starts_load_command.cmd = lc.cmd ;
23132322 function_starts_load_command.cmdsize = lc.cmdsize ;
23142323 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
23162325 memset (&function_starts_load_command, 0 ,
23172326 sizeof (function_starts_load_command));
23182327 break ;
@@ -2456,16 +2465,24 @@ size_t ObjectFileMachO::ParseSymtab() {
24562465 dyld_info.export_off += linkedit_slide;
24572466 m_dysymtab.indirectsymoff += linkedit_slide;
24582467 function_starts_load_command.dataoff += linkedit_slide;
2468+ exports_trie_load_command.dataoff += linkedit_slide;
24592469 }
24602470
24612471 nlist_data.SetData (m_data, symtab_load_command.symoff ,
24622472 nlist_data_byte_size);
24632473 strtab_data.SetData (m_data, symtab_load_command.stroff ,
24642474 strtab_data_byte_size);
24652475
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 )));
24662480 if (dyld_info.export_size > 0 ) {
24672481 dyld_trie_data.SetData (m_data, dyld_info.export_off ,
24682482 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 );
24692486 }
24702487
24712488 if (m_dysymtab.nindirectsyms != 0 ) {
0 commit comments