[PATCH] D36202: [Driver] Disable static C++ library support on Fuchsia

Nico Weber via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 2 09:18:58 PDT 2017


Should clang warn if you request static libc++ on fuchsia? It now silently
ignores the flag, right?

On Aug 1, 2017 9:18 PM, "Petr Hosek via Phabricator via cfe-commits" <
cfe-commits at lists.llvm.org> wrote:

This revision was automatically updated to reflect the committed changes.
Closed by commit rL309778: [Driver] Disable static C++ library support on
Fuchsia (authored by phosek).

Changed prior to commit:
  https://reviews.llvm.org/D36202?vs=109255&id=109258#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D36202

Files:
  cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
  cfe/trunk/lib/Driver/ToolChains/Fuchsia.cpp
  cfe/trunk/test/Driver/fuchsia.cpp


Index: cfe/trunk/lib/Driver/ToolChains/Fuchsia.cpp
===================================================================
--- cfe/trunk/lib/Driver/ToolChains/Fuchsia.cpp
+++ cfe/trunk/lib/Driver/ToolChains/Fuchsia.cpp
@@ -107,15 +107,8 @@
       CmdArgs.push_back("-Bdynamic");

     if (D.CCCIsCXX()) {
-      if (ToolChain.ShouldLinkCXXStdlib(Args)) {
-        bool OnlyLibstdcxxStatic = Args.hasArg(options::OPT_static_libstdcxx)
&&
-                                   !Args.hasArg(options::OPT_static);
-        if (OnlyLibstdcxxStatic)
-          CmdArgs.push_back("-Bstatic");
+      if (ToolChain.ShouldLinkCXXStdlib(Args))
         ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs);
-        if (OnlyLibstdcxxStatic)
-          CmdArgs.push_back("-Bdynamic");
-      }
       CmdArgs.push_back("-lm");
     }

Index: cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
===================================================================
--- cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
+++ cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
@@ -31,6 +31,7 @@
   set(BUILTINS_${target}-fuchsia_CMAKE_SYSROOT
${FUCHSIA_${target}_SYSROOT} CACHE PATH "")
   set(BUILTINS_${target}-fuchsia_CMAKE_SYSTEM_NAME Fuchsia CACHE STRING "")
 endforeach()
+
 if(NOT APPLE)
   list(APPEND LLVM_BUILTIN_TARGETS "default")
 endif()
@@ -45,8 +46,10 @@
   set(RUNTIMES_${target}-fuchsia_LIBUNWIND_USE_COMPILER_RT ON CACHE BOOL
"")
   set(RUNTIMES_${target}-fuchsia_LIBCXXABI_USE_COMPILER_RT ON CACHE BOOL
"")
   set(RUNTIMES_${target}-fuchsia_LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL
"")
+  set(RUNTIMES_${target}-fuchsia_LIBCXXABI_ENABLE_STATIC OFF CACHE BOOL "")
   set(RUNTIMES_${target}-fuchsia_LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
   set(RUNTIMES_${target}-fuchsia_LIBCXX_ABI_VERSION 2 CACHE STRING "")
+  set(RUNTIMES_${target}-fuchsia_LIBCXX_ENABLE_STATIC OFF CACHE BOOL "")
 endforeach()

 # Setup toolchain.
Index: cfe/trunk/test/Driver/fuchsia.cpp
===================================================================
--- cfe/trunk/test/Driver/fuchsia.cpp
+++ cfe/trunk/test/Driver/fuchsia.cpp
@@ -28,8 +28,8 @@

 // RUN: %clangxx %s -### --target=x86_64-unknown-fuchsia -static-libstdc++
2>&1 \
 // RUN:     | FileCheck %s -check-prefix=CHECK-STATIC
-// CHECK-STATIC: "-Bstatic"
+// CHECK-STATIC-NOT: "-Bstatic"
 // CHECK-STATIC: "-lc++" "-lc++abi" "-lunwind"
-// CHECK-STATIC: "-Bdynamic"
+// CHECK-STATIC-NOT: "-Bdynamic"
 // CHECK-STATIC: "-lm"
 // CHECK-STATIC: "-lc"



_______________________________________________
cfe-commits mailing list
cfe-commits at lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170802/394c31c5/attachment.html>


More information about the cfe-commits mailing list