Skip to content

Commit ff94c5a

Browse files
committed
[𝘀𝗽𝗿] changes to main this commit is based on
Created using spr 1.3.4 [skip ci]
1 parent d484c4d commit ff94c5a

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

bolt/include/bolt/Core/BinaryFunction.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,9 @@ class BinaryFunction {
361361
/// True if another function body was merged into this one.
362362
bool HasFunctionsFoldedInto{false};
363363

364+
/// True if the function has internal calls.
365+
bool HasInternalCalls{false};
366+
364367
/// Name for the section this function code should reside in.
365368
std::string CodeSectionName;
366369

@@ -1334,6 +1337,9 @@ class BinaryFunction {
13341337
/// Return true if other functions were folded into this one.
13351338
bool hasFunctionsFoldedInto() const { return HasFunctionsFoldedInto; }
13361339

1340+
/// Return true if the function has internal calls.
1341+
bool hasInternalCalls() const { return HasInternalCalls; }
1342+
13371343
/// If this function was folded, return the function it was folded into.
13381344
BinaryFunction *getFoldedIntoFunction() const { return FoldedIntoFunction; }
13391345

bolt/lib/Core/BinaryFunction.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,6 +1281,7 @@ Error BinaryFunction::disassemble() {
12811281
// Recursive call.
12821282
TargetSymbol = getSymbol();
12831283
} else {
1284+
HasInternalCalls = true;
12841285
if (BC.isX86()) {
12851286
// Dangerous old-style x86 PIC code. We may need to freeze this
12861287
// function, so preserve the function as is for now.

bolt/lib/Passes/ValidateInternalCalls.cpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -309,15 +309,10 @@ Error ValidateInternalCalls::runOnFunctions(BinaryContext &BC) {
309309
std::set<BinaryFunction *> NeedsValidation;
310310
for (auto &BFI : BC.getBinaryFunctions()) {
311311
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);
321316
}
322317

323318
// Skip validation for non-relocation mode

0 commit comments

Comments
 (0)