File tree Expand file tree Collapse file tree 4 files changed +13
-15
lines changed Expand file tree Collapse file tree 4 files changed +13
-15
lines changed Original file line number Diff line number Diff line change @@ -361,6 +361,9 @@ class BinaryFunction {
361
361
// / True if another function body was merged into this one.
362
362
bool HasFunctionsFoldedInto{false };
363
363
364
+ // / True if the function has internal calls.
365
+ bool HasInternalCalls{false };
366
+
364
367
// / Name for the section this function code should reside in.
365
368
std::string CodeSectionName;
366
369
@@ -1334,6 +1337,9 @@ class BinaryFunction {
1334
1337
// / Return true if other functions were folded into this one.
1335
1338
bool hasFunctionsFoldedInto () const { return HasFunctionsFoldedInto; }
1336
1339
1340
+ // / Return true if the function has internal calls.
1341
+ bool hasInternalCalls () const { return HasInternalCalls; }
1342
+
1337
1343
// / If this function was folded, return the function it was folded into.
1338
1344
BinaryFunction *getFoldedIntoFunction () const { return FoldedIntoFunction; }
1339
1345
Original file line number Diff line number Diff line change @@ -1281,6 +1281,7 @@ Error BinaryFunction::disassemble() {
1281
1281
// Recursive call.
1282
1282
TargetSymbol = getSymbol ();
1283
1283
} else {
1284
+ HasInternalCalls = true ;
1284
1285
if (BC.isX86 ()) {
1285
1286
// Dangerous old-style x86 PIC code. We may need to freeze this
1286
1287
// function, so preserve the function as is for now.
@@ -1436,11 +1437,6 @@ Error BinaryFunction::disassemble() {
1436
1437
1437
1438
clearList (Relocations);
1438
1439
1439
- if (!IsSimple) {
1440
- clearList (Instructions);
1441
- return createNonFatalBOLTError (" " );
1442
- }
1443
-
1444
1440
updateState (State::Disassembled);
1445
1441
1446
1442
return Error::success ();
Original file line number Diff line number Diff line change @@ -309,15 +309,10 @@ Error ValidateInternalCalls::runOnFunctions(BinaryContext &BC) {
309
309
std::set<BinaryFunction *> NeedsValidation;
310
310
for (auto &BFI : BC.getBinaryFunctions ()) {
311
311
BinaryFunction &Function = BFI.second ;
312
- for (BinaryBasicBlock &BB : Function) {
313
- for (MCInst &Inst : BB) {
314
- if (getInternalCallTarget (Function, Inst)) {
315
- NeedsValidation.insert (&Function);
316
- Function.setSimple (false );
317
- break ;
318
- }
319
- }
320
- }
312
+ if (!Function.hasInternalCalls ())
313
+ continue ;
314
+ NeedsValidation.insert (&Function);
315
+ Function.setSimple (false );
321
316
}
322
317
323
318
// Skip validation for non-relocation mode
Original file line number Diff line number Diff line change @@ -3343,7 +3343,8 @@ void RewriteInstance::disassembleFunctions() {
3343
3343
3344
3344
if (!Function.isSimple ()) {
3345
3345
assert ((!BC->HasRelocations || Function.getSize () == 0 ||
3346
- Function.hasIndirectTargetToSplitFragment ()) &&
3346
+ Function.hasIndirectTargetToSplitFragment () ||
3347
+ Function.hasInternalCalls ()) &&
3347
3348
" unexpected non-simple function in relocation mode" );
3348
3349
continue ;
3349
3350
}
You can’t perform that action at this time.
0 commit comments