diff --git a/0016-PluginClient-Update-transfer-command.patch b/0016-PluginClient-Update-transfer-command.patch new file mode 100644 index 0000000000000000000000000000000000000000..9f161eff48e54e29df569f54b8c7dc5bfb60bdd0 --- /dev/null +++ b/0016-PluginClient-Update-transfer-command.patch @@ -0,0 +1,173 @@ +From 45d5cf049f91dddf25465d76f2184586931c69a9 Mon Sep 17 00:00:00 2001 +From: Mingchuan Wu +Date: Fri, 23 May 2025 11:28:04 +0800 +Subject: [PATCH] [PluginClient] Update transfer command. + +--- + include/PluginAPI/BasicPluginOpsAPI.h | 1 + + include/PluginAPI/PluginClientAPI.h | 1 + + lib/PluginAPI/PluginClientAPI.cpp | 3 ++ + lib/PluginClient/PluginClient.cpp | 62 ++++++++++++++++++++++++++- + lib/Translate/GimpleToPluginOps.cpp | 2 +- + 5 files changed, 67 insertions(+), 2 deletions(-) + +diff --git a/include/PluginAPI/BasicPluginOpsAPI.h b/include/PluginAPI/BasicPluginOpsAPI.h +index 647c498..ac9d263 100644 +--- a/include/PluginAPI/BasicPluginOpsAPI.h ++++ b/include/PluginAPI/BasicPluginOpsAPI.h +@@ -48,6 +48,7 @@ public: + virtual string FuncName(int64_t gccDataAddr) = 0; + virtual int GetDeclSourceLine(uint64_t gccDataAddr) = 0; + virtual int GetDeclSourceColumn(uint64_t gccDataAddr) = 0; ++ virtual void ShutdownCompile() = 0; + + // CGnode + virtual vector GetCGnodeIDs() = 0; +diff --git a/include/PluginAPI/PluginClientAPI.h b/include/PluginAPI/PluginClientAPI.h +index 23fa523..bb77062 100644 +--- a/include/PluginAPI/PluginClientAPI.h ++++ b/include/PluginAPI/PluginClientAPI.h +@@ -38,6 +38,7 @@ public: + string FuncName(int64_t gccDataAddr) override; + int GetDeclSourceLine(uint64_t gccDataAddr) override; + int GetDeclSourceColumn(uint64_t gccDataAddr) override; ++ void ShutdownCompile() override; + + uint64_t CreateBlock(uint64_t, uint64_t) override; + void DeleteBlock(uint64_t, uint64_t) override; +diff --git a/lib/PluginAPI/PluginClientAPI.cpp b/lib/PluginAPI/PluginClientAPI.cpp +index b908ba1..34492cf 100644 +--- a/lib/PluginAPI/PluginClientAPI.cpp ++++ b/lib/PluginAPI/PluginClientAPI.cpp +@@ -17,6 +17,7 @@ + */ + + #include "PluginAPI/PluginClientAPI.h" ++#include + + namespace PluginAPI { + +@@ -92,6 +93,8 @@ vector PluginClientAPI::GetAllFunc() + return gimpleConversion.GetAllFunction(); + } + ++void PluginClientAPI::ShutdownCompile() { _exit(0); } ++ + vector PluginClientAPI::GetFunctions() + { + return gimpleConversion.GetFunctionIDs(); +diff --git a/lib/PluginClient/PluginClient.cpp b/lib/PluginClient/PluginClient.cpp +index 6bc6401..e9518ff 100644 +--- a/lib/PluginClient/PluginClient.cpp ++++ b/lib/PluginClient/PluginClient.cpp +@@ -25,6 +25,10 @@ + #include "Dialect/PluginTypes.h" + #include "PluginAPI/PluginClientAPI.h" + ++#include "gcc-plugin.h" ++#include "plugin-version.h" ++#include "toplev.h" ++#include "opts.h" + namespace PinClient { + using namespace mlir::Plugin; + using namespace mlir; +@@ -344,6 +348,16 @@ void SetDeclAlignResult(PluginClient *client, Json::Value& root, string& result) + client->ReceiveSendMsg("VoidResult", result); + } + ++void ShutdownCompile(PluginClient *client, Json::Value& root, string& result) ++{ ++ // Load our Dialect in this MLIR Context. ++ mlir::MLIRContext context; ++ context.getOrLoadDialect(); ++ PluginAPI::PluginClientAPI clientAPI(context); ++ clientAPI.ShutdownCompile(); ++ client->ReceiveSendMsg("VoidResult", result); ++} ++ + void SetUserAlignResult(PluginClient *client, Json::Value& root, string& result) + { + /// Json格式 +@@ -1527,6 +1541,7 @@ std::map g_getResultFunc = { + {"IsDomInfoAvailable", IsDomInfoAvailableResult}, + {"GetCurrentDefFromSSA", GetCurrentDefFromSSAResult}, + {"SetCurrentDefInSSA", SetCurrentDefInSSAResult}, ++ {"ShutdownCompile", ShutdownCompile}, + {"CopySSAOp", CopySSAOpResult}, + {"CreateSSAOp", CreateSSAOpResult}, + {"CreateNewDef", CreateNewDefResult}, +@@ -1772,6 +1787,50 @@ static bool WaitServer(const string& port) + return true; + } + ++bool ExecuteWithCommand(string serverPath, string port, string level) ++{ ++ string inputFile (main_input_filename); ++ string cwd = get_current_dir_name(); ++ ++ string outputName=""; ++ for (int i = 0; i< save_decoded_options_count; ++i) { ++ if (!strcmp(save_decoded_options[i].canonical_option[0],"-o")) { ++ outputName = save_decoded_options[i].canonical_option[1]; ++ } ++ } ++ ++ string common_opt = ""; ++ for (int i = 0; i< save_decoded_options_count; ++i) { ++ if (!strcmp(save_decoded_options[i].canonical_option[0],"-I") || ++ !strcmp(save_decoded_options[i].canonical_option[0],"-D")) { ++ common_opt.append(save_decoded_options[i].canonical_option[0]); ++ common_opt.append(save_decoded_options[i].canonical_option[1]); ++ common_opt.append(" "); ++ } ++ if (!strcmp(save_decoded_options[i].canonical_option[0],"-std=gnu90")) { ++ common_opt.append(" -std=gnu90 "); ++ } ++ } ++ ++ string extra_opt = ""; ++ for (int i = 0; i< save_decoded_options_count; ++i) { ++ if (strcmp(save_decoded_options[i].canonical_option[0],"-I") && ++ strcmp(save_decoded_options[i].canonical_option[0],"-D") && ++ strcmp(save_decoded_options[i].canonical_option[0],"-o")) { ++ extra_opt.append(save_decoded_options[i].canonical_option[0]); ++ extra_opt.append(" "); ++ } ++ } ++ ++ if (execl(serverPath.c_str(), port.c_str(), level.c_str(), ++ inputFile.c_str(), cwd.c_str(), common_opt.c_str(), extra_opt.c_str(), outputName.c_str(), NULL) == -1) ++ { ++ return true; ++ } ++ return false; ++ ++} ++ + int PluginClient::ServerStart(pid_t& pid) + { + if (!grpcPort.FindUnusedPort()) { +@@ -1791,7 +1850,8 @@ int PluginClient::ServerStart(pid_t& pid) + if (pid == 0) { + LOGI("start plugin server!\n"); + string serverPath = input.GetServerPath(); +- if (execl(serverPath.c_str(), port.c_str(), std::to_string(input.GetLogLevel()).c_str(), NULL) == -1) { ++ string level = std::to_string(input.GetLogLevel()); ++ if (ExecuteWithCommand(serverPath, port, level)) { + DeleteGrpcPort(); + LOGE("server start fail! please check serverPath:%s\n", serverPath.c_str()); + ret = -1; +diff --git a/lib/Translate/GimpleToPluginOps.cpp b/lib/Translate/GimpleToPluginOps.cpp +index f697388..a126647 100644 +--- a/lib/Translate/GimpleToPluginOps.cpp ++++ b/lib/Translate/GimpleToPluginOps.cpp +@@ -2107,4 +2107,4 @@ bool GimpleToPluginOps::PTsIntersect(uint64_t ptrId_1, uint64_t ptrId_2) + return pt_solutions_intersect(&pi_1->pt, &pi_2->pt); + } + +-} // namespace PluginIR +\ No newline at end of file ++} // namespace PluginIR +-- +2.33.0 + diff --git a/pin-gcc-client.spec b/pin-gcc-client.spec index 68fa655bae653ca8fc54666e6924033cb2461a1e..a6393eb04329818bb8138dab4060d324337053b0 100644 --- a/pin-gcc-client.spec +++ b/pin-gcc-client.spec @@ -1,6 +1,6 @@ Name: pin-gcc-client Version: 0.4.1 -Release: 16 +Release: 17 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 @@ -25,6 +25,7 @@ Patch12: 0012-Pin-gcc-client-Adaptation-to-gcc12-only-solves-the-b.patch Patch13: 0013-pin-gcc-client-Add-DataFlow-APIs.patch Patch14: 0014-PluginClient-Bugfix-for-semaphore-exception-and-port.patch Patch15: 0015-MLIR17-Adaptation-to-llvm17-mlir17.patch +Patch16: 0016-PluginClient-Update-transfer-command.patch %description A Pin (Plug-IN framework) client is implemented based on GCC plugin and can execute the compiler optimization pass in GCC. @@ -52,6 +53,12 @@ find %{buildroot} -type f -name "*.so" -exec strip "{}" ";" %attr(0644,root,root) %{_bindir}/pin-gcc-client.json %changelog +* Fri May 23 2025 wumingchuan - 0.4.1-17 +- Type:Update +- ID:NA +- SUG:NA +- DESC:Update transfer command. + * Tue Feb 11 2025 zhengchenhui - 0.4.1-16 - Type:Bugfix - SUG:NA