[Update] Fix the bug during multi-process compilation

This commit is contained in:
dingguangya 2023-04-06 16:28:17 +08:00
parent 9932e821d3
commit 35567be976
2 changed files with 59 additions and 1 deletions

View File

@ -0,0 +1,50 @@
From 87821c34287af363d40624f75f82ef267828d815 Mon Sep 17 00:00:00 2001
From: Mingchuan Wu <wumingchuan1992@foxmail.com>
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<InjectPoint, plugin_event> g_injectPoint {
{HANDLE_PARSE_TYPE, PLUGIN_FINISH_TYPE},
@@ -47,7 +47,10 @@ std::map<InjectPoint, plugin_event> 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

View File

@ -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 <dingguangya1@huawei.com> - 0.4.1-7
- Type:Update
- ID:NA
- SUG:NA
- DESC:Fix the bug during multi-process compilation
* Sat 25 2023 dingguangya <dingguangya1@huawei.com> - 0.4.1-6
- Type:Update
- ID:NA