Skip to content

Commit

Permalink
Put the interposer in llvm.compiler.used.
Browse files Browse the repository at this point in the history
  • Loading branch information
maleadt committed Jul 19, 2022
1 parent ee0e01a commit bd6b58a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/aotcompile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <llvm/Transforms/InstCombine/InstCombine.h>
#include <llvm/Transforms/Scalar/InstSimplifyPass.h>
#include <llvm/Transforms/Utils/SimplifyCFGOptions.h>
#include <llvm/Transforms/Utils/ModuleUtils.h>
#include <llvm/Passes/PassBuilder.h>
#include <llvm/Passes/PassPlugin.h>
#if defined(USE_POLLY)
Expand Down Expand Up @@ -441,9 +442,8 @@ static void injectCRTAlias(Module &M, StringRef name, StringRef alias, FunctionT
if (!target) {
target = Function::Create(FT, Function::ExternalLinkage, alias, M);
}
// Weak so that this does not get discarded
// maybe use llvm.compiler.used instead?
Function *interposer = Function::Create(FT, Function::WeakAnyLinkage, name, M);
appendToCompilerUsed(M, {interposer});

llvm::IRBuilder<> builder(BasicBlock::Create(M.getContext(), "top", interposer));
SmallVector<Value *, 4> CallArgs;
Expand Down

0 comments on commit bd6b58a

Please sign in to comment.