[PATCH] D54082: [Driver] Use -Bstatic/dynamic for libc++ on Fuchsia
Petr Hosek via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Nov 3 21:28:14 PDT 2018
phosek created this revision.
phosek added a reviewer: mcgrathr.
Herald added a reviewer: EricWF.
Herald added a subscriber: cfe-commits.
-static relies on lld's behavior, but -Bstatic/dynamic across all
linkers, -lm is only needed when statically linking libc++.
Repository:
rC Clang
https://reviews.llvm.org/D54082
Files:
clang/lib/Driver/ToolChains/Fuchsia.cpp
clang/test/Driver/fuchsia.cpp
Index: clang/test/Driver/fuchsia.cpp
===================================================================
--- clang/test/Driver/fuchsia.cpp
+++ clang/test/Driver/fuchsia.cpp
@@ -20,7 +20,6 @@
// CHECK: "--push-state"
// CHECK: "--as-needed"
// CHECK: "-lc++"
-// CHECK: "-lm"
// CHECK: "--pop-state"
// CHECK: "[[RESOURCE_DIR]]{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}lib{{/|\\\\}}libclang_rt.builtins.a"
// CHECK: "-lc"
@@ -37,8 +36,9 @@
// RUN: | FileCheck %s -check-prefix=CHECK-STATIC
// CHECK-STATIC: "--push-state"
// CHECK-STATIC: "--as-needed"
-// CHECK-STATIC: "-static"
+// CHECK-STATIC: "-Bstatic"
// CHECK-STATIC: "-lc++"
+// CHECK-STATIC: "-Bdynamic"
// CHECK-STATIC: "-lm"
// CHECK-STATIC: "--pop-state"
// CHECK-STATIC: "-lc"
Index: clang/lib/Driver/ToolChains/Fuchsia.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Fuchsia.cpp
+++ clang/lib/Driver/ToolChains/Fuchsia.cpp
@@ -125,9 +125,12 @@
CmdArgs.push_back("--push-state");
CmdArgs.push_back("--as-needed");
if (OnlyLibstdcxxStatic)
- CmdArgs.push_back("-static");
+ CmdArgs.push_back("-Bstatic");
ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs);
- CmdArgs.push_back("-lm");
+ if (OnlyLibstdcxxStatic) {
+ CmdArgs.push_back("-Bdynamic");
+ CmdArgs.push_back("-lm");
+ }
CmdArgs.push_back("--pop-state");
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54082.172513.patch
Type: text/x-patch
Size: 1454 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181104/3e90c86d/attachment.bin>
More information about the cfe-commits
mailing list