From e2c9c3fffcc61a0c102ccf6a7924e2de709092ad Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Tue, 27 Dec 2022 22:41:22 +0200 Subject: [PATCH] Add gcc's private library directory to ClangLinker's system path It's needed for libstdc++. --- source/clanglinker.cpp | 17 +++++++++++++++++ source/clanglinker.h | 3 +++ 2 files changed, 20 insertions(+) diff --git a/source/clanglinker.cpp b/source/clanglinker.cpp index 9d39979..5089028 100644 --- a/source/clanglinker.cpp +++ b/source/clanglinker.cpp @@ -1,7 +1,24 @@ +#include +#include "builder.h" #include "clanglinker.h" +using namespace Msp; + ClangLinker::ClangLinker(Builder &b, const Architecture &a): CustomizedTool(b, "LINK", a) { set_command("clang", true); } + +void ClangLinker::do_prepare(ToolData &tool) const +{ + parent.prepare(); + CustomizedTool::do_prepare(tool); + for(const FS::Path &p: parent.get_system_path()) + if(FS::exists(p/"libstdc++.so")) + { + builder.get_logger().log("tools", "Got %s gcc system path: %s", static_cast(tool).get_tag(), p); + tool.system_path.push_back(p); + break; + } +} diff --git a/source/clanglinker.h b/source/clanglinker.h index fd7e264..de65e64 100644 --- a/source/clanglinker.h +++ b/source/clanglinker.h @@ -7,6 +7,9 @@ class ClangLinker: public CustomizedTool { public: ClangLinker(Builder &, const Architecture &); + +protected: + void do_prepare(ToolData &) const override; }; #endif -- 2.45.2