Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SymbolExternalizer: Check KLP_ macros only if there was externzalized… #92

Merged
merged 1 commit into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libcextract/Passes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ class FunctionExternalizerPass : public Pass
ClangCompat_None, ctx->OFS);
PrettyPrint::Set_AST(ctx->AST.get());

if (ctx->Ibt && ctx->AST) {
if (ctx->Ibt && ctx->AST && externalizer.Has_Externalizations()) {
/* Do a sanity check on IBT macros. Some kernel branches can't use it,
so do a check here for sanity reasons. */
Preprocessor &pp = ctx->AST->getPreprocessor();
Expand Down
11 changes: 11 additions & 0 deletions libcextract/SymbolExternalizer.hh
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,17 @@ class SymbolExternalizer
return Log;
}

/** Returns true if there was at least one externalized symbol */
inline bool Has_Externalizations(void)
{
for (auto const& [key, val] : SymbolsMap) {
if (val.ExtType == ExternalizationType::STRONG)
return true;
}

return false;
}

/** Dump the SymbolsMap structure into stdout for debugging purposes. */
void Dump_SymbolsMap(void);

Expand Down
Loading