Lines 92-99
Link Here
|
92 |
|
92 |
|
93 |
static bool validMachOFile(const uint8_t* fileContent, uint64_t fileLength, |
93 |
static bool validMachOFile(const uint8_t* fileContent, uint64_t fileLength, |
94 |
const mach_o::relocatable::ParserOptions& opts); |
94 |
const mach_o::relocatable::ParserOptions& opts); |
|
|
95 |
#ifdef LTO |
95 |
static bool validLTOFile(const uint8_t* fileContent, uint64_t fileLength, |
96 |
static bool validLTOFile(const uint8_t* fileContent, uint64_t fileLength, |
96 |
const mach_o::relocatable::ParserOptions& opts); |
97 |
const mach_o::relocatable::ParserOptions& opts); |
|
|
98 |
#endif |
97 |
static cpu_type_t architecture(); |
99 |
static cpu_type_t architecture(); |
98 |
|
100 |
|
99 |
class Entry : ar_hdr |
101 |
class Entry : ar_hdr |
Lines 237-242
Link Here
|
237 |
return mach_o::relocatable::isObjectFile(fileContent, fileLength, opts); |
239 |
return mach_o::relocatable::isObjectFile(fileContent, fileLength, opts); |
238 |
} |
240 |
} |
239 |
|
241 |
|
|
|
242 |
#ifdef LTO |
240 |
template <typename A> |
243 |
template <typename A> |
241 |
bool File<A>::validLTOFile(const uint8_t* fileContent, uint64_t fileLength, const mach_o::relocatable::ParserOptions& opts) |
244 |
bool File<A>::validLTOFile(const uint8_t* fileContent, uint64_t fileLength, const mach_o::relocatable::ParserOptions& opts) |
242 |
{ |
245 |
{ |
Lines 247-252
Link Here
|
247 |
return false; |
250 |
return false; |
248 |
return lto::isObjectFile(fileContent, fileLength, opts.architecture, opts.subType); |
251 |
return lto::isObjectFile(fileContent, fileLength, opts.architecture, opts.subType); |
249 |
} |
252 |
} |
|
|
253 |
#endif |
250 |
|
254 |
|
251 |
|
255 |
|
252 |
|
256 |
|
Lines 271-277
Link Here
|
271 |
continue; |
275 |
continue; |
272 |
#endif |
276 |
#endif |
273 |
// archive is valid if first .o file is valid |
277 |
// archive is valid if first .o file is valid |
274 |
return (validMachOFile(p->content(), p->contentSize(), opts) || validLTOFile(p->content(), p->contentSize(), opts)); |
278 |
return (validMachOFile(p->content(), p->contentSize(), opts) |
|
|
279 |
#ifdef LTO |
280 |
|| validLTOFile(p->content(), p->contentSize(), opts) |
281 |
#endif |
282 |
); |
275 |
} |
283 |
} |
276 |
// empty archive |
284 |
// empty archive |
277 |
return true; |
285 |
return true; |
Lines 407-412
Link Here
|
407 |
_instantiatedEntries[member] = state; |
415 |
_instantiatedEntries[member] = state; |
408 |
return _instantiatedEntries[member]; |
416 |
return _instantiatedEntries[member]; |
409 |
} |
417 |
} |
|
|
418 |
#ifdef LTO |
410 |
// see if member is llvm bitcode file |
419 |
// see if member is llvm bitcode file |
411 |
result = lto::parse(member->content(), member->contentSize(), |
420 |
result = lto::parse(member->content(), member->contentSize(), |
412 |
mPath, member->modificationTime(), ordinal, |
421 |
mPath, member->modificationTime(), ordinal, |
Lines 416-423
Link Here
|
416 |
_instantiatedEntries[member] = state; |
425 |
_instantiatedEntries[member] = state; |
417 |
return _instantiatedEntries[member]; |
426 |
return _instantiatedEntries[member]; |
418 |
} |
427 |
} |
|
|
428 |
#endif |
419 |
|
429 |
|
420 |
throwf("archive member '%s' with length %d is not mach-o or llvm bitcode", memberName, member->contentSize()); |
430 |
throwf("archive member '%s' with length %d is not mach-o" |
|
|
431 |
#ifdef LTO |
432 |
" or llvm bitcode" |
433 |
#endif |
434 |
, memberName, member->contentSize()); |
421 |
} |
435 |
} |
422 |
catch (const char* msg) { |
436 |
catch (const char* msg) { |
423 |
throwf("in %s, %s", memberPath, msg); |
437 |
throwf("in %s, %s", memberPath, msg); |
Lines 490-495
Link Here
|
490 |
if ( (member==start) && ((strcmp(mname, SYMDEF_64_SORTED) == 0) || (strcmp(mname, SYMDEF_64) == 0)) ) |
504 |
if ( (member==start) && ((strcmp(mname, SYMDEF_64_SORTED) == 0) || (strcmp(mname, SYMDEF_64) == 0)) ) |
491 |
continue; |
505 |
continue; |
492 |
#endif |
506 |
#endif |
|
|
507 |
#ifdef LTO |
493 |
if ( validMachOFile(member->content(), member->contentSize(), _objOpts) ) { |
508 |
if ( validMachOFile(member->content(), member->contentSize(), _objOpts) ) { |
494 |
MemberState& state = this->makeObjectFileForMember(member); |
509 |
MemberState& state = this->makeObjectFileForMember(member); |
495 |
// only look at files not already loaded |
510 |
// only look at files not already loaded |
Lines 513-518
Link Here
|
513 |
} |
528 |
} |
514 |
} |
529 |
} |
515 |
} |
530 |
} |
|
|
531 |
#endif |
516 |
} |
532 |
} |
517 |
} |
533 |
} |
518 |
return didSome; |
534 |
return didSome; |