diff --git a/IDEHelper/Compiler/BfIRCodeGen.cpp b/IDEHelper/Compiler/BfIRCodeGen.cpp index 393d992a..d92a6c8c 100644 --- a/IDEHelper/Compiler/BfIRCodeGen.cpp +++ b/IDEHelper/Compiler/BfIRCodeGen.cpp @@ -352,6 +352,7 @@ BfIRCodeGen::BfIRCodeGen() mLLVMContext = new llvm::LLVMContext(); mLLVMModule = NULL; mIsCodeView = false; + mHadDLLExport = false; mConstValIdx = 0; mCmdCount = 0; @@ -3794,6 +3795,7 @@ void BfIRCodeGen::HandleNextCmd() else if (attribute == BFIRAttribute_DllExport) { func->setDLLStorageClass(llvm::GlobalValue::DLLExportStorageClass); + mHadDLLExport = true; } else if (attribute == BFIRAttribute_NoFramePointerElim) { @@ -5314,6 +5316,9 @@ bool BfIRCodeGen::WriteObjectFile(const StringImpl& outFileName) { enableLTO = false; } + + if (mHadDLLExport) // LTO bug in LLVM-link? + enableLTO = false; } std::error_code EC; diff --git a/IDEHelper/Compiler/BfIRCodeGen.h b/IDEHelper/Compiler/BfIRCodeGen.h index 7cd3868f..ad474f4d 100644 --- a/IDEHelper/Compiler/BfIRCodeGen.h +++ b/IDEHelper/Compiler/BfIRCodeGen.h @@ -106,6 +106,7 @@ public: BfCodeGenOptions mCodeGenOptions; bool mHasDebugLoc; bool mIsCodeView; + bool mHadDLLExport; int mConstValIdx; int mCmdCount;