From cdfe23207e730da7b00f18bab92661c9817860a4 Mon Sep 17 00:00:00 2001 From: dingguangya Date: Thu, 6 Apr 2023 16:28:17 +0800 Subject: [PATCH] [Update] Fix the bug during multi-process compilation (cherry picked from commit 35567be976a30081271e3fdcd32ec6716e1df0d1) --- ...-the-bug-during-multi-process-compil.patch | 50 +++++++++++++++++++ pin-gcc-client.spec | 10 +++- 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 0010-PluginClient-Fix-the-bug-during-multi-process-compil.patch diff --git a/0010-PluginClient-Fix-the-bug-during-multi-process-compil.patch b/0010-PluginClient-Fix-the-bug-during-multi-process-compil.patch new file mode 100644 index 0000000..0371c6d --- /dev/null +++ b/0010-PluginClient-Fix-the-bug-during-multi-process-compil.patch @@ -0,0 +1,50 @@ +From 87821c34287af363d40624f75f82ef267828d815 Mon Sep 17 00:00:00 2001 +From: Mingchuan Wu +Date: Mon, 3 Apr 2023 19:29:16 +0800 +Subject: [PATCH] [PluginClient] Fix the bug during multi-process compilation. + + +diff --git a/lib/PluginClient/PluginClient.cpp b/lib/PluginClient/PluginClient.cpp +index c354d7e..c9f3cb7 100644 +--- a/lib/PluginClient/PluginClient.cpp ++++ b/lib/PluginClient/PluginClient.cpp +@@ -28,7 +28,7 @@ + namespace PinClient { + using namespace mlir::Plugin; + using namespace mlir; +-static PluginClient g_plugin; ++static PluginClient *g_plugin; + + std::map g_injectPoint { + {HANDLE_PARSE_TYPE, PLUGIN_FINISH_TYPE}, +@@ -47,7 +47,10 @@ std::map g_injectPoint { + + PluginClient *PluginClient::GetInstance() + { +- return &g_plugin; ++ if (g_plugin == nullptr) { ++ g_plugin = new PluginClient(); ++ } ++ return g_plugin; + } + + int PluginClient::GetEvent(InjectPoint inject, plugin_event *event) +diff --git a/lib/PluginClient/PluginInputCheck.cpp b/lib/PluginClient/PluginInputCheck.cpp +index 36ebd8c..f2505ca 100755 +--- a/lib/PluginClient/PluginInputCheck.cpp ++++ b/lib/PluginClient/PluginInputCheck.cpp +@@ -43,6 +43,11 @@ bool PluginInputCheck::ReadConfigfile(Json::Value& root) + Json::Reader reader; + std::ifstream ifs(configFilePath.c_str()); + if (!ifs.is_open()) { ++ if (serverPath == "") { ++ LOGW("open %s fail and server path is NULL! should specify server path first!\n", configFilePath.c_str()); ++ } else { ++ LOGW("open %s fail! use default sha256file:%s\n", configFilePath.c_str(), shaPath.c_str()); ++ } + return false; + } + +-- +2.33.0 + diff --git a/pin-gcc-client.spec b/pin-gcc-client.spec index 28f4865..6a14925 100644 --- a/pin-gcc-client.spec +++ b/pin-gcc-client.spec @@ -1,6 +1,6 @@ Name: pin-gcc-client Version: 0.4.1 -Release: 6 +Release: 7 Summary: A Pin (Plug-IN framework) client is implemented based on GCC plugin and can execute the compiler optimization pass in GCC. License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+ and BSD URL: https://gitee.com/src-openeuler/pin-gcc-client @@ -19,6 +19,7 @@ Patch6: 0006-Pin-gcc-client-Add-GetDeclType.patch Patch7: 0007-Pin-gcc-client-Fix-VectorType.patch Patch8: 0008-Pin-gcc-client-Fix-struct-self-contained-CallOp-Tree.patch Patch9: 0009-Pin-gcc-client-Fix-TreeToValue-VAR_DECL-and-ARRAY_TY.patch +Patch10: 0010-PluginClient-Fix-the-bug-during-multi-process-compil.patch %description A Pin (Plug-IN framework) client is implemented based on GCC plugin and can execute the compiler optimization pass in GCC. @@ -35,6 +36,7 @@ A Pin (Plug-IN framework) client is implemented based on GCC plugin and can exec %patch7 -p1 %patch8 -p1 %patch9 -p1 +%patch10 -p1 mkdir -p _build cd _build @@ -71,6 +73,12 @@ find %{_libdir} -type f -name "*.so" -exec strip "{}" ";" %config(noreplace) /etc/ld.so.conf.d/%{name}-%{_arch}.conf %changelog +* Thu Apr 6 2023 dingguangya - 0.4.1-7 +- Type:Update +- ID:NA +- SUG:NA +- DESC:Fix the bug during multi-process compilation + * Sat 25 2023 dingguangya - 0.4.1-6 - Type:Update - ID:NA -- Gitee