File tree Expand file tree Collapse file tree 3 files changed +11
-9
lines changed Expand file tree Collapse file tree 3 files changed +11
-9
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.
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
You can’t perform that action at this time.
0 commit comments