mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 19:57:45 +00:00
Toolchain/Clang: Add support for -static-libstdc++
This option is already used by our GNU toolchain to avoid creating a circular dependency between LibC and `lib(std)c++`.
This commit is contained in:
parent
497180a650
commit
91546f42f3
1 changed files with 14 additions and 9 deletions
|
@ -136,10 +136,10 @@ index 58ae08a38..8e9a3fee6 100644
|
||||||
options::OPT_foperator_names, false))
|
options::OPT_foperator_names, false))
|
||||||
diff --git a/clang/lib/Driver/ToolChains/Serenity.cpp b/clang/lib/Driver/ToolChains/Serenity.cpp
|
diff --git a/clang/lib/Driver/ToolChains/Serenity.cpp b/clang/lib/Driver/ToolChains/Serenity.cpp
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 000000000..8f3e125dd
|
index 000000000..512eafd72
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/clang/lib/Driver/ToolChains/Serenity.cpp
|
+++ b/clang/lib/Driver/ToolChains/Serenity.cpp
|
||||||
@@ -0,0 +1,275 @@
|
@@ -0,0 +1,281 @@
|
||||||
+//===---- Serenity.cpp - SerenityOS ToolChain Implementation ----*- C++ -*-===//
|
+//===---- Serenity.cpp - SerenityOS ToolChain Implementation ----*- C++ -*-===//
|
||||||
+//
|
+//
|
||||||
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
@ -271,12 +271,18 @@ index 000000000..8f3e125dd
|
||||||
+ CmdArgs.push_back("-lubsan");
|
+ CmdArgs.push_back("-lubsan");
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
|
+ if (D.CCCIsCXX() && TC.ShouldLinkCXXStdlib(Args)) {
|
||||||
+ if (D.CCCIsCXX()) {
|
+ bool OnlyLibstdcxxStatic = Args.hasArg(options::OPT_static_libstdcxx) &&
|
||||||
+ if (TC.ShouldLinkCXXStdlib(Args))
|
+ !Args.hasArg(options::OPT_static);
|
||||||
+ TC.AddCXXStdlibLibArgs(Args, CmdArgs);
|
+ CmdArgs.push_back("--push-state");
|
||||||
+ CmdArgs.push_back("-lm");
|
+ CmdArgs.push_back("--as-needed");
|
||||||
+ }
|
+ if (OnlyLibstdcxxStatic)
|
||||||
|
+ CmdArgs.push_back("-Bstatic");
|
||||||
|
+ TC.AddCXXStdlibLibArgs(Args, CmdArgs);
|
||||||
|
+ if (OnlyLibstdcxxStatic)
|
||||||
|
+ CmdArgs.push_back("-Bdynamic");
|
||||||
|
+ CmdArgs.push_back("-lm");
|
||||||
|
+ CmdArgs.push_back("--pop-state");
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
|
+ if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
|
||||||
|
@ -415,7 +421,6 @@ index 000000000..8f3e125dd
|
||||||
+
|
+
|
||||||
+ return ToolChain::UNW_None;
|
+ return ToolChain::UNW_None;
|
||||||
+}
|
+}
|
||||||
\ No newline at end of file
|
|
||||||
diff --git a/clang/lib/Driver/ToolChains/Serenity.h b/clang/lib/Driver/ToolChains/Serenity.h
|
diff --git a/clang/lib/Driver/ToolChains/Serenity.h b/clang/lib/Driver/ToolChains/Serenity.h
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 000000000..50b0dbe62
|
index 000000000..50b0dbe62
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue