diff options
author | Marco Elver <elver@google.com> | 2020-06-08 10:30:50 +0200 |
---|---|---|
committer | Marco Elver <elver@google.com> | 2020-06-08 10:34:03 +0200 |
commit | c6ec352a6bde1995794c523adc2ebab802ccdf0a (patch) | |
tree | 9b19e16a021dadc2e075e48b60767b7689033b3e /llvm/lib/Transforms/Utils/ModuleUtils.cpp | |
parent | 6143874f734bf3b27eeeb82d7756e008cba3b043 (diff) | |
download | llvm-c6ec352a6bde1995794c523adc2ebab802ccdf0a.zip llvm-c6ec352a6bde1995794c523adc2ebab802ccdf0a.tar.gz llvm-c6ec352a6bde1995794c523adc2ebab802ccdf0a.tar.bz2 |
Revert "[KernelAddressSanitizer] Make globals constructors compatible with kernel"
This reverts commit 866ee2353f7d0224644799d0d1faed53c7f3a06d.
Building the kernel results in modpost failures due to modpost relying
on debug info and inspecting kernel modules' globals:
https://github.com/ClangBuiltLinux/linux/issues/1045#issuecomment-640381783
Diffstat (limited to 'llvm/lib/Transforms/Utils/ModuleUtils.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/ModuleUtils.cpp | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/llvm/lib/Transforms/Utils/ModuleUtils.cpp b/llvm/lib/Transforms/Utils/ModuleUtils.cpp index ef9f18a..b2e6d98 100644 --- a/llvm/lib/Transforms/Utils/ModuleUtils.cpp +++ b/llvm/lib/Transforms/Utils/ModuleUtils.cpp @@ -119,15 +119,6 @@ llvm::declareSanitizerInitFunction(Module &M, StringRef InitName, AttributeList()); } -Function *llvm::createSanitizerCtor(Module &M, StringRef CtorName) { - Function *Ctor = Function::Create( - FunctionType::get(Type::getVoidTy(M.getContext()), false), - GlobalValue::InternalLinkage, CtorName, &M); - BasicBlock *CtorBB = BasicBlock::Create(M.getContext(), "", Ctor); - ReturnInst::Create(M.getContext(), CtorBB); - return Ctor; -} - std::pair<Function *, FunctionCallee> llvm::createSanitizerCtorAndInitFunctions( Module &M, StringRef CtorName, StringRef InitName, ArrayRef<Type *> InitArgTypes, ArrayRef<Value *> InitArgs, @@ -137,8 +128,11 @@ std::pair<Function *, FunctionCallee> llvm::createSanitizerCtorAndInitFunctions( "Sanitizer's init function expects different number of arguments"); FunctionCallee InitFunction = declareSanitizerInitFunction(M, InitName, InitArgTypes); - Function *Ctor = createSanitizerCtor(M, CtorName); - IRBuilder<> IRB(Ctor->getEntryBlock().getTerminator()); + Function *Ctor = Function::Create( + FunctionType::get(Type::getVoidTy(M.getContext()), false), + GlobalValue::InternalLinkage, CtorName, &M); + BasicBlock *CtorBB = BasicBlock::Create(M.getContext(), "", Ctor); + IRBuilder<> IRB(ReturnInst::Create(M.getContext(), CtorBB)); IRB.CreateCall(InitFunction, InitArgs); if (!VersionCheckName.empty()) { FunctionCallee VersionCheckFunction = M.getOrInsertFunction( |