Skip to content

Commit

Permalink
SymbolExternalizer: Check KLP_ macros only if there was externzalized…
Browse files Browse the repository at this point in the history
… syms

Signed-off-by: Marcos Paulo de Souza <[email protected]>
  • Loading branch information
marcosps committed Jul 22, 2024
1 parent 9b2dfb6 commit 6611f09
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
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

0 comments on commit 6611f09

Please sign in to comment.