diff options
author | Qinkun Bao <qinkun@google.com> | 2025-06-24 13:11:52 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-06-24 13:11:52 -0400 |
commit | 4b4782bc868bcca7a92f1253529f148eb61cb628 (patch) | |
tree | 60cb1942ec0d17efdef9fbf46b575f4db00f77a3 /clang/lib/CodeGen | |
parent | 0c50971460cb4ff808990ade61e2d5688b9b9d73 (diff) | |
download | llvm-4b4782bc868bcca7a92f1253529f148eb61cb628.zip llvm-4b4782bc868bcca7a92f1253529f148eb61cb628.tar.gz llvm-4b4782bc868bcca7a92f1253529f148eb61cb628.tar.bz2 |
Revert "Add support for Windows Secure Hot-Patching" (#145553)
Reverts llvm/llvm-project#138972
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGCall.cpp | 7 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 29 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.h | 5 |
3 files changed, 0 insertions, 41 deletions
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index c8c3d6b..fd75de4 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -2660,13 +2660,6 @@ void CodeGenModule::ConstructAttributeList(StringRef Name, // CPU/feature overrides. addDefaultFunctionDefinitionAttributes // handles these separately to set them based on the global defaults. GetCPUAndFeaturesAttributes(CalleeInfo.getCalleeDecl(), FuncAttrs); - - // Windows hotpatching support - if (!MSHotPatchFunctions.empty()) { - bool IsHotPatched = llvm::binary_search(MSHotPatchFunctions, Name); - if (IsHotPatched) - FuncAttrs.addAttribute("marked_for_windows_hot_patching"); - } } // Mark functions that are replaceable by the loader. diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 96fdab2..1668881 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -458,35 +458,6 @@ CodeGenModule::CodeGenModule(ASTContext &C, if (Context.getTargetInfo().getTriple().getArch() == llvm::Triple::x86) getModule().addModuleFlag(llvm::Module::Error, "NumRegisterParameters", CodeGenOpts.NumRegisterParameters); - - // If there are any functions that are marked for Windows secure hot-patching, - // then build the list of functions now. - if (!CGO.MSSecureHotPatchFunctionsFile.empty() || - !CGO.MSSecureHotPatchFunctionsList.empty()) { - if (!CGO.MSSecureHotPatchFunctionsFile.empty()) { - auto BufOrErr = - llvm::MemoryBuffer::getFile(CGO.MSSecureHotPatchFunctionsFile); - if (BufOrErr) { - const llvm::MemoryBuffer &FileBuffer = **BufOrErr; - for (llvm::line_iterator I(FileBuffer.getMemBufferRef(), true), E; - I != E; ++I) - this->MSHotPatchFunctions.push_back(std::string{*I}); - } else { - auto &DE = Context.getDiagnostics(); - unsigned DiagID = - DE.getCustomDiagID(DiagnosticsEngine::Error, - "failed to open hotpatch functions file " - "(-fms-hotpatch-functions-file): %0 : %1"); - DE.Report(DiagID) << CGO.MSSecureHotPatchFunctionsFile - << BufOrErr.getError().message(); - } - } - - for (const auto &FuncName : CGO.MSSecureHotPatchFunctionsList) - this->MSHotPatchFunctions.push_back(FuncName); - - llvm::sort(this->MSHotPatchFunctions); - } } CodeGenModule::~CodeGenModule() {} diff --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h index cb013fe..1b67d43 100644 --- a/clang/lib/CodeGen/CodeGenModule.h +++ b/clang/lib/CodeGen/CodeGenModule.h @@ -678,11 +678,6 @@ private: AtomicOptions AtomicOpts; - // A set of functions which should be hot-patched; see - // -fms-hotpatch-functions-file (and -list). This will nearly always be empty. - // The list is sorted for binary-searching. - std::vector<std::string> MSHotPatchFunctions; - public: CodeGenModule(ASTContext &C, IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS, const HeaderSearchOptions &headersearchopts, |