[PATCH] D50547: [Driver] Use normalized triples for multiarch runtime path

2018-08-09 Thread Petr Hosek via Phabricator via cfe-commits
phosek created this revision.
phosek added reviewers: rnk, echristo, chandlerc, beanz.
Herald added subscribers: cfe-commits, JDevlieghere, mgorny.

Previously we used target triple as provided which matches the GCC
behavior, but it also means that all clients have to be consistent
in their spelling of target triples since e.g. x86_64-linux-gnu and
x86_64-unknown-linux-gnu will result in Clang driver looking at two
different paths when searching for runtime libraries.

Unfortunately, as it turned out many clients aren't consistent in
their spelling of target triples, e.g. many Linux distributions use
the shorter spelling but config.guess and rustc insist on using the
normalized variant which is causing issues. To avoid having to ship
multiple copies of runtimes for different triple spelling or rely on
symlinks which are not portable, we should use the normalized triple
when constructing paths for multiarch runtimes.


Repository:
  rC Clang

https://reviews.llvm.org/D50547

Files:
  clang/cmake/caches/Fuchsia-stage2.cmake
  clang/lib/Driver/ToolChain.cpp

Index: clang/lib/Driver/ToolChain.cpp
===
--- clang/lib/Driver/ToolChain.cpp
+++ clang/lib/Driver/ToolChain.cpp
@@ -75,7 +75,7 @@
 : D(D), Triple(T), Args(Args), CachedRTTIArg(GetRTTIArgument(Args)),
   CachedRTTIMode(CalculateRTTIMode(Args, Triple, CachedRTTIArg)) {
   SmallString<128> P(D.ResourceDir);
-  llvm::sys::path::append(P, D.getTargetTriple(), "lib");
+  llvm::sys::path::append(P, Triple.str(), "lib");
   if (getVFS().exists(P))
 getFilePaths().push_back(P.str());
 
@@ -364,7 +364,7 @@
 
   const Driver &D = getDriver();
   SmallString<128> P(D.ResourceDir);
-  llvm::sys::path::append(P, D.getTargetTriple(), "lib");
+  llvm::sys::path::append(P, TT.str(), "lib");
   if (getVFS().exists(P)) {
 llvm::sys::path::append(P, Prefix + Twine("clang_rt.") + Component + Suffix);
 return P.str();
Index: clang/cmake/caches/Fuchsia-stage2.cmake
===
--- clang/cmake/caches/Fuchsia-stage2.cmake
+++ clang/cmake/caches/Fuchsia-stage2.cmake
@@ -35,31 +35,31 @@
   foreach(target i386;x86_64;armhf;aarch64)
 if(LINUX_${target}_SYSROOT)
   # Set the per-target builtins options.
-  list(APPEND BUILTIN_TARGETS "${target}-linux-gnu")
-  set(BUILTINS_${target}-linux-gnu_CMAKE_SYSTEM_NAME Linux CACHE STRING "")
-  set(BUILTINS_${target}-linux-gnu_CMAKE_BUILD_TYPE Release CACHE STRING "")
-  set(BUILTINS_${target}-linux-gnu_CMAKE_SYSROOT ${LINUX_${target}_SYSROOT} CACHE STRING "")
+  list(APPEND BUILTIN_TARGETS "${target}-unknown-linux-gnu")
+  set(BUILTINS_${target}-unknown-linux-gnu_CMAKE_SYSTEM_NAME Linux CACHE STRING "")
+  set(BUILTINS_${target}-unknown-linux-gnu_CMAKE_BUILD_TYPE Release CACHE STRING "")
+  set(BUILTINS_${target}-unknown-linux-gnu_CMAKE_SYSROOT ${LINUX_${target}_SYSROOT} CACHE STRING "")
 
   # Set the per-target runtimes options.
-  list(APPEND RUNTIME_TARGETS "${target}-linux-gnu")
-  set(RUNTIMES_${target}-linux-gnu_CMAKE_SYSTEM_NAME Linux CACHE STRING "")
-  set(RUNTIMES_${target}-linux-gnu_CMAKE_BUILD_TYPE Release CACHE STRING "")
-  set(RUNTIMES_${target}-linux-gnu_CMAKE_SYSROOT ${LINUX_${target}_SYSROOT} CACHE STRING "")
-  set(RUNTIMES_${target}-linux-gnu_LLVM_ENABLE_ASSERTIONS ON CACHE BOOL "")
-  set(RUNTIMES_${target}-linux-gnu_LIBUNWIND_ENABLE_SHARED OFF CACHE BOOL "")
-  set(RUNTIMES_${target}-linux-gnu_LIBUNWIND_USE_COMPILER_RT ON CACHE BOOL "")
-  set(RUNTIMES_${target}-linux-gnu_LIBUNWIND_INSTALL_LIBRARY OFF CACHE BOOL "")
-  set(RUNTIMES_${target}-linux-gnu_LIBCXXABI_USE_COMPILER_RT ON CACHE BOOL "")
-  set(RUNTIMES_${target}-linux-gnu_LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "")
-  set(RUNTIMES_${target}-linux-gnu_LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "")
-  set(RUNTIMES_${target}-linux-gnu_LIBCXXABI_ENABLE_STATIC_UNWINDER ON CACHE BOOL "")
-  set(RUNTIMES_${target}-linux-gnu_LIBCXXABI_INSTALL_LIBRARY OFF CACHE BOOL "")
-  set(RUNTIMES_${target}-linux-gnu_LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
-  set(RUNTIMES_${target}-linux-gnu_LIBCXX_ENABLE_SHARED OFF CACHE BOOL "")
-  set(RUNTIMES_${target}-linux-gnu_LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE BOOL "")
-  set(RUNTIMES_${target}-linux-gnu_SANITIZER_CXX_ABI "libc++" CACHE STRING "")
-  set(RUNTIMES_${target}-linux-gnu_SANITIZER_CXX_ABI_INTREE ON CACHE BOOL "")
-  set(RUNTIMES_${target}-linux-gnu_COMPILER_RT_USE_BUILTINS_LIBRARY ON CACHE BOOL "")
+  list(APPEND RUNTIME_TARGETS "${target}-unknown-linux-gnu")
+  set(RUNTIMES_${target}-unknown-linux-gnu_CMAKE_SYSTEM_NAME Linux CACHE STRING "")
+  set(RUNTIMES_${target}-unknown-linux-gnu_CMAKE_BUILD_TYPE Release CACHE STRING "")
+  set(RUNTIMES_${target}-unknown-linux-gnu_CMAKE_SYSROOT ${LINUX_${target}_SYSROOT} CACHE STRING "")
+  set(RUNTIMES_${target

[PATCH] D50663: [libunwind] [cmake] Add MINGW_LIBRARIES to the linker flags

2018-08-13 Thread Petr Hosek via Phabricator via cfe-commits
phosek accepted this revision.
phosek added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rUNW libunwind

https://reviews.llvm.org/D50663



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D50691: [CMake] Fix the LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY option

2018-08-14 Thread Petr Hosek via Phabricator via cfe-commits
phosek accepted this revision.
phosek added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rCXX libc++

https://reviews.llvm.org/D50691



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D50618: Refactor Darwin driver to refer to runtimes by component

2018-08-14 Thread Petr Hosek via Phabricator via cfe-commits
phosek accepted this revision.
phosek added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rC Clang

https://reviews.llvm.org/D50618



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D50755: [Driver] -print-target-triple and -print-effective-triple options

2018-08-14 Thread Petr Hosek via Phabricator via cfe-commits
phosek created this revision.
phosek added reviewers: beanz, rnk.
Herald added a subscriber: cfe-commits.

These can be used to print Clang target and effective triple.


Repository:
  rC Clang

https://reviews.llvm.org/D50755

Files:
  clang/include/clang/Driver/Options.td
  clang/lib/Driver/Driver.cpp
  clang/test/Driver/print-effective-triple.c
  clang/test/Driver/print-target-triple.c


Index: clang/test/Driver/print-target-triple.c
===
--- /dev/null
+++ clang/test/Driver/print-target-triple.c
@@ -0,0 +1,6 @@
+// Test that -print-target-triple prints correct triple.
+
+// RUN: %clang -print-target-triple 2>&1 \
+// RUN: --target=x86_64-linux-gnu \
+// RUN:   | FileCheck %s
+// CHECK: x86_64-unknown-linux-gnu
Index: clang/test/Driver/print-effective-triple.c
===
--- /dev/null
+++ clang/test/Driver/print-effective-triple.c
@@ -0,0 +1,6 @@
+// Test that -print-target-triple prints correct triple.
+
+// RUN: %clang -print-effective-triple 2>&1 \
+// RUN: --target=thumb-linux-gnu \
+// RUN:   | FileCheck %s
+// CHECK: armv4t-unknown-linux-gnu
Index: clang/lib/Driver/Driver.cpp
===
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -1672,6 +1672,18 @@
 }
 return false;
   }
+
+  if (C.getArgs().hasArg(options::OPT_print_target_triple)) {
+llvm::outs() << TC.getTripleString() << "\n";
+return false;
+  }
+
+  if (C.getArgs().hasArg(options::OPT_print_effective_triple)) {
+const llvm::Triple Triple(TC.ComputeEffectiveClangTriple(C.getArgs()));
+llvm::outs() << Triple.getTriple() << "\n";
+return false;
+  }
+
   return true;
 }
 
Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -2348,6 +2348,10 @@
 def print_multi_lib : Flag<["-", "--"], "print-multi-lib">;
 def print_multi_os_directory : Flag<["-", "--"], "print-multi-os-directory">,
   Flags<[Unsupported]>;
+def print_target_triple : Flag<["-", "--"], "print-target-triple">,
+  HelpText<"Print the normalized target triple">;
+def print_effective_triple : Flag<["-", "--"], "print-effective-triple">,
+  HelpText<"Print the effective target triple">;
 def print_prog_name_EQ : Joined<["-", "--"], "print-prog-name=">,
   HelpText<"Print the full program path of ">, MetaVarName<"">;
 def print_resource_dir : Flag<["-", "--"], "print-resource-dir">,


Index: clang/test/Driver/print-target-triple.c
===
--- /dev/null
+++ clang/test/Driver/print-target-triple.c
@@ -0,0 +1,6 @@
+// Test that -print-target-triple prints correct triple.
+
+// RUN: %clang -print-target-triple 2>&1 \
+// RUN: --target=x86_64-linux-gnu \
+// RUN:   | FileCheck %s
+// CHECK: x86_64-unknown-linux-gnu
Index: clang/test/Driver/print-effective-triple.c
===
--- /dev/null
+++ clang/test/Driver/print-effective-triple.c
@@ -0,0 +1,6 @@
+// Test that -print-target-triple prints correct triple.
+
+// RUN: %clang -print-effective-triple 2>&1 \
+// RUN: --target=thumb-linux-gnu \
+// RUN:   | FileCheck %s
+// CHECK: armv4t-unknown-linux-gnu
Index: clang/lib/Driver/Driver.cpp
===
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -1672,6 +1672,18 @@
 }
 return false;
   }
+
+  if (C.getArgs().hasArg(options::OPT_print_target_triple)) {
+llvm::outs() << TC.getTripleString() << "\n";
+return false;
+  }
+
+  if (C.getArgs().hasArg(options::OPT_print_effective_triple)) {
+const llvm::Triple Triple(TC.ComputeEffectiveClangTriple(C.getArgs()));
+llvm::outs() << Triple.getTriple() << "\n";
+return false;
+  }
+
   return true;
 }
 
Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -2348,6 +2348,10 @@
 def print_multi_lib : Flag<["-", "--"], "print-multi-lib">;
 def print_multi_os_directory : Flag<["-", "--"], "print-multi-os-directory">,
   Flags<[Unsupported]>;
+def print_target_triple : Flag<["-", "--"], "print-target-triple">,
+  HelpText<"Print the normalized target triple">;
+def print_effective_triple : Flag<["-", "--"], "print-effective-triple">,
+  HelpText<"Print the effective target triple">;
 def print_prog_name_EQ : Joined<["-", "--"], "print-prog-name=">,
   HelpText<"Print the full program path of ">, MetaVarName<"">;
 def print_resource_dir : Flag<["-", "--"], "print-resource-dir">,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/lis

[PATCH] D50755: [Driver] -print-target-triple and -print-effective-triple options

2018-08-15 Thread Petr Hosek via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL339834: [Driver] -print-target-triple and 
-print-effective-triple options (authored by phosek, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D50755?vs=160746&id=160954#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D50755

Files:
  cfe/trunk/include/clang/Driver/Options.td
  cfe/trunk/lib/Driver/Driver.cpp
  cfe/trunk/test/Driver/print-effective-triple.c
  cfe/trunk/test/Driver/print-target-triple.c


Index: cfe/trunk/include/clang/Driver/Options.td
===
--- cfe/trunk/include/clang/Driver/Options.td
+++ cfe/trunk/include/clang/Driver/Options.td
@@ -2348,6 +2348,10 @@
 def print_multi_lib : Flag<["-", "--"], "print-multi-lib">;
 def print_multi_os_directory : Flag<["-", "--"], "print-multi-os-directory">,
   Flags<[Unsupported]>;
+def print_target_triple : Flag<["-", "--"], "print-target-triple">,
+  HelpText<"Print the normalized target triple">;
+def print_effective_triple : Flag<["-", "--"], "print-effective-triple">,
+  HelpText<"Print the effective target triple">;
 def print_prog_name_EQ : Joined<["-", "--"], "print-prog-name=">,
   HelpText<"Print the full program path of ">, MetaVarName<"">;
 def print_resource_dir : Flag<["-", "--"], "print-resource-dir">,
Index: cfe/trunk/test/Driver/print-target-triple.c
===
--- cfe/trunk/test/Driver/print-target-triple.c
+++ cfe/trunk/test/Driver/print-target-triple.c
@@ -0,0 +1,6 @@
+// Test that -print-target-triple prints correct triple.
+
+// RUN: %clang -print-target-triple 2>&1 \
+// RUN: --target=x86_64-linux-gnu \
+// RUN:   | FileCheck %s
+// CHECK: x86_64-unknown-linux-gnu
Index: cfe/trunk/test/Driver/print-effective-triple.c
===
--- cfe/trunk/test/Driver/print-effective-triple.c
+++ cfe/trunk/test/Driver/print-effective-triple.c
@@ -0,0 +1,6 @@
+// Test that -print-target-triple prints correct triple.
+
+// RUN: %clang -print-effective-triple 2>&1 \
+// RUN: --target=thumb-linux-gnu \
+// RUN:   | FileCheck %s
+// CHECK: armv4t-unknown-linux-gnu
Index: cfe/trunk/lib/Driver/Driver.cpp
===
--- cfe/trunk/lib/Driver/Driver.cpp
+++ cfe/trunk/lib/Driver/Driver.cpp
@@ -1672,6 +1672,18 @@
 }
 return false;
   }
+
+  if (C.getArgs().hasArg(options::OPT_print_target_triple)) {
+llvm::outs() << TC.getTripleString() << "\n";
+return false;
+  }
+
+  if (C.getArgs().hasArg(options::OPT_print_effective_triple)) {
+const llvm::Triple Triple(TC.ComputeEffectiveClangTriple(C.getArgs()));
+llvm::outs() << Triple.getTriple() << "\n";
+return false;
+  }
+
   return true;
 }
 


Index: cfe/trunk/include/clang/Driver/Options.td
===
--- cfe/trunk/include/clang/Driver/Options.td
+++ cfe/trunk/include/clang/Driver/Options.td
@@ -2348,6 +2348,10 @@
 def print_multi_lib : Flag<["-", "--"], "print-multi-lib">;
 def print_multi_os_directory : Flag<["-", "--"], "print-multi-os-directory">,
   Flags<[Unsupported]>;
+def print_target_triple : Flag<["-", "--"], "print-target-triple">,
+  HelpText<"Print the normalized target triple">;
+def print_effective_triple : Flag<["-", "--"], "print-effective-triple">,
+  HelpText<"Print the effective target triple">;
 def print_prog_name_EQ : Joined<["-", "--"], "print-prog-name=">,
   HelpText<"Print the full program path of ">, MetaVarName<"">;
 def print_resource_dir : Flag<["-", "--"], "print-resource-dir">,
Index: cfe/trunk/test/Driver/print-target-triple.c
===
--- cfe/trunk/test/Driver/print-target-triple.c
+++ cfe/trunk/test/Driver/print-target-triple.c
@@ -0,0 +1,6 @@
+// Test that -print-target-triple prints correct triple.
+
+// RUN: %clang -print-target-triple 2>&1 \
+// RUN: --target=x86_64-linux-gnu \
+// RUN:   | FileCheck %s
+// CHECK: x86_64-unknown-linux-gnu
Index: cfe/trunk/test/Driver/print-effective-triple.c
===
--- cfe/trunk/test/Driver/print-effective-triple.c
+++ cfe/trunk/test/Driver/print-effective-triple.c
@@ -0,0 +1,6 @@
+// Test that -print-target-triple prints correct triple.
+
+// RUN: %clang -print-effective-triple 2>&1 \
+// RUN: --target=thumb-linux-gnu \
+// RUN:   | FileCheck %s
+// CHECK: armv4t-unknown-linux-gnu
Index: cfe/trunk/lib/Driver/Driver.cpp
===
--- cfe/trunk/lib/Driver/Driver.cpp
+++ cfe/trunk/lib/Driver/Driver.cpp
@@ -1672,6 +1672,18 @@
 }
 return false;
   }
+
+  if (C.getArgs().hasArg(options::OPT_print_target_triple)) {
+llvm::outs() << TC.getTripleString() << "\n";
+retu

[PATCH] D50547: [Driver] Use normalized triples for multiarch runtime path

2018-08-16 Thread Petr Hosek via Phabricator via cfe-commits
phosek updated this revision to Diff 161031.

Repository:
  rC Clang

https://reviews.llvm.org/D50547

Files:
  clang/include/clang/Driver/ToolChain.h
  clang/lib/Driver/ToolChain.cpp


Index: clang/lib/Driver/ToolChain.cpp
===
--- clang/lib/Driver/ToolChain.cpp
+++ clang/lib/Driver/ToolChain.cpp
@@ -74,10 +74,8 @@
  const ArgList &Args)
 : D(D), Triple(T), Args(Args), CachedRTTIArg(GetRTTIArgument(Args)),
   CachedRTTIMode(CalculateRTTIMode(Args, Triple, CachedRTTIArg)) {
-  SmallString<128> P(D.ResourceDir);
-  llvm::sys::path::append(P, D.getTargetTriple(), "lib");
-  if (getVFS().exists(P))
-getFilePaths().push_back(P.str());
+  if (llvm::Optional TargetLibPath = getTargetLibPath())
+getFilePaths().push_back(*TargetLibPath);
 
   std::string CandidateLibPath = getArchSpecificLibPath();
   if (getVFS().exists(CandidateLibPath))
@@ -362,10 +360,8 @@
   const char *Suffix = Shared ? (Triple.isOSWindows() ? ".dll" : ".so")
   : (IsITANMSVCWindows ? ".lib" : ".a");
 
-  const Driver &D = getDriver();
-  SmallString<128> P(D.ResourceDir);
-  llvm::sys::path::append(P, D.getTargetTriple(), "lib");
-  if (getVFS().exists(P)) {
+  if (llvm::Optional TargetLibPath = getTargetLibPath()) {
+SmallString<128> P(*TargetLibPath);
 llvm::sys::path::append(P, Prefix + Twine("clang_rt.") + Component + 
Suffix);
 return P.str();
   }
@@ -384,6 +380,21 @@
   return Args.MakeArgString(getCompilerRT(Args, Component, Shared));
 }
 
+Optional ToolChain::getTargetLibPath() const {
+  const Driver &D = getDriver();
+  SmallString<128> P(D.ResourceDir);
+  llvm::sys::path::append(P, D.getTargetTriple(), "lib");
+  if (getVFS().exists(P)) {
+return std::string(P.str());
+  } else {
+P.assign(D.ResourceDir);
+llvm::sys::path::append(P, Triple.str(), "lib");
+if (getVFS().exists(P))
+  return std::string(P.str());
+  }
+  return None;
+}
+
 std::string ToolChain::getArchSpecificLibPath() const {
   SmallString<128> Path(getDriver().ResourceDir);
   llvm::sys::path::append(Path, "lib", getOSLibName(),
Index: clang/include/clang/Driver/ToolChain.h
===
--- clang/include/clang/Driver/ToolChain.h
+++ clang/include/clang/Driver/ToolChain.h
@@ -362,6 +362,10 @@
  StringRef Component,
  bool Shared = false) const;
 
+  // Returns /lib/. This is used by runtimes to find
+  // per-target libraries.
+  Optional getTargetLibPath() const;
+
   // Returns /lib//.  This is used by runtimes (such
   // as OpenMP) to find arch-specific libraries.
   std::string getArchSpecificLibPath() const;


Index: clang/lib/Driver/ToolChain.cpp
===
--- clang/lib/Driver/ToolChain.cpp
+++ clang/lib/Driver/ToolChain.cpp
@@ -74,10 +74,8 @@
  const ArgList &Args)
 : D(D), Triple(T), Args(Args), CachedRTTIArg(GetRTTIArgument(Args)),
   CachedRTTIMode(CalculateRTTIMode(Args, Triple, CachedRTTIArg)) {
-  SmallString<128> P(D.ResourceDir);
-  llvm::sys::path::append(P, D.getTargetTriple(), "lib");
-  if (getVFS().exists(P))
-getFilePaths().push_back(P.str());
+  if (llvm::Optional TargetLibPath = getTargetLibPath())
+getFilePaths().push_back(*TargetLibPath);
 
   std::string CandidateLibPath = getArchSpecificLibPath();
   if (getVFS().exists(CandidateLibPath))
@@ -362,10 +360,8 @@
   const char *Suffix = Shared ? (Triple.isOSWindows() ? ".dll" : ".so")
   : (IsITANMSVCWindows ? ".lib" : ".a");
 
-  const Driver &D = getDriver();
-  SmallString<128> P(D.ResourceDir);
-  llvm::sys::path::append(P, D.getTargetTriple(), "lib");
-  if (getVFS().exists(P)) {
+  if (llvm::Optional TargetLibPath = getTargetLibPath()) {
+SmallString<128> P(*TargetLibPath);
 llvm::sys::path::append(P, Prefix + Twine("clang_rt.") + Component + Suffix);
 return P.str();
   }
@@ -384,6 +380,21 @@
   return Args.MakeArgString(getCompilerRT(Args, Component, Shared));
 }
 
+Optional ToolChain::getTargetLibPath() const {
+  const Driver &D = getDriver();
+  SmallString<128> P(D.ResourceDir);
+  llvm::sys::path::append(P, D.getTargetTriple(), "lib");
+  if (getVFS().exists(P)) {
+return std::string(P.str());
+  } else {
+P.assign(D.ResourceDir);
+llvm::sys::path::append(P, Triple.str(), "lib");
+if (getVFS().exists(P))
+  return std::string(P.str());
+  }
+  return None;
+}
+
 std::string ToolChain::getArchSpecificLibPath() const {
   SmallString<128> Path(getDriver().ResourceDir);
   llvm::sys::path::append(Path, "lib", getOSLibName(),
Index: clang/include/clang/Driver/ToolChain.h
===
--- clang/include/clang/Driver/ToolChain.h
+++ clang/include/clang/Driver/ToolChain.h
@@ -362,6 +362,10 @@

[PATCH] D50547: [Driver] Use normalized triples for multiarch runtime path

2018-08-16 Thread Petr Hosek via Phabricator via cfe-commits
phosek added a comment.

In https://reviews.llvm.org/D50547#1198218, @rnk wrote:

> Would it be to much to check both the normalized and non-normalized?


Done, currently I'm only checking the provided target triple followed by the 
normalized one, I'm not checking the effective triple but it'd be easy to add 
if we decide to do that as well.


Repository:
  rC Clang

https://reviews.llvm.org/D50547



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D50547: [Driver] Use normalized triples for multiarch runtime path

2018-08-21 Thread Petr Hosek via Phabricator via cfe-commits
phosek updated this revision to Diff 161818.

Repository:
  rC Clang

https://reviews.llvm.org/D50547

Files:
  clang/include/clang/Driver/ToolChain.h
  clang/lib/Driver/ToolChain.cpp


Index: clang/lib/Driver/ToolChain.cpp
===
--- clang/lib/Driver/ToolChain.cpp
+++ clang/lib/Driver/ToolChain.cpp
@@ -74,10 +74,8 @@
  const ArgList &Args)
 : D(D), Triple(T), Args(Args), CachedRTTIArg(GetRTTIArgument(Args)),
   CachedRTTIMode(CalculateRTTIMode(Args, Triple, CachedRTTIArg)) {
-  SmallString<128> P(D.ResourceDir);
-  llvm::sys::path::append(P, D.getTargetTriple(), "lib");
-  if (getVFS().exists(P))
-getFilePaths().push_back(P.str());
+  if (llvm::Optional TargetLibPath = getTargetLibPath())
+getFilePaths().push_back(*TargetLibPath);
 
   std::string CandidateLibPath = getArchSpecificLibPath();
   if (getVFS().exists(CandidateLibPath))
@@ -362,10 +360,8 @@
   const char *Suffix = Shared ? (Triple.isOSWindows() ? ".dll" : ".so")
   : (IsITANMSVCWindows ? ".lib" : ".a");
 
-  const Driver &D = getDriver();
-  SmallString<128> P(D.ResourceDir);
-  llvm::sys::path::append(P, D.getTargetTriple(), "lib");
-  if (getVFS().exists(P)) {
+  if (llvm::Optional TargetLibPath = getTargetLibPath()) {
+SmallString<128> P(*TargetLibPath);
 llvm::sys::path::append(P, Prefix + Twine("clang_rt.") + Component + 
Suffix);
 return P.str();
   }
@@ -384,6 +380,21 @@
   return Args.MakeArgString(getCompilerRT(Args, Component, Shared));
 }
 
+Optional ToolChain::getTargetLibPath() const {
+  const Driver &D = getDriver();
+  SmallString<128> P(D.ResourceDir);
+  llvm::sys::path::append(P, D.getTargetTriple(), "lib");
+  if (getVFS().exists(P)) {
+return std::string(P.str());
+  } else {
+P.assign(D.ResourceDir);
+llvm::sys::path::append(P, Triple.str(), "lib");
+if (getVFS().exists(P))
+  return std::string(P.str());
+  }
+  return None;
+}
+
 std::string ToolChain::getArchSpecificLibPath() const {
   SmallString<128> Path(getDriver().ResourceDir);
   llvm::sys::path::append(Path, "lib", getOSLibName(),
Index: clang/include/clang/Driver/ToolChain.h
===
--- clang/include/clang/Driver/ToolChain.h
+++ clang/include/clang/Driver/ToolChain.h
@@ -362,6 +362,10 @@
  StringRef Component,
  bool Shared = false) const;
 
+  // Returns /lib/. This is used by runtimes to find
+  // per-target libraries.
+  Optional getTargetLibPath() const;
+
   // Returns /lib//.  This is used by runtimes (such
   // as OpenMP) to find arch-specific libraries.
   std::string getArchSpecificLibPath() const;


Index: clang/lib/Driver/ToolChain.cpp
===
--- clang/lib/Driver/ToolChain.cpp
+++ clang/lib/Driver/ToolChain.cpp
@@ -74,10 +74,8 @@
  const ArgList &Args)
 : D(D), Triple(T), Args(Args), CachedRTTIArg(GetRTTIArgument(Args)),
   CachedRTTIMode(CalculateRTTIMode(Args, Triple, CachedRTTIArg)) {
-  SmallString<128> P(D.ResourceDir);
-  llvm::sys::path::append(P, D.getTargetTriple(), "lib");
-  if (getVFS().exists(P))
-getFilePaths().push_back(P.str());
+  if (llvm::Optional TargetLibPath = getTargetLibPath())
+getFilePaths().push_back(*TargetLibPath);
 
   std::string CandidateLibPath = getArchSpecificLibPath();
   if (getVFS().exists(CandidateLibPath))
@@ -362,10 +360,8 @@
   const char *Suffix = Shared ? (Triple.isOSWindows() ? ".dll" : ".so")
   : (IsITANMSVCWindows ? ".lib" : ".a");
 
-  const Driver &D = getDriver();
-  SmallString<128> P(D.ResourceDir);
-  llvm::sys::path::append(P, D.getTargetTriple(), "lib");
-  if (getVFS().exists(P)) {
+  if (llvm::Optional TargetLibPath = getTargetLibPath()) {
+SmallString<128> P(*TargetLibPath);
 llvm::sys::path::append(P, Prefix + Twine("clang_rt.") + Component + Suffix);
 return P.str();
   }
@@ -384,6 +380,21 @@
   return Args.MakeArgString(getCompilerRT(Args, Component, Shared));
 }
 
+Optional ToolChain::getTargetLibPath() const {
+  const Driver &D = getDriver();
+  SmallString<128> P(D.ResourceDir);
+  llvm::sys::path::append(P, D.getTargetTriple(), "lib");
+  if (getVFS().exists(P)) {
+return std::string(P.str());
+  } else {
+P.assign(D.ResourceDir);
+llvm::sys::path::append(P, Triple.str(), "lib");
+if (getVFS().exists(P))
+  return std::string(P.str());
+  }
+  return None;
+}
+
 std::string ToolChain::getArchSpecificLibPath() const {
   SmallString<128> Path(getDriver().ResourceDir);
   llvm::sys::path::append(Path, "lib", getOSLibName(),
Index: clang/include/clang/Driver/ToolChain.h
===
--- clang/include/clang/Driver/ToolChain.h
+++ clang/include/clang/Driver/ToolChain.h
@@ -362,6 +362,10 @@

[PATCH] D50547: [Driver] Use normalized triples for multiarch runtime path

2018-08-21 Thread Petr Hosek via Phabricator via cfe-commits
phosek added a comment.

I also need to create the following empty files for tests to pass (somehow 
those are not displayed by Phabricator):

  
clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/aarch64-fuchsia/lib/libclang_rt.asan-preinit.a
  
clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/aarch64-fuchsia/lib/libclang_rt.asan.so
  
clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/aarch64-fuchsia/lib/libclang_rt.builtins.a
  
clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/aarch64-fuchsia/lib/libclang_rt.fuzzer.a
  
clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/aarch64-fuchsia/lib/libclang_rt.scudo.so
  
clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/i386-linux-gnu/lib/libclang_rt.builtins.a
  
clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/x86_64-fuchsia/lib/libclang_rt.asan-preinit.a
  
clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/x86_64-fuchsia/lib/libclang_rt.asan.so
  
clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/x86_64-fuchsia/lib/libclang_rt.builtins.a
  
clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/x86_64-fuchsia/lib/libclang_rt.fuzzer.a
  
clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/x86_64-fuchsia/lib/libclang_rt.scudo.so
  
clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/x86_64-linux-gnu/lib/libclang_rt.builtins.a


Repository:
  rC Clang

https://reviews.llvm.org/D50547



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D50547: [Driver] Use normalized triples for multiarch runtime path

2018-08-21 Thread Petr Hosek via Phabricator via cfe-commits
phosek updated this revision to Diff 161821.
Herald added a reviewer: javed.absar.

Repository:
  rC Clang

https://reviews.llvm.org/D50547

Files:
  clang/include/clang/Driver/ToolChain.h
  clang/lib/Driver/ToolChain.cpp
  
clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/aarch64-fuchsia/lib/libclang_rt.asan-preinit.a
  
clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/aarch64-fuchsia/lib/libclang_rt.asan.so
  
clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/aarch64-fuchsia/lib/libclang_rt.builtins.a
  
clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/aarch64-fuchsia/lib/libclang_rt.fuzzer.a
  
clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/aarch64-fuchsia/lib/libclang_rt.scudo.so
  
clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/i386-linux-gnu/lib/libclang_rt.builtins.a
  
clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/x86_64-fuchsia/lib/libclang_rt.asan-preinit.a
  
clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/x86_64-fuchsia/lib/libclang_rt.asan.so
  
clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/x86_64-fuchsia/lib/libclang_rt.builtins.a
  
clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/x86_64-fuchsia/lib/libclang_rt.fuzzer.a
  
clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/x86_64-fuchsia/lib/libclang_rt.scudo.so
  
clang/test/Driver/Inputs/resource_dir_with_per_target_subdir/x86_64-linux-gnu/lib/libclang_rt.builtins.a


Index: clang/lib/Driver/ToolChain.cpp
===
--- clang/lib/Driver/ToolChain.cpp
+++ clang/lib/Driver/ToolChain.cpp
@@ -74,10 +74,17 @@
  const ArgList &Args)
 : D(D), Triple(T), Args(Args), CachedRTTIArg(GetRTTIArgument(Args)),
   CachedRTTIMode(CalculateRTTIMode(Args, Triple, CachedRTTIArg)) {
-  SmallString<128> P(D.ResourceDir);
+  SmallString<128> P;
+
+  P.assign(D.ResourceDir);
   llvm::sys::path::append(P, D.getTargetTriple(), "lib");
   if (getVFS().exists(P))
-getFilePaths().push_back(P.str());
+getLibraryPaths().push_back(P.str());
+
+  P.assign(D.ResourceDir);
+  llvm::sys::path::append(P, Triple.str(), "lib");
+  if (getVFS().exists(P))
+getLibraryPaths().push_back(P.str());
 
   std::string CandidateLibPath = getArchSpecificLibPath();
   if (getVFS().exists(CandidateLibPath))
@@ -362,12 +369,11 @@
   const char *Suffix = Shared ? (Triple.isOSWindows() ? ".dll" : ".so")
   : (IsITANMSVCWindows ? ".lib" : ".a");
 
-  const Driver &D = getDriver();
-  SmallString<128> P(D.ResourceDir);
-  llvm::sys::path::append(P, D.getTargetTriple(), "lib");
-  if (getVFS().exists(P)) {
+  for (const auto &LibPath : getLibraryPaths()) {
+SmallString<128> P(LibPath);
 llvm::sys::path::append(P, Prefix + Twine("clang_rt.") + Component + 
Suffix);
-return P.str();
+if (getVFS().exists(P))
+  return P.str();
   }
 
   StringRef Arch = getArchNameForCompilerRTLib(*this, Args);
@@ -765,6 +771,10 @@
   for (const auto &LibPath : getFilePaths())
 if(LibPath.length() > 0)
   CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + LibPath));
+
+  for (const auto &LibPath : getLibraryPaths())
+if(LibPath.length() > 0)
+  CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + LibPath));
 }
 
 void ToolChain::AddCCKextLibArgs(const ArgList &Args,
Index: clang/include/clang/Driver/ToolChain.h
===
--- clang/include/clang/Driver/ToolChain.h
+++ clang/include/clang/Driver/ToolChain.h
@@ -122,6 +122,9 @@
   /// The list of toolchain specific path prefixes to search for programs.
   path_list ProgramPaths;
 
+  /// The list of toolchain specific path prefixes to search for libraries.
+  path_list LibraryPaths;
+
   mutable std::unique_ptr Clang;
   mutable std::unique_ptr Assemble;
   mutable std::unique_ptr Link;
@@ -219,6 +222,9 @@
   path_list &getProgramPaths() { return ProgramPaths; }
   const path_list &getProgramPaths() const { return ProgramPaths; }
 
+  path_list &getLibraryPaths() { return LibraryPaths; }
+  const path_list &getLibraryPaths() const { return LibraryPaths; }
+
   const MultilibSet &getMultilibs() const { return Multilibs; }
 
   const SanitizerArgs& getSanitizerArgs() const;


Index: clang/lib/Driver/ToolChain.cpp
===
--- clang/lib/Driver/ToolChain.cpp
+++ clang/lib/Driver/ToolChain.cpp
@@ -74,10 +74,17 @@
  const ArgList &Args)
 : D(D), Triple(T), Args(Args), CachedRTTIArg(GetRTTIArgument(Args)),
   CachedRTTIMode(CalculateRTTIMode(Args, Triple, CachedRTTIArg)) {
-  SmallString<128> P(D.ResourceDir);
+  SmallString<128> P;
+
+  P.assign(D.ResourceDir);
   llvm::sys::path::append(P, D.getTargetTriple(), "lib");
   if (getVFS().exists(P))
-getFilePaths().push_back(P.str());
+getLibraryPaths().push_back(P.str());
+
+ 

[PATCH] D50547: [Driver] Use normalized triples for multiarch runtime path

2018-08-21 Thread Petr Hosek via Phabricator via cfe-commits
phosek added inline comments.



Comment at: clang/lib/Driver/ToolChain.cpp:372
 
-  const Driver &D = getDriver();
-  SmallString<128> P(D.ResourceDir);
-  llvm::sys::path::append(P, D.getTargetTriple(), "lib");
-  if (getVFS().exists(P)) {
+  for (const auto &LibPath : getLibraryPaths()) {
+SmallString<128> P(LibPath);

One possible alternative I've considered would be to simply return 
`-lclang_rt..` instead of returning the full path when 
`getLibraryPaths()` is not empty. That should work because we add all paths in 
this list as `-L` in `AddFilePathLibArgs` and it's more consistent with e.g. 
`-lgcc_s`.


Repository:
  rC Clang

https://reviews.llvm.org/D50547



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D50547: [Driver] Use normalized triples for multiarch runtime path

2018-08-22 Thread Petr Hosek via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC340471: [Driver] Check normalized triples for multiarch 
runtime path (authored by phosek, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D50547?vs=161821&id=162090#toc

Repository:
  rC Clang

https://reviews.llvm.org/D50547

Files:
  include/clang/Driver/ToolChain.h
  lib/Driver/ToolChain.cpp
  
test/Driver/Inputs/resource_dir_with_per_target_subdir/aarch64-fuchsia/lib/libclang_rt.asan-preinit.a
  
test/Driver/Inputs/resource_dir_with_per_target_subdir/aarch64-fuchsia/lib/libclang_rt.asan.so
  
test/Driver/Inputs/resource_dir_with_per_target_subdir/aarch64-fuchsia/lib/libclang_rt.builtins.a
  
test/Driver/Inputs/resource_dir_with_per_target_subdir/aarch64-fuchsia/lib/libclang_rt.fuzzer.a
  
test/Driver/Inputs/resource_dir_with_per_target_subdir/aarch64-fuchsia/lib/libclang_rt.scudo.so
  
test/Driver/Inputs/resource_dir_with_per_target_subdir/i386-linux-gnu/lib/libclang_rt.builtins.a
  
test/Driver/Inputs/resource_dir_with_per_target_subdir/x86_64-fuchsia/lib/libclang_rt.asan-preinit.a
  
test/Driver/Inputs/resource_dir_with_per_target_subdir/x86_64-fuchsia/lib/libclang_rt.asan.so
  
test/Driver/Inputs/resource_dir_with_per_target_subdir/x86_64-fuchsia/lib/libclang_rt.builtins.a
  
test/Driver/Inputs/resource_dir_with_per_target_subdir/x86_64-fuchsia/lib/libclang_rt.fuzzer.a
  
test/Driver/Inputs/resource_dir_with_per_target_subdir/x86_64-fuchsia/lib/libclang_rt.scudo.so
  
test/Driver/Inputs/resource_dir_with_per_target_subdir/x86_64-linux-gnu/lib/libclang_rt.builtins.a


Index: lib/Driver/ToolChain.cpp
===
--- lib/Driver/ToolChain.cpp
+++ lib/Driver/ToolChain.cpp
@@ -74,10 +74,17 @@
  const ArgList &Args)
 : D(D), Triple(T), Args(Args), CachedRTTIArg(GetRTTIArgument(Args)),
   CachedRTTIMode(CalculateRTTIMode(Args, Triple, CachedRTTIArg)) {
-  SmallString<128> P(D.ResourceDir);
+  SmallString<128> P;
+
+  P.assign(D.ResourceDir);
   llvm::sys::path::append(P, D.getTargetTriple(), "lib");
   if (getVFS().exists(P))
-getFilePaths().push_back(P.str());
+getLibraryPaths().push_back(P.str());
+
+  P.assign(D.ResourceDir);
+  llvm::sys::path::append(P, Triple.str(), "lib");
+  if (getVFS().exists(P))
+getLibraryPaths().push_back(P.str());
 
   std::string CandidateLibPath = getArchSpecificLibPath();
   if (getVFS().exists(CandidateLibPath))
@@ -362,12 +369,11 @@
   const char *Suffix = Shared ? (Triple.isOSWindows() ? ".dll" : ".so")
   : (IsITANMSVCWindows ? ".lib" : ".a");
 
-  const Driver &D = getDriver();
-  SmallString<128> P(D.ResourceDir);
-  llvm::sys::path::append(P, D.getTargetTriple(), "lib");
-  if (getVFS().exists(P)) {
+  for (const auto &LibPath : getLibraryPaths()) {
+SmallString<128> P(LibPath);
 llvm::sys::path::append(P, Prefix + Twine("clang_rt.") + Component + 
Suffix);
-return P.str();
+if (getVFS().exists(P))
+  return P.str();
   }
 
   StringRef Arch = getArchNameForCompilerRTLib(*this, Args);
@@ -762,6 +768,10 @@
 
 void ToolChain::AddFilePathLibArgs(const ArgList &Args,
ArgStringList &CmdArgs) const {
+  for (const auto &LibPath : getLibraryPaths())
+if(LibPath.length() > 0)
+  CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + LibPath));
+
   for (const auto &LibPath : getFilePaths())
 if(LibPath.length() > 0)
   CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + LibPath));
Index: include/clang/Driver/ToolChain.h
===
--- include/clang/Driver/ToolChain.h
+++ include/clang/Driver/ToolChain.h
@@ -116,6 +116,9 @@
 
   const RTTIMode CachedRTTIMode;
 
+  /// The list of toolchain specific path prefixes to search for libraries.
+  path_list LibraryPaths;
+
   /// The list of toolchain specific path prefixes to search for files.
   path_list FilePaths;
 
@@ -213,6 +216,9 @@
 return EffectiveTriple;
   }
 
+  path_list &getLibraryPaths() { return LibraryPaths; }
+  const path_list &getLibraryPaths() const { return LibraryPaths; }
+
   path_list &getFilePaths() { return FilePaths; }
   const path_list &getFilePaths() const { return FilePaths; }
 


Index: lib/Driver/ToolChain.cpp
===
--- lib/Driver/ToolChain.cpp
+++ lib/Driver/ToolChain.cpp
@@ -74,10 +74,17 @@
  const ArgList &Args)
 : D(D), Triple(T), Args(Args), CachedRTTIArg(GetRTTIArgument(Args)),
   CachedRTTIMode(CalculateRTTIMode(Args, Triple, CachedRTTIArg)) {
-  SmallString<128> P(D.ResourceDir);
+  SmallString<128> P;
+
+  P.assign(D.ResourceDir);
   llvm::sys::path::append(P, D.getTargetTriple(), "lib");
   if (getVFS().exists(P))
-getFilePaths().push_back(P.str());
+getLibraryPaths().push_back(P.str());
+
+  P.assign(D.ResourceDir);
+  llvm::

[PATCH] D46610: [CMake] Set CMAKE_BUILD_WITH_INSTALL_RPATH for Fuchsia runtimes

2018-05-08 Thread Petr Hosek via Phabricator via cfe-commits
phosek created this revision.
phosek added a reviewer: mcgrathr.
Herald added subscribers: cfe-commits, mgorny.

This doesn't make any difference since we don't use RPATH/RUNPATH
on Fuchsia but it avoids the CMake error when re-linking libraries
while building with Ninja.


Repository:
  rC Clang

https://reviews.llvm.org/D46610

Files:
  clang/cmake/caches/Fuchsia-stage2.cmake


Index: clang/cmake/caches/Fuchsia-stage2.cmake
===
--- clang/cmake/caches/Fuchsia-stage2.cmake
+++ clang/cmake/caches/Fuchsia-stage2.cmake
@@ -67,6 +67,7 @@
 foreach(target x86_64;aarch64)
   set(RUNTIMES_${target}-fuchsia_CMAKE_SYSTEM_NAME Fuchsia CACHE STRING "")
   set(RUNTIMES_${target}-fuchsia_CMAKE_BUILD_TYPE 
${FUCHSIA_RUNTIMES_BUILD_TYPE} CACHE STRING "")
+  set(RUNTIMES_${target}-fuchsia_CMAKE_BUILD_WITH_INSTALL_RPATH ON CACHE 
STRING "")
   set(RUNTIMES_${target}-fuchsia_CMAKE_ASM_FLAGS ${FUCHSIA_${target}_C_FLAGS} 
CACHE PATH "")
   set(RUNTIMES_${target}-fuchsia_CMAKE_C_FLAGS ${FUCHSIA_${target}_C_FLAGS} 
CACHE PATH "")
   set(RUNTIMES_${target}-fuchsia_CMAKE_CXX_FLAGS 
${FUCHSIA_${target}_CXX_FLAGS} CACHE PATH "")


Index: clang/cmake/caches/Fuchsia-stage2.cmake
===
--- clang/cmake/caches/Fuchsia-stage2.cmake
+++ clang/cmake/caches/Fuchsia-stage2.cmake
@@ -67,6 +67,7 @@
 foreach(target x86_64;aarch64)
   set(RUNTIMES_${target}-fuchsia_CMAKE_SYSTEM_NAME Fuchsia CACHE STRING "")
   set(RUNTIMES_${target}-fuchsia_CMAKE_BUILD_TYPE ${FUCHSIA_RUNTIMES_BUILD_TYPE} CACHE STRING "")
+  set(RUNTIMES_${target}-fuchsia_CMAKE_BUILD_WITH_INSTALL_RPATH ON CACHE STRING "")
   set(RUNTIMES_${target}-fuchsia_CMAKE_ASM_FLAGS ${FUCHSIA_${target}_C_FLAGS} CACHE PATH "")
   set(RUNTIMES_${target}-fuchsia_CMAKE_C_FLAGS ${FUCHSIA_${target}_C_FLAGS} CACHE PATH "")
   set(RUNTIMES_${target}-fuchsia_CMAKE_CXX_FLAGS ${FUCHSIA_${target}_CXX_FLAGS} CACHE PATH "")
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D46610: [CMake] Set CMAKE_BUILD_WITH_INSTALL_RPATH for Fuchsia runtimes

2018-05-08 Thread Petr Hosek via Phabricator via cfe-commits
phosek added a comment.

Actually after testing this I believe this is really what we want, without this 
option CMake sets RPATH for build libraries and then removes it when installing 
these. With this option it doesn't even set the RPATH for build libraries.


Repository:
  rC Clang

https://reviews.llvm.org/D46610



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D46612: [CMake] Include llvm-strip in Fuchsia toolchain distribution

2018-05-08 Thread Petr Hosek via Phabricator via cfe-commits
phosek created this revision.
phosek added a reviewer: jakehehrlich.
Herald added subscribers: cfe-commits, mgorny.

Now that llvm-strip is available, include it in the Fuchsia toolchain.


Repository:
  rC Clang

https://reviews.llvm.org/D46612

Files:
  clang/cmake/caches/Fuchsia-stage2.cmake


Index: clang/cmake/caches/Fuchsia-stage2.cmake
===
--- clang/cmake/caches/Fuchsia-stage2.cmake
+++ clang/cmake/caches/Fuchsia-stage2.cmake
@@ -108,6 +108,7 @@
   llvm-readelf
   llvm-readobj
   llvm-size
+  llvm-strip
   llvm-symbolizer
   opt
   sancov


Index: clang/cmake/caches/Fuchsia-stage2.cmake
===
--- clang/cmake/caches/Fuchsia-stage2.cmake
+++ clang/cmake/caches/Fuchsia-stage2.cmake
@@ -108,6 +108,7 @@
   llvm-readelf
   llvm-readobj
   llvm-size
+  llvm-strip
   llvm-symbolizer
   opt
   sancov
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D46612: [CMake] Include llvm-strip in Fuchsia toolchain distribution

2018-05-08 Thread Petr Hosek via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC331826: [CMake] Include llvm-strip in Fuchsia toolchain 
distribution (authored by phosek, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D46612?vs=145815&id=145818#toc

Repository:
  rC Clang

https://reviews.llvm.org/D46612

Files:
  cmake/caches/Fuchsia-stage2.cmake


Index: cmake/caches/Fuchsia-stage2.cmake
===
--- cmake/caches/Fuchsia-stage2.cmake
+++ cmake/caches/Fuchsia-stage2.cmake
@@ -108,6 +108,7 @@
   llvm-readelf
   llvm-readobj
   llvm-size
+  llvm-strip
   llvm-symbolizer
   opt
   sancov


Index: cmake/caches/Fuchsia-stage2.cmake
===
--- cmake/caches/Fuchsia-stage2.cmake
+++ cmake/caches/Fuchsia-stage2.cmake
@@ -108,6 +108,7 @@
   llvm-readelf
   llvm-readobj
   llvm-size
+  llvm-strip
   llvm-symbolizer
   opt
   sancov
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D46768: [Driver] Only use -lc++ on Fuchsia

2018-05-11 Thread Petr Hosek via Phabricator via cfe-commits
phosek created this revision.
phosek added reviewers: mcgrathr, jakehehrlich, juliehockett.
Herald added a subscriber: cfe-commits.

The fact that libc++ depends on libc++abi and libunwind is an internal
detail that's captured by the libc++.so linker script.


Repository:
  rC Clang

https://reviews.llvm.org/D46768

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
@@ -15,7 +15,7 @@
 // CHECK-NOT: crti.o
 // CHECK-NOT: crtbegin.o
 // CHECK: "-L[[SYSROOT]]{{/|}}lib"
-// CHECK: "-lc++" "-lc++abi" "-lunwind" "-lm"
+// CHECK: "-lc++" "-lm"
 // CHECK: "{{.*[/\\]}}libclang_rt.builtins-x86_64.a"
 // CHECK: "-lc"
 // CHECK-NOT: crtend.o
Index: clang/lib/Driver/ToolChains/Fuchsia.cpp
===
--- clang/lib/Driver/ToolChains/Fuchsia.cpp
+++ clang/lib/Driver/ToolChains/Fuchsia.cpp
@@ -267,8 +267,6 @@
   switch (GetCXXStdlibType(Args)) {
   case ToolChain::CST_Libcxx:
 CmdArgs.push_back("-lc++");
-CmdArgs.push_back("-lc++abi");
-CmdArgs.push_back("-lunwind");
 break;
 
   case ToolChain::CST_Libstdcxx:


Index: clang/test/Driver/fuchsia.cpp
===
--- clang/test/Driver/fuchsia.cpp
+++ clang/test/Driver/fuchsia.cpp
@@ -15,7 +15,7 @@
 // CHECK-NOT: crti.o
 // CHECK-NOT: crtbegin.o
 // CHECK: "-L[[SYSROOT]]{{/|}}lib"
-// CHECK: "-lc++" "-lc++abi" "-lunwind" "-lm"
+// CHECK: "-lc++" "-lm"
 // CHECK: "{{.*[/\\]}}libclang_rt.builtins-x86_64.a"
 // CHECK: "-lc"
 // CHECK-NOT: crtend.o
Index: clang/lib/Driver/ToolChains/Fuchsia.cpp
===
--- clang/lib/Driver/ToolChains/Fuchsia.cpp
+++ clang/lib/Driver/ToolChains/Fuchsia.cpp
@@ -267,8 +267,6 @@
   switch (GetCXXStdlibType(Args)) {
   case ToolChain::CST_Libcxx:
 CmdArgs.push_back("-lc++");
-CmdArgs.push_back("-lc++abi");
-CmdArgs.push_back("-lunwind");
 break;
 
   case ToolChain::CST_Libstdcxx:
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D46768: [Driver] Only use -lc++ on Fuchsia

2018-05-11 Thread Petr Hosek via Phabricator via cfe-commits
phosek updated this revision to Diff 146396.

Repository:
  rC Clang

https://reviews.llvm.org/D46768

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
@@ -15,7 +15,7 @@
 // CHECK-NOT: crti.o
 // CHECK-NOT: crtbegin.o
 // CHECK: "-L[[SYSROOT]]{{/|}}lib"
-// CHECK: "-lc++" "-lc++abi" "-lunwind" "-lm"
+// CHECK: "-lc++" "-lm"
 // CHECK: "{{.*[/\\]}}libclang_rt.builtins-x86_64.a"
 // CHECK: "-lc"
 // CHECK-NOT: crtend.o
@@ -28,7 +28,7 @@
 // RUN: %clangxx %s -### --target=x86_64-unknown-fuchsia -static-libstdc++ 
2>&1 \
 // RUN: | FileCheck %s -check-prefix=CHECK-STATIC
 // CHECK-STATIC-NOT: "-Bstatic"
-// CHECK-STATIC: "-lc++" "-lc++abi" "-lunwind"
+// CHECK-STATIC: "-lc++"
 // CHECK-STATIC-NOT: "-Bdynamic"
 // CHECK-STATIC: "-lm"
 // CHECK-STATIC: "-lc"
Index: clang/lib/Driver/ToolChains/Fuchsia.cpp
===
--- clang/lib/Driver/ToolChains/Fuchsia.cpp
+++ clang/lib/Driver/ToolChains/Fuchsia.cpp
@@ -267,8 +267,6 @@
   switch (GetCXXStdlibType(Args)) {
   case ToolChain::CST_Libcxx:
 CmdArgs.push_back("-lc++");
-CmdArgs.push_back("-lc++abi");
-CmdArgs.push_back("-lunwind");
 break;
 
   case ToolChain::CST_Libstdcxx:


Index: clang/test/Driver/fuchsia.cpp
===
--- clang/test/Driver/fuchsia.cpp
+++ clang/test/Driver/fuchsia.cpp
@@ -15,7 +15,7 @@
 // CHECK-NOT: crti.o
 // CHECK-NOT: crtbegin.o
 // CHECK: "-L[[SYSROOT]]{{/|}}lib"
-// CHECK: "-lc++" "-lc++abi" "-lunwind" "-lm"
+// CHECK: "-lc++" "-lm"
 // CHECK: "{{.*[/\\]}}libclang_rt.builtins-x86_64.a"
 // CHECK: "-lc"
 // CHECK-NOT: crtend.o
@@ -28,7 +28,7 @@
 // RUN: %clangxx %s -### --target=x86_64-unknown-fuchsia -static-libstdc++ 2>&1 \
 // RUN: | FileCheck %s -check-prefix=CHECK-STATIC
 // CHECK-STATIC-NOT: "-Bstatic"
-// CHECK-STATIC: "-lc++" "-lc++abi" "-lunwind"
+// CHECK-STATIC: "-lc++"
 // CHECK-STATIC-NOT: "-Bdynamic"
 // CHECK-STATIC: "-lm"
 // CHECK-STATIC: "-lc"
Index: clang/lib/Driver/ToolChains/Fuchsia.cpp
===
--- clang/lib/Driver/ToolChains/Fuchsia.cpp
+++ clang/lib/Driver/ToolChains/Fuchsia.cpp
@@ -267,8 +267,6 @@
   switch (GetCXXStdlibType(Args)) {
   case ToolChain::CST_Libcxx:
 CmdArgs.push_back("-lc++");
-CmdArgs.push_back("-lc++abi");
-CmdArgs.push_back("-lunwind");
 break;
 
   case ToolChain::CST_Libstdcxx:
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D46768: [Driver] Only use -lc++ on Fuchsia

2018-05-11 Thread Petr Hosek via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL332138: [Driver] Only use -lc++ on Fuchsia (authored by 
phosek, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D46768?vs=146396&id=146408#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D46768

Files:
  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
@@ -267,8 +267,6 @@
   switch (GetCXXStdlibType(Args)) {
   case ToolChain::CST_Libcxx:
 CmdArgs.push_back("-lc++");
-CmdArgs.push_back("-lc++abi");
-CmdArgs.push_back("-lunwind");
 break;
 
   case ToolChain::CST_Libstdcxx:
Index: cfe/trunk/test/Driver/fuchsia.cpp
===
--- cfe/trunk/test/Driver/fuchsia.cpp
+++ cfe/trunk/test/Driver/fuchsia.cpp
@@ -15,7 +15,7 @@
 // CHECK-NOT: crti.o
 // CHECK-NOT: crtbegin.o
 // CHECK: "-L[[SYSROOT]]{{/|}}lib"
-// CHECK: "-lc++" "-lc++abi" "-lunwind" "-lm"
+// CHECK: "-lc++" "-lm"
 // CHECK: "{{.*[/\\]}}libclang_rt.builtins-x86_64.a"
 // CHECK: "-lc"
 // CHECK-NOT: crtend.o
@@ -28,7 +28,7 @@
 // RUN: %clangxx %s -### --target=x86_64-unknown-fuchsia -static-libstdc++ 
2>&1 \
 // RUN: | FileCheck %s -check-prefix=CHECK-STATIC
 // CHECK-STATIC-NOT: "-Bstatic"
-// CHECK-STATIC: "-lc++" "-lc++abi" "-lunwind"
+// CHECK-STATIC: "-lc++"
 // CHECK-STATIC-NOT: "-Bdynamic"
 // CHECK-STATIC: "-lm"
 // CHECK-STATIC: "-lc"


Index: cfe/trunk/lib/Driver/ToolChains/Fuchsia.cpp
===
--- cfe/trunk/lib/Driver/ToolChains/Fuchsia.cpp
+++ cfe/trunk/lib/Driver/ToolChains/Fuchsia.cpp
@@ -267,8 +267,6 @@
   switch (GetCXXStdlibType(Args)) {
   case ToolChain::CST_Libcxx:
 CmdArgs.push_back("-lc++");
-CmdArgs.push_back("-lc++abi");
-CmdArgs.push_back("-lunwind");
 break;
 
   case ToolChain::CST_Libstdcxx:
Index: cfe/trunk/test/Driver/fuchsia.cpp
===
--- cfe/trunk/test/Driver/fuchsia.cpp
+++ cfe/trunk/test/Driver/fuchsia.cpp
@@ -15,7 +15,7 @@
 // CHECK-NOT: crti.o
 // CHECK-NOT: crtbegin.o
 // CHECK: "-L[[SYSROOT]]{{/|}}lib"
-// CHECK: "-lc++" "-lc++abi" "-lunwind" "-lm"
+// CHECK: "-lc++" "-lm"
 // CHECK: "{{.*[/\\]}}libclang_rt.builtins-x86_64.a"
 // CHECK: "-lc"
 // CHECK-NOT: crtend.o
@@ -28,7 +28,7 @@
 // RUN: %clangxx %s -### --target=x86_64-unknown-fuchsia -static-libstdc++ 2>&1 \
 // RUN: | FileCheck %s -check-prefix=CHECK-STATIC
 // CHECK-STATIC-NOT: "-Bstatic"
-// CHECK-STATIC: "-lc++" "-lc++abi" "-lunwind"
+// CHECK-STATIC: "-lc++"
 // CHECK-STATIC-NOT: "-Bdynamic"
 // CHECK-STATIC: "-lm"
 // CHECK-STATIC: "-lc"
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D46084: [Fixed Point Arithmetic] Addition of the Fixed Point _Accum type

2018-05-17 Thread Petr Hosek via Phabricator via cfe-commits
phosek added inline comments.



Comment at: lib/Index/USRGeneration.cpp:691
+case BuiltinType::ULongAccum:
+  llvm_unreachable("No USR name mangling for fixed point types.");
 case BuiltinType::Float16:

We need some solution for fixed point types.



Comment at: lib/Sema/SemaType.cpp:1391
+if (S.getLangOpts().CPlusPlus) {
+  S.Diag(DS.getTypeSpecTypeLoc(), diag::err_fixed_point_only_allowed_in_c);
+}

Shouldn't there be a break after this line?


https://reviews.llvm.org/D46084



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D46910: [Support] Avoid normalization in sys::getDefaultTargetTriple

2018-05-17 Thread Petr Hosek via Phabricator via cfe-commits
phosek updated this revision to Diff 147431.
Herald added a subscriber: cfe-commits.

Repository:
  rC Clang

https://reviews.llvm.org/D46910

Files:
  clang/lib/Frontend/CompilerInvocation.cpp
  llvm/cmake/modules/GetHostTriple.cmake
  llvm/lib/Support/Unix/Host.inc
  llvm/lib/Support/Windows/Host.inc


Index: llvm/lib/Support/Windows/Host.inc
===
--- llvm/lib/Support/Windows/Host.inc
+++ llvm/lib/Support/Windows/Host.inc
@@ -30,5 +30,5 @@
 Triple = EnvTriple;
 #endif
 
-  return Triple::normalize(Triple);
+  return Triple;
 }
Index: llvm/lib/Support/Unix/Host.inc
===
--- llvm/lib/Support/Unix/Host.inc
+++ llvm/lib/Support/Unix/Host.inc
@@ -64,5 +64,5 @@
 TargetTripleString = EnvTriple;
 #endif
 
-  return Triple::normalize(TargetTripleString);
+  return TargetTripleString;
 }
Index: llvm/cmake/modules/GetHostTriple.cmake
===
--- llvm/cmake/modules/GetHostTriple.cmake
+++ llvm/cmake/modules/GetHostTriple.cmake
@@ -4,15 +4,15 @@
 function( get_host_triple var )
   if( MSVC )
 if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
-  set( value "x86_64-pc-win32" )
+  set( value "x86_64-pc-windows-msvc" )
 else()
-  set( value "i686-pc-win32" )
+  set( value "i686-pc-windows-msvc" )
 endif()
   elseif( MINGW AND NOT MSYS )
 if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
-  set( value "x86_64-w64-mingw32" )
+  set( value "x86_64-w64-windows-gnu" )
 else()
-  set( value "i686-pc-mingw32" )
+  set( value "i686-pc-windows-gnu" )
 endif()
   else( MSVC )
 set(config_guess ${LLVM_MAIN_SRC_DIR}/cmake/config.guess)
Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -2916,10 +2916,11 @@
   Opts.FPMath = Args.getLastArgValue(OPT_mfpmath);
   Opts.FeaturesAsWritten = Args.getAllArgValues(OPT_target_feature);
   Opts.LinkerVersion = Args.getLastArgValue(OPT_target_linker_version);
-  Opts.Triple = llvm::Triple::normalize(Args.getLastArgValue(OPT_triple));
+  Opts.Triple = Args.getLastArgValue(OPT_triple);
   // Use the default target triple if unspecified.
   if (Opts.Triple.empty())
 Opts.Triple = llvm::sys::getDefaultTargetTriple();
+  Opts.Triple = llvm::Triple::normalize(Opts.Triple);
   Opts.OpenCLExtensionsAsWritten = Args.getAllArgValues(OPT_cl_ext_EQ);
   Opts.ForceEnableInt128 = Args.hasArg(OPT_fforce_enable_int128);
   Opts.NVPTXUseShortPointers = Args.hasFlag(


Index: llvm/lib/Support/Windows/Host.inc
===
--- llvm/lib/Support/Windows/Host.inc
+++ llvm/lib/Support/Windows/Host.inc
@@ -30,5 +30,5 @@
 Triple = EnvTriple;
 #endif
 
-  return Triple::normalize(Triple);
+  return Triple;
 }
Index: llvm/lib/Support/Unix/Host.inc
===
--- llvm/lib/Support/Unix/Host.inc
+++ llvm/lib/Support/Unix/Host.inc
@@ -64,5 +64,5 @@
 TargetTripleString = EnvTriple;
 #endif
 
-  return Triple::normalize(TargetTripleString);
+  return TargetTripleString;
 }
Index: llvm/cmake/modules/GetHostTriple.cmake
===
--- llvm/cmake/modules/GetHostTriple.cmake
+++ llvm/cmake/modules/GetHostTriple.cmake
@@ -4,15 +4,15 @@
 function( get_host_triple var )
   if( MSVC )
 if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
-  set( value "x86_64-pc-win32" )
+  set( value "x86_64-pc-windows-msvc" )
 else()
-  set( value "i686-pc-win32" )
+  set( value "i686-pc-windows-msvc" )
 endif()
   elseif( MINGW AND NOT MSYS )
 if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
-  set( value "x86_64-w64-mingw32" )
+  set( value "x86_64-w64-windows-gnu" )
 else()
-  set( value "i686-pc-mingw32" )
+  set( value "i686-pc-windows-gnu" )
 endif()
   else( MSVC )
 set(config_guess ${LLVM_MAIN_SRC_DIR}/cmake/config.guess)
Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -2916,10 +2916,11 @@
   Opts.FPMath = Args.getLastArgValue(OPT_mfpmath);
   Opts.FeaturesAsWritten = Args.getAllArgValues(OPT_target_feature);
   Opts.LinkerVersion = Args.getLastArgValue(OPT_target_linker_version);
-  Opts.Triple = llvm::Triple::normalize(Args.getLastArgValue(OPT_triple));
+  Opts.Triple = Args.getLastArgValue(OPT_triple);
   // Use the default target triple if unspecified.
   if (Opts.Triple.empty())
 Opts.Triple = llvm::sys::getDefaultTargetTriple();
+  Opts.Triple = llvm::Triple::normalize(Opts.Triple);
   Opts.OpenCLExtensionsAsWritten = Args.getAllArgValues(OPT_cl_ext_EQ);
   Opts.ForceEnableInt128 = Args.hasAr

[PATCH] D46910: [Support] Avoid normalization in sys::getDefaultTargetTriple

2018-05-17 Thread Petr Hosek via Phabricator via cfe-commits
phosek added a comment.

Applied, thanks so much for looking into it.


Repository:
  rC Clang

https://reviews.llvm.org/D46910



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D46910: [Support] Avoid normalization in sys::getDefaultTargetTriple

2018-05-18 Thread Petr Hosek via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC332750: [Support] Avoid normalization in 
sys::getDefaultTargetTriple (authored by phosek, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D46910?vs=147431&id=147567#toc

Repository:
  rC Clang

https://reviews.llvm.org/D46910

Files:
  lib/Frontend/CompilerInvocation.cpp


Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -2927,10 +2927,11 @@
   Opts.FPMath = Args.getLastArgValue(OPT_mfpmath);
   Opts.FeaturesAsWritten = Args.getAllArgValues(OPT_target_feature);
   Opts.LinkerVersion = Args.getLastArgValue(OPT_target_linker_version);
-  Opts.Triple = llvm::Triple::normalize(Args.getLastArgValue(OPT_triple));
+  Opts.Triple = Args.getLastArgValue(OPT_triple);
   // Use the default target triple if unspecified.
   if (Opts.Triple.empty())
 Opts.Triple = llvm::sys::getDefaultTargetTriple();
+  Opts.Triple = llvm::Triple::normalize(Opts.Triple);
   Opts.OpenCLExtensionsAsWritten = Args.getAllArgValues(OPT_cl_ext_EQ);
   Opts.ForceEnableInt128 = Args.hasArg(OPT_fforce_enable_int128);
   Opts.NVPTXUseShortPointers = Args.hasFlag(


Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -2927,10 +2927,11 @@
   Opts.FPMath = Args.getLastArgValue(OPT_mfpmath);
   Opts.FeaturesAsWritten = Args.getAllArgValues(OPT_target_feature);
   Opts.LinkerVersion = Args.getLastArgValue(OPT_target_linker_version);
-  Opts.Triple = llvm::Triple::normalize(Args.getLastArgValue(OPT_triple));
+  Opts.Triple = Args.getLastArgValue(OPT_triple);
   // Use the default target triple if unspecified.
   if (Opts.Triple.empty())
 Opts.Triple = llvm::sys::getDefaultTargetTriple();
+  Opts.Triple = llvm::Triple::normalize(Opts.Triple);
   Opts.OpenCLExtensionsAsWritten = Args.getAllArgValues(OPT_cl_ext_EQ);
   Opts.ForceEnableInt128 = Args.hasArg(OPT_fforce_enable_int128);
   Opts.NVPTXUseShortPointers = Args.hasFlag(
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D46910: [Support] Avoid normalization in sys::getDefaultTargetTriple

2018-05-20 Thread Petr Hosek via Phabricator via cfe-commits
phosek added a comment.

In https://reviews.llvm.org/D46910#1105992, @thakis wrote:

> This changes the default triple on Windows from x86_64-pc-win32 to 
> x86_64-pc-windows-msvc. This breaks at least lit's make_itanium_abi_triple() 
> (http://llvm-cs.pcc.me.uk/utils/lit/lit/llvm/config.py#234)
>
>   def make_itanium_abi_triple(self, triple):
>   m = re.match(r'(\w+)-(\w+)-(\w+)', triple)
>   if not m:
>   self.lit_config.fatal(
>   "Could not turn '%s' into Itanium ABI triple" % triple)
>   if m.group(3).lower() != 'win32':
>   # All non-win32 triples use the Itanium ABI.
>   return triple
>   return m.group(1) + '-' + m.group(2) + '-mingw32'
>   
>
> which in turn breaks %itanium_abi_triple in lit tests, which then breaks some 
> 257 tests on Windows.
>
> (Also visible on http://lab.llvm.org:8011/builders/clang-x64-ninja-win7 , but 
> that bot has been broken for a long time.)
>
> So I'll revert this for now.


Sorry about the breakage, I wasn't aware of that test failure and never got any 
email (probably because the bot has been red before). I'll try to fix 
make_itanium_abi_triple and test it on my Windows box tomorrow before 
resubmitting.

In https://reviews.llvm.org/D46910#1105993, @thakis wrote:

> …hm looks like https://reviews.llvm.org/rL332750 touched files in both clang 
> and llvm, which is probably why the diff looks super confusing on phab. I'll 
> revert it in two pieces, I don't know how to commit changes to llvm and clang 
> in one revision.


The change was made through monorepo and submitted via `git llvm push` which 
allows changing multiple projects in one commit.


Repository:
  rC Clang

https://reviews.llvm.org/D46910



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D47355: [CMake] Allow specifying extra dependencies of bootstrap stage

2018-05-24 Thread Petr Hosek via Phabricator via cfe-commits
phosek created this revision.
phosek added a reviewer: beanz.
Herald added subscribers: cfe-commits, mgorny.

This allows adding additional bootstrap dependencies to the bootstrap
compiler that may be needed by later stages.


Repository:
  rC Clang

https://reviews.llvm.org/D47355

Files:
  clang/CMakeLists.txt


Index: clang/CMakeLists.txt
===
--- clang/CMakeLists.txt
+++ clang/CMakeLists.txt
@@ -583,6 +583,10 @@
 endif()
   endif()
 
+  if(CLANG_BOOTSTRAP_EXTRA_COMPONENTS)
+add_dependencies(clang-bootstrap-deps ${CLANG_BOOTSTRAP_EXTRA_COMPONENTS})
+  endif()
+
   add_custom_target(${NEXT_CLANG_STAGE}-clear
 DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${NEXT_CLANG_STAGE}-cleared
 )


Index: clang/CMakeLists.txt
===
--- clang/CMakeLists.txt
+++ clang/CMakeLists.txt
@@ -583,6 +583,10 @@
 endif()
   endif()
 
+  if(CLANG_BOOTSTRAP_EXTRA_COMPONENTS)
+add_dependencies(clang-bootstrap-deps ${CLANG_BOOTSTRAP_EXTRA_COMPONENTS})
+  endif()
+
   add_custom_target(${NEXT_CLANG_STAGE}-clear
 DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${NEXT_CLANG_STAGE}-cleared
 )
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D47356: [CMake] Use libc++ and compiler-rt for bootstrap Fuchsia Clang

2018-05-24 Thread Petr Hosek via Phabricator via cfe-commits
phosek created this revision.
phosek added reviewers: beanz, jakehehrlich, mcgrathr.
Herald added subscribers: cfe-commits, mgorny, dberris.
Herald added a reviewer: EricWF.

We want to build the second stage compiler with libc++ and compiler-rt,
also include builtins and runtimes into extra bootstrap components to
ensure these get built.


Repository:
  rC Clang

https://reviews.llvm.org/D47356

Files:
  clang/cmake/caches/Fuchsia.cmake


Index: clang/cmake/caches/Fuchsia.cmake
===
--- clang/cmake/caches/Fuchsia.cmake
+++ clang/cmake/caches/Fuchsia.cmake
@@ -21,6 +21,9 @@
   set(BOOTSTRAP_LLVM_ENABLE_LLD ON CACHE BOOL "")
 endif()
 
+set(CLANG_DEFAULT_CXX_STDLIB libc++ CACHE STRING "")
+set(CLANG_DEFAULT_RTLIB compiler-rt CACHE STRING "")
+
 if(APPLE)
   set(COMPILER_RT_ENABLE_IOS OFF CACHE BOOL "")
   set(COMPILER_RT_ENABLE_TVOS OFF CACHE BOOL "")
@@ -50,6 +53,10 @@
 
 # Setup the bootstrap build.
 set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
+set(CLANG_BOOTSTRAP_EXTRA_COMPONENTS
+  builtins
+  runtimes
+  CACHE STRING "")
 set(CLANG_BOOTSTRAP_CMAKE_ARGS
   ${EXTRA_ARGS}
   -C ${CMAKE_CURRENT_LIST_DIR}/Fuchsia-stage2.cmake


Index: clang/cmake/caches/Fuchsia.cmake
===
--- clang/cmake/caches/Fuchsia.cmake
+++ clang/cmake/caches/Fuchsia.cmake
@@ -21,6 +21,9 @@
   set(BOOTSTRAP_LLVM_ENABLE_LLD ON CACHE BOOL "")
 endif()
 
+set(CLANG_DEFAULT_CXX_STDLIB libc++ CACHE STRING "")
+set(CLANG_DEFAULT_RTLIB compiler-rt CACHE STRING "")
+
 if(APPLE)
   set(COMPILER_RT_ENABLE_IOS OFF CACHE BOOL "")
   set(COMPILER_RT_ENABLE_TVOS OFF CACHE BOOL "")
@@ -50,6 +53,10 @@
 
 # Setup the bootstrap build.
 set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
+set(CLANG_BOOTSTRAP_EXTRA_COMPONENTS
+  builtins
+  runtimes
+  CACHE STRING "")
 set(CLANG_BOOTSTRAP_CMAKE_ARGS
   ${EXTRA_ARGS}
   -C ${CMAKE_CURRENT_LIST_DIR}/Fuchsia-stage2.cmake
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D47355: [CMake] Allow specifying extra dependencies of bootstrap stage

2018-05-24 Thread Petr Hosek via Phabricator via cfe-commits
phosek added inline comments.



Comment at: clang/CMakeLists.txt:586
 
+  if(CLANG_BOOTSTRAP_EXTRA_COMPONENTS)
+add_dependencies(clang-bootstrap-deps ${CLANG_BOOTSTRAP_EXTRA_COMPONENTS})

I don't know if `COMPONENTS` is the best term, this could also possibly be 
`DEPS`.


Repository:
  rC Clang

https://reviews.llvm.org/D47355



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D47357: [Driver] Rename DefaultTargetTriple to TargetTriple

2018-05-24 Thread Petr Hosek via Phabricator via cfe-commits
phosek created this revision.
phosek added reviewers: hans, rnk, echristo.
Herald added a subscriber: cfe-commits.

While this value is initialized with the DefaultTargetTriple, it
can be later overriden using the -target flag so TargetTriple is
a more accurate name. This change also provides an accessor which
could be accessed from ToolChain implementations.


Repository:
  rC Clang

https://reviews.llvm.org/D47357

Files:
  clang/include/clang/Driver/Driver.h
  clang/lib/Driver/Driver.cpp

Index: clang/lib/Driver/Driver.cpp
===
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -84,7 +84,7 @@
 using namespace clang;
 using namespace llvm::opt;
 
-Driver::Driver(StringRef ClangExecutable, StringRef DefaultTargetTriple,
+Driver::Driver(StringRef ClangExecutable, StringRef TargetTriple,
DiagnosticsEngine &Diags,
IntrusiveRefCntPtr VFS)
 : Opts(createDriverOptTable()), Diags(Diags), VFS(std::move(VFS)),
@@ -94,7 +94,7 @@
   CCPrintOptionsFilename(nullptr), CCPrintHeadersFilename(nullptr),
   CCLogDiagnosticsFilename(nullptr), CCCPrintBindings(false),
   CCPrintOptions(false), CCPrintHeaders(false), CCLogDiagnostics(false),
-  CCGenDiagnostics(false), DefaultTargetTriple(DefaultTargetTriple),
+  CCGenDiagnostics(false), TargetTriple(TargetTriple),
   CCCGenericGCCName(""), Saver(Alloc), CheckInputsExist(true),
   CCCUsePCH(true), GenReproducer(false),
   SuppressMissingInputWarning(false) {
@@ -388,14 +388,14 @@
 /// This routine provides the logic to compute a target triple from various
 /// args passed to the driver and the default triple string.
 static llvm::Triple computeTargetTriple(const Driver &D,
-StringRef DefaultTargetTriple,
+StringRef TargetTriple,
 const ArgList &Args,
 StringRef DarwinArchName = "") {
   // FIXME: Already done in Compilation *Driver::BuildCompilation
   if (const Arg *A = Args.getLastArg(options::OPT_target))
-DefaultTargetTriple = A->getValue();
+TargetTriple = A->getValue();
 
-  llvm::Triple Target(llvm::Triple::normalize(DefaultTargetTriple));
+  llvm::Triple Target(llvm::Triple::normalize(TargetTriple));
 
   // Handle Apple-specific options available here.
   if (Target.isOSBinFormatMachO()) {
@@ -941,19 +941,19 @@
   GenReproducer = Args.hasFlag(options::OPT_gen_reproducer,
options::OPT_fno_crash_diagnostics,
!!::getenv("FORCE_CLANG_DIAGNOSTICS_CRASH"));
-  // FIXME: DefaultTargetTriple is used by the target-prefixed calls to as/ld
+  // FIXME: TargetTriple is used by the target-prefixed calls to as/ld
   // and getToolChain is const.
   if (IsCLMode()) {
 // clang-cl targets MSVC-style Win32.
-llvm::Triple T(DefaultTargetTriple);
+llvm::Triple T(TargetTriple);
 T.setOS(llvm::Triple::Win32);
 T.setVendor(llvm::Triple::PC);
 T.setEnvironment(llvm::Triple::MSVC);
 T.setObjectFormat(llvm::Triple::COFF);
-DefaultTargetTriple = T.str();
+TargetTriple = T.str();
   }
   if (const Arg *A = Args.getLastArg(options::OPT_target))
-DefaultTargetTriple = A->getValue();
+TargetTriple = A->getValue();
   if (const Arg *A = Args.getLastArg(options::OPT_ccc_install_dir))
 Dir = InstalledDir = A->getValue();
   for (const Arg *A : Args.filtered(options::OPT_B)) {
@@ -1001,7 +1001,7 @@
 
   // Owned by the host.
   const ToolChain &TC = getToolChain(
-  *UArgs, computeTargetTriple(*this, DefaultTargetTriple, *UArgs));
+  *UArgs, computeTargetTriple(*this, TargetTriple, *UArgs));
 
   // The compilation takes ownership of Args.
   Compilation *C = new Compilation(*this, TC, UArgs.release(), TranslatedArgs,
@@ -3665,7 +3665,7 @@
 
 if (!ArchName.empty())
   TC = &getToolChain(C.getArgs(),
- computeTargetTriple(*this, DefaultTargetTriple,
+ computeTargetTriple(*this, TargetTriple,
  C.getArgs(), ArchName));
 else
   TC = &C.getDefaultToolChain();
@@ -3834,7 +3834,7 @@
 }
 
 const char *Driver::getDefaultImageName() const {
-  llvm::Triple Target(llvm::Triple::normalize(DefaultTargetTriple));
+  llvm::Triple Target(llvm::Triple::normalize(TargetTriple));
   return Target.isOSWindows() ? "a.exe" : "a.out";
 }
 
@@ -4073,14 +4073,14 @@
 void Driver::generatePrefixedToolNames(
 StringRef Tool, const ToolChain &TC,
 SmallVectorImpl &Names) const {
-  // FIXME: Needs a better variable than DefaultTargetTriple
-  Names.emplace_back((DefaultTargetTriple + "-" + Tool).str());
+  // FIXME: Needs a better variable than TargetTriple
+  Names.emplace_back((TargetTriple + "-" + Tool).str());
   Names.emplace_back(Tool);
 
   // Allow the discovery of tools prefixe

[PATCH] D47357: [Driver] Rename DefaultTargetTriple to TargetTriple

2018-05-29 Thread Petr Hosek via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC333468: [Driver] Rename DefaultTargetTriple to TargetTriple 
(authored by phosek, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D47357?vs=148539&id=148996#toc

Repository:
  rC Clang

https://reviews.llvm.org/D47357

Files:
  include/clang/Driver/Driver.h
  lib/Driver/Driver.cpp

Index: lib/Driver/Driver.cpp
===
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -84,7 +84,7 @@
 using namespace clang;
 using namespace llvm::opt;
 
-Driver::Driver(StringRef ClangExecutable, StringRef DefaultTargetTriple,
+Driver::Driver(StringRef ClangExecutable, StringRef TargetTriple,
DiagnosticsEngine &Diags,
IntrusiveRefCntPtr VFS)
 : Opts(createDriverOptTable()), Diags(Diags), VFS(std::move(VFS)),
@@ -94,7 +94,7 @@
   CCPrintOptionsFilename(nullptr), CCPrintHeadersFilename(nullptr),
   CCLogDiagnosticsFilename(nullptr), CCCPrintBindings(false),
   CCPrintOptions(false), CCPrintHeaders(false), CCLogDiagnostics(false),
-  CCGenDiagnostics(false), DefaultTargetTriple(DefaultTargetTriple),
+  CCGenDiagnostics(false), TargetTriple(TargetTriple),
   CCCGenericGCCName(""), Saver(Alloc), CheckInputsExist(true),
   CCCUsePCH(true), GenReproducer(false),
   SuppressMissingInputWarning(false) {
@@ -388,14 +388,14 @@
 /// This routine provides the logic to compute a target triple from various
 /// args passed to the driver and the default triple string.
 static llvm::Triple computeTargetTriple(const Driver &D,
-StringRef DefaultTargetTriple,
+StringRef TargetTriple,
 const ArgList &Args,
 StringRef DarwinArchName = "") {
   // FIXME: Already done in Compilation *Driver::BuildCompilation
   if (const Arg *A = Args.getLastArg(options::OPT_target))
-DefaultTargetTriple = A->getValue();
+TargetTriple = A->getValue();
 
-  llvm::Triple Target(llvm::Triple::normalize(DefaultTargetTriple));
+  llvm::Triple Target(llvm::Triple::normalize(TargetTriple));
 
   // Handle Apple-specific options available here.
   if (Target.isOSBinFormatMachO()) {
@@ -941,19 +941,19 @@
   GenReproducer = Args.hasFlag(options::OPT_gen_reproducer,
options::OPT_fno_crash_diagnostics,
!!::getenv("FORCE_CLANG_DIAGNOSTICS_CRASH"));
-  // FIXME: DefaultTargetTriple is used by the target-prefixed calls to as/ld
+  // FIXME: TargetTriple is used by the target-prefixed calls to as/ld
   // and getToolChain is const.
   if (IsCLMode()) {
 // clang-cl targets MSVC-style Win32.
-llvm::Triple T(DefaultTargetTriple);
+llvm::Triple T(TargetTriple);
 T.setOS(llvm::Triple::Win32);
 T.setVendor(llvm::Triple::PC);
 T.setEnvironment(llvm::Triple::MSVC);
 T.setObjectFormat(llvm::Triple::COFF);
-DefaultTargetTriple = T.str();
+TargetTriple = T.str();
   }
   if (const Arg *A = Args.getLastArg(options::OPT_target))
-DefaultTargetTriple = A->getValue();
+TargetTriple = A->getValue();
   if (const Arg *A = Args.getLastArg(options::OPT_ccc_install_dir))
 Dir = InstalledDir = A->getValue();
   for (const Arg *A : Args.filtered(options::OPT_B)) {
@@ -1001,7 +1001,7 @@
 
   // Owned by the host.
   const ToolChain &TC = getToolChain(
-  *UArgs, computeTargetTriple(*this, DefaultTargetTriple, *UArgs));
+  *UArgs, computeTargetTriple(*this, TargetTriple, *UArgs));
 
   // The compilation takes ownership of Args.
   Compilation *C = new Compilation(*this, TC, UArgs.release(), TranslatedArgs,
@@ -3665,7 +3665,7 @@
 
 if (!ArchName.empty())
   TC = &getToolChain(C.getArgs(),
- computeTargetTriple(*this, DefaultTargetTriple,
+ computeTargetTriple(*this, TargetTriple,
  C.getArgs(), ArchName));
 else
   TC = &C.getDefaultToolChain();
@@ -3834,7 +3834,7 @@
 }
 
 const char *Driver::getDefaultImageName() const {
-  llvm::Triple Target(llvm::Triple::normalize(DefaultTargetTriple));
+  llvm::Triple Target(llvm::Triple::normalize(TargetTriple));
   return Target.isOSWindows() ? "a.exe" : "a.out";
 }
 
@@ -4073,14 +4073,14 @@
 void Driver::generatePrefixedToolNames(
 StringRef Tool, const ToolChain &TC,
 SmallVectorImpl &Names) const {
-  // FIXME: Needs a better variable than DefaultTargetTriple
-  Names.emplace_back((DefaultTargetTriple + "-" + Tool).str());
+  // FIXME: Needs a better variable than TargetTriple
+  Names.emplace_back((TargetTriple + "-" + Tool).str());
   Names.emplace_back(Tool);
 
   // Allow the discovery of tools prefixed with LLVM's default target triple.
-  std::string LLVMDefaultTargetTriple = llvm::sys::getDefaultTargetTriple();
-  

[PATCH] D39017: [CMake] Build Fuchsia toolchain as -O3

2017-10-17 Thread Petr Hosek via Phabricator via cfe-commits
phosek created this revision.
Herald added a subscriber: mgorny.

Repository:
  rL LLVM

https://reviews.llvm.org/D39017

Files:
  cmake/caches/Fuchsia-stage2.cmake


Index: cmake/caches/Fuchsia-stage2.cmake
===
--- cmake/caches/Fuchsia-stage2.cmake
+++ cmake/caches/Fuchsia-stage2.cmake
@@ -30,8 +30,8 @@
 endif()
 
 set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "")
-set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -gline-tables-only -DNDEBUG" CACHE 
STRING "")
-set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -gline-tables-only -DNDEBUG" CACHE 
STRING "")
+set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 -gline-tables-only -DNDEBUG" CACHE 
STRING "")
+set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -gline-tables-only -DNDEBUG" CACHE 
STRING "")
 
 set(LLVM_BUILTIN_TARGETS "x86_64-fuchsia;aarch64-fuchsia" CACHE STRING "")
 foreach(target x86_64;aarch64)


Index: cmake/caches/Fuchsia-stage2.cmake
===
--- cmake/caches/Fuchsia-stage2.cmake
+++ cmake/caches/Fuchsia-stage2.cmake
@@ -30,8 +30,8 @@
 endif()
 
 set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "")
-set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -gline-tables-only -DNDEBUG" CACHE STRING "")
-set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -gline-tables-only -DNDEBUG" CACHE STRING "")
+set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 -gline-tables-only -DNDEBUG" CACHE STRING "")
+set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -gline-tables-only -DNDEBUG" CACHE STRING "")
 
 set(LLVM_BUILTIN_TARGETS "x86_64-fuchsia;aarch64-fuchsia" CACHE STRING "")
 foreach(target x86_64;aarch64)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D39017: [CMake] Build Fuchsia toolchain as -O3

2017-10-17 Thread Petr Hosek via Phabricator via cfe-commits
phosek added a comment.

It seems like with the current patch, CMake already sets `-Wl,-O3` so that 
should be sufficient.


Repository:
  rL LLVM

https://reviews.llvm.org/D39017



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D39017: [CMake] Build Fuchsia toolchain as -O3

2017-10-17 Thread Petr Hosek via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL316053: [CMake] Build Fuchsia toolchain as -O3 (authored by 
phosek).

Changed prior to commit:
  https://reviews.llvm.org/D39017?vs=119372&id=119417#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D39017

Files:
  cfe/trunk/cmake/caches/Fuchsia-stage2.cmake


Index: cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
===
--- cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
+++ cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
@@ -30,8 +30,8 @@
 endif()
 
 set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "")
-set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -gline-tables-only -DNDEBUG" CACHE 
STRING "")
-set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -gline-tables-only -DNDEBUG" CACHE 
STRING "")
+set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 -gline-tables-only -DNDEBUG" CACHE 
STRING "")
+set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -gline-tables-only -DNDEBUG" CACHE 
STRING "")
 
 set(LLVM_BUILTIN_TARGETS "x86_64-fuchsia;aarch64-fuchsia" CACHE STRING "")
 foreach(target x86_64;aarch64)


Index: cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
===
--- cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
+++ cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
@@ -30,8 +30,8 @@
 endif()
 
 set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "")
-set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -gline-tables-only -DNDEBUG" CACHE STRING "")
-set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -gline-tables-only -DNDEBUG" CACHE STRING "")
+set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 -gline-tables-only -DNDEBUG" CACHE STRING "")
+set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -gline-tables-only -DNDEBUG" CACHE STRING "")
 
 set(LLVM_BUILTIN_TARGETS "x86_64-fuchsia;aarch64-fuchsia" CACHE STRING "")
 foreach(target x86_64;aarch64)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D39176: [Driver] Use ld.lld directly for Fuchsia rather than passing flavor

2017-10-22 Thread Petr Hosek via Phabricator via cfe-commits
phosek created this revision.
phosek added a project: clang.

Passing a flavor to LLD requires command line argument, but if these
are being passed through a response file, this will fail because LLD
needs to know which driver to use before processing the response file.
Use ld.lld directly instead to avoid this issue.


Repository:
  rL LLVM

https://reviews.llvm.org/D39176

Files:
  lib/Driver/ToolChains/Fuchsia.cpp
  lib/Driver/ToolChains/Fuchsia.h
  test/Driver/fuchsia.c
  test/Driver/fuchsia.cpp


Index: test/Driver/fuchsia.cpp
===
--- test/Driver/fuchsia.cpp
+++ test/Driver/fuchsia.cpp
@@ -1,13 +1,12 @@
 // RUN: %clangxx %s -### -no-canonical-prefixes 
--target=x86_64-unknown-fuchsia \
-// RUN: --sysroot=%S/platform 2>&1 -fuse-ld=ld | FileCheck %s
+// RUN: --sysroot=%S/platform 2>&1 | FileCheck %s
 // CHECK: {{.*}}clang{{.*}}" "-cc1"
 // CHECK: "-triple" "x86_64-fuchsia"
 // CHECK: "-fuse-init-array"
 // CHECK: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK: "-internal-isystem" 
"{{.*[/\\]}}x86_64-fuchsia{{/|}}include{{/|}}c++{{/|}}v1"
 // CHECK: "-internal-externc-isystem" "[[SYSROOT]]{{/|}}include"
-// CHECK: {{.*}}lld{{.*}}" "-flavor" "gnu"
-// CHECK: "-z" "rodynamic"
+// CHECK: {{.*}}ld.lld{{.*}}" "-z" "rodynamic"
 // CHECK: "--sysroot=[[SYSROOT]]"
 // CHECK: "-pie"
 // CHECK: "--build-id"
Index: test/Driver/fuchsia.c
===
--- test/Driver/fuchsia.c
+++ test/Driver/fuchsia.c
@@ -1,16 +1,15 @@
 // RUN: %clang %s -### -no-canonical-prefixes --target=x86_64-unknown-fuchsia \
-// RUN: --sysroot=%S/platform -fuse-ld=ld 2>&1 \
+// RUN: --sysroot=%S/platform 2>&1 \
 // RUN: | FileCheck -check-prefixes=CHECK,CHECK-X86_64 %s
 // RUN: %clang %s -### -no-canonical-prefixes --target=aarch64-unknown-fuchsia 
\
-// RUN: --sysroot=%S/platform -fuse-ld=ld 2>&1 \
+// RUN: --sysroot=%S/platform 2>&1 \
 // RUN: | FileCheck -check-prefixes=CHECK,CHECK-AARCH64 %s
 // CHECK: {{.*}}clang{{.*}}" "-cc1"
 // CHECK: "-munwind-tables"
 // CHECK: "-fuse-init-array"
 // CHECK: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK: "-internal-externc-isystem" "[[SYSROOT]]{{/|}}include"
-// CHECK: {{.*}}lld{{.*}}" "-flavor" "gnu"
-// CHECK: "-z" "rodynamic"
+// CHECK: {{.*}}ld.lld{{.*}}" "-z" "rodynamic"
 // CHECK: "--sysroot=[[SYSROOT]]"
 // CHECK: "-pie"
 // CHECK: "--build-id"
Index: lib/Driver/ToolChains/Fuchsia.h
===
--- lib/Driver/ToolChains/Fuchsia.h
+++ lib/Driver/ToolChains/Fuchsia.h
@@ -82,7 +82,7 @@
llvm::opt::ArgStringList &CmdArgs) const override;
 
   const char *getDefaultLinker() const override {
-return "lld";
+return "ld.lld";
   }
 
 protected:
Index: lib/Driver/ToolChains/Fuchsia.cpp
===
--- lib/Driver/ToolChains/Fuchsia.cpp
+++ lib/Driver/ToolChains/Fuchsia.cpp
@@ -44,10 +44,7 @@
   Args.ClaimAllArgs(options::OPT_w);
 
   const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath());
-  if (llvm::sys::path::stem(Exec).equals_lower("lld")) {
-CmdArgs.push_back("-flavor");
-CmdArgs.push_back("gnu");
-
+  if (llvm::sys::path::filename(Exec).startswith_lower("ld.lld")) {
 CmdArgs.push_back("-z");
 CmdArgs.push_back("rodynamic");
   }


Index: test/Driver/fuchsia.cpp
===
--- test/Driver/fuchsia.cpp
+++ test/Driver/fuchsia.cpp
@@ -1,13 +1,12 @@
 // RUN: %clangxx %s -### -no-canonical-prefixes --target=x86_64-unknown-fuchsia \
-// RUN: --sysroot=%S/platform 2>&1 -fuse-ld=ld | FileCheck %s
+// RUN: --sysroot=%S/platform 2>&1 | FileCheck %s
 // CHECK: {{.*}}clang{{.*}}" "-cc1"
 // CHECK: "-triple" "x86_64-fuchsia"
 // CHECK: "-fuse-init-array"
 // CHECK: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK: "-internal-isystem" "{{.*[/\\]}}x86_64-fuchsia{{/|}}include{{/|}}c++{{/|}}v1"
 // CHECK: "-internal-externc-isystem" "[[SYSROOT]]{{/|}}include"
-// CHECK: {{.*}}lld{{.*}}" "-flavor" "gnu"
-// CHECK: "-z" "rodynamic"
+// CHECK: {{.*}}ld.lld{{.*}}" "-z" "rodynamic"
 // CHECK: "--sysroot=[[SYSROOT]]"
 // CHECK: "-pie"
 // CHECK: "--build-id"
Index: test/Driver/fuchsia.c
===
--- test/Driver/fuchsia.c
+++ test/Driver/fuchsia.c
@@ -1,16 +1,15 @@
 // RUN: %clang %s -### -no-canonical-prefixes --target=x86_64-unknown-fuchsia \
-// RUN: --sysroot=%S/platform -fuse-ld=ld 2>&1 \
+// RUN: --sysroot=%S/platform 2>&1 \
 // RUN: | FileCheck -check-prefixes=CHECK,CHECK-X86_64 %s
 // RUN: %clang %s -### -no-canonical-prefixes --target=aarch64-unknown-fuchsia \
-// RUN: --sysroot=%S/platform -fuse-ld=ld 2>&1 \
+// RUN: --sysroot=%S/platform 2>&1 \
 // RUN: | FileCheck -check-prefixes=CHECK,CHECK-AARCH64 %s
 // CHECK: {{.*}}clang{{.*

[PATCH] D39176: [Driver] Use ld.lld directly for Fuchsia rather than passing flavor

2017-10-23 Thread Petr Hosek via Phabricator via cfe-commits
phosek updated this revision to Diff 119923.

Repository:
  rL LLVM

https://reviews.llvm.org/D39176

Files:
  lib/Driver/ToolChains/Fuchsia.cpp
  lib/Driver/ToolChains/Fuchsia.h
  test/Driver/fuchsia.c
  test/Driver/fuchsia.cpp


Index: test/Driver/fuchsia.cpp
===
--- test/Driver/fuchsia.cpp
+++ test/Driver/fuchsia.cpp
@@ -1,13 +1,12 @@
 // RUN: %clangxx %s -### -no-canonical-prefixes 
--target=x86_64-unknown-fuchsia \
-// RUN: --sysroot=%S/platform 2>&1 -fuse-ld=ld | FileCheck %s
+// RUN: --sysroot=%S/platform 2>&1 | FileCheck %s
 // CHECK: {{.*}}clang{{.*}}" "-cc1"
 // CHECK: "-triple" "x86_64-fuchsia"
 // CHECK: "-fuse-init-array"
 // CHECK: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK: "-internal-isystem" 
"{{.*[/\\]}}x86_64-fuchsia{{/|}}include{{/|}}c++{{/|}}v1"
 // CHECK: "-internal-externc-isystem" "[[SYSROOT]]{{/|}}include"
-// CHECK: {{.*}}lld{{.*}}" "-flavor" "gnu"
-// CHECK: "-z" "rodynamic"
+// CHECK: {{.*}}ld.lld{{.*}}" "-z" "rodynamic"
 // CHECK: "--sysroot=[[SYSROOT]]"
 // CHECK: "-pie"
 // CHECK: "--build-id"
Index: test/Driver/fuchsia.c
===
--- test/Driver/fuchsia.c
+++ test/Driver/fuchsia.c
@@ -1,16 +1,15 @@
 // RUN: %clang %s -### -no-canonical-prefixes --target=x86_64-unknown-fuchsia \
-// RUN: --sysroot=%S/platform -fuse-ld=ld 2>&1 \
+// RUN: --sysroot=%S/platform 2>&1 \
 // RUN: | FileCheck -check-prefixes=CHECK,CHECK-X86_64 %s
 // RUN: %clang %s -### -no-canonical-prefixes --target=aarch64-unknown-fuchsia 
\
-// RUN: --sysroot=%S/platform -fuse-ld=ld 2>&1 \
+// RUN: --sysroot=%S/platform 2>&1 \
 // RUN: | FileCheck -check-prefixes=CHECK,CHECK-AARCH64 %s
 // CHECK: {{.*}}clang{{.*}}" "-cc1"
 // CHECK: "-munwind-tables"
 // CHECK: "-fuse-init-array"
 // CHECK: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK: "-internal-externc-isystem" "[[SYSROOT]]{{/|}}include"
-// CHECK: {{.*}}lld{{.*}}" "-flavor" "gnu"
-// CHECK: "-z" "rodynamic"
+// CHECK: {{.*}}ld.lld{{.*}}" "-z" "rodynamic"
 // CHECK: "--sysroot=[[SYSROOT]]"
 // CHECK: "-pie"
 // CHECK: "--build-id"
Index: lib/Driver/ToolChains/Fuchsia.h
===
--- lib/Driver/ToolChains/Fuchsia.h
+++ lib/Driver/ToolChains/Fuchsia.h
@@ -82,7 +82,7 @@
llvm::opt::ArgStringList &CmdArgs) const override;
 
   const char *getDefaultLinker() const override {
-return "lld";
+return "ld.lld";
   }
 
 protected:
Index: lib/Driver/ToolChains/Fuchsia.cpp
===
--- lib/Driver/ToolChains/Fuchsia.cpp
+++ lib/Driver/ToolChains/Fuchsia.cpp
@@ -44,10 +44,8 @@
   Args.ClaimAllArgs(options::OPT_w);
 
   const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath());
-  if (llvm::sys::path::stem(Exec).equals_lower("lld")) {
-CmdArgs.push_back("-flavor");
-CmdArgs.push_back("gnu");
-
+  if (llvm::sys::path::filename(Exec).equals_lower("ld.lld") ||
+  llvm::sys::path::stem(Exec).equals_lower("ld.lld")) {
 CmdArgs.push_back("-z");
 CmdArgs.push_back("rodynamic");
   }


Index: test/Driver/fuchsia.cpp
===
--- test/Driver/fuchsia.cpp
+++ test/Driver/fuchsia.cpp
@@ -1,13 +1,12 @@
 // RUN: %clangxx %s -### -no-canonical-prefixes --target=x86_64-unknown-fuchsia \
-// RUN: --sysroot=%S/platform 2>&1 -fuse-ld=ld | FileCheck %s
+// RUN: --sysroot=%S/platform 2>&1 | FileCheck %s
 // CHECK: {{.*}}clang{{.*}}" "-cc1"
 // CHECK: "-triple" "x86_64-fuchsia"
 // CHECK: "-fuse-init-array"
 // CHECK: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK: "-internal-isystem" "{{.*[/\\]}}x86_64-fuchsia{{/|}}include{{/|}}c++{{/|}}v1"
 // CHECK: "-internal-externc-isystem" "[[SYSROOT]]{{/|}}include"
-// CHECK: {{.*}}lld{{.*}}" "-flavor" "gnu"
-// CHECK: "-z" "rodynamic"
+// CHECK: {{.*}}ld.lld{{.*}}" "-z" "rodynamic"
 // CHECK: "--sysroot=[[SYSROOT]]"
 // CHECK: "-pie"
 // CHECK: "--build-id"
Index: test/Driver/fuchsia.c
===
--- test/Driver/fuchsia.c
+++ test/Driver/fuchsia.c
@@ -1,16 +1,15 @@
 // RUN: %clang %s -### -no-canonical-prefixes --target=x86_64-unknown-fuchsia \
-// RUN: --sysroot=%S/platform -fuse-ld=ld 2>&1 \
+// RUN: --sysroot=%S/platform 2>&1 \
 // RUN: | FileCheck -check-prefixes=CHECK,CHECK-X86_64 %s
 // RUN: %clang %s -### -no-canonical-prefixes --target=aarch64-unknown-fuchsia \
-// RUN: --sysroot=%S/platform -fuse-ld=ld 2>&1 \
+// RUN: --sysroot=%S/platform 2>&1 \
 // RUN: | FileCheck -check-prefixes=CHECK,CHECK-AARCH64 %s
 // CHECK: {{.*}}clang{{.*}}" "-cc1"
 // CHECK: "-munwind-tables"
 // CHECK: "-fuse-init-array"
 // CHECK: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK: "-internal-externc-isystem" "[[SYSROOT]]{{/|}}include"
-// CHECK: {{.*}}lld{{.*}}" "-flavor

[PATCH] D39176: [Driver] Use ld.lld directly for Fuchsia rather than passing flavor

2017-10-23 Thread Petr Hosek via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL316379: [Driver] Use ld.lld directly for Fuchsia rather than 
passing flavor (authored by phosek).

Changed prior to commit:
  https://reviews.llvm.org/D39176?vs=119923&id=119938#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D39176

Files:
  cfe/trunk/lib/Driver/ToolChains/Fuchsia.cpp
  cfe/trunk/lib/Driver/ToolChains/Fuchsia.h
  cfe/trunk/test/Driver/fuchsia.c
  cfe/trunk/test/Driver/fuchsia.cpp


Index: cfe/trunk/test/Driver/fuchsia.c
===
--- cfe/trunk/test/Driver/fuchsia.c
+++ cfe/trunk/test/Driver/fuchsia.c
@@ -1,16 +1,15 @@
 // RUN: %clang %s -### -no-canonical-prefixes --target=x86_64-unknown-fuchsia \
-// RUN: --sysroot=%S/platform -fuse-ld=ld 2>&1 \
+// RUN: --sysroot=%S/platform 2>&1 \
 // RUN: | FileCheck -check-prefixes=CHECK,CHECK-X86_64 %s
 // RUN: %clang %s -### -no-canonical-prefixes --target=aarch64-unknown-fuchsia 
\
-// RUN: --sysroot=%S/platform -fuse-ld=ld 2>&1 \
+// RUN: --sysroot=%S/platform 2>&1 \
 // RUN: | FileCheck -check-prefixes=CHECK,CHECK-AARCH64 %s
 // CHECK: {{.*}}clang{{.*}}" "-cc1"
 // CHECK: "-munwind-tables"
 // CHECK: "-fuse-init-array"
 // CHECK: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK: "-internal-externc-isystem" "[[SYSROOT]]{{/|}}include"
-// CHECK: {{.*}}lld{{.*}}" "-flavor" "gnu"
-// CHECK: "-z" "rodynamic"
+// CHECK: {{.*}}ld.lld{{.*}}" "-z" "rodynamic"
 // CHECK: "--sysroot=[[SYSROOT]]"
 // CHECK: "-pie"
 // CHECK: "--build-id"
Index: cfe/trunk/test/Driver/fuchsia.cpp
===
--- cfe/trunk/test/Driver/fuchsia.cpp
+++ cfe/trunk/test/Driver/fuchsia.cpp
@@ -1,13 +1,12 @@
 // RUN: %clangxx %s -### -no-canonical-prefixes 
--target=x86_64-unknown-fuchsia \
-// RUN: --sysroot=%S/platform 2>&1 -fuse-ld=ld | FileCheck %s
+// RUN: --sysroot=%S/platform 2>&1 | FileCheck %s
 // CHECK: {{.*}}clang{{.*}}" "-cc1"
 // CHECK: "-triple" "x86_64-fuchsia"
 // CHECK: "-fuse-init-array"
 // CHECK: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK: "-internal-isystem" 
"{{.*[/\\]}}x86_64-fuchsia{{/|}}include{{/|}}c++{{/|}}v1"
 // CHECK: "-internal-externc-isystem" "[[SYSROOT]]{{/|}}include"
-// CHECK: {{.*}}lld{{.*}}" "-flavor" "gnu"
-// CHECK: "-z" "rodynamic"
+// CHECK: {{.*}}ld.lld{{.*}}" "-z" "rodynamic"
 // CHECK: "--sysroot=[[SYSROOT]]"
 // CHECK: "-pie"
 // CHECK: "--build-id"
Index: cfe/trunk/lib/Driver/ToolChains/Fuchsia.cpp
===
--- cfe/trunk/lib/Driver/ToolChains/Fuchsia.cpp
+++ cfe/trunk/lib/Driver/ToolChains/Fuchsia.cpp
@@ -44,10 +44,8 @@
   Args.ClaimAllArgs(options::OPT_w);
 
   const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath());
-  if (llvm::sys::path::stem(Exec).equals_lower("lld")) {
-CmdArgs.push_back("-flavor");
-CmdArgs.push_back("gnu");
-
+  if (llvm::sys::path::filename(Exec).equals_lower("ld.lld") ||
+  llvm::sys::path::stem(Exec).equals_lower("ld.lld")) {
 CmdArgs.push_back("-z");
 CmdArgs.push_back("rodynamic");
   }
Index: cfe/trunk/lib/Driver/ToolChains/Fuchsia.h
===
--- cfe/trunk/lib/Driver/ToolChains/Fuchsia.h
+++ cfe/trunk/lib/Driver/ToolChains/Fuchsia.h
@@ -82,7 +82,7 @@
llvm::opt::ArgStringList &CmdArgs) const override;
 
   const char *getDefaultLinker() const override {
-return "lld";
+return "ld.lld";
   }
 
 protected:


Index: cfe/trunk/test/Driver/fuchsia.c
===
--- cfe/trunk/test/Driver/fuchsia.c
+++ cfe/trunk/test/Driver/fuchsia.c
@@ -1,16 +1,15 @@
 // RUN: %clang %s -### -no-canonical-prefixes --target=x86_64-unknown-fuchsia \
-// RUN: --sysroot=%S/platform -fuse-ld=ld 2>&1 \
+// RUN: --sysroot=%S/platform 2>&1 \
 // RUN: | FileCheck -check-prefixes=CHECK,CHECK-X86_64 %s
 // RUN: %clang %s -### -no-canonical-prefixes --target=aarch64-unknown-fuchsia \
-// RUN: --sysroot=%S/platform -fuse-ld=ld 2>&1 \
+// RUN: --sysroot=%S/platform 2>&1 \
 // RUN: | FileCheck -check-prefixes=CHECK,CHECK-AARCH64 %s
 // CHECK: {{.*}}clang{{.*}}" "-cc1"
 // CHECK: "-munwind-tables"
 // CHECK: "-fuse-init-array"
 // CHECK: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK: "-internal-externc-isystem" "[[SYSROOT]]{{/|}}include"
-// CHECK: {{.*}}lld{{.*}}" "-flavor" "gnu"
-// CHECK: "-z" "rodynamic"
+// CHECK: {{.*}}ld.lld{{.*}}" "-z" "rodynamic"
 // CHECK: "--sysroot=[[SYSROOT]]"
 // CHECK: "-pie"
 // CHECK: "--build-id"
Index: cfe/trunk/test/Driver/fuchsia.cpp
===
--- cfe/trunk/test/Driver/fuchsia.cpp
+++ cfe/trunk/test/Driver/fuchsia.cpp
@@ -1,13 +1,12 @@
 // RUN: %clangxx %s -### -no-canonical-prefixes --target=x86_64-unknown-fuchsia \
-// RUN: --sysroot=%S/

[PATCH] D39266: [clang-refactor] Use add_clang_tool CMake template

2017-10-24 Thread Petr Hosek via Phabricator via cfe-commits
phosek created this revision.
phosek added a project: clang.
Herald added a subscriber: mgorny.

This allows including clang-refactor in LLVM_DISTRIBUTION_COMPONENTS
to build clang-refactor as part of the toolchain distribution.


Repository:
  rL LLVM

https://reviews.llvm.org/D39266

Files:
  tools/clang-refactor/CMakeLists.txt


Index: tools/clang-refactor/CMakeLists.txt
===
--- tools/clang-refactor/CMakeLists.txt
+++ tools/clang-refactor/CMakeLists.txt
@@ -3,7 +3,7 @@
   Support
   )
 
-add_clang_executable(clang-refactor
+add_clang_tool(clang-refactor
   ClangRefactor.cpp
   TestSupport.cpp
   )


Index: tools/clang-refactor/CMakeLists.txt
===
--- tools/clang-refactor/CMakeLists.txt
+++ tools/clang-refactor/CMakeLists.txt
@@ -3,7 +3,7 @@
   Support
   )
 
-add_clang_executable(clang-refactor
+add_clang_tool(clang-refactor
   ClangRefactor.cpp
   TestSupport.cpp
   )
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D39270: [CMake] Include clang-refactor in Fuchsia toolchain

2017-10-24 Thread Petr Hosek via Phabricator via cfe-commits
phosek created this revision.
phosek added a project: clang.
Herald added a subscriber: mgorny.

This includes the clang-refactor in the toolchain distribution.


Repository:
  rL LLVM

https://reviews.llvm.org/D39270

Files:
  cmake/caches/Fuchsia-stage2.cmake


Index: cmake/caches/Fuchsia-stage2.cmake
===
--- cmake/caches/Fuchsia-stage2.cmake
+++ cmake/caches/Fuchsia-stage2.cmake
@@ -97,6 +97,7 @@
   LTO
   clang-format
   clang-headers
+  clang-refactor
   clang-tidy
   clangd
   builtins


Index: cmake/caches/Fuchsia-stage2.cmake
===
--- cmake/caches/Fuchsia-stage2.cmake
+++ cmake/caches/Fuchsia-stage2.cmake
@@ -97,6 +97,7 @@
   LTO
   clang-format
   clang-headers
+  clang-refactor
   clang-tidy
   clangd
   builtins
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D39266: [clang-refactor] Use add_clang_tool CMake template

2017-10-24 Thread Petr Hosek via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL316540: [clang-refactor] Use add_clang_tool CMake template 
(authored by phosek).

Changed prior to commit:
  https://reviews.llvm.org/D39266?vs=120155&id=120164#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D39266

Files:
  cfe/trunk/tools/clang-refactor/CMakeLists.txt


Index: cfe/trunk/tools/clang-refactor/CMakeLists.txt
===
--- cfe/trunk/tools/clang-refactor/CMakeLists.txt
+++ cfe/trunk/tools/clang-refactor/CMakeLists.txt
@@ -3,7 +3,7 @@
   Support
   )
 
-add_clang_executable(clang-refactor
+add_clang_tool(clang-refactor
   ClangRefactor.cpp
   TestSupport.cpp
   )


Index: cfe/trunk/tools/clang-refactor/CMakeLists.txt
===
--- cfe/trunk/tools/clang-refactor/CMakeLists.txt
+++ cfe/trunk/tools/clang-refactor/CMakeLists.txt
@@ -3,7 +3,7 @@
   Support
   )
 
-add_clang_executable(clang-refactor
+add_clang_tool(clang-refactor
   ClangRefactor.cpp
   TestSupport.cpp
   )
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D39273: [CMake] Build host builtins in Fuchsia toolchain even on Darwin

2017-10-24 Thread Petr Hosek via Phabricator via cfe-commits
phosek created this revision.
phosek added a project: clang.
Herald added a subscriber: mgorny.

This is needed for the toolchain to be actually usable as a host
toolchain on Darwin.


Repository:
  rL LLVM

https://reviews.llvm.org/D39273

Files:
  cmake/caches/Fuchsia-stage2.cmake


Index: cmake/caches/Fuchsia-stage2.cmake
===
--- cmake/caches/Fuchsia-stage2.cmake
+++ cmake/caches/Fuchsia-stage2.cmake
@@ -33,16 +33,12 @@
 set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 -gline-tables-only -DNDEBUG" CACHE 
STRING "")
 set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -gline-tables-only -DNDEBUG" CACHE 
STRING "")
 
-set(LLVM_BUILTIN_TARGETS "x86_64-fuchsia;aarch64-fuchsia" CACHE STRING "")
+set(LLVM_BUILTIN_TARGETS "default;x86_64-fuchsia;aarch64-fuchsia" CACHE STRING 
"")
 foreach(target x86_64;aarch64)
   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)
-  set(LLVM_BUILTIN_TARGETS "default;${LLVM_BUILTIN_TARGETS}" CACHE STRING "" 
FORCE)
-endif()
-
 set(LLVM_RUNTIME_TARGETS 
"default;x86_64-fuchsia;aarch64-fuchsia;x86_64-fuchsia-asan:x86_64-fuchsia;aarch64-fuchsia-asan:aarch64-fuchsia"
 CACHE STRING "")
 foreach(target x86_64;aarch64)
   set(RUNTIMES_${target}-fuchsia_CMAKE_BUILD_WITH_INSTALL_RPATH ON CACHE BOOL 
"")


Index: cmake/caches/Fuchsia-stage2.cmake
===
--- cmake/caches/Fuchsia-stage2.cmake
+++ cmake/caches/Fuchsia-stage2.cmake
@@ -33,16 +33,12 @@
 set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 -gline-tables-only -DNDEBUG" CACHE STRING "")
 set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -gline-tables-only -DNDEBUG" CACHE STRING "")
 
-set(LLVM_BUILTIN_TARGETS "x86_64-fuchsia;aarch64-fuchsia" CACHE STRING "")
+set(LLVM_BUILTIN_TARGETS "default;x86_64-fuchsia;aarch64-fuchsia" CACHE STRING "")
 foreach(target x86_64;aarch64)
   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)
-  set(LLVM_BUILTIN_TARGETS "default;${LLVM_BUILTIN_TARGETS}" CACHE STRING "" FORCE)
-endif()
-
 set(LLVM_RUNTIME_TARGETS "default;x86_64-fuchsia;aarch64-fuchsia;x86_64-fuchsia-asan:x86_64-fuchsia;aarch64-fuchsia-asan:aarch64-fuchsia" CACHE STRING "")
 foreach(target x86_64;aarch64)
   set(RUNTIMES_${target}-fuchsia_CMAKE_BUILD_WITH_INSTALL_RPATH ON CACHE BOOL "")
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D39270: [CMake] Include clang-refactor in Fuchsia toolchain

2017-10-24 Thread Petr Hosek via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL316541: [CMake] Include clang-refactor in Fuchsia toolchain 
(authored by phosek).

Changed prior to commit:
  https://reviews.llvm.org/D39270?vs=120163&id=120178#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D39270

Files:
  cfe/trunk/cmake/caches/Fuchsia-stage2.cmake


Index: cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
===
--- cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
+++ cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
@@ -97,6 +97,7 @@
   LTO
   clang-format
   clang-headers
+  clang-refactor
   clang-tidy
   clangd
   builtins


Index: cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
===
--- cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
+++ cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
@@ -97,6 +97,7 @@
   LTO
   clang-format
   clang-headers
+  clang-refactor
   clang-tidy
   clangd
   builtins
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D39273: [CMake] Build host builtins in Fuchsia toolchain even on Darwin

2017-10-24 Thread Petr Hosek via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL316542: [CMake] Build host builtins in Fuchsia toolchain 
even on Darwin (authored by phosek).

Changed prior to commit:
  https://reviews.llvm.org/D39273?vs=120165&id=120179#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D39273

Files:
  cfe/trunk/cmake/caches/Fuchsia-stage2.cmake


Index: cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
===
--- cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
+++ cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
@@ -33,16 +33,12 @@
 set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 -gline-tables-only -DNDEBUG" CACHE 
STRING "")
 set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -gline-tables-only -DNDEBUG" CACHE 
STRING "")
 
-set(LLVM_BUILTIN_TARGETS "x86_64-fuchsia;aarch64-fuchsia" CACHE STRING "")
+set(LLVM_BUILTIN_TARGETS "default;x86_64-fuchsia;aarch64-fuchsia" CACHE STRING 
"")
 foreach(target x86_64;aarch64)
   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)
-  set(LLVM_BUILTIN_TARGETS "default;${LLVM_BUILTIN_TARGETS}" CACHE STRING "" 
FORCE)
-endif()
-
 set(LLVM_RUNTIME_TARGETS 
"default;x86_64-fuchsia;aarch64-fuchsia;x86_64-fuchsia-asan:x86_64-fuchsia;aarch64-fuchsia-asan:aarch64-fuchsia"
 CACHE STRING "")
 foreach(target x86_64;aarch64)
   set(RUNTIMES_${target}-fuchsia_CMAKE_BUILD_WITH_INSTALL_RPATH ON CACHE BOOL 
"")


Index: cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
===
--- cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
+++ cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
@@ -33,16 +33,12 @@
 set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 -gline-tables-only -DNDEBUG" CACHE STRING "")
 set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -gline-tables-only -DNDEBUG" CACHE STRING "")
 
-set(LLVM_BUILTIN_TARGETS "x86_64-fuchsia;aarch64-fuchsia" CACHE STRING "")
+set(LLVM_BUILTIN_TARGETS "default;x86_64-fuchsia;aarch64-fuchsia" CACHE STRING "")
 foreach(target x86_64;aarch64)
   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)
-  set(LLVM_BUILTIN_TARGETS "default;${LLVM_BUILTIN_TARGETS}" CACHE STRING "" FORCE)
-endif()
-
 set(LLVM_RUNTIME_TARGETS "default;x86_64-fuchsia;aarch64-fuchsia;x86_64-fuchsia-asan:x86_64-fuchsia;aarch64-fuchsia-asan:aarch64-fuchsia" CACHE STRING "")
 foreach(target x86_64;aarch64)
   set(RUNTIMES_${target}-fuchsia_CMAKE_BUILD_WITH_INSTALL_RPATH ON CACHE BOOL "")
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D51440: [ToolChains] Link to compiler-rt with -L + -l when possible

2018-08-30 Thread Petr Hosek via Phabricator via cfe-commits
phosek added a comment.

What about other compiler-rt runtimes? Shouldn't we use the same approach for 
those?

In case of multiarch runtime layout, we already add 
 
the runtime directory to the new `LibraryPaths` list, which is added 

 to the list of library paths. We could consider doing the same for the default 
layout, in which case all `getCompilerRT` would need to return is the name of 
the library rather than a path, but we would need to use `-l` for all 
compiler-rt runtimes, not just builtins. That's going to require more changes, 
but I think it's going to result in a cleaner design.

@beanz would that work for Darwin as well?




Comment at: lib/Driver/ToolChains/CommonArgs.cpp:1164
+  case ToolChain::RLT_CompilerRT: {
+StringRef Path = TC.getCompilerRTArgString(Args, "builtins");
+StringRef Dir = llvm::sys::path::parent_path(Path);

Rather than parsing the return string below, wouldn't it be cleaner to modify 
`ToolChain::getCompilerRT` to return a tuple 
(`ToolChain::getCompilerRTArgString` could still return a string) and then use 
if here?



Comment at: lib/Driver/ToolChains/CommonArgs.cpp:1168
+if (Filename.consume_front("lib") && Filename.consume_back(".a")) {
+  CmdArgs.push_back(Args.MakeArgString("-L" + Dir));
+  CmdArgs.push_back(Args.MakeArgString("-l" + Filename));

When the multiarch runtime layout is being used, this will result in this path 
being added twice, once in the `ToolChain` constructor and once here.


Repository:
  rC Clang

https://reviews.llvm.org/D51440



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D51440: [ToolChains] Link to compiler-rt with -L + -l when possible

2018-08-31 Thread Petr Hosek via Phabricator via cfe-commits
phosek added a comment.

In https://reviews.llvm.org/D51440#1218859, @mstorsjo wrote:

> I'll see if I can get to looking at that sometime soon. I had this patch 
> lying around as an attempt to work around the libtool issue in 
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=27866 which doesn't seem to be 
> going anywhere (and even if it did, it probably takes quite a bit of time 
> before a new libtool release is made and it gets propagated to most places 
> where I'd like to use this), and was curious if there was any specific reason 
> for having this the way it was, or just the usual; historical reasons that it 
> has started out like this and haven't had a need to change until now. If you 
> otherwise would happen to be touching the same areas, feel free to pick it up 
> ;-) otherwise I'll try to look at addressing your points in a few days.


I'd be happy to pick this up. I already planned to do more refactoring/cleanup 
of this part of the driver. @beanz is improving the Darwin toolchain driver to 
make more like other Clang drivers, so I want to first sync up with him to make 
sure this is also going to work for them.


Repository:
  rC Clang

https://reviews.llvm.org/D51440



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D51573: [Driver] Search LibraryPaths when handling -print-file-name

2018-09-01 Thread Petr Hosek via Phabricator via cfe-commits
phosek created this revision.
phosek added a reviewer: beanz.
Herald added a subscriber: cfe-commits.

This is necessary to handle the multiarch runtime directories.


Repository:
  rC Clang

https://reviews.llvm.org/D51573

Files:
  clang/lib/Driver/Driver.cpp


Index: clang/lib/Driver/Driver.cpp
===
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -4166,16 +4166,23 @@
 }
 
 std::string Driver::GetFilePath(StringRef Name, const ToolChain &TC) const {
+  auto FindPath = [&](const llvm::SmallVectorImpl &P)
+  -> llvm::Optional {
+for (const std::string &Dir : P) {
+  if (Dir.empty())
+continue;
+  SmallString<128> P(Dir[0] == '=' ? SysRoot + Dir.substr(1) : Dir);
+  llvm::sys::path::append(P, Name);
+  if (llvm::sys::fs::exists(Twine(P)))
+return std::string(P.str());
+}
+return None;
+  };
+
   // Respect a limited subset of the '-Bprefix' functionality in GCC by
   // attempting to use this prefix when looking for file paths.
-  for (const std::string &Dir : PrefixDirs) {
-if (Dir.empty())
-  continue;
-SmallString<128> P(Dir[0] == '=' ? SysRoot + Dir.substr(1) : Dir);
-llvm::sys::path::append(P, Name);
-if (llvm::sys::fs::exists(Twine(P)))
-  return P.str();
-  }
+  if (Optional D = FindPath(PrefixDirs))
+return *D;
 
   SmallString<128> R(ResourceDir);
   llvm::sys::path::append(R, Name);
@@ -4187,14 +4194,11 @@
   if (llvm::sys::fs::exists(Twine(P)))
 return P.str();
 
-  for (const std::string &Dir : TC.getFilePaths()) {
-if (Dir.empty())
-  continue;
-SmallString<128> P(Dir[0] == '=' ? SysRoot + Dir.substr(1) : Dir);
-llvm::sys::path::append(P, Name);
-if (llvm::sys::fs::exists(Twine(P)))
-  return P.str();
-  }
+  if (Optional D = FindPath(TC.getLibraryPaths()))
+return *D;
+
+  if (Optional D = FindPath(TC.getFilePaths()))
+return *D;
 
   return Name;
 }


Index: clang/lib/Driver/Driver.cpp
===
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -4166,16 +4166,23 @@
 }
 
 std::string Driver::GetFilePath(StringRef Name, const ToolChain &TC) const {
+  auto FindPath = [&](const llvm::SmallVectorImpl &P)
+  -> llvm::Optional {
+for (const std::string &Dir : P) {
+  if (Dir.empty())
+continue;
+  SmallString<128> P(Dir[0] == '=' ? SysRoot + Dir.substr(1) : Dir);
+  llvm::sys::path::append(P, Name);
+  if (llvm::sys::fs::exists(Twine(P)))
+return std::string(P.str());
+}
+return None;
+  };
+
   // Respect a limited subset of the '-Bprefix' functionality in GCC by
   // attempting to use this prefix when looking for file paths.
-  for (const std::string &Dir : PrefixDirs) {
-if (Dir.empty())
-  continue;
-SmallString<128> P(Dir[0] == '=' ? SysRoot + Dir.substr(1) : Dir);
-llvm::sys::path::append(P, Name);
-if (llvm::sys::fs::exists(Twine(P)))
-  return P.str();
-  }
+  if (Optional D = FindPath(PrefixDirs))
+return *D;
 
   SmallString<128> R(ResourceDir);
   llvm::sys::path::append(R, Name);
@@ -4187,14 +4194,11 @@
   if (llvm::sys::fs::exists(Twine(P)))
 return P.str();
 
-  for (const std::string &Dir : TC.getFilePaths()) {
-if (Dir.empty())
-  continue;
-SmallString<128> P(Dir[0] == '=' ? SysRoot + Dir.substr(1) : Dir);
-llvm::sys::path::append(P, Name);
-if (llvm::sys::fs::exists(Twine(P)))
-  return P.str();
-  }
+  if (Optional D = FindPath(TC.getLibraryPaths()))
+return *D;
+
+  if (Optional D = FindPath(TC.getFilePaths()))
+return *D;
 
   return Name;
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D51573: [Driver] Search LibraryPaths when handling -print-file-name

2018-09-01 Thread Petr Hosek via Phabricator via cfe-commits
phosek updated this revision to Diff 163630.

Repository:
  rC Clang

https://reviews.llvm.org/D51573

Files:
  clang/lib/Driver/Driver.cpp


Index: clang/lib/Driver/Driver.cpp
===
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -4166,16 +4166,23 @@
 }
 
 std::string Driver::GetFilePath(StringRef Name, const ToolChain &TC) const {
-  // Respect a limited subset of the '-Bprefix' functionality in GCC by
-  // attempting to use this prefix when looking for file paths.
-  for (const std::string &Dir : PrefixDirs) {
-if (Dir.empty())
-  continue;
-SmallString<128> P(Dir[0] == '=' ? SysRoot + Dir.substr(1) : Dir);
-llvm::sys::path::append(P, Name);
-if (llvm::sys::fs::exists(Twine(P)))
-  return P.str();
-  }
+  auto FindPath = [&](const llvm::SmallVectorImpl &P)
+  -> llvm::Optional {
+// Respect a limited subset of the '-Bprefix' functionality in GCC by
+// attempting to use this prefix when looking for file paths.
+for (const std::string &Dir : P) {
+  if (Dir.empty())
+continue;
+  SmallString<128> P(Dir[0] == '=' ? SysRoot + Dir.substr(1) : Dir);
+  llvm::sys::path::append(P, Name);
+  if (llvm::sys::fs::exists(Twine(P)))
+return std::string(P.str());
+}
+return None;
+  };
+
+  if (Optional D = FindPath(PrefixDirs))
+return *D;
 
   SmallString<128> R(ResourceDir);
   llvm::sys::path::append(R, Name);
@@ -4187,14 +4194,11 @@
   if (llvm::sys::fs::exists(Twine(P)))
 return P.str();
 
-  for (const std::string &Dir : TC.getFilePaths()) {
-if (Dir.empty())
-  continue;
-SmallString<128> P(Dir[0] == '=' ? SysRoot + Dir.substr(1) : Dir);
-llvm::sys::path::append(P, Name);
-if (llvm::sys::fs::exists(Twine(P)))
-  return P.str();
-  }
+  if (Optional D = FindPath(TC.getLibraryPaths()))
+return *D;
+
+  if (Optional D = FindPath(TC.getFilePaths()))
+return *D;
 
   return Name;
 }


Index: clang/lib/Driver/Driver.cpp
===
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -4166,16 +4166,23 @@
 }
 
 std::string Driver::GetFilePath(StringRef Name, const ToolChain &TC) const {
-  // Respect a limited subset of the '-Bprefix' functionality in GCC by
-  // attempting to use this prefix when looking for file paths.
-  for (const std::string &Dir : PrefixDirs) {
-if (Dir.empty())
-  continue;
-SmallString<128> P(Dir[0] == '=' ? SysRoot + Dir.substr(1) : Dir);
-llvm::sys::path::append(P, Name);
-if (llvm::sys::fs::exists(Twine(P)))
-  return P.str();
-  }
+  auto FindPath = [&](const llvm::SmallVectorImpl &P)
+  -> llvm::Optional {
+// Respect a limited subset of the '-Bprefix' functionality in GCC by
+// attempting to use this prefix when looking for file paths.
+for (const std::string &Dir : P) {
+  if (Dir.empty())
+continue;
+  SmallString<128> P(Dir[0] == '=' ? SysRoot + Dir.substr(1) : Dir);
+  llvm::sys::path::append(P, Name);
+  if (llvm::sys::fs::exists(Twine(P)))
+return std::string(P.str());
+}
+return None;
+  };
+
+  if (Optional D = FindPath(PrefixDirs))
+return *D;
 
   SmallString<128> R(ResourceDir);
   llvm::sys::path::append(R, Name);
@@ -4187,14 +4194,11 @@
   if (llvm::sys::fs::exists(Twine(P)))
 return P.str();
 
-  for (const std::string &Dir : TC.getFilePaths()) {
-if (Dir.empty())
-  continue;
-SmallString<128> P(Dir[0] == '=' ? SysRoot + Dir.substr(1) : Dir);
-llvm::sys::path::append(P, Name);
-if (llvm::sys::fs::exists(Twine(P)))
-  return P.str();
-  }
+  if (Optional D = FindPath(TC.getLibraryPaths()))
+return *D;
+
+  if (Optional D = FindPath(TC.getFilePaths()))
+return *D;
 
   return Name;
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D51573: [Driver] Search LibraryPaths when handling -print-file-name

2018-09-01 Thread Petr Hosek via Phabricator via cfe-commits
phosek updated this revision to Diff 163633.

Repository:
  rC Clang

https://reviews.llvm.org/D51573

Files:
  clang/lib/Driver/Driver.cpp
  clang/test/Driver/linux-per-target-runtime-dir.c


Index: clang/test/Driver/linux-per-target-runtime-dir.c
===
--- clang/test/Driver/linux-per-target-runtime-dir.c
+++ clang/test/Driver/linux-per-target-runtime-dir.c
@@ -19,3 +19,9 @@
 // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN:   | FileCheck --check-prefix=CHECK-CLANGRT-X8664 %s
 // CHECK-CLANGRT-X8664: 
x86_64-linux-gnu{{/|\\}}lib{{/|\\}}libclang_rt.builtins.a
+
+// RUN: %clang -rtlib=compiler-rt -print-file-name=libclang_rt.builtins.a 2>&1 
\
+// RUN: --target=x86_64-linux-gnu \
+// RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
+// RUN:   | FileCheck --check-prefix=CHECK-FILE-NAME-X8664 %s
+// CHECK-FILE-NAME-X8664: 
x86_64-linux-gnu{{/|\\}}lib{{/|\\}}libclang_rt.builtins.a
Index: clang/lib/Driver/Driver.cpp
===
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -4166,16 +4166,23 @@
 }
 
 std::string Driver::GetFilePath(StringRef Name, const ToolChain &TC) const {
-  // Respect a limited subset of the '-Bprefix' functionality in GCC by
-  // attempting to use this prefix when looking for file paths.
-  for (const std::string &Dir : PrefixDirs) {
-if (Dir.empty())
-  continue;
-SmallString<128> P(Dir[0] == '=' ? SysRoot + Dir.substr(1) : Dir);
-llvm::sys::path::append(P, Name);
-if (llvm::sys::fs::exists(Twine(P)))
-  return P.str();
-  }
+  auto FindPath = [&](const llvm::SmallVectorImpl &P)
+  -> llvm::Optional {
+// Respect a limited subset of the '-Bprefix' functionality in GCC by
+// attempting to use this prefix when looking for file paths.
+for (const std::string &Dir : P) {
+  if (Dir.empty())
+continue;
+  SmallString<128> P(Dir[0] == '=' ? SysRoot + Dir.substr(1) : Dir);
+  llvm::sys::path::append(P, Name);
+  if (llvm::sys::fs::exists(Twine(P)))
+return std::string(P.str());
+}
+return None;
+  };
+
+  if (Optional D = FindPath(PrefixDirs))
+return *D;
 
   SmallString<128> R(ResourceDir);
   llvm::sys::path::append(R, Name);
@@ -4187,14 +4194,11 @@
   if (llvm::sys::fs::exists(Twine(P)))
 return P.str();
 
-  for (const std::string &Dir : TC.getFilePaths()) {
-if (Dir.empty())
-  continue;
-SmallString<128> P(Dir[0] == '=' ? SysRoot + Dir.substr(1) : Dir);
-llvm::sys::path::append(P, Name);
-if (llvm::sys::fs::exists(Twine(P)))
-  return P.str();
-  }
+  if (Optional D = FindPath(TC.getLibraryPaths()))
+return *D;
+
+  if (Optional D = FindPath(TC.getFilePaths()))
+return *D;
 
   return Name;
 }


Index: clang/test/Driver/linux-per-target-runtime-dir.c
===
--- clang/test/Driver/linux-per-target-runtime-dir.c
+++ clang/test/Driver/linux-per-target-runtime-dir.c
@@ -19,3 +19,9 @@
 // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN:   | FileCheck --check-prefix=CHECK-CLANGRT-X8664 %s
 // CHECK-CLANGRT-X8664: x86_64-linux-gnu{{/|\\}}lib{{/|\\}}libclang_rt.builtins.a
+
+// RUN: %clang -rtlib=compiler-rt -print-file-name=libclang_rt.builtins.a 2>&1 \
+// RUN: --target=x86_64-linux-gnu \
+// RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
+// RUN:   | FileCheck --check-prefix=CHECK-FILE-NAME-X8664 %s
+// CHECK-FILE-NAME-X8664: x86_64-linux-gnu{{/|\\}}lib{{/|\\}}libclang_rt.builtins.a
Index: clang/lib/Driver/Driver.cpp
===
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -4166,16 +4166,23 @@
 }
 
 std::string Driver::GetFilePath(StringRef Name, const ToolChain &TC) const {
-  // Respect a limited subset of the '-Bprefix' functionality in GCC by
-  // attempting to use this prefix when looking for file paths.
-  for (const std::string &Dir : PrefixDirs) {
-if (Dir.empty())
-  continue;
-SmallString<128> P(Dir[0] == '=' ? SysRoot + Dir.substr(1) : Dir);
-llvm::sys::path::append(P, Name);
-if (llvm::sys::fs::exists(Twine(P)))
-  return P.str();
-  }
+  auto FindPath = [&](const llvm::SmallVectorImpl &P)
+  -> llvm::Optional {
+// Respect a limited subset of the '-Bprefix' functionality in GCC by
+// attempting to use this prefix when looking for file paths.
+for (const std::string &Dir : P) {
+  if (Dir.empty())
+continue;
+  SmallString<128> P(Dir[0] == '=' ? SysRoot + Dir.substr(1) : Dir);
+  llvm::sys::path::append(P, Name);
+  if (llvm::sys::fs::exists(Twine(P)))
+return std::string(P.str());
+}
+return None;
+  };
+
+  if (Optional D = FindPath(PrefixDirs))
+return *D;
 
   SmallString<128> R(Resourc

[PATCH] D51573: [Driver] Search LibraryPaths when handling -print-file-name

2018-09-01 Thread Petr Hosek via Phabricator via cfe-commits
phosek updated this revision to Diff 163636.
phosek marked 4 inline comments as done.

Repository:
  rC Clang

https://reviews.llvm.org/D51573

Files:
  clang/lib/Driver/Driver.cpp
  clang/test/Driver/linux-per-target-runtime-dir.c


Index: clang/test/Driver/linux-per-target-runtime-dir.c
===
--- clang/test/Driver/linux-per-target-runtime-dir.c
+++ clang/test/Driver/linux-per-target-runtime-dir.c
@@ -19,3 +19,9 @@
 // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN:   | FileCheck --check-prefix=CHECK-CLANGRT-X8664 %s
 // CHECK-CLANGRT-X8664: 
x86_64-linux-gnu{{/|\\}}lib{{/|\\}}libclang_rt.builtins.a
+
+// RUN: %clang -rtlib=compiler-rt -print-file-name=libclang_rt.builtins.a 2>&1 
\
+// RUN: --target=x86_64-linux-gnu \
+// RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
+// RUN:   | FileCheck --check-prefix=CHECK-FILE-NAME-X8664 %s
+// CHECK-FILE-NAME-X8664: 
x86_64-linux-gnu{{/|\\}}lib{{/|\\}}libclang_rt.builtins.a
Index: clang/lib/Driver/Driver.cpp
===
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -4166,16 +4166,24 @@
 }
 
 std::string Driver::GetFilePath(StringRef Name, const ToolChain &TC) const {
-  // Respect a limited subset of the '-Bprefix' functionality in GCC by
-  // attempting to use this prefix when looking for file paths.
-  for (const std::string &Dir : PrefixDirs) {
-if (Dir.empty())
-  continue;
-SmallString<128> P(Dir[0] == '=' ? SysRoot + Dir.substr(1) : Dir);
-llvm::sys::path::append(P, Name);
-if (llvm::sys::fs::exists(Twine(P)))
-  return P.str();
-  }
+  // Check for Name in a list of paths.
+  auto FindPath = [&](const llvm::SmallVectorImpl &P)
+  -> llvm::Optional {
+// Respect a limited subset of the '-Bprefix' functionality in GCC by
+// attempting to use this prefix when looking for file paths.
+for (const auto &Dir : P) {
+  if (Dir.empty())
+continue;
+  SmallString<128> P(Dir[0] == '=' ? SysRoot + Dir.substr(1) : Dir);
+  llvm::sys::path::append(P, Name);
+  if (llvm::sys::fs::exists(Twine(P)))
+return {P.str()};
+}
+return None;
+  };
+
+  if (auto P = FindPath(PrefixDirs))
+return *P;
 
   SmallString<128> R(ResourceDir);
   llvm::sys::path::append(R, Name);
@@ -4187,14 +4195,11 @@
   if (llvm::sys::fs::exists(Twine(P)))
 return P.str();
 
-  for (const std::string &Dir : TC.getFilePaths()) {
-if (Dir.empty())
-  continue;
-SmallString<128> P(Dir[0] == '=' ? SysRoot + Dir.substr(1) : Dir);
-llvm::sys::path::append(P, Name);
-if (llvm::sys::fs::exists(Twine(P)))
-  return P.str();
-  }
+  if (auto P = FindPath(TC.getLibraryPaths()))
+return *P;
+
+  if (auto P = FindPath(TC.getFilePaths()))
+return *P;
 
   return Name;
 }


Index: clang/test/Driver/linux-per-target-runtime-dir.c
===
--- clang/test/Driver/linux-per-target-runtime-dir.c
+++ clang/test/Driver/linux-per-target-runtime-dir.c
@@ -19,3 +19,9 @@
 // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN:   | FileCheck --check-prefix=CHECK-CLANGRT-X8664 %s
 // CHECK-CLANGRT-X8664: x86_64-linux-gnu{{/|\\}}lib{{/|\\}}libclang_rt.builtins.a
+
+// RUN: %clang -rtlib=compiler-rt -print-file-name=libclang_rt.builtins.a 2>&1 \
+// RUN: --target=x86_64-linux-gnu \
+// RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
+// RUN:   | FileCheck --check-prefix=CHECK-FILE-NAME-X8664 %s
+// CHECK-FILE-NAME-X8664: x86_64-linux-gnu{{/|\\}}lib{{/|\\}}libclang_rt.builtins.a
Index: clang/lib/Driver/Driver.cpp
===
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -4166,16 +4166,24 @@
 }
 
 std::string Driver::GetFilePath(StringRef Name, const ToolChain &TC) const {
-  // Respect a limited subset of the '-Bprefix' functionality in GCC by
-  // attempting to use this prefix when looking for file paths.
-  for (const std::string &Dir : PrefixDirs) {
-if (Dir.empty())
-  continue;
-SmallString<128> P(Dir[0] == '=' ? SysRoot + Dir.substr(1) : Dir);
-llvm::sys::path::append(P, Name);
-if (llvm::sys::fs::exists(Twine(P)))
-  return P.str();
-  }
+  // Check for Name in a list of paths.
+  auto FindPath = [&](const llvm::SmallVectorImpl &P)
+  -> llvm::Optional {
+// Respect a limited subset of the '-Bprefix' functionality in GCC by
+// attempting to use this prefix when looking for file paths.
+for (const auto &Dir : P) {
+  if (Dir.empty())
+continue;
+  SmallString<128> P(Dir[0] == '=' ? SysRoot + Dir.substr(1) : Dir);
+  llvm::sys::path::append(P, Name);
+  if (llvm::sys::fs::exists(Twine(P)))
+return {P.str()};
+}
+return None;
+  };
+
+  if (auto P 

[PATCH] D51573: [Driver] Search LibraryPaths when handling -print-file-name

2018-09-03 Thread Petr Hosek via Phabricator via cfe-commits
phosek added inline comments.



Comment at: clang/lib/Driver/Driver.cpp:4187
 
   SmallString<128> R(ResourceDir);
   llvm::sys::path::append(R, Name);

mcgrathr wrote:
> You could fold these cases into the lambda too by having it take a bool 
> UseSysRoot and passing `{ResourceDir}, false`.
> Then the main body is a uniform and concise list of paths to check.
I considered that but `llvm::SmallVector` doesn't support initializer list so 
this ends up looking not so great.


Repository:
  rC Clang

https://reviews.llvm.org/D51573



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D51573: [Driver] Search LibraryPaths when handling -print-file-name

2018-09-11 Thread Petr Hosek via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC342021: [Driver] Search LibraryPaths when handling 
-print-file-name (authored by phosek, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D51573?vs=163636&id=165008#toc

Repository:
  rC Clang

https://reviews.llvm.org/D51573

Files:
  lib/Driver/Driver.cpp
  test/Driver/linux-per-target-runtime-dir.c


Index: lib/Driver/Driver.cpp
===
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -4152,16 +4152,24 @@
 }
 
 std::string Driver::GetFilePath(StringRef Name, const ToolChain &TC) const {
-  // Respect a limited subset of the '-Bprefix' functionality in GCC by
-  // attempting to use this prefix when looking for file paths.
-  for (const std::string &Dir : PrefixDirs) {
-if (Dir.empty())
-  continue;
-SmallString<128> P(Dir[0] == '=' ? SysRoot + Dir.substr(1) : Dir);
-llvm::sys::path::append(P, Name);
-if (llvm::sys::fs::exists(Twine(P)))
-  return P.str();
-  }
+  // Seach for Name in a list of paths.
+  auto SearchPaths = [&](const llvm::SmallVectorImpl &P)
+  -> llvm::Optional {
+// Respect a limited subset of the '-Bprefix' functionality in GCC by
+// attempting to use this prefix when looking for file paths.
+for (const auto &Dir : P) {
+  if (Dir.empty())
+continue;
+  SmallString<128> P(Dir[0] == '=' ? SysRoot + Dir.substr(1) : Dir);
+  llvm::sys::path::append(P, Name);
+  if (llvm::sys::fs::exists(Twine(P)))
+return {P.str()};
+}
+return None;
+  };
+
+  if (auto P = SearchPaths(PrefixDirs))
+return *P;
 
   SmallString<128> R(ResourceDir);
   llvm::sys::path::append(R, Name);
@@ -4173,14 +4181,11 @@
   if (llvm::sys::fs::exists(Twine(P)))
 return P.str();
 
-  for (const std::string &Dir : TC.getFilePaths()) {
-if (Dir.empty())
-  continue;
-SmallString<128> P(Dir[0] == '=' ? SysRoot + Dir.substr(1) : Dir);
-llvm::sys::path::append(P, Name);
-if (llvm::sys::fs::exists(Twine(P)))
-  return P.str();
-  }
+  if (auto P = SearchPaths(TC.getLibraryPaths()))
+return *P;
+
+  if (auto P = SearchPaths(TC.getFilePaths()))
+return *P;
 
   return Name;
 }
Index: test/Driver/linux-per-target-runtime-dir.c
===
--- test/Driver/linux-per-target-runtime-dir.c
+++ test/Driver/linux-per-target-runtime-dir.c
@@ -19,3 +19,9 @@
 // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN:   | FileCheck --check-prefix=CHECK-CLANGRT-X8664 %s
 // CHECK-CLANGRT-X8664: 
x86_64-linux-gnu{{/|\\}}lib{{/|\\}}libclang_rt.builtins.a
+
+// RUN: %clang -rtlib=compiler-rt -print-file-name=libclang_rt.builtins.a 2>&1 
\
+// RUN: --target=x86_64-linux-gnu \
+// RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
+// RUN:   | FileCheck --check-prefix=CHECK-FILE-NAME-X8664 %s
+// CHECK-FILE-NAME-X8664: 
x86_64-linux-gnu{{/|\\}}lib{{/|\\}}libclang_rt.builtins.a


Index: lib/Driver/Driver.cpp
===
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -4152,16 +4152,24 @@
 }
 
 std::string Driver::GetFilePath(StringRef Name, const ToolChain &TC) const {
-  // Respect a limited subset of the '-Bprefix' functionality in GCC by
-  // attempting to use this prefix when looking for file paths.
-  for (const std::string &Dir : PrefixDirs) {
-if (Dir.empty())
-  continue;
-SmallString<128> P(Dir[0] == '=' ? SysRoot + Dir.substr(1) : Dir);
-llvm::sys::path::append(P, Name);
-if (llvm::sys::fs::exists(Twine(P)))
-  return P.str();
-  }
+  // Seach for Name in a list of paths.
+  auto SearchPaths = [&](const llvm::SmallVectorImpl &P)
+  -> llvm::Optional {
+// Respect a limited subset of the '-Bprefix' functionality in GCC by
+// attempting to use this prefix when looking for file paths.
+for (const auto &Dir : P) {
+  if (Dir.empty())
+continue;
+  SmallString<128> P(Dir[0] == '=' ? SysRoot + Dir.substr(1) : Dir);
+  llvm::sys::path::append(P, Name);
+  if (llvm::sys::fs::exists(Twine(P)))
+return {P.str()};
+}
+return None;
+  };
+
+  if (auto P = SearchPaths(PrefixDirs))
+return *P;
 
   SmallString<128> R(ResourceDir);
   llvm::sys::path::append(R, Name);
@@ -4173,14 +4181,11 @@
   if (llvm::sys::fs::exists(Twine(P)))
 return P.str();
 
-  for (const std::string &Dir : TC.getFilePaths()) {
-if (Dir.empty())
-  continue;
-SmallString<128> P(Dir[0] == '=' ? SysRoot + Dir.substr(1) : Dir);
-llvm::sys::path::append(P, Name);
-if (llvm::sys::fs::exists(Twine(P)))
-  return P.str();
-  }
+  if (auto P = SearchPaths(TC.getLibraryPaths()))
+return *P;
+
+  if (auto P = SearchPaths(TC.getFilePaths()))
+return *P;
 
   return Name;
 }
Index: test/Driver/linux-per-target-

[PATCH] D49502: [CMake] Support statically linking dependencies only to shared or static library

2018-07-19 Thread Petr Hosek via Phabricator via cfe-commits
phosek added inline comments.



Comment at: libcxx/lib/CMakeLists.txt:269
+AND (TARGET cxxabi_static OR HAVE_LIBCXXABI))
+#if ((TARGET ${LIBCXX_CXX_ABI_LIBRARY}) OR
+#(${LIBCXX_CXX_ABI_LIBRARY} MATCHES "cxxabi(_static|_shared)?" AND 
HAVE_LIBCXXABI))

ldionne wrote:
> phosek wrote:
> > ldionne wrote:
> > > I don't understand why any of this needs to change -- can you please 
> > > explain? Also, you probably didn't mean to leave the commented-out lines.
> > The reason this change is needed the case when we're linking shared 
> > libc++abi into shared libc++ in which case `${LIBCXX_CXX_ABI_LIBRARY}` will 
> > be set to `cxxabi_shared` in `HandleLibCXXABI.cmake` but we cannot merge 
> > `libc++abi.so` into `libc++.a`, so instead we force the use of 
> > `cxxabi_static` here.
> > 
> > Alternatively, we could modify `HandleLibCXXABI.cmake` to set two 
> > dependencies, one for the static case and one for the shared case and use 
> > the former one here.
> > 
> > Removed the commented out lines.
> Thanks. There's something I still don't understand. If you are linking the 
> ABI library dynamically, why would you want to merge it (well, the static 
> version of it) into `libc++.a`? It seems like this is somewhat defeating the 
> purpose of dynamically linking against the ABI library, no?
In our case, we want to link shared library dynamically and merge all static 
libraries, so `LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY=OFF` and 
`LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY=ON`. This means that 
`LIBCXX_CXX_ABI_LIBRARY` will be set to `cxxabi_shared` and it's what will be 
used other places throughout this file as the interface library. However, we 
cannot merge `libc++abi.so` into `libc++.a` so that's why we have to explicitly 
select `cxxabi_static` here rather than simply using `LIBCXX_CXX_ABI_LIBRARY` 
as before.

Like I mentioned in the previous comment, alternative would be to split this 
into two variables, e.g. `LIBCXX_CXX_SHARED_ABI_LIBRARY` and 
`LIBCXX_CXX_STATIC_ABI_LIBRARY`, would you prefer that approach?



Comment at: libcxxabi/src/CMakeLists.txt:64
   # FIXME: Is it correct to prefer the static version of libunwind?
   if (NOT LIBCXXABI_ENABLE_STATIC_UNWINDER AND (TARGET unwind_shared OR 
HAVE_LIBUNWIND))
 list(APPEND LIBCXXABI_LIBRARIES unwind_shared)

ldionne wrote:
> Does this not need to change anymore? I think we'd have to set different 
> flags for `cxxabi_shared` and `cxxabi_static`.
> 
This is relying on the fact that `LIBCXXABI_LIBRARIES` isn't used for library 
merging that's done on lines 158-162 and CMake should ignore shared library 
dependencies passed to `target_link_libraries` when building static library as 
done on line 163 (since linking dynamic library target against static library 
doesn't make sense). This seems to be working fine in my testing, but I'm also 
OK splitting this into two variables if you want it to be explicit.


Repository:
  rCXX libc++

https://reviews.llvm.org/D49502



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D49573: [CMake] Option to control whether shared/static library is installed

2018-07-19 Thread Petr Hosek via Phabricator via cfe-commits
phosek updated this revision to Diff 156382.
phosek edited subscribers, added: cfe-commits; removed: llvm-commits.

Repository:
  rL LLVM

https://reviews.llvm.org/D49573

Files:
  libcxx/CMakeLists.txt
  libcxx/lib/CMakeLists.txt
  libcxxabi/CMakeLists.txt
  libcxxabi/src/CMakeLists.txt
  libunwind/CMakeLists.txt
  libunwind/src/CMakeLists.txt

Index: libunwind/src/CMakeLists.txt
===
--- libunwind/src/CMakeLists.txt
+++ libunwind/src/CMakeLists.txt
@@ -103,8 +103,6 @@
 COMPILE_FLAGS "${LIBUNWIND_COMPILE_FLAGS}"
 POSITION_INDEPENDENT_CODE ON)
 
-set(LIBUNWIND_TARGETS)
-
 # Build the shared library.
 if (LIBUNWIND_ENABLE_SHARED)
   add_library(unwind_shared SHARED $)
@@ -118,7 +116,10 @@
   OUTPUT_NAME   "unwind"
   VERSION   "1.0"
   SOVERSION "1")
-  list(APPEND LIBUNWIND_TARGETS "unwind_shared")
+  list(APPEND LIBUNWIND_BUILD_TARGETS "unwind_shared")
+  if (LIBUNWIND_INSTALL_SHARED_LIBRARY)
+list(APPEND LIBUNWIND_INSTALL_TARGETS "unwind_shared")
+  endif()
 endif()
 
 # Build the static library.
@@ -129,14 +130,17 @@
 PROPERTIES
   LINK_FLAGS"${LIBUNWIND_LINK_FLAGS}"
   OUTPUT_NAME   "unwind")
-  list(APPEND LIBUNWIND_TARGETS "unwind_static")
+  list(APPEND LIBUNWIND_BUILD_TARGETS "unwind_static")
+  if (LIBUNWIND_INSTALL_STATIC_LIBRARY)
+list(APPEND LIBUNWIND_INSTALL_TARGETS "unwind_static")
+  endif()
 endif()
 
 # Add a meta-target for both libraries.
-add_custom_target(unwind DEPENDS ${LIBUNWIND_TARGETS})
+add_custom_target(unwind DEPENDS ${LIBUNWIND_BUILD_TARGETS})
 
 if (LIBUNWIND_INSTALL_LIBRARY)
-  install(TARGETS ${LIBUNWIND_TARGETS}
+  install(TARGETS ${LIBUNWIND_INSTALL_TARGETS}
 LIBRARY DESTINATION ${LIBUNWIND_INSTALL_PREFIX}lib${LIBUNWIND_LIBDIR_SUFFIX} COMPONENT unwind
 ARCHIVE DESTINATION ${LIBUNWIND_INSTALL_PREFIX}lib${LIBUNWIND_LIBDIR_SUFFIX} COMPONENT unwind)
 endif()
Index: libunwind/CMakeLists.txt
===
--- libunwind/CMakeLists.txt
+++ libunwind/CMakeLists.txt
@@ -137,6 +137,12 @@
 set(LIBUNWIND_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}" CACHE STRING
 "Define suffix of library directory name (32/64)")
 option(LIBUNWIND_INSTALL_LIBRARY "Install the libunwind library." ON)
+cmake_dependent_option(LIBUNWIND_INSTALL_STATIC_LIBRARY
+  "Install the static libunwind library." ON
+  "LIBUNWIND_ENABLE_STATIC;LIBUNWIND_INSTALL_LIBRARY" OFF)
+cmake_dependent_option(LIBUNWIND_INSTALL_SHARED_LIBRARY
+  "Install the shared libunwind library." ON
+  "LIBUNWIND_ENABLE_SHARED;LIBUNWIND_INSTALL_LIBRARY" OFF)
 set(LIBUNWIND_TARGET_TRIPLE "" CACHE STRING "Target triple for cross compiling.")
 set(LIBUNWIND_GCC_TOOLCHAIN "" CACHE PATH "GCC toolchain for cross compiling.")
 set(LIBUNWIND_SYSROOT "" CACHE PATH "Sysroot for cross compiling.")
Index: libcxxabi/src/CMakeLists.txt
===
--- libcxxabi/src/CMakeLists.txt
+++ libcxxabi/src/CMakeLists.txt
@@ -122,8 +122,6 @@
 POSITION_INDEPENDENT_CODE
   ON)
 
-set(LIBCXXABI_TARGETS)
-
 # Build the shared library.
 if (LIBCXXABI_ENABLE_SHARED)
   add_library(cxxabi_shared SHARED $)
@@ -149,7 +147,10 @@
 "1"
   VERSION
 "1.0")
-  list(APPEND LIBCXXABI_TARGETS "cxxabi_shared")
+  list(APPEND LIBCXXABI_BUILD_TARGETS "cxxabi_shared")
+  if (LIBCXXABI_INSTALL_SHARED_LIBRARY)
+list(APPEND LIBCXXABI_INSTALL_TARGETS "cxxabi_shared")
+  endif()
 endif()
 
 # Build the static library.
@@ -176,14 +177,17 @@
 "c++abi"
   POSITION_INDEPENDENT_CODE
 ON)
-  list(APPEND LIBCXXABI_TARGETS "cxxabi_static")
+  list(APPEND LIBCXXABI_BUILD_TARGETS "cxxabi_static")
+  if (LIBCXXABI_INSTALL_STATIC_LIBRARY)
+list(APPEND LIBCXXABI_INSTALL_TARGETS "cxxabi_static")
+  endif()
 endif()
 
 # Add a meta-target for both libraries.
-add_custom_target(cxxabi DEPENDS ${LIBCXXABI_TARGETS})
+add_custom_target(cxxabi DEPENDS ${LIBCXXABI_BUILD_TARGETS})
 
 if (LIBCXXABI_INSTALL_LIBRARY)
-  install(TARGETS ${LIBCXXABI_TARGETS}
+  install(TARGETS ${LIBCXXABI_INSTALL_TARGETS}
 LIBRARY DESTINATION ${LIBCXXABI_INSTALL_PREFIX}lib${LIBCXXABI_LIBDIR_SUFFIX} COMPONENT cxxabi
 ARCHIVE DESTINATION ${LIBCXXABI_INSTALL_PREFIX}lib${LIBCXXABI_LIBDIR_SUFFIX} COMPONENT cxxabi
 )
Index: libcxxabi/CMakeLists.txt
===
--- libcxxabi/CMakeLists.txt
+++ libcxxabi/CMakeLists.txt
@@ -75,6 +75,13 @@
 set(LIBCXXABI_SYSROOT "" CACHE PATH "Sysroot for cross compiling.")
 set(LIBCXXABI_LIBCXX_LIBRARY_PATH "" CACHE PATH "The path to libc++ library.

[PATCH] D49502: [CMake] Support statically linking dependencies only to shared or static library

2018-07-19 Thread Petr Hosek via Phabricator via cfe-commits
phosek updated this revision to Diff 156416.
phosek marked 8 inline comments as done.
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

https://reviews.llvm.org/D49502

Files:
  libcxx/CMakeLists.txt
  libcxx/cmake/Modules/HandleLibCXXABI.cmake
  libcxx/lib/CMakeLists.txt
  libcxxabi/CMakeLists.txt
  libcxxabi/src/CMakeLists.txt

Index: libcxxabi/src/CMakeLists.txt
===
--- libcxxabi/src/CMakeLists.txt
+++ libcxxabi/src/CMakeLists.txt
@@ -61,19 +61,27 @@
   # Prefer using the in-tree version of libunwind, either shared or static. If
   # none are found fall back to using -lunwind.
   # FIXME: Is it correct to prefer the static version of libunwind?
-  if (NOT LIBCXXABI_ENABLE_STATIC_UNWINDER AND (TARGET unwind_shared OR HAVE_LIBUNWIND))
-list(APPEND LIBCXXABI_LIBRARIES unwind_shared)
-  elseif (LIBCXXABI_ENABLE_STATIC_UNWINDER AND (TARGET unwind_static OR HAVE_LIBUNWIND))
-list(APPEND LIBCXXABI_LIBRARIES unwind_static)
+  if (NOT LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_SHARED_LIBRARY AND (TARGET unwind_shared OR HAVE_LIBUNWIND))
+list(APPEND LIBCXXABI_SHARED_LIBRARIES unwind_shared)
+  elseif (LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_SHARED_LIBRARY AND (TARGET unwind_static OR HAVE_LIBUNWIND))
+list(APPEND LIBCXXABI_SHARED_LIBRARIES unwind_static)
   else()
-list(APPEND LIBCXXABI_LIBRARIES unwind)
+list(APPEND LIBCXXABI_SHARED_LIBRARIES unwind)
+  endif()
+  if (NOT LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_STATIC_LIBRARY AND (TARGET unwind_shared OR HAVE_LIBUNWIND))
+list(APPEND LIBCXXABI_STATIC_LIBRARIES unwind_shared)
+  elseif (LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_STATIC_LIBRARY AND (TARGET unwind_static OR HAVE_LIBUNWIND))
+  # We handle this by directly merging libunwind objects into libc++abi.
+  else()
+list(APPEND LIBCXXABI_STATIC_LIBRARIES unwind)
   endif()
 else()
   add_library_flags_if(LIBCXXABI_HAS_GCC_S_LIB gcc_s)
 endif()
 if (MINGW)
   # MINGW_LIBRARIES is defined in config-ix.cmake
-  list(APPEND LIBCXXABI_LIBRARIES ${MINGW_LIBRARIES})
+  list(APPEND LIBCXXABI_SHARED_LIBRARIES ${MINGW_LIBRARIES})
+  list(APPEND LIBCXXABI_STATIC_LIBRARIES ${MINGW_LIBRARIES})
 endif()
 
 # Setup flags.
@@ -130,7 +138,7 @@
   if(COMMAND llvm_setup_rpath)
 llvm_setup_rpath(cxxabi_shared)
   endif()
-  target_link_libraries(cxxabi_shared ${LIBCXXABI_LIBRARIES})
+  target_link_libraries(cxxabi_shared ${LIBCXXABI_SHARED_LIBRARIES})
   set_target_properties(cxxabi_shared
 PROPERTIES
   CXX_EXTENSIONS
@@ -155,13 +163,13 @@
 # Build the static library.
 if (LIBCXXABI_ENABLE_STATIC)
   set(cxxabi_static_sources $)
-  if (LIBCXXABI_USE_LLVM_UNWINDER AND LIBCXXABI_ENABLE_STATIC_UNWINDER)
+  if (LIBCXXABI_USE_LLVM_UNWINDER AND LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_STATIC_LIBRARY)
 if (TARGET unwind_static OR HAVE_LIBUNWIND)
   list(APPEND cxxabi_static_sources $)
 endif()
   endif()
   add_library(cxxabi_static STATIC ${cxxabi_static_sources})
-  target_link_libraries(cxxabi_static ${LIBCXXABI_LIBRARIES})
+  target_link_libraries(cxxabi_static ${LIBCXXABI_STATIC_LIBRARIES})
   set_target_properties(cxxabi_static
 PROPERTIES
   CXX_EXTENSIONS
Index: libcxxabi/CMakeLists.txt
===
--- libcxxabi/CMakeLists.txt
+++ libcxxabi/CMakeLists.txt
@@ -84,6 +84,13 @@
 option(LIBCXXABI_ENABLE_SHARED "Build libc++abi as a shared library." ON)
 option(LIBCXXABI_ENABLE_STATIC "Build libc++abi as a static library." ON)
 
+cmake_dependent_option(LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_STATIC_LIBRARY
+  "Statically link the LLVM unwinder to static library" ON
+  "LIBCXXABI_ENABLE_STATIC_UNWINDER;LIBCXXABI_ENABLE_STATIC" OFF)
+cmake_dependent_option(LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_SHARED_LIBRARY
+  "Statically link the LLVM unwinder to shared library" ON
+  "LIBCXXABI_ENABLE_STATIC_UNWINDER;LIBCXXABI_ENABLE_SHARED" OFF)
+
 option(LIBCXXABI_BAREMETAL "Build libc++abi for baremetal targets." OFF)
 # The default terminate handler attempts to demangle uncaught exceptions, which
 # causes extra I/O and demangling code to be pulled in.
Index: libcxx/lib/CMakeLists.txt
===
--- libcxx/lib/CMakeLists.txt
+++ libcxx/lib/CMakeLists.txt
@@ -44,7 +44,7 @@
   set(LIBCXX_OSX_REEXPORT_SYSTEM_ABI_LIBRARY ON)
 endif()
 
-if (LIBCXX_ENABLE_STATIC_ABI_LIBRARY)
+if (LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY)
   add_library_flags("-Wl,--whole-archive" "-Wl,-Bstatic")
   add_library_flags("${LIBCXX_CXX_ABI_LIBRARY}")
   add_library_flags("-Wl,-Bdynamic" "-Wl,--no-whole-archive")
@@ -259,14 +259,14 @@
 
   list(APPEND LIBCXX_TARGETS "cxx_static")
   # Attempt to merge the libc++.a archive and the ABI library archive into one.
-  if (LIBCXX_ENABLE_STATIC_ABI_LIBRARY)
+  if (LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY)

[PATCH] D49584: [CMake] Install C++ ABI headers into the right location

2018-07-19 Thread Petr Hosek via Phabricator via cfe-commits
phosek created this revision.
phosek added reviewers: ldionne, EricWF.
Herald added subscribers: cfe-commits, christof, mgorny.

This is a follow-up to r335809 and r337118. While libc++ headers are now 
installed into the right location in both standard as well as multiarch 
runtimes layout, turned out C++ ABI headers are still installed into the old 
location in the latter case. This change addresses that.


Repository:
  rCXX libc++

https://reviews.llvm.org/D49584

Files:
  libcxx/cmake/Modules/HandleLibCXXABI.cmake


Index: libcxx/cmake/Modules/HandleLibCXXABI.cmake
===
--- libcxx/cmake/Modules/HandleLibCXXABI.cmake
+++ libcxx/cmake/Modules/HandleLibCXXABI.cmake
@@ -32,14 +32,6 @@
   set(LIBCXX_CXX_ABI_LIBRARY ${abilib})
   set(LIBCXX_ABILIB_FILES ${abifiles})
 
-  # The place in the build tree where we store out-of-source headers.
-  file(MAKE_DIRECTORY "${LIBCXX_BUILD_HEADERS_ROOT}")
-  file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/include/c++/v1")
-  foreach(_d ${abidirs})
-file(MAKE_DIRECTORY "${LIBCXX_BINARY_INCLUDE_DIR}/${_d}")
-file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/include/c++/v1/${_d}")
-  endforeach()
-
   foreach(fpath ${LIBCXX_ABILIB_FILES})
 set(found FALSE)
 foreach(incpath ${LIBCXX_CXX_ABI_INCLUDE_PATHS})
@@ -56,16 +48,16 @@
 COMMENT "Copying C++ ABI header ${fpath}...")
 list(APPEND abilib_headers "${dst}")
 
-set(dst "${CMAKE_BINARY_DIR}/include/c++/v1/${dstdir}/${fpath}")
+set(dst "${LIBCXX_HEADER_DIR}/include/c++/v1/${dstdir}/${fpath}")
 add_custom_command(OUTPUT ${dst}
 DEPENDS ${src}
 COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
 COMMENT "Copying C++ ABI header ${fpath}...")
 list(APPEND abilib_headers "${dst}")
 
 if (LIBCXX_INSTALL_HEADERS)
   install(FILES "${LIBCXX_BINARY_INCLUDE_DIR}/${fpath}"
-DESTINATION ${LIBCXX_INSTALL_PATH}include/c++/v1/${dstdir}
+DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1/${dstdir}
 COMPONENT cxx-headers
 PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
 )


Index: libcxx/cmake/Modules/HandleLibCXXABI.cmake
===
--- libcxx/cmake/Modules/HandleLibCXXABI.cmake
+++ libcxx/cmake/Modules/HandleLibCXXABI.cmake
@@ -32,14 +32,6 @@
   set(LIBCXX_CXX_ABI_LIBRARY ${abilib})
   set(LIBCXX_ABILIB_FILES ${abifiles})
 
-  # The place in the build tree where we store out-of-source headers.
-  file(MAKE_DIRECTORY "${LIBCXX_BUILD_HEADERS_ROOT}")
-  file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/include/c++/v1")
-  foreach(_d ${abidirs})
-file(MAKE_DIRECTORY "${LIBCXX_BINARY_INCLUDE_DIR}/${_d}")
-file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/include/c++/v1/${_d}")
-  endforeach()
-
   foreach(fpath ${LIBCXX_ABILIB_FILES})
 set(found FALSE)
 foreach(incpath ${LIBCXX_CXX_ABI_INCLUDE_PATHS})
@@ -56,16 +48,16 @@
 COMMENT "Copying C++ ABI header ${fpath}...")
 list(APPEND abilib_headers "${dst}")
 
-set(dst "${CMAKE_BINARY_DIR}/include/c++/v1/${dstdir}/${fpath}")
+set(dst "${LIBCXX_HEADER_DIR}/include/c++/v1/${dstdir}/${fpath}")
 add_custom_command(OUTPUT ${dst}
 DEPENDS ${src}
 COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
 COMMENT "Copying C++ ABI header ${fpath}...")
 list(APPEND abilib_headers "${dst}")
 
 if (LIBCXX_INSTALL_HEADERS)
   install(FILES "${LIBCXX_BINARY_INCLUDE_DIR}/${fpath}"
-DESTINATION ${LIBCXX_INSTALL_PATH}include/c++/v1/${dstdir}
+DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1/${dstdir}
 COMPONENT cxx-headers
 PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
 )
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D49502: [CMake] Support statically linking dependencies only to shared or static library

2018-07-19 Thread Petr Hosek via Phabricator via cfe-commits
phosek added inline comments.



Comment at: libcxx/lib/CMakeLists.txt:269
+AND (TARGET cxxabi_static OR HAVE_LIBCXXABI))
+#if ((TARGET ${LIBCXX_CXX_ABI_LIBRARY}) OR
+#(${LIBCXX_CXX_ABI_LIBRARY} MATCHES "cxxabi(_static|_shared)?" AND 
HAVE_LIBCXXABI))

ldionne wrote:
> phosek wrote:
> > ldionne wrote:
> > > phosek wrote:
> > > > ldionne wrote:
> > > > > I don't understand why any of this needs to change -- can you please 
> > > > > explain? Also, you probably didn't mean to leave the commented-out 
> > > > > lines.
> > > > The reason this change is needed the case when we're linking shared 
> > > > libc++abi into shared libc++ in which case `${LIBCXX_CXX_ABI_LIBRARY}` 
> > > > will be set to `cxxabi_shared` in `HandleLibCXXABI.cmake` but we cannot 
> > > > merge `libc++abi.so` into `libc++.a`, so instead we force the use of 
> > > > `cxxabi_static` here.
> > > > 
> > > > Alternatively, we could modify `HandleLibCXXABI.cmake` to set two 
> > > > dependencies, one for the static case and one for the shared case and 
> > > > use the former one here.
> > > > 
> > > > Removed the commented out lines.
> > > Thanks. There's something I still don't understand. If you are linking 
> > > the ABI library dynamically, why would you want to merge it (well, the 
> > > static version of it) into `libc++.a`? It seems like this is somewhat 
> > > defeating the purpose of dynamically linking against the ABI library, no?
> > In our case, we want to link shared library dynamically and merge all 
> > static libraries, so `LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY=OFF` and 
> > `LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY=ON`. This means that 
> > `LIBCXX_CXX_ABI_LIBRARY` will be set to `cxxabi_shared` and it's what will 
> > be used other places throughout this file as the interface library. 
> > However, we cannot merge `libc++abi.so` into `libc++.a` so that's why we 
> > have to explicitly select `cxxabi_static` here rather than simply using 
> > `LIBCXX_CXX_ABI_LIBRARY` as before.
> > 
> > Like I mentioned in the previous comment, alternative would be to split 
> > this into two variables, e.g. `LIBCXX_CXX_SHARED_ABI_LIBRARY` and 
> > `LIBCXX_CXX_STATIC_ABI_LIBRARY`, would you prefer that approach?
> Yes, I understand why the `TARGET_LINKER_FILE` must also be `cxxabi_static`. 
> What I don't understand is why the conditions need to change, i.e. why you're 
> going from
> ```
> if (TARGET ${LIBCXX_CXX_ABI_LIBRARY} OR
> (${LIBCXX_CXX_ABI_LIBRARY} MATCHES "cxxabi(_static|_shared)?" AND 
> HAVE_LIBCXXABI))
> ```
> 
> to 
> 
> ```
> if (${LIBCXX_CXX_ABI_LIBRARY} MATCHES "cxxabi(_static|_shared)?"
> AND (TARGET cxxabi_static OR HAVE_LIBCXXABI))
> ```
> 
> Note that I do think your new condition make more sense (since if the ABI 
> library is not a target, we should fall back on the `else()` branch). I just 
> want to understand why you're changing it.
> 
> > Like I mentioned in the previous comment, alternative would be to split 
> > this into two variables, e.g. `LIBCXX_CXX_SHARED_ABI_LIBRARY` and 
> > `LIBCXX_CXX_STATIC_ABI_LIBRARY`, would you prefer that approach?
> 
> I don't think that is necessary at this point.
> 
You're right, that's a leftover from previous iterations.


Repository:
  rL LLVM

https://reviews.llvm.org/D49502



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D41755: [CMake] Collect target names in the global LLVM_RUNTIMES property

2018-07-19 Thread Petr Hosek via Phabricator via cfe-commits
phosek abandoned this revision.
phosek added a comment.
Herald added a subscriber: ldionne.

Replaced by https://reviews.llvm.org/D49587.


Repository:
  rCXX libc++

https://reviews.llvm.org/D41755



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D41753: [CMake] Collect target names in the global LLVM_RUNTIMES property

2018-07-19 Thread Petr Hosek via Phabricator via cfe-commits
phosek abandoned this revision.
phosek added a comment.

Replaced by https://reviews.llvm.org/D49587.


Repository:
  rUNW libunwind

https://reviews.llvm.org/D41753



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D41754: [CMake] Collect target names in the global LLVM_RUNTIMES property

2018-07-19 Thread Petr Hosek via Phabricator via cfe-commits
phosek abandoned this revision.
phosek added a comment.
Herald added a subscriber: ldionne.

Replaced by https://reviews.llvm.org/D49587.


Repository:
  rCXXA libc++abi

https://reviews.llvm.org/D41754



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D49584: [CMake] Install C++ ABI headers into the right location

2018-07-20 Thread Petr Hosek via Phabricator via cfe-commits
phosek added a subscriber: beanz.
phosek added a comment.

We currently support two different layouts:

1. The standard layout (for a lack of a better name) which is used when libc++ 
is built standalone as well as being built as part of LLVM without any other 
options which is `$DESTDIR/include/c++/v1` for headers and `$DESTDIR/lib` for 
libraries. Clang driver knows where to find those headers and libraries when 
libc++ is selected, the problem is that this only works for the default target 
since there's going to be just a single copy of `$DESTDIR/lib/libc++.so`, etc.
2. The mutliarch runtime layout where headers are installed to 
`$DESTDIR/lib/clang/$CLANG_VERSION/include/c++/v1` and libraries to 
`$DESTDIR/lib/clang/$CLANG_VERSION/$TARGET/lib` where `$TARGET` is the target 
passed to Clang, e.g. `--target=x86-linux-gnu`. This layout supports 
distributing libc++ (and other runtimes) for multiple different targets with 
your toolchain. The reason we cannot use the same prefix for both headers and 
libraries is the multiarch runtime layout since headers and libraries are 
installed to different paths.

Fuchsia is currently the first toolchain that AFAIK uses the new layout for its 
toolchain, but @beanz is working on using this layout also for Darwin. Android 
team also expressed interest in using the new layout since they need to support 
multiple targets in their toolchain.


Repository:
  rCXX libc++

https://reviews.llvm.org/D49584



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D49573: [CMake] Option to control whether shared/static library is installed

2018-07-20 Thread Petr Hosek via Phabricator via cfe-commits
phosek added a comment.

In https://reviews.llvm.org/D49573#1169615, @ldionne wrote:

> I don't like the fact that we're adding options like crazy, thus making the 
> build more complicated. If you don't want to have some libraries that were 
> built, why not just remove them afterwards?


The motivation behind this is that you could produce a complete toolchain with 
just CMake, combined with the fact that the cache files are all part of the 
LLVM tree, anyone can build the toolchain themselves which is useful when 
reproducing issues. We would like to add Fuchsia bots to upstream in the near 
future where reproducibility is going to be even more important and I'd like to 
avoid for people to have to run additional post-processing scripts.

Regarding this change, this in combination with https://reviews.llvm.org/D49502 
is all we need to exactly what gets built and installed, I don't plan on adding 
anymore options. Alternative that I also considered would be avoid exposing 
these options and instead do this implicitly based on the variables that are 
being set, e.g. in libc++abi build check if 
`LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY` is set and if so  don't even 
install libc++abi.a. The problem is that while this may work for us, I'm pretty 
sure there are going to be other clients that have other requirements where 
this is not the right choice and we could see combinatorial explosion of 
different configurations, so providing these options is probably a better 
choice.


Repository:
  rL LLVM

https://reviews.llvm.org/D49573



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D49584: [CMake] Install C++ ABI headers into the right location

2018-07-20 Thread Petr Hosek via Phabricator via cfe-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL337630: [CMake] Install C++ ABI headers into the right 
location (authored by phosek, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D49584?vs=156417&id=156627#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D49584

Files:
  libcxx/trunk/cmake/Modules/HandleLibCXXABI.cmake


Index: libcxx/trunk/cmake/Modules/HandleLibCXXABI.cmake
===
--- libcxx/trunk/cmake/Modules/HandleLibCXXABI.cmake
+++ libcxx/trunk/cmake/Modules/HandleLibCXXABI.cmake
@@ -32,14 +32,6 @@
   set(LIBCXX_CXX_ABI_LIBRARY ${abilib})
   set(LIBCXX_ABILIB_FILES ${abifiles})
 
-  # The place in the build tree where we store out-of-source headers.
-  file(MAKE_DIRECTORY "${LIBCXX_BUILD_HEADERS_ROOT}")
-  file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/include/c++/v1")
-  foreach(_d ${abidirs})
-file(MAKE_DIRECTORY "${LIBCXX_BINARY_INCLUDE_DIR}/${_d}")
-file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/include/c++/v1/${_d}")
-  endforeach()
-
   foreach(fpath ${LIBCXX_ABILIB_FILES})
 set(found FALSE)
 foreach(incpath ${LIBCXX_CXX_ABI_INCLUDE_PATHS})
@@ -56,16 +48,16 @@
 COMMENT "Copying C++ ABI header ${fpath}...")
 list(APPEND abilib_headers "${dst}")
 
-set(dst "${CMAKE_BINARY_DIR}/include/c++/v1/${dstdir}/${fpath}")
+set(dst "${LIBCXX_HEADER_DIR}/include/c++/v1/${dstdir}/${fpath}")
 add_custom_command(OUTPUT ${dst}
 DEPENDS ${src}
 COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
 COMMENT "Copying C++ ABI header ${fpath}...")
 list(APPEND abilib_headers "${dst}")
 
 if (LIBCXX_INSTALL_HEADERS)
   install(FILES "${LIBCXX_BINARY_INCLUDE_DIR}/${fpath}"
-DESTINATION ${LIBCXX_INSTALL_PATH}include/c++/v1/${dstdir}
+DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1/${dstdir}
 COMPONENT cxx-headers
 PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
 )


Index: libcxx/trunk/cmake/Modules/HandleLibCXXABI.cmake
===
--- libcxx/trunk/cmake/Modules/HandleLibCXXABI.cmake
+++ libcxx/trunk/cmake/Modules/HandleLibCXXABI.cmake
@@ -32,14 +32,6 @@
   set(LIBCXX_CXX_ABI_LIBRARY ${abilib})
   set(LIBCXX_ABILIB_FILES ${abifiles})
 
-  # The place in the build tree where we store out-of-source headers.
-  file(MAKE_DIRECTORY "${LIBCXX_BUILD_HEADERS_ROOT}")
-  file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/include/c++/v1")
-  foreach(_d ${abidirs})
-file(MAKE_DIRECTORY "${LIBCXX_BINARY_INCLUDE_DIR}/${_d}")
-file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/include/c++/v1/${_d}")
-  endforeach()
-
   foreach(fpath ${LIBCXX_ABILIB_FILES})
 set(found FALSE)
 foreach(incpath ${LIBCXX_CXX_ABI_INCLUDE_PATHS})
@@ -56,16 +48,16 @@
 COMMENT "Copying C++ ABI header ${fpath}...")
 list(APPEND abilib_headers "${dst}")
 
-set(dst "${CMAKE_BINARY_DIR}/include/c++/v1/${dstdir}/${fpath}")
+set(dst "${LIBCXX_HEADER_DIR}/include/c++/v1/${dstdir}/${fpath}")
 add_custom_command(OUTPUT ${dst}
 DEPENDS ${src}
 COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
 COMMENT "Copying C++ ABI header ${fpath}...")
 list(APPEND abilib_headers "${dst}")
 
 if (LIBCXX_INSTALL_HEADERS)
   install(FILES "${LIBCXX_BINARY_INCLUDE_DIR}/${fpath}"
-DESTINATION ${LIBCXX_INSTALL_PATH}include/c++/v1/${dstdir}
+DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1/${dstdir}
 COMPONENT cxx-headers
 PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
 )
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D49628: [CMake] Link static libunwind and libc++abi into libc++ in Fuchsia toolchain

2018-07-20 Thread Petr Hosek via Phabricator via cfe-commits
phosek created this revision.
phosek added reviewers: mcgrathr, juliehockett, jakehehrlich.
Herald added subscribers: cfe-commits, chrib, mgorny.
Herald added a reviewer: EricWF.

When building libc++ for Fuchsia, we want to distribute shared libc++,
libc++abi and libunwind as separate libraries, but for static versions
we would like to link all of them into libc++ so -lc++ flag has the same
effect whether shared or static library is being used.


Repository:
  rC Clang

https://reviews.llvm.org/D49628

Files:
  clang/cmake/caches/Fuchsia-stage2.cmake


Index: clang/cmake/caches/Fuchsia-stage2.cmake
===
--- clang/cmake/caches/Fuchsia-stage2.cmake
+++ clang/cmake/caches/Fuchsia-stage2.cmake
@@ -102,7 +102,11 @@
 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_UNWINDER ON CACHE 
BOOL "")
+
set(RUNTIMES_${target}-fuchsia_LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_SHARED_LIBRARY
 OFF CACHE BOOL "")
 set(RUNTIMES_${target}-fuchsia_LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
+set(RUNTIMES_${target}-fuchsia_LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE 
BOOL "")
+
set(RUNTIMES_${target}-fuchsia_LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY OFF 
CACHE BOOL "")
   endforeach()
 
   set(LLVM_RUNTIME_SANITIZERS "Address" CACHE STRING "")


Index: clang/cmake/caches/Fuchsia-stage2.cmake
===
--- clang/cmake/caches/Fuchsia-stage2.cmake
+++ clang/cmake/caches/Fuchsia-stage2.cmake
@@ -102,7 +102,11 @@
 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_UNWINDER ON CACHE BOOL "")
+set(RUNTIMES_${target}-fuchsia_LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_SHARED_LIBRARY OFF CACHE BOOL "")
 set(RUNTIMES_${target}-fuchsia_LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
+set(RUNTIMES_${target}-fuchsia_LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE BOOL "")
+set(RUNTIMES_${target}-fuchsia_LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY OFF CACHE BOOL "")
   endforeach()
 
   set(LLVM_RUNTIME_SANITIZERS "Address" CACHE STRING "")
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D49502: [CMake] Support statically linking dependencies only to shared or static library

2018-07-22 Thread Petr Hosek via Phabricator via cfe-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL337668: [CMake] Support statically linking dependencies only 
to shared or static library (authored by phosek, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D49502?vs=156416&id=156722#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D49502

Files:
  libcxx/trunk/CMakeLists.txt
  libcxx/trunk/cmake/Modules/HandleLibCXXABI.cmake
  libcxx/trunk/lib/CMakeLists.txt
  libcxxabi/trunk/CMakeLists.txt
  libcxxabi/trunk/src/CMakeLists.txt

Index: libcxxabi/trunk/CMakeLists.txt
===
--- libcxxabi/trunk/CMakeLists.txt
+++ libcxxabi/trunk/CMakeLists.txt
@@ -84,6 +84,13 @@
 option(LIBCXXABI_ENABLE_SHARED "Build libc++abi as a shared library." ON)
 option(LIBCXXABI_ENABLE_STATIC "Build libc++abi as a static library." ON)
 
+cmake_dependent_option(LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_STATIC_LIBRARY
+  "Statically link the LLVM unwinder to static library" ON
+  "LIBCXXABI_ENABLE_STATIC_UNWINDER;LIBCXXABI_ENABLE_STATIC" OFF)
+cmake_dependent_option(LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_SHARED_LIBRARY
+  "Statically link the LLVM unwinder to shared library" ON
+  "LIBCXXABI_ENABLE_STATIC_UNWINDER;LIBCXXABI_ENABLE_SHARED" OFF)
+
 option(LIBCXXABI_BAREMETAL "Build libc++abi for baremetal targets." OFF)
 # The default terminate handler attempts to demangle uncaught exceptions, which
 # causes extra I/O and demangling code to be pulled in.
Index: libcxxabi/trunk/src/CMakeLists.txt
===
--- libcxxabi/trunk/src/CMakeLists.txt
+++ libcxxabi/trunk/src/CMakeLists.txt
@@ -61,19 +61,27 @@
   # Prefer using the in-tree version of libunwind, either shared or static. If
   # none are found fall back to using -lunwind.
   # FIXME: Is it correct to prefer the static version of libunwind?
-  if (NOT LIBCXXABI_ENABLE_STATIC_UNWINDER AND (TARGET unwind_shared OR HAVE_LIBUNWIND))
-list(APPEND LIBCXXABI_LIBRARIES unwind_shared)
-  elseif (LIBCXXABI_ENABLE_STATIC_UNWINDER AND (TARGET unwind_static OR HAVE_LIBUNWIND))
-list(APPEND LIBCXXABI_LIBRARIES unwind_static)
+  if (NOT LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_SHARED_LIBRARY AND (TARGET unwind_shared OR HAVE_LIBUNWIND))
+list(APPEND LIBCXXABI_SHARED_LIBRARIES unwind_shared)
+  elseif (LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_SHARED_LIBRARY AND (TARGET unwind_static OR HAVE_LIBUNWIND))
+list(APPEND LIBCXXABI_SHARED_LIBRARIES unwind_static)
   else()
-list(APPEND LIBCXXABI_LIBRARIES unwind)
+list(APPEND LIBCXXABI_SHARED_LIBRARIES unwind)
+  endif()
+  if (NOT LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_STATIC_LIBRARY AND (TARGET unwind_shared OR HAVE_LIBUNWIND))
+list(APPEND LIBCXXABI_STATIC_LIBRARIES unwind_shared)
+  elseif (LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_STATIC_LIBRARY AND (TARGET unwind_static OR HAVE_LIBUNWIND))
+  # We handle this by directly merging libunwind objects into libc++abi.
+  else()
+list(APPEND LIBCXXABI_STATIC_LIBRARIES unwind)
   endif()
 else()
   add_library_flags_if(LIBCXXABI_HAS_GCC_S_LIB gcc_s)
 endif()
 if (MINGW)
   # MINGW_LIBRARIES is defined in config-ix.cmake
-  list(APPEND LIBCXXABI_LIBRARIES ${MINGW_LIBRARIES})
+  list(APPEND LIBCXXABI_SHARED_LIBRARIES ${MINGW_LIBRARIES})
+  list(APPEND LIBCXXABI_STATIC_LIBRARIES ${MINGW_LIBRARIES})
 endif()
 
 # Setup flags.
@@ -130,7 +138,7 @@
   if(COMMAND llvm_setup_rpath)
 llvm_setup_rpath(cxxabi_shared)
   endif()
-  target_link_libraries(cxxabi_shared ${LIBCXXABI_LIBRARIES})
+  target_link_libraries(cxxabi_shared ${LIBCXXABI_SHARED_LIBRARIES})
   set_target_properties(cxxabi_shared
 PROPERTIES
   CXX_EXTENSIONS
@@ -155,13 +163,13 @@
 # Build the static library.
 if (LIBCXXABI_ENABLE_STATIC)
   set(cxxabi_static_sources $)
-  if (LIBCXXABI_USE_LLVM_UNWINDER AND LIBCXXABI_ENABLE_STATIC_UNWINDER)
+  if (LIBCXXABI_USE_LLVM_UNWINDER AND LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_STATIC_LIBRARY)
 if (TARGET unwind_static OR HAVE_LIBUNWIND)
   list(APPEND cxxabi_static_sources $)
 endif()
   endif()
   add_library(cxxabi_static STATIC ${cxxabi_static_sources})
-  target_link_libraries(cxxabi_static ${LIBCXXABI_LIBRARIES})
+  target_link_libraries(cxxabi_static ${LIBCXXABI_STATIC_LIBRARIES})
   set_target_properties(cxxabi_static
 PROPERTIES
   CXX_EXTENSIONS
Index: libcxx/trunk/cmake/Modules/HandleLibCXXABI.cmake
===
--- libcxx/trunk/cmake/Modules/HandleLibCXXABI.cmake
+++ libcxx/trunk/cmake/Modules/HandleLibCXXABI.cmake
@@ -96,10 +96,10 @@
 elseif ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libcxxabi")
   if (LIBCXX_CXX_ABI_INTREE)
 # Link against just-built "cxxabi" target.
-if (LIBCXX_ENABLE_STATIC_A

[PATCH] D49629: [CMake] Fix the setting of LIBCXX_HEADER_DIR

2018-07-23 Thread Petr Hosek via Phabricator via cfe-commits
phosek accepted this revision.
phosek added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rCXX libc++

https://reviews.llvm.org/D49629



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D49573: [CMake] Option to control whether shared/static library is installed

2018-07-23 Thread Petr Hosek via Phabricator via cfe-commits
phosek added a comment.

You're right that we don't need these flags for libc++, we only need them for 
libc++abi and libunwind for the cases when one of these is linked into libc++ 
or libc++abi respectively. I added them for consistency, but I'm fine dropping 
them from libc++, would that be more acceptable?


Repository:
  rL LLVM

https://reviews.llvm.org/D49573



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D49711: [CMake] Fix the setting of LIBCXX_HEADER_DIR in standalone build

2018-07-23 Thread Petr Hosek via Phabricator via cfe-commits
phosek created this revision.
phosek added reviewers: EricWF, ldionne, aheejin, arphaman.
Herald added subscribers: cfe-commits, christof, mgorny.

This is an alternative approach to r337727 which broke the build
because libc++ headers were copied into the location outside of
directories used by Clang. This change sets LIBCXX_HEADER_DIR to
different values depending on whether libc++ is being built as
part of LLVM w/ per-target multiarch runtime, LLVM or standalone.


Repository:
  rCXX libc++

https://reviews.llvm.org/D49711

Files:
  libcxx/CMakeLists.txt
  libcxx/cmake/Modules/HandleLibCXXABI.cmake
  libcxx/include/CMakeLists.txt


Index: libcxx/include/CMakeLists.txt
===
--- libcxx/include/CMakeLists.txt
+++ libcxx/include/CMakeLists.txt
@@ -204,7 +204,7 @@
 )
 endif()
 
-if(NOT LIBCXX_USING_INSTALLED_LLVM AND LLVM_BINARY_DIR)
+if(NOT LIBCXX_USING_INSTALLED_LLVM AND LIBCXX_HEADER_DIR)
   set(output_dir ${LIBCXX_HEADER_DIR}/include/c++/v1)
 
   set(out_files)
Index: libcxx/cmake/Modules/HandleLibCXXABI.cmake
===
--- libcxx/cmake/Modules/HandleLibCXXABI.cmake
+++ libcxx/cmake/Modules/HandleLibCXXABI.cmake
@@ -48,12 +48,14 @@
 COMMENT "Copying C++ ABI header ${fpath}...")
 list(APPEND abilib_headers "${dst}")
 
-set(dst "${LIBCXX_HEADER_DIR}/include/c++/v1/${dstdir}/${fpath}")
-add_custom_command(OUTPUT ${dst}
-DEPENDS ${src}
-COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
-COMMENT "Copying C++ ABI header ${fpath}...")
-list(APPEND abilib_headers "${dst}")
+if(NOT LIBCXX_USING_INSTALLED_LLVM AND LIBCXX_HEADER_DIR)
+  set(dst "${LIBCXX_HEADER_DIR}/include/c++/v1/${dstdir}/${fpath}")
+  add_custom_command(OUTPUT ${dst}
+  DEPENDS ${src}
+  COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
+  COMMENT "Copying C++ ABI header ${fpath}...")
+  list(APPEND abilib_headers "${dst}")
+endif()
 
 if (LIBCXX_INSTALL_HEADERS)
   install(FILES "${LIBCXX_BINARY_INCLUDE_DIR}/${fpath}"
Index: libcxx/CMakeLists.txt
===
--- libcxx/CMakeLists.txt
+++ libcxx/CMakeLists.txt
@@ -378,7 +378,6 @@
 set(LIBCXX_COMPILER${CMAKE_CXX_COMPILER})
 set(LIBCXX_SOURCE_DIR  ${CMAKE_CURRENT_SOURCE_DIR})
 set(LIBCXX_BINARY_DIR  ${CMAKE_CURRENT_BINARY_DIR})
-set(LIBCXX_HEADER_DIR  ${LLVM_BINARY_DIR})
 set(LIBCXX_BINARY_INCLUDE_DIR "${LIBCXX_BINARY_DIR}/include/c++build")
 
 string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION
@@ -391,8 +390,10 @@
   set(LIBCXX_HEADER_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION})
 elseif(LLVM_LIBRARY_OUTPUT_INTDIR)
   set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
+  set(LIBCXX_HEADER_DIR  ${LLVM_BINARY_DIR})
 else()
   set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX})
+  set(LIBCXX_HEADER_DIR  ${CMAKE_BINARY_DIR})
 endif()
 
 file(MAKE_DIRECTORY "${LIBCXX_BINARY_INCLUDE_DIR}")


Index: libcxx/include/CMakeLists.txt
===
--- libcxx/include/CMakeLists.txt
+++ libcxx/include/CMakeLists.txt
@@ -204,7 +204,7 @@
 )
 endif()
 
-if(NOT LIBCXX_USING_INSTALLED_LLVM AND LLVM_BINARY_DIR)
+if(NOT LIBCXX_USING_INSTALLED_LLVM AND LIBCXX_HEADER_DIR)
   set(output_dir ${LIBCXX_HEADER_DIR}/include/c++/v1)
 
   set(out_files)
Index: libcxx/cmake/Modules/HandleLibCXXABI.cmake
===
--- libcxx/cmake/Modules/HandleLibCXXABI.cmake
+++ libcxx/cmake/Modules/HandleLibCXXABI.cmake
@@ -48,12 +48,14 @@
 COMMENT "Copying C++ ABI header ${fpath}...")
 list(APPEND abilib_headers "${dst}")
 
-set(dst "${LIBCXX_HEADER_DIR}/include/c++/v1/${dstdir}/${fpath}")
-add_custom_command(OUTPUT ${dst}
-DEPENDS ${src}
-COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
-COMMENT "Copying C++ ABI header ${fpath}...")
-list(APPEND abilib_headers "${dst}")
+if(NOT LIBCXX_USING_INSTALLED_LLVM AND LIBCXX_HEADER_DIR)
+  set(dst "${LIBCXX_HEADER_DIR}/include/c++/v1/${dstdir}/${fpath}")
+  add_custom_command(OUTPUT ${dst}
+  DEPENDS ${src}
+  COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
+  COMMENT "Copying C++ ABI header ${fpath}...")
+  list(APPEND abilib_headers "${dst}")
+endif()
 
 if (LIBCXX_INSTALL_HEADERS)
   install(FILES "${LIBCXX_BINARY_INCLUDE_DIR}/${fpath}"
Index: libcxx/CMakeLists.txt
===
--- libcxx/CMakeLists.txt
+++ libcxx/CMakeLists.txt
@@ -378,7 +378,6 @@
 set(LIBCXX_COMPILER${CMAKE_CXX_COMPILER})
 set(LIBCXX_SOURCE_DIR  ${CM

[PATCH] D49711: [CMake] Fix the setting of LIBCXX_HEADER_DIR in standalone build

2018-07-23 Thread Petr Hosek via Phabricator via cfe-commits
phosek added a comment.

I've tested this on macOS and everything seems to be working,


Repository:
  rCXX libc++

https://reviews.llvm.org/D49711



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D49711: [CMake] Fix the setting of LIBCXX_HEADER_DIR in standalone build

2018-07-24 Thread Petr Hosek via Phabricator via cfe-commits
phosek updated this revision to Diff 157043.

Repository:
  rCXX libc++

https://reviews.llvm.org/D49711

Files:
  libcxx/CMakeLists.txt
  libcxx/cmake/Modules/HandleLibCXXABI.cmake


Index: libcxx/cmake/Modules/HandleLibCXXABI.cmake
===
--- libcxx/cmake/Modules/HandleLibCXXABI.cmake
+++ libcxx/cmake/Modules/HandleLibCXXABI.cmake
@@ -48,12 +48,14 @@
 COMMENT "Copying C++ ABI header ${fpath}...")
 list(APPEND abilib_headers "${dst}")
 
-set(dst "${LIBCXX_HEADER_DIR}/include/c++/v1/${dstdir}/${fpath}")
-add_custom_command(OUTPUT ${dst}
-DEPENDS ${src}
-COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
-COMMENT "Copying C++ ABI header ${fpath}...")
-list(APPEND abilib_headers "${dst}")
+if(NOT LIBCXX_USING_INSTALLED_LLVM AND LIBCXX_HEADER_DIR)
+  set(dst "${LIBCXX_HEADER_DIR}/include/c++/v1/${dstdir}/${fpath}")
+  add_custom_command(OUTPUT ${dst}
+  DEPENDS ${src}
+  COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
+  COMMENT "Copying C++ ABI header ${fpath}...")
+  list(APPEND abilib_headers "${dst}")
+endif()
 
 if (LIBCXX_INSTALL_HEADERS)
   install(FILES "${LIBCXX_BINARY_INCLUDE_DIR}/${fpath}"
Index: libcxx/CMakeLists.txt
===
--- libcxx/CMakeLists.txt
+++ libcxx/CMakeLists.txt
@@ -386,7 +386,6 @@
 set(LIBCXX_COMPILER${CMAKE_CXX_COMPILER})
 set(LIBCXX_SOURCE_DIR  ${CMAKE_CURRENT_SOURCE_DIR})
 set(LIBCXX_BINARY_DIR  ${CMAKE_CURRENT_BINARY_DIR})
-set(LIBCXX_HEADER_DIR  ${LLVM_BINARY_DIR})
 set(LIBCXX_BINARY_INCLUDE_DIR "${LIBCXX_BINARY_DIR}/include/c++build")
 
 string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION
@@ -399,8 +398,10 @@
   set(LIBCXX_HEADER_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION})
 elseif(LLVM_LIBRARY_OUTPUT_INTDIR)
   set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
+  set(LIBCXX_HEADER_DIR  ${LLVM_BINARY_DIR})
 else()
   set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX})
+  set(LIBCXX_HEADER_DIR  ${CMAKE_BINARY_DIR})
 endif()
 
 file(MAKE_DIRECTORY "${LIBCXX_BINARY_INCLUDE_DIR}")


Index: libcxx/cmake/Modules/HandleLibCXXABI.cmake
===
--- libcxx/cmake/Modules/HandleLibCXXABI.cmake
+++ libcxx/cmake/Modules/HandleLibCXXABI.cmake
@@ -48,12 +48,14 @@
 COMMENT "Copying C++ ABI header ${fpath}...")
 list(APPEND abilib_headers "${dst}")
 
-set(dst "${LIBCXX_HEADER_DIR}/include/c++/v1/${dstdir}/${fpath}")
-add_custom_command(OUTPUT ${dst}
-DEPENDS ${src}
-COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
-COMMENT "Copying C++ ABI header ${fpath}...")
-list(APPEND abilib_headers "${dst}")
+if(NOT LIBCXX_USING_INSTALLED_LLVM AND LIBCXX_HEADER_DIR)
+  set(dst "${LIBCXX_HEADER_DIR}/include/c++/v1/${dstdir}/${fpath}")
+  add_custom_command(OUTPUT ${dst}
+  DEPENDS ${src}
+  COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
+  COMMENT "Copying C++ ABI header ${fpath}...")
+  list(APPEND abilib_headers "${dst}")
+endif()
 
 if (LIBCXX_INSTALL_HEADERS)
   install(FILES "${LIBCXX_BINARY_INCLUDE_DIR}/${fpath}"
Index: libcxx/CMakeLists.txt
===
--- libcxx/CMakeLists.txt
+++ libcxx/CMakeLists.txt
@@ -386,7 +386,6 @@
 set(LIBCXX_COMPILER${CMAKE_CXX_COMPILER})
 set(LIBCXX_SOURCE_DIR  ${CMAKE_CURRENT_SOURCE_DIR})
 set(LIBCXX_BINARY_DIR  ${CMAKE_CURRENT_BINARY_DIR})
-set(LIBCXX_HEADER_DIR  ${LLVM_BINARY_DIR})
 set(LIBCXX_BINARY_INCLUDE_DIR "${LIBCXX_BINARY_DIR}/include/c++build")
 
 string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION
@@ -399,8 +398,10 @@
   set(LIBCXX_HEADER_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION})
 elseif(LLVM_LIBRARY_OUTPUT_INTDIR)
   set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
+  set(LIBCXX_HEADER_DIR  ${LLVM_BINARY_DIR})
 else()
   set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX})
+  set(LIBCXX_HEADER_DIR  ${CMAKE_BINARY_DIR})
 endif()
 
 file(MAKE_DIRECTORY "${LIBCXX_BINARY_INCLUDE_DIR}")
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D49711: [CMake] Fix the setting of LIBCXX_HEADER_DIR in standalone build

2018-07-24 Thread Petr Hosek via Phabricator via cfe-commits
phosek updated this revision to Diff 157050.

Repository:
  rCXX libc++

https://reviews.llvm.org/D49711

Files:
  libcxx/CMakeLists.txt
  libcxx/cmake/Modules/HandleLibCXXABI.cmake


Index: libcxx/cmake/Modules/HandleLibCXXABI.cmake
===
--- libcxx/cmake/Modules/HandleLibCXXABI.cmake
+++ libcxx/cmake/Modules/HandleLibCXXABI.cmake
@@ -48,12 +48,14 @@
 COMMENT "Copying C++ ABI header ${fpath}...")
 list(APPEND abilib_headers "${dst}")
 
-set(dst "${LIBCXX_HEADER_DIR}/include/c++/v1/${dstdir}/${fpath}")
-add_custom_command(OUTPUT ${dst}
-DEPENDS ${src}
-COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
-COMMENT "Copying C++ ABI header ${fpath}...")
-list(APPEND abilib_headers "${dst}")
+if (NOT LIBCXX_USING_INSTALLED_LLVM)
+  set(dst "${LIBCXX_HEADER_DIR}/include/c++/v1/${dstdir}/${fpath}")
+  add_custom_command(OUTPUT ${dst}
+  DEPENDS ${src}
+  COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
+  COMMENT "Copying C++ ABI header ${fpath}...")
+  list(APPEND abilib_headers "${dst}")
+endif()
 
 if (LIBCXX_INSTALL_HEADERS)
   install(FILES "${LIBCXX_BINARY_INCLUDE_DIR}/${fpath}"
Index: libcxx/CMakeLists.txt
===
--- libcxx/CMakeLists.txt
+++ libcxx/CMakeLists.txt
@@ -386,7 +386,6 @@
 set(LIBCXX_COMPILER${CMAKE_CXX_COMPILER})
 set(LIBCXX_SOURCE_DIR  ${CMAKE_CURRENT_SOURCE_DIR})
 set(LIBCXX_BINARY_DIR  ${CMAKE_CURRENT_BINARY_DIR})
-set(LIBCXX_HEADER_DIR  ${LLVM_BINARY_DIR})
 set(LIBCXX_BINARY_INCLUDE_DIR "${LIBCXX_BINARY_DIR}/include/c++build")
 
 string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION
@@ -399,8 +398,10 @@
   set(LIBCXX_HEADER_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION})
 elseif(LLVM_LIBRARY_OUTPUT_INTDIR)
   set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
+  set(LIBCXX_HEADER_DIR  ${LLVM_BINARY_DIR})
 else()
   set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX})
+  set(LIBCXX_HEADER_DIR  ${CMAKE_BINARY_DIR})
 endif()
 
 file(MAKE_DIRECTORY "${LIBCXX_BINARY_INCLUDE_DIR}")


Index: libcxx/cmake/Modules/HandleLibCXXABI.cmake
===
--- libcxx/cmake/Modules/HandleLibCXXABI.cmake
+++ libcxx/cmake/Modules/HandleLibCXXABI.cmake
@@ -48,12 +48,14 @@
 COMMENT "Copying C++ ABI header ${fpath}...")
 list(APPEND abilib_headers "${dst}")
 
-set(dst "${LIBCXX_HEADER_DIR}/include/c++/v1/${dstdir}/${fpath}")
-add_custom_command(OUTPUT ${dst}
-DEPENDS ${src}
-COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
-COMMENT "Copying C++ ABI header ${fpath}...")
-list(APPEND abilib_headers "${dst}")
+if (NOT LIBCXX_USING_INSTALLED_LLVM)
+  set(dst "${LIBCXX_HEADER_DIR}/include/c++/v1/${dstdir}/${fpath}")
+  add_custom_command(OUTPUT ${dst}
+  DEPENDS ${src}
+  COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
+  COMMENT "Copying C++ ABI header ${fpath}...")
+  list(APPEND abilib_headers "${dst}")
+endif()
 
 if (LIBCXX_INSTALL_HEADERS)
   install(FILES "${LIBCXX_BINARY_INCLUDE_DIR}/${fpath}"
Index: libcxx/CMakeLists.txt
===
--- libcxx/CMakeLists.txt
+++ libcxx/CMakeLists.txt
@@ -386,7 +386,6 @@
 set(LIBCXX_COMPILER${CMAKE_CXX_COMPILER})
 set(LIBCXX_SOURCE_DIR  ${CMAKE_CURRENT_SOURCE_DIR})
 set(LIBCXX_BINARY_DIR  ${CMAKE_CURRENT_BINARY_DIR})
-set(LIBCXX_HEADER_DIR  ${LLVM_BINARY_DIR})
 set(LIBCXX_BINARY_INCLUDE_DIR "${LIBCXX_BINARY_DIR}/include/c++build")
 
 string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION
@@ -399,8 +398,10 @@
   set(LIBCXX_HEADER_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION})
 elseif(LLVM_LIBRARY_OUTPUT_INTDIR)
   set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
+  set(LIBCXX_HEADER_DIR  ${LLVM_BINARY_DIR})
 else()
   set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX})
+  set(LIBCXX_HEADER_DIR  ${CMAKE_BINARY_DIR})
 endif()
 
 file(MAKE_DIRECTORY "${LIBCXX_BINARY_INCLUDE_DIR}")
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D49711: [CMake] Fix the setting of LIBCXX_HEADER_DIR in standalone build

2018-07-24 Thread Petr Hosek via Phabricator via cfe-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL337833: [CMake] Fix the setting of LIBCXX_HEADER_DIR in 
standalone build (authored by phosek, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D49711?vs=157050&id=157051#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D49711

Files:
  libcxx/trunk/CMakeLists.txt
  libcxx/trunk/cmake/Modules/HandleLibCXXABI.cmake


Index: libcxx/trunk/cmake/Modules/HandleLibCXXABI.cmake
===
--- libcxx/trunk/cmake/Modules/HandleLibCXXABI.cmake
+++ libcxx/trunk/cmake/Modules/HandleLibCXXABI.cmake
@@ -48,12 +48,14 @@
 COMMENT "Copying C++ ABI header ${fpath}...")
 list(APPEND abilib_headers "${dst}")
 
-set(dst "${LIBCXX_HEADER_DIR}/include/c++/v1/${dstdir}/${fpath}")
-add_custom_command(OUTPUT ${dst}
-DEPENDS ${src}
-COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
-COMMENT "Copying C++ ABI header ${fpath}...")
-list(APPEND abilib_headers "${dst}")
+if (NOT LIBCXX_USING_INSTALLED_LLVM)
+  set(dst "${LIBCXX_HEADER_DIR}/include/c++/v1/${dstdir}/${fpath}")
+  add_custom_command(OUTPUT ${dst}
+  DEPENDS ${src}
+  COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
+  COMMENT "Copying C++ ABI header ${fpath}...")
+  list(APPEND abilib_headers "${dst}")
+endif()
 
 if (LIBCXX_INSTALL_HEADERS)
   install(FILES "${LIBCXX_BINARY_INCLUDE_DIR}/${fpath}"
Index: libcxx/trunk/CMakeLists.txt
===
--- libcxx/trunk/CMakeLists.txt
+++ libcxx/trunk/CMakeLists.txt
@@ -386,7 +386,6 @@
 set(LIBCXX_COMPILER${CMAKE_CXX_COMPILER})
 set(LIBCXX_SOURCE_DIR  ${CMAKE_CURRENT_SOURCE_DIR})
 set(LIBCXX_BINARY_DIR  ${CMAKE_CURRENT_BINARY_DIR})
-set(LIBCXX_HEADER_DIR  ${LLVM_BINARY_DIR})
 set(LIBCXX_BINARY_INCLUDE_DIR "${LIBCXX_BINARY_DIR}/include/c++build")
 
 string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION
@@ -399,8 +398,10 @@
   set(LIBCXX_HEADER_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION})
 elseif(LLVM_LIBRARY_OUTPUT_INTDIR)
   set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
+  set(LIBCXX_HEADER_DIR  ${LLVM_BINARY_DIR})
 else()
   set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX})
+  set(LIBCXX_HEADER_DIR  ${CMAKE_BINARY_DIR})
 endif()
 
 file(MAKE_DIRECTORY "${LIBCXX_BINARY_INCLUDE_DIR}")


Index: libcxx/trunk/cmake/Modules/HandleLibCXXABI.cmake
===
--- libcxx/trunk/cmake/Modules/HandleLibCXXABI.cmake
+++ libcxx/trunk/cmake/Modules/HandleLibCXXABI.cmake
@@ -48,12 +48,14 @@
 COMMENT "Copying C++ ABI header ${fpath}...")
 list(APPEND abilib_headers "${dst}")
 
-set(dst "${LIBCXX_HEADER_DIR}/include/c++/v1/${dstdir}/${fpath}")
-add_custom_command(OUTPUT ${dst}
-DEPENDS ${src}
-COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
-COMMENT "Copying C++ ABI header ${fpath}...")
-list(APPEND abilib_headers "${dst}")
+if (NOT LIBCXX_USING_INSTALLED_LLVM)
+  set(dst "${LIBCXX_HEADER_DIR}/include/c++/v1/${dstdir}/${fpath}")
+  add_custom_command(OUTPUT ${dst}
+  DEPENDS ${src}
+  COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
+  COMMENT "Copying C++ ABI header ${fpath}...")
+  list(APPEND abilib_headers "${dst}")
+endif()
 
 if (LIBCXX_INSTALL_HEADERS)
   install(FILES "${LIBCXX_BINARY_INCLUDE_DIR}/${fpath}"
Index: libcxx/trunk/CMakeLists.txt
===
--- libcxx/trunk/CMakeLists.txt
+++ libcxx/trunk/CMakeLists.txt
@@ -386,7 +386,6 @@
 set(LIBCXX_COMPILER${CMAKE_CXX_COMPILER})
 set(LIBCXX_SOURCE_DIR  ${CMAKE_CURRENT_SOURCE_DIR})
 set(LIBCXX_BINARY_DIR  ${CMAKE_CURRENT_BINARY_DIR})
-set(LIBCXX_HEADER_DIR  ${LLVM_BINARY_DIR})
 set(LIBCXX_BINARY_INCLUDE_DIR "${LIBCXX_BINARY_DIR}/include/c++build")
 
 string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION
@@ -399,8 +398,10 @@
   set(LIBCXX_HEADER_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION})
 elseif(LLVM_LIBRARY_OUTPUT_INTDIR)
   set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
+  set(LIBCXX_HEADER_DIR  ${LLVM_BINARY_DIR})
 else()
   set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX})
+  set(LIBCXX_HEADER_DIR  ${CMAKE_BINARY_DIR})
 endif()
 
 file(MAKE_DIRECTORY "${LIBCXX_BINARY_INCLUDE_DIR}")
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D49752: [CMake] Don't install c++abi headers in standalone libc++ build

2018-07-24 Thread Petr Hosek via Phabricator via cfe-commits
phosek created this revision.
phosek added reviewers: mclow.lists, EricWF, ldionne.
Herald added subscribers: cfe-commits, christof, mgorny.

This is a refinement on r337833. Previously we were installing two
copies of c++abi headers in libc++ build directory, one in
include/c++build and another one in include/c++/v1. However, the
second copy is unnecessary when building libc++ standalone.


Repository:
  rCXX libc++

https://reviews.llvm.org/D49752

Files:
  libcxx/CMakeLists.txt
  libcxx/cmake/Modules/HandleLibCXXABI.cmake
  libcxx/include/CMakeLists.txt


Index: libcxx/include/CMakeLists.txt
===
--- libcxx/include/CMakeLists.txt
+++ libcxx/include/CMakeLists.txt
@@ -205,7 +205,7 @@
 )
 endif()
 
-if(NOT LIBCXX_USING_INSTALLED_LLVM AND LLVM_BINARY_DIR)
+if(NOT LIBCXX_USING_INSTALLED_LLVM AND LIBCXX_HEADER_DIR)
   set(output_dir ${LIBCXX_HEADER_DIR}/include/c++/v1)
 
   set(out_files)
Index: libcxx/cmake/Modules/HandleLibCXXABI.cmake
===
--- libcxx/cmake/Modules/HandleLibCXXABI.cmake
+++ libcxx/cmake/Modules/HandleLibCXXABI.cmake
@@ -48,7 +48,7 @@
 COMMENT "Copying C++ ABI header ${fpath}...")
 list(APPEND abilib_headers "${dst}")
 
-if (NOT LIBCXX_USING_INSTALLED_LLVM)
+if (NOT LIBCXX_USING_INSTALLED_LLVM AND LIBCXX_HEADER_DIR)
   set(dst "${LIBCXX_HEADER_DIR}/include/c++/v1/${dstdir}/${fpath}")
   add_custom_command(OUTPUT ${dst}
   DEPENDS ${src}
Index: libcxx/CMakeLists.txt
===
--- libcxx/CMakeLists.txt
+++ libcxx/CMakeLists.txt
@@ -401,7 +401,6 @@
   set(LIBCXX_HEADER_DIR  ${LLVM_BINARY_DIR})
 else()
   set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX})
-  set(LIBCXX_HEADER_DIR  ${CMAKE_BINARY_DIR})
 endif()
 
 file(MAKE_DIRECTORY "${LIBCXX_BINARY_INCLUDE_DIR}")


Index: libcxx/include/CMakeLists.txt
===
--- libcxx/include/CMakeLists.txt
+++ libcxx/include/CMakeLists.txt
@@ -205,7 +205,7 @@
 )
 endif()
 
-if(NOT LIBCXX_USING_INSTALLED_LLVM AND LLVM_BINARY_DIR)
+if(NOT LIBCXX_USING_INSTALLED_LLVM AND LIBCXX_HEADER_DIR)
   set(output_dir ${LIBCXX_HEADER_DIR}/include/c++/v1)
 
   set(out_files)
Index: libcxx/cmake/Modules/HandleLibCXXABI.cmake
===
--- libcxx/cmake/Modules/HandleLibCXXABI.cmake
+++ libcxx/cmake/Modules/HandleLibCXXABI.cmake
@@ -48,7 +48,7 @@
 COMMENT "Copying C++ ABI header ${fpath}...")
 list(APPEND abilib_headers "${dst}")
 
-if (NOT LIBCXX_USING_INSTALLED_LLVM)
+if (NOT LIBCXX_USING_INSTALLED_LLVM AND LIBCXX_HEADER_DIR)
   set(dst "${LIBCXX_HEADER_DIR}/include/c++/v1/${dstdir}/${fpath}")
   add_custom_command(OUTPUT ${dst}
   DEPENDS ${src}
Index: libcxx/CMakeLists.txt
===
--- libcxx/CMakeLists.txt
+++ libcxx/CMakeLists.txt
@@ -401,7 +401,6 @@
   set(LIBCXX_HEADER_DIR  ${LLVM_BINARY_DIR})
 else()
   set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX})
-  set(LIBCXX_HEADER_DIR  ${CMAKE_BINARY_DIR})
 endif()
 
 file(MAKE_DIRECTORY "${LIBCXX_BINARY_INCLUDE_DIR}")
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D49752: [CMake] Don't install c++abi headers in standalone libc++ build

2018-07-24 Thread Petr Hosek via Phabricator via cfe-commits
phosek added a comment.

This was pointed out by @mclow.lists on IRC in our discussion related to 
https://reviews.llvm.org/D49711, I believe this change should resolve that 
issue.


Repository:
  rCXX libc++

https://reviews.llvm.org/D49752



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D49765: [CMake] Use LIBCXXABI_LIBDIR_SUFFIX in libc++abi build

2018-07-24 Thread Petr Hosek via Phabricator via cfe-commits
phosek created this revision.
phosek added reviewers: mgorny, EricWF.
Herald added subscribers: cfe-commits, ldionne, christof.

This was changed unintentionally in r335809.


Repository:
  rCXXA libc++abi

https://reviews.llvm.org/D49765

Files:
  libcxxabi/CMakeLists.txt


Index: libcxxabi/CMakeLists.txt
===
--- libcxxabi/CMakeLists.txt
+++ libcxxabi/CMakeLists.txt
@@ -172,7 +172,7 @@
 elseif(LLVM_LIBRARY_OUTPUT_INTDIR)
   set(LIBCXXABI_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
 else()
-  set(LIBCXXABI_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX})
+  set(LIBCXXABI_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXXABI_LIBDIR_SUFFIX})
 endif()
 
 set(LIBCXXABI_INSTALL_PREFIX ${DEFAULT_INSTALL_PREFIX} CACHE STRING


Index: libcxxabi/CMakeLists.txt
===
--- libcxxabi/CMakeLists.txt
+++ libcxxabi/CMakeLists.txt
@@ -172,7 +172,7 @@
 elseif(LLVM_LIBRARY_OUTPUT_INTDIR)
   set(LIBCXXABI_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
 else()
-  set(LIBCXXABI_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX})
+  set(LIBCXXABI_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXXABI_LIBDIR_SUFFIX})
 endif()
 
 set(LIBCXXABI_INSTALL_PREFIX ${DEFAULT_INSTALL_PREFIX} CACHE STRING
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D49573: [CMake] Option to control whether shared/static library is installed

2018-07-24 Thread Petr Hosek via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rCXX337867: [CMake] Option to control whether shared/static 
library is installed (authored by phosek, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D49573?vs=156382&id=157170#toc

Repository:
  rCXX libc++

https://reviews.llvm.org/D49573

Files:
  CMakeLists.txt
  lib/CMakeLists.txt


Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -93,6 +93,12 @@
 "Define suffix of library directory name (32/64)")
 option(LIBCXX_INSTALL_HEADERS "Install the libc++ headers." ON)
 option(LIBCXX_INSTALL_LIBRARY "Install the libc++ library." ON)
+cmake_dependent_option(LIBCXX_INSTALL_STATIC_LIBRARY
+  "Install the static libc++ library." ON
+  "LIBCXX_ENABLE_STATIC;LIBCXX_INSTALL_LIBRARY" OFF)
+cmake_dependent_option(LIBCXX_INSTALL_SHARED_LIBRARY
+  "Install the shared libc++ library." ON
+  "LIBCXX_ENABLE_SHARED;LIBCXX_INSTALL_LIBRARY" OFF)
 option(LIBCXX_INSTALL_SUPPORT_HEADERS "Install libc++ support headers." ON)
 cmake_dependent_option(LIBCXX_INSTALL_EXPERIMENTAL_LIBRARY
 "Install libc++experimental.a" ON
Index: lib/CMakeLists.txt
===
--- lib/CMakeLists.txt
+++ lib/CMakeLists.txt
@@ -220,8 +220,6 @@
 COMPILE_FLAGS "${LIBCXX_COMPILE_FLAGS}"
 )
 
-set(LIBCXX_TARGETS)
-
 # Build the shared library.
 if (LIBCXX_ENABLE_SHARED)
   add_library(cxx_shared SHARED $)
@@ -236,7 +234,10 @@
   VERSION   "${LIBCXX_ABI_VERSION}.0"
   SOVERSION "${LIBCXX_ABI_VERSION}"
   )
-  list(APPEND LIBCXX_TARGETS "cxx_shared")
+  list(APPEND LIBCXX_BUILD_TARGETS "cxx_shared")
+  if (LIBCXX_INSTALL_SHARED_LIBRARY)
+list(APPEND LIBCXX_INSTALL_TARGETS "cxx_shared")
+  endif()
   if(WIN32 AND NOT MINGW AND NOT "${CMAKE_HOST_SYSTEM_NAME}" STREQUAL 
"Windows")
 # Since we most likely do not have a mt.exe replacement, disable the
 # manifest bundling.  This allows a normal cmake invocation to pass which
@@ -256,8 +257,10 @@
   LINK_FLAGS"${LIBCXX_LINK_FLAGS}"
   OUTPUT_NAME   "c++"
   )
-
-  list(APPEND LIBCXX_TARGETS "cxx_static")
+  list(APPEND LIBCXX_BUILD_TARGETS "cxx_static")
+  if (LIBCXX_INSTALL_STATIC_LIBRARY)
+list(APPEND LIBCXX_INSTALL_TARGETS "cxx_static")
+  endif()
   # Attempt to merge the libc++.a archive and the ABI library archive into one.
   if (LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY)
 set(MERGE_ARCHIVES_SEARCH_PATHS "")
@@ -286,7 +289,7 @@
 endif()
 
 # Add a meta-target for both libraries.
-add_custom_target(cxx DEPENDS cxx-headers ${LIBCXX_TARGETS})
+add_custom_target(cxx DEPENDS cxx-headers ${LIBCXX_BUILD_TARGETS})
 
 if (LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY)
   file(GLOB LIBCXX_EXPERIMENTAL_SOURCES ../src/experimental/*.cpp)
@@ -362,7 +365,7 @@
   if (LIBCXX_INSTALL_EXPERIMENTAL_LIBRARY)
 set(experimental_lib cxx_experimental)
   endif()
-  install(TARGETS ${LIBCXX_TARGETS} ${experimental_lib}
+  install(TARGETS ${LIBCXX_INSTALL_TARGETS} ${experimental_lib}
 LIBRARY DESTINATION ${LIBCXX_INSTALL_PREFIX}lib${LIBCXX_LIBDIR_SUFFIX} 
COMPONENT cxx
 ARCHIVE DESTINATION ${LIBCXX_INSTALL_PREFIX}lib${LIBCXX_LIBDIR_SUFFIX} 
COMPONENT cxx
 )


Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -93,6 +93,12 @@
 "Define suffix of library directory name (32/64)")
 option(LIBCXX_INSTALL_HEADERS "Install the libc++ headers." ON)
 option(LIBCXX_INSTALL_LIBRARY "Install the libc++ library." ON)
+cmake_dependent_option(LIBCXX_INSTALL_STATIC_LIBRARY
+  "Install the static libc++ library." ON
+  "LIBCXX_ENABLE_STATIC;LIBCXX_INSTALL_LIBRARY" OFF)
+cmake_dependent_option(LIBCXX_INSTALL_SHARED_LIBRARY
+  "Install the shared libc++ library." ON
+  "LIBCXX_ENABLE_SHARED;LIBCXX_INSTALL_LIBRARY" OFF)
 option(LIBCXX_INSTALL_SUPPORT_HEADERS "Install libc++ support headers." ON)
 cmake_dependent_option(LIBCXX_INSTALL_EXPERIMENTAL_LIBRARY
 "Install libc++experimental.a" ON
Index: lib/CMakeLists.txt
===
--- lib/CMakeLists.txt
+++ lib/CMakeLists.txt
@@ -220,8 +220,6 @@
 COMPILE_FLAGS "${LIBCXX_COMPILE_FLAGS}"
 )
 
-set(LIBCXX_TARGETS)
-
 # Build the shared library.
 if (LIBCXX_ENABLE_SHARED)
   add_library(cxx_shared SHARED $)
@@ -236,7 +234,10 @@
   VERSION   "${LIBCXX_ABI_VERSION}.0"
   SOVERSION "${LIBCXX_ABI_VERSION}"
   )
-  list(APPEND LIBCXX_TARGETS "cxx_shared")
+  list(APPEND LIBCXX_BUILD_TARGETS "cxx_shared")
+  if (LIBCXX_INSTALL_SHARED_LIBRARY)
+list(APPEND LIBCXX_INSTALL_TARGETS "cxx_shared")
+  endif()
   if(WIN32 AND NOT MINGW AND NOT "${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows")
 # Since we most likely do not have a mt.exe replacement, disable the
 # manifest bundling.  This allows a normal cmake invocation to pass which

[PATCH] D49628: [CMake] Link static libunwind and libc++abi into libc++ in Fuchsia toolchain

2018-07-24 Thread Petr Hosek via Phabricator via cfe-commits
phosek updated this revision to Diff 157182.

Repository:
  rC Clang

https://reviews.llvm.org/D49628

Files:
  clang/cmake/caches/Fuchsia-stage2.cmake


Index: clang/cmake/caches/Fuchsia-stage2.cmake
===
--- clang/cmake/caches/Fuchsia-stage2.cmake
+++ clang/cmake/caches/Fuchsia-stage2.cmake
@@ -100,9 +100,15 @@
 set(RUNTIMES_${target}-fuchsia_CMAKE_SYSROOT ${FUCHSIA_${target}_SYSROOT} 
CACHE PATH "")
 set(RUNTIMES_${target}-fuchsia_LLVM_ENABLE_ASSERTIONS ON CACHE BOOL "")
 set(RUNTIMES_${target}-fuchsia_LIBUNWIND_USE_COMPILER_RT ON CACHE BOOL "")
+set(RUNTIMES_${target}-fuchsia_LIBUNWIND_INSTALL_STATIC_LIBRARY OFF 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_UNWINDER ON CACHE 
BOOL "")
+set(RUNTIMES_${target}-fuchsia_LIBCXXABI_INSTALL_STATIC_LIBRARY OFF CACHE 
BOOL "")
+
set(RUNTIMES_${target}-fuchsia_LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_SHARED_LIBRARY
 OFF CACHE BOOL "")
 set(RUNTIMES_${target}-fuchsia_LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
+set(RUNTIMES_${target}-fuchsia_LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE 
BOOL "")
+
set(RUNTIMES_${target}-fuchsia_LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY OFF 
CACHE BOOL "")
   endforeach()
 
   set(LLVM_RUNTIME_SANITIZERS "Address" CACHE STRING "")


Index: clang/cmake/caches/Fuchsia-stage2.cmake
===
--- clang/cmake/caches/Fuchsia-stage2.cmake
+++ clang/cmake/caches/Fuchsia-stage2.cmake
@@ -100,9 +100,15 @@
 set(RUNTIMES_${target}-fuchsia_CMAKE_SYSROOT ${FUCHSIA_${target}_SYSROOT} CACHE PATH "")
 set(RUNTIMES_${target}-fuchsia_LLVM_ENABLE_ASSERTIONS ON CACHE BOOL "")
 set(RUNTIMES_${target}-fuchsia_LIBUNWIND_USE_COMPILER_RT ON CACHE BOOL "")
+set(RUNTIMES_${target}-fuchsia_LIBUNWIND_INSTALL_STATIC_LIBRARY OFF 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_UNWINDER ON CACHE BOOL "")
+set(RUNTIMES_${target}-fuchsia_LIBCXXABI_INSTALL_STATIC_LIBRARY OFF CACHE BOOL "")
+set(RUNTIMES_${target}-fuchsia_LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_SHARED_LIBRARY OFF CACHE BOOL "")
 set(RUNTIMES_${target}-fuchsia_LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
+set(RUNTIMES_${target}-fuchsia_LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE BOOL "")
+set(RUNTIMES_${target}-fuchsia_LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY OFF CACHE BOOL "")
   endforeach()
 
   set(LLVM_RUNTIME_SANITIZERS "Address" CACHE STRING "")
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D49628: [CMake] Link static libunwind and libc++abi into libc++ in Fuchsia toolchain

2018-07-24 Thread Petr Hosek via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL337877: [CMake] Link static libunwind and libc++abi into 
libc++ in Fuchsia toolchain (authored by phosek, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D49628?vs=157182&id=157183#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D49628

Files:
  cfe/trunk/cmake/caches/Fuchsia-stage2.cmake


Index: cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
===
--- cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
+++ cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
@@ -100,9 +100,15 @@
 set(RUNTIMES_${target}-fuchsia_CMAKE_SYSROOT ${FUCHSIA_${target}_SYSROOT} 
CACHE PATH "")
 set(RUNTIMES_${target}-fuchsia_LLVM_ENABLE_ASSERTIONS ON CACHE BOOL "")
 set(RUNTIMES_${target}-fuchsia_LIBUNWIND_USE_COMPILER_RT ON CACHE BOOL "")
+set(RUNTIMES_${target}-fuchsia_LIBUNWIND_INSTALL_STATIC_LIBRARY OFF 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_UNWINDER ON CACHE 
BOOL "")
+set(RUNTIMES_${target}-fuchsia_LIBCXXABI_INSTALL_STATIC_LIBRARY OFF CACHE 
BOOL "")
+
set(RUNTIMES_${target}-fuchsia_LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_SHARED_LIBRARY
 OFF CACHE BOOL "")
 set(RUNTIMES_${target}-fuchsia_LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
+set(RUNTIMES_${target}-fuchsia_LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE 
BOOL "")
+
set(RUNTIMES_${target}-fuchsia_LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY OFF 
CACHE BOOL "")
   endforeach()
 
   set(LLVM_RUNTIME_SANITIZERS "Address" CACHE STRING "")


Index: cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
===
--- cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
+++ cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
@@ -100,9 +100,15 @@
 set(RUNTIMES_${target}-fuchsia_CMAKE_SYSROOT ${FUCHSIA_${target}_SYSROOT} CACHE PATH "")
 set(RUNTIMES_${target}-fuchsia_LLVM_ENABLE_ASSERTIONS ON CACHE BOOL "")
 set(RUNTIMES_${target}-fuchsia_LIBUNWIND_USE_COMPILER_RT ON CACHE BOOL "")
+set(RUNTIMES_${target}-fuchsia_LIBUNWIND_INSTALL_STATIC_LIBRARY OFF 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_UNWINDER ON CACHE BOOL "")
+set(RUNTIMES_${target}-fuchsia_LIBCXXABI_INSTALL_STATIC_LIBRARY OFF CACHE BOOL "")
+set(RUNTIMES_${target}-fuchsia_LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_SHARED_LIBRARY OFF CACHE BOOL "")
 set(RUNTIMES_${target}-fuchsia_LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
+set(RUNTIMES_${target}-fuchsia_LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE BOOL "")
+set(RUNTIMES_${target}-fuchsia_LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY OFF CACHE BOOL "")
   endforeach()
 
   set(LLVM_RUNTIME_SANITIZERS "Address" CACHE STRING "")
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D49765: [CMake] Use LIBCXXABI_LIBDIR_SUFFIX in libc++abi build

2018-07-25 Thread Petr Hosek via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL337937: [CMake] Use LIBCXXABI_LIBDIR_SUFFIX in libc++abi 
build (authored by phosek, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D49765?vs=157154&id=157296#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D49765

Files:
  libcxxabi/trunk/CMakeLists.txt


Index: libcxxabi/trunk/CMakeLists.txt
===
--- libcxxabi/trunk/CMakeLists.txt
+++ libcxxabi/trunk/CMakeLists.txt
@@ -179,7 +179,7 @@
 elseif(LLVM_LIBRARY_OUTPUT_INTDIR)
   set(LIBCXXABI_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
 else()
-  set(LIBCXXABI_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX})
+  set(LIBCXXABI_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXXABI_LIBDIR_SUFFIX})
 endif()
 
 set(LIBCXXABI_INSTALL_PREFIX ${DEFAULT_INSTALL_PREFIX} CACHE STRING


Index: libcxxabi/trunk/CMakeLists.txt
===
--- libcxxabi/trunk/CMakeLists.txt
+++ libcxxabi/trunk/CMakeLists.txt
@@ -179,7 +179,7 @@
 elseif(LLVM_LIBRARY_OUTPUT_INTDIR)
   set(LIBCXXABI_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
 else()
-  set(LIBCXXABI_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX})
+  set(LIBCXXABI_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXXABI_LIBDIR_SUFFIX})
 endif()
 
 set(LIBCXXABI_INSTALL_PREFIX ${DEFAULT_INSTALL_PREFIX} CACHE STRING
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D42019: [Driver] Set default sysroot for Fuchsia if none is specified

2018-07-25 Thread Petr Hosek via Phabricator via cfe-commits
phosek added a comment.

In https://reviews.llvm.org/D42019#1162644, @mcgrathr wrote:

> Is this still live? Should it be different after all the multiarch stuff?


I'm about to revive this and was pondering if maybe we should generalize this 
to all targets now that the multiarch runtime bit has landed?


Repository:
  rC Clang

https://reviews.llvm.org/D42019



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D49752: [CMake] Don't install c++abi headers in standalone libc++ build

2018-07-25 Thread Petr Hosek via Phabricator via cfe-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL337979: [CMake] Don't install c++abi headers in 
standalone libc++ build (authored by phosek, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D49752?vs=157110&id=157383#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D49752

Files:
  libcxx/trunk/CMakeLists.txt
  libcxx/trunk/cmake/Modules/HandleLibCXXABI.cmake
  libcxx/trunk/include/CMakeLists.txt


Index: libcxx/trunk/include/CMakeLists.txt
===
--- libcxx/trunk/include/CMakeLists.txt
+++ libcxx/trunk/include/CMakeLists.txt
@@ -205,7 +205,7 @@
 )
 endif()
 
-if(NOT LIBCXX_USING_INSTALLED_LLVM AND LLVM_BINARY_DIR)
+if(NOT LIBCXX_USING_INSTALLED_LLVM AND LIBCXX_HEADER_DIR)
   set(output_dir ${LIBCXX_HEADER_DIR}/include/c++/v1)
 
   set(out_files)
Index: libcxx/trunk/cmake/Modules/HandleLibCXXABI.cmake
===
--- libcxx/trunk/cmake/Modules/HandleLibCXXABI.cmake
+++ libcxx/trunk/cmake/Modules/HandleLibCXXABI.cmake
@@ -48,7 +48,7 @@
 COMMENT "Copying C++ ABI header ${fpath}...")
 list(APPEND abilib_headers "${dst}")
 
-if (NOT LIBCXX_USING_INSTALLED_LLVM)
+if (NOT LIBCXX_USING_INSTALLED_LLVM AND LIBCXX_HEADER_DIR)
   set(dst "${LIBCXX_HEADER_DIR}/include/c++/v1/${dstdir}/${fpath}")
   add_custom_command(OUTPUT ${dst}
   DEPENDS ${src}
Index: libcxx/trunk/CMakeLists.txt
===
--- libcxx/trunk/CMakeLists.txt
+++ libcxx/trunk/CMakeLists.txt
@@ -407,7 +407,6 @@
   set(LIBCXX_HEADER_DIR  ${LLVM_BINARY_DIR})
 else()
   set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX})
-  set(LIBCXX_HEADER_DIR  ${CMAKE_BINARY_DIR})
 endif()
 
 file(MAKE_DIRECTORY "${LIBCXX_BINARY_INCLUDE_DIR}")


Index: libcxx/trunk/include/CMakeLists.txt
===
--- libcxx/trunk/include/CMakeLists.txt
+++ libcxx/trunk/include/CMakeLists.txt
@@ -205,7 +205,7 @@
 )
 endif()
 
-if(NOT LIBCXX_USING_INSTALLED_LLVM AND LLVM_BINARY_DIR)
+if(NOT LIBCXX_USING_INSTALLED_LLVM AND LIBCXX_HEADER_DIR)
   set(output_dir ${LIBCXX_HEADER_DIR}/include/c++/v1)
 
   set(out_files)
Index: libcxx/trunk/cmake/Modules/HandleLibCXXABI.cmake
===
--- libcxx/trunk/cmake/Modules/HandleLibCXXABI.cmake
+++ libcxx/trunk/cmake/Modules/HandleLibCXXABI.cmake
@@ -48,7 +48,7 @@
 COMMENT "Copying C++ ABI header ${fpath}...")
 list(APPEND abilib_headers "${dst}")
 
-if (NOT LIBCXX_USING_INSTALLED_LLVM)
+if (NOT LIBCXX_USING_INSTALLED_LLVM AND LIBCXX_HEADER_DIR)
   set(dst "${LIBCXX_HEADER_DIR}/include/c++/v1/${dstdir}/${fpath}")
   add_custom_command(OUTPUT ${dst}
   DEPENDS ${src}
Index: libcxx/trunk/CMakeLists.txt
===
--- libcxx/trunk/CMakeLists.txt
+++ libcxx/trunk/CMakeLists.txt
@@ -407,7 +407,6 @@
   set(LIBCXX_HEADER_DIR  ${LLVM_BINARY_DIR})
 else()
   set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX})
-  set(LIBCXX_HEADER_DIR  ${CMAKE_BINARY_DIR})
 endif()
 
 file(MAKE_DIRECTORY "${LIBCXX_BINARY_INCLUDE_DIR}")
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D49825: [CMake] Don't use LIBCXXABI_ENABLE_STATIC option before its declared

2018-07-25 Thread Petr Hosek via Phabricator via cfe-commits
phosek accepted this revision.
phosek added a comment.
This revision is now accepted and ready to land.

LGTM, thanks!


Repository:
  rCXXA libc++abi

https://reviews.llvm.org/D49825



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D49834: [CMake] Don't generate linker script only when shared library isn't statically linked

2018-07-25 Thread Petr Hosek via Phabricator via cfe-commits
phosek created this revision.
phosek added reviewers: EricWF, ldionne, mclow.lists.
Herald added subscribers: cfe-commits, christof, mgorny.

Since r337668, we support statically linking dependencies only to shared
or static library. However, that change hasn't updated the check whether
to generate a linker script. We shouldn't generate linker script only in
the case when we aren't statically linked ABI into the shared library.


Repository:
  rCXX libc++

https://reviews.llvm.org/D49834

Files:
  libcxx/CMakeLists.txt


Index: libcxx/CMakeLists.txt
===
--- libcxx/CMakeLists.txt
+++ libcxx/CMakeLists.txt
@@ -175,7 +175,7 @@
 # is on. This option is also disabled when the ABI library is not specified
 # or is specified to be "none".
 set(ENABLE_LINKER_SCRIPT_DEFAULT_VALUE OFF)
-if (LLVM_HAVE_LINK_VERSION_SCRIPT AND NOT LIBCXX_ENABLE_STATIC_ABI_LIBRARY
+if (LLVM_HAVE_LINK_VERSION_SCRIPT AND NOT 
LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY
   AND NOT LIBCXX_CXX_ABI_LIBNAME STREQUAL "none"
   AND NOT LIBCXX_CXX_ABI_LIBNAME STREQUAL "default"
   AND PYTHONINTERP_FOUND


Index: libcxx/CMakeLists.txt
===
--- libcxx/CMakeLists.txt
+++ libcxx/CMakeLists.txt
@@ -175,7 +175,7 @@
 # is on. This option is also disabled when the ABI library is not specified
 # or is specified to be "none".
 set(ENABLE_LINKER_SCRIPT_DEFAULT_VALUE OFF)
-if (LLVM_HAVE_LINK_VERSION_SCRIPT AND NOT LIBCXX_ENABLE_STATIC_ABI_LIBRARY
+if (LLVM_HAVE_LINK_VERSION_SCRIPT AND NOT LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY
   AND NOT LIBCXX_CXX_ABI_LIBNAME STREQUAL "none"
   AND NOT LIBCXX_CXX_ABI_LIBNAME STREQUAL "default"
   AND PYTHONINTERP_FOUND
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D49834: [CMake] Don't generate linker script only when shared library isn't statically linked

2018-07-25 Thread Petr Hosek via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL338006: [CMake] Don't generate linker script only when 
shared library isn't statically… (authored by phosek, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D49834?vs=157421&id=157425#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D49834

Files:
  libcxx/trunk/CMakeLists.txt


Index: libcxx/trunk/CMakeLists.txt
===
--- libcxx/trunk/CMakeLists.txt
+++ libcxx/trunk/CMakeLists.txt
@@ -179,7 +179,7 @@
 # is on. This option is also disabled when the ABI library is not specified
 # or is specified to be "none".
 set(ENABLE_LINKER_SCRIPT_DEFAULT_VALUE OFF)
-if (LLVM_HAVE_LINK_VERSION_SCRIPT AND NOT LIBCXX_ENABLE_STATIC_ABI_LIBRARY
+if (LLVM_HAVE_LINK_VERSION_SCRIPT AND NOT 
LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY
   AND NOT LIBCXX_CXX_ABI_LIBNAME STREQUAL "none"
   AND NOT LIBCXX_CXX_ABI_LIBNAME STREQUAL "default"
   AND PYTHONINTERP_FOUND
@@ -374,7 +374,7 @@
 endif()
 endif()
 
-if (LIBCXX_ENABLE_STATIC_ABI_LIBRARY AND LIBCXX_ENABLE_ABI_LINKER_SCRIPT)
+if (LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY AND 
LIBCXX_ENABLE_ABI_LINKER_SCRIPT)
 message(FATAL_ERROR "Conflicting options given.
 LIBCXX_ENABLE_STATIC_ABI_LIBRARY cannot be specified with
 LIBCXX_ENABLE_ABI_LINKER_SCRIPT")


Index: libcxx/trunk/CMakeLists.txt
===
--- libcxx/trunk/CMakeLists.txt
+++ libcxx/trunk/CMakeLists.txt
@@ -179,7 +179,7 @@
 # is on. This option is also disabled when the ABI library is not specified
 # or is specified to be "none".
 set(ENABLE_LINKER_SCRIPT_DEFAULT_VALUE OFF)
-if (LLVM_HAVE_LINK_VERSION_SCRIPT AND NOT LIBCXX_ENABLE_STATIC_ABI_LIBRARY
+if (LLVM_HAVE_LINK_VERSION_SCRIPT AND NOT LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY
   AND NOT LIBCXX_CXX_ABI_LIBNAME STREQUAL "none"
   AND NOT LIBCXX_CXX_ABI_LIBNAME STREQUAL "default"
   AND PYTHONINTERP_FOUND
@@ -374,7 +374,7 @@
 endif()
 endif()
 
-if (LIBCXX_ENABLE_STATIC_ABI_LIBRARY AND LIBCXX_ENABLE_ABI_LINKER_SCRIPT)
+if (LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY AND LIBCXX_ENABLE_ABI_LINKER_SCRIPT)
 message(FATAL_ERROR "Conflicting options given.
 LIBCXX_ENABLE_STATIC_ABI_LIBRARY cannot be specified with
 LIBCXX_ENABLE_ABI_LINKER_SCRIPT")
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D49899: Make test/Driver/fuchsia.c(pp) work with lld or gold

2018-07-26 Thread Petr Hosek via Phabricator via cfe-commits
phosek requested changes to this revision.
phosek added a comment.
This revision now requires changes to proceed.

We don't actively support gold in Fuchsia driver and currently have no plans on 
doing so. We should instead modify the driver to always use lld even if gold is 
set as the default Clang linker.


Repository:
  rC Clang

https://reviews.llvm.org/D49899



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45639: [Driver] Support default libc++ library location on Darwin

2018-07-30 Thread Petr Hosek via Phabricator via cfe-commits
phosek added a comment.

I think we just ran into one such issue. We're using our own Clang that's 
usually following tip-of-tree and we recently switched to C++17, but that 
started failing on our macOS 10.12 bots with:

  Undefined symbols for architecture x86_64:
"operator delete(void*, std::align_val_t)", referenced from:
_main in main.cpp.o
std::__1::__vector_base >, 
std::__1::allocator > > >::~__vector_base() in main.cpp.o

std::__1::__vector_base >, 
std::__1::allocator > > >::~__vector_base() 
in main.cpp.o
std::__1::__vector_base >, 
std::__1::allocator > > >::~__vector_base() in 
main.cpp.o
std::__1::__vector_base >, 
std::__1::allocator > > >::~__vector_base() in 
main.cpp.o

std::__1::__vector_base >, 
std::__1::allocator > > >::~__vector_base() 
in main.cpp.o
std::__1::__vector_base >, 
std::__1::allocator > > >::~__vector_base() in 
main.cpp.o
...
"operator new(unsigned long, std::align_val_t)", referenced from:
std::__1::enable_if<__is_forward_iterator::value, void>::type 
std::__1::basic_string, 
std::__1::allocator >::__init(char*, char*) in main.cpp.o

std::__1::unique_ptr 
> >, void*>, 
std::__1::__tree_node_destructor > >, void*> > > > 
std::__1::__tree > >, 
std::__1::__map_value_compare<(anonymous namespace)::Behavior, 
std::__1::__value_type<(anonymous namespace)::Behavior, 
std::__1::basic_fstream > >, 
std::__1::less<(anonymous namespace)::Behavior>, true>, 
std::__1::allocator > > > 
>::__construct_node<(anonymous namespace)::Behavior, 
std::__1::basic_fstream > >((anonymous 
namespace)::Behavior&&, std::__1::basic_fstream >&&) in main.cpp.o
std::__1::__split_buffer&>::__split_buffer(unsigned long, 
unsigned long, std::__1::allocator&) in main.cpp.o
std::__1::vector >::__vallocate(unsigned long) in 
main.cpp.o

std::__1::unique_ptr >, 
std::__1::unique_ptr > >, void*>, 
std::__1::__tree_node_destructor >, 
std::__1::unique_ptr > >, void*> > > > 
std::__1::__tree >, 
std::__1::unique_ptr > >, 
std::__1::__map_value_compare >, 
std::__1::__value_type >, 
std::__1::unique_ptr > >, 
std::__1::less > >, true>, 
std::__1::allocator >, 
std::__1::unique_ptr > > > 
>::__construct_node >, 
std::__1::unique_ptr > > 
>(std::__1::pair >, 
std::__1::unique_ptr > >&&) in main.cpp.o
std::__1::enable_if<__is_forward_iterator::value, 
void>::type std::__1::basic_string, 
std::__1::allocator >::__init(char const*, char const*) in 
libfidl.a(c_generator.cpp.o)
std::__1::__split_buffer&>::__split_buffer(unsigned long, unsigned long, 
std::__1::allocator&) in libfidl.a(c_generator.cpp.o)
...
  ld: symbol(s) not found for architecture x86_64

AFAICT this is because `/usr/lib/libc++.dylib` doesn't yet support C++17, but 
the headers that are part of Clang toolchain do. When we force Clang to use 
libc++ that's part of the toolchain by manually setting the necessary `-L`/`-l` 
flag resolves the issue. I don't know if this is an expected behavior, but I'd 
really appreciate some response on this.


Repository:
  rC Clang

https://reviews.llvm.org/D45639



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D48862: [OpenEmbedded] Fix lib paths for OpenEmbedded targets

2018-07-31 Thread Petr Hosek via Phabricator via cfe-commits
phosek added a comment.

This has been breaking our bots since it has landed (both Linux and macOS 
ones), here's a log: 
https://logs.chromium.org/v/?s=fuchsia%2Fbuildbucket%2Fcr-buildbucket.appspot.com%2F8939527016533487696%2F%2B%2Fsteps%2Fclang%2F0%2Fsteps%2Fcheck-clang%2F0%2Fstdout

In our Clang toolchain 
,
 we set libc++ to be the default C++ library and compiler-rt to be the default 
runtime library. In your case you need to explicitly set `-stdlib=libstdc++` 
and `-rtlib=libgcc` if you're relying on those being used in your tests.


Repository:
  rL LLVM

https://reviews.llvm.org/D48862



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D49899: Force test/Driver/fuchsia.c(pp) to use lld

2018-07-31 Thread Petr Hosek via Phabricator via cfe-commits
phosek accepted this revision.
phosek added a comment.
This revision is now accepted and ready to land.

LGTM


https://reviews.llvm.org/D49899



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D50123: [OpenEmbedded] Explicitly specify -stdlib and -rtlib in tests

2018-07-31 Thread Petr Hosek via Phabricator via cfe-commits
phosek created this revision.
phosek added reviewers: rsmith, mgrang, Hahnfeld.
Herald added a subscriber: cfe-commits.

Tests added r338294 implicitly assume that the libstdc++ is the standard
C++ library and libgcc is the runtime library, but that's not the case
when the user configures Clang to use libc++ or compiler-rt when these
tests will break. Explicitly request libstdc++ and libgcc when invoking
clang in these tests to avoid that.


Repository:
  rC Clang

https://reviews.llvm.org/D50123

Files:
  clang/test/Driver/linux-header-search.cpp
  clang/test/Driver/linux-ld.c


Index: clang/test/Driver/linux-ld.c
===
--- clang/test/Driver/linux-ld.c
+++ clang/test/Driver/linux-ld.c
@@ -1816,7 +1816,7 @@
 
 // Check whether the OpenEmbedded ARM libs are added correctly.
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: --target=arm-oe-linux-gnueabi \
+// RUN: --target=arm-oe-linux-gnueabi -rtlib=libgcc \
 // RUN: --sysroot=%S/Inputs/openembedded_arm_linux_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-OE-ARM %s
 
@@ -1835,7 +1835,7 @@
 
 // Check whether the OpenEmbedded AArch64 libs are added correctly.
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: --target=aarch64-oe-linux \
+// RUN: --target=aarch64-oe-linux -rtlib=libgcc \
 // RUN: --sysroot=%S/Inputs/openembedded_aarch64_linux_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-OE-AARCH64 %s
 
Index: clang/test/Driver/linux-header-search.cpp
===
--- clang/test/Driver/linux-header-search.cpp
+++ clang/test/Driver/linux-header-search.cpp
@@ -496,7 +496,7 @@
 
 // Check header search on OpenEmbedded ARM.
 // RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
-// RUN: -target arm-oe-linux-gnueabi \
+// RUN: -target arm-oe-linux-gnueabi -stdlib=libstdc++ \
 // RUN: --sysroot=%S/Inputs/openembedded_arm_linux_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-OE-ARM %s
 
@@ -507,7 +507,7 @@
 
 // Check header search on OpenEmbedded AArch64.
 // RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
-// RUN: -target aarch64-oe-linux \
+// RUN: -target aarch64-oe-linux -stdlib=libstdc++ \
 // RUN: --sysroot=%S/Inputs/openembedded_aarch64_linux_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-OE-AARCH64 %s
 


Index: clang/test/Driver/linux-ld.c
===
--- clang/test/Driver/linux-ld.c
+++ clang/test/Driver/linux-ld.c
@@ -1816,7 +1816,7 @@
 
 // Check whether the OpenEmbedded ARM libs are added correctly.
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: --target=arm-oe-linux-gnueabi \
+// RUN: --target=arm-oe-linux-gnueabi -rtlib=libgcc \
 // RUN: --sysroot=%S/Inputs/openembedded_arm_linux_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-OE-ARM %s
 
@@ -1835,7 +1835,7 @@
 
 // Check whether the OpenEmbedded AArch64 libs are added correctly.
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: --target=aarch64-oe-linux \
+// RUN: --target=aarch64-oe-linux -rtlib=libgcc \
 // RUN: --sysroot=%S/Inputs/openembedded_aarch64_linux_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-OE-AARCH64 %s
 
Index: clang/test/Driver/linux-header-search.cpp
===
--- clang/test/Driver/linux-header-search.cpp
+++ clang/test/Driver/linux-header-search.cpp
@@ -496,7 +496,7 @@
 
 // Check header search on OpenEmbedded ARM.
 // RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
-// RUN: -target arm-oe-linux-gnueabi \
+// RUN: -target arm-oe-linux-gnueabi -stdlib=libstdc++ \
 // RUN: --sysroot=%S/Inputs/openembedded_arm_linux_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-OE-ARM %s
 
@@ -507,7 +507,7 @@
 
 // Check header search on OpenEmbedded AArch64.
 // RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
-// RUN: -target aarch64-oe-linux \
+// RUN: -target aarch64-oe-linux -stdlib=libstdc++ \
 // RUN: --sysroot=%S/Inputs/openembedded_aarch64_linux_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-OE-AARCH64 %s
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D50123: [OpenEmbedded] Explicitly specify -stdlib and -rtlib in tests

2018-07-31 Thread Petr Hosek via Phabricator via cfe-commits
phosek added a comment.

This broke all our bots so I plan on submitting this if I don't hear back soon.


Repository:
  rC Clang

https://reviews.llvm.org/D50123



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D50123: [OpenEmbedded] Explicitly specify -stdlib and -rtlib in tests

2018-07-31 Thread Petr Hosek via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL338482: [OpenEmbedded] Explicitly specify -rtlib in tests 
(authored by phosek, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D50123?vs=158444&id=158457#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D50123

Files:
  cfe/trunk/test/Driver/linux-ld.c


Index: cfe/trunk/test/Driver/linux-ld.c
===
--- cfe/trunk/test/Driver/linux-ld.c
+++ cfe/trunk/test/Driver/linux-ld.c
@@ -1816,7 +1816,7 @@
 
 // Check whether the OpenEmbedded ARM libs are added correctly.
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: --target=arm-oe-linux-gnueabi \
+// RUN: --target=arm-oe-linux-gnueabi -rtlib=libgcc \
 // RUN: --sysroot=%S/Inputs/openembedded_arm_linux_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-OE-ARM %s
 
@@ -1835,7 +1835,7 @@
 
 // Check whether the OpenEmbedded AArch64 libs are added correctly.
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: --target=aarch64-oe-linux \
+// RUN: --target=aarch64-oe-linux -rtlib=libgcc \
 // RUN: --sysroot=%S/Inputs/openembedded_aarch64_linux_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-OE-AARCH64 %s
 


Index: cfe/trunk/test/Driver/linux-ld.c
===
--- cfe/trunk/test/Driver/linux-ld.c
+++ cfe/trunk/test/Driver/linux-ld.c
@@ -1816,7 +1816,7 @@
 
 // Check whether the OpenEmbedded ARM libs are added correctly.
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: --target=arm-oe-linux-gnueabi \
+// RUN: --target=arm-oe-linux-gnueabi -rtlib=libgcc \
 // RUN: --sysroot=%S/Inputs/openembedded_arm_linux_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-OE-ARM %s
 
@@ -1835,7 +1835,7 @@
 
 // Check whether the OpenEmbedded AArch64 libs are added correctly.
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: --target=aarch64-oe-linux \
+// RUN: --target=aarch64-oe-linux -rtlib=libgcc \
 // RUN: --sysroot=%S/Inputs/openembedded_aarch64_linux_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-OE-AARCH64 %s
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D50135: [libunwind] [CMake] Allow building standalone without any llvm-config available

2018-08-02 Thread Petr Hosek via Phabricator via cfe-commits
phosek added inline comments.



Comment at: CMakeLists.txt:363
 
-add_subdirectory(test)
+if (EXISTS ${LLVM_CMAKE_PATH})
+  add_subdirectory(test)

libcxx seems to be using a different condition: `IS_DIRECTORY 
"${CMAKE_CURRENT_SOURCE_DIR}/test"`, should this be unified?


Repository:
  rUNW libunwind

https://reviews.llvm.org/D50135



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D49355: Thread safety analysis: Allow lock upgrading and downgrading

2018-08-03 Thread Petr Hosek via Phabricator via cfe-commits
phosek added a comment.

This change broke the acquire+release case. Concretely, in Flutter we have this 
code: 
https://github.com/flutter/engine/blob/master/lib/ui/isolate_name_server/isolate_name_server.h#L26.
 This worked fine previously, but after this change we're getting an error in 
https://github.com/flutter/engine/blob/master/lib/ui/isolate_name_server/isolate_name_server_natives.cc#L19
 and many other places like this one:

  
../../third_party/flutter/lib/ui/isolate_name_server/isolate_name_server_natives.cc:19:33:
 error: releasing mutex 'name_server->mutex_' that was not held 
[-Werror,-Wthread-safety-analysis]
Dart_Port port = name_server->LookupIsolatePortByName(name);
  ^
  
../../third_party/flutter/lib/ui/isolate_name_server/isolate_name_server_natives.cc:24:1:
 error: mutex 'name_server->mutex_' is still held at the end of function 
[-Werror,-Wthread-safety-analysis]
  }
  ^
  
../../third_party/flutter/lib/ui/isolate_name_server/isolate_name_server_natives.cc:19:33:
 note: mutex acquired here
Dart_Port port = name_server->LookupIsolatePortByName(name);

Would it be possible revert this change? The old logic was "all acquires; then 
all releases" and the new logic is "all releases; then all acquires" but I 
think this needs fancier logic with actual bookkeeping to detect the upgrade 
case without breaking the acquire+release case.


Repository:
  rC Clang

https://reviews.llvm.org/D49355



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D49355: Thread safety analysis: Allow lock upgrading and downgrading

2018-08-04 Thread Petr Hosek via Phabricator via cfe-commits
phosek added a comment.

In https://reviews.llvm.org/D49355#1188520, @aaronpuchert wrote:

> Could you explain what annotations like `LOCK_UNLOCK` are useful for? What do 
> they check? The annotation should certainly not be necessary.
>
> Shouldn't you just use `REQUIRES(!...)` or `EXCLUDES(...)`? If a function 
> locks and unlocks a mutex, I don't see a reason to have annotations on it, 
> other than for preventing double locks. But for that we have negative 
> capabilities.


The purpose here indeed is to avoid double locks. I tried using `EXCLUDES(...)` 
but that doesn't work because `RegisterIsolatePortWithName` 

 calls `LookupIsolatePortByNameUnprotected` 

 which has `EXCLUSIVE_LOCKS_REQUIRED(...)` annotation. I also tried using the 
negative annotation but that reports far too many warnings in the existing code 
which makes it unusable.

I'm fine changing the code, but unless there's a simple workaround I'd still 
argue for a revert, because the change even if correct has broken an existing 
usage pattern that worked fine for a long time before and is used in large 
codebases.


Repository:
  rC Clang

https://reviews.llvm.org/D49355



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D43371: [clang-include-fixer] Use add_clang_tool instead add_clang_executable

2018-02-15 Thread Petr Hosek via Phabricator via cfe-commits
phosek created this revision.
phosek added reviewers: klimek, sammccall, bkramer, hokein.
Herald added subscribers: cfe-commits, mgorny.

This makes it possible to include clang-include-fixer as distribution
component when building Clang based toolchain using CMake.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D43371

Files:
  clang-tools-extra/include-fixer/tool/CMakeLists.txt


Index: clang-tools-extra/include-fixer/tool/CMakeLists.txt
===
--- clang-tools-extra/include-fixer/tool/CMakeLists.txt
+++ clang-tools-extra/include-fixer/tool/CMakeLists.txt
@@ -1,6 +1,6 @@
 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
 
-add_clang_executable(clang-include-fixer
+add_clang_tool(clang-include-fixer
   ClangIncludeFixer.cpp
   )
 


Index: clang-tools-extra/include-fixer/tool/CMakeLists.txt
===
--- clang-tools-extra/include-fixer/tool/CMakeLists.txt
+++ clang-tools-extra/include-fixer/tool/CMakeLists.txt
@@ -1,6 +1,6 @@
 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
 
-add_clang_executable(clang-include-fixer
+add_clang_tool(clang-include-fixer
   ClangIncludeFixer.cpp
   )
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D43404: [Fuchsia] Include libClang and clang-include-fixer in the toolchain

2018-02-16 Thread Petr Hosek via Phabricator via cfe-commits
phosek created this revision.
phosek added reviewers: mcgrathr, jakehehrlich.
Herald added subscribers: cfe-commits, mgorny.

libClang is used by other Clang based tools such as cquery while
clang-include-fixer is generally a useful tool.


Repository:
  rC Clang

https://reviews.llvm.org/D43404

Files:
  clang/cmake/caches/Fuchsia-stage2.cmake


Index: clang/cmake/caches/Fuchsia-stage2.cmake
===
--- clang/cmake/caches/Fuchsia-stage2.cmake
+++ clang/cmake/caches/Fuchsia-stage2.cmake
@@ -79,10 +79,12 @@
 
 set(LLVM_DISTRIBUTION_COMPONENTS
   clang
+  libclang
   lld
   LTO
   clang-format
   clang-headers
+  clang-include-fixer
   clang-refactor
   clang-tidy
   clangd


Index: clang/cmake/caches/Fuchsia-stage2.cmake
===
--- clang/cmake/caches/Fuchsia-stage2.cmake
+++ clang/cmake/caches/Fuchsia-stage2.cmake
@@ -79,10 +79,12 @@
 
 set(LLVM_DISTRIBUTION_COMPONENTS
   clang
+  libclang
   lld
   LTO
   clang-format
   clang-headers
+  clang-include-fixer
   clang-refactor
   clang-tidy
   clangd
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D43371: [clang-include-fixer] Use add_clang_tool instead of add_clang_executable

2018-02-16 Thread Petr Hosek via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rCTE325381: [clang-include-fixer] Use add_clang_tool instead 
add_clang_executable (authored by phosek, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D43371?vs=134559&id=134691#toc

Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D43371

Files:
  include-fixer/tool/CMakeLists.txt


Index: include-fixer/tool/CMakeLists.txt
===
--- include-fixer/tool/CMakeLists.txt
+++ include-fixer/tool/CMakeLists.txt
@@ -1,6 +1,6 @@
 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
 
-add_clang_executable(clang-include-fixer
+add_clang_tool(clang-include-fixer
   ClangIncludeFixer.cpp
   )
 


Index: include-fixer/tool/CMakeLists.txt
===
--- include-fixer/tool/CMakeLists.txt
+++ include-fixer/tool/CMakeLists.txt
@@ -1,6 +1,6 @@
 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
 
-add_clang_executable(clang-include-fixer
+add_clang_tool(clang-include-fixer
   ClangIncludeFixer.cpp
   )
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D43545: [Driver] Make -fno-common default for Fuchsia

2018-02-20 Thread Petr Hosek via Phabricator via cfe-commits
phosek created this revision.
phosek added reviewers: mcgrathr, jakehehrlich.
Herald added a subscriber: cfe-commits.

We never want to generate common symbols on Fuchsia.


Repository:
  rC Clang

https://reviews.llvm.org/D43545

Files:
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/Driver/fuchsia.c


Index: clang/test/Driver/fuchsia.c
===
--- clang/test/Driver/fuchsia.c
+++ clang/test/Driver/fuchsia.c
@@ -10,6 +10,7 @@
 // CHECK: "-fuse-init-array"
 // CHECK: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK: "-internal-externc-isystem" "[[SYSROOT]]{{/|}}include"
+// CHECK: "-fno-common"
 // CHECK: {{.*}}ld.lld{{.*}}" "-z" "rodynamic"
 // CHECK: "--sysroot=[[SYSROOT]]"
 // CHECK: "-pie"
Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -1306,6 +1306,8 @@
 static bool isNoCommonDefault(const llvm::Triple &Triple) {
   switch (Triple.getArch()) {
   default:
+if (Triple.isOSFuchsia())
+  return true;
 return false;
 
   case llvm::Triple::xcore:


Index: clang/test/Driver/fuchsia.c
===
--- clang/test/Driver/fuchsia.c
+++ clang/test/Driver/fuchsia.c
@@ -10,6 +10,7 @@
 // CHECK: "-fuse-init-array"
 // CHECK: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK: "-internal-externc-isystem" "[[SYSROOT]]{{/|}}include"
+// CHECK: "-fno-common"
 // CHECK: {{.*}}ld.lld{{.*}}" "-z" "rodynamic"
 // CHECK: "--sysroot=[[SYSROOT]]"
 // CHECK: "-pie"
Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -1306,6 +1306,8 @@
 static bool isNoCommonDefault(const llvm::Triple &Triple) {
   switch (Triple.getArch()) {
   default:
+if (Triple.isOSFuchsia())
+  return true;
 return false;
 
   case llvm::Triple::xcore:
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D43404: [Fuchsia] Include libClang and clang-include-fixer in the toolchain

2018-02-20 Thread Petr Hosek via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC325665: [Fuchsia] Include libClang and clang-include-fixer 
in the toolchain (authored by phosek, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D43404?vs=134687&id=135195#toc

Repository:
  rC Clang

https://reviews.llvm.org/D43404

Files:
  cmake/caches/Fuchsia-stage2.cmake


Index: cmake/caches/Fuchsia-stage2.cmake
===
--- cmake/caches/Fuchsia-stage2.cmake
+++ cmake/caches/Fuchsia-stage2.cmake
@@ -79,10 +79,12 @@
 
 set(LLVM_DISTRIBUTION_COMPONENTS
   clang
+  libclang
   lld
   LTO
   clang-format
   clang-headers
+  clang-include-fixer
   clang-refactor
   clang-tidy
   clangd


Index: cmake/caches/Fuchsia-stage2.cmake
===
--- cmake/caches/Fuchsia-stage2.cmake
+++ cmake/caches/Fuchsia-stage2.cmake
@@ -79,10 +79,12 @@
 
 set(LLVM_DISTRIBUTION_COMPONENTS
   clang
+  libclang
   lld
   LTO
   clang-format
   clang-headers
+  clang-include-fixer
   clang-refactor
   clang-tidy
   clangd
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D43606: [Driver] Add SafeStack to a map of incompatible sanitizers

2018-02-21 Thread Petr Hosek via Phabricator via cfe-commits
phosek created this revision.
phosek added reviewers: kcc, vitalybuka.
Herald added a subscriber: cfe-commits.

This allows reporting an error when user tries to use SafeStack with
incompatible sanitizers.


Repository:
  rC Clang

https://reviews.llvm.org/D43606

Files:
  clang/lib/Driver/SanitizerArgs.cpp
  clang/test/Driver/fsanitize.c


Index: clang/test/Driver/fsanitize.c
===
--- clang/test/Driver/fsanitize.c
+++ clang/test/Driver/fsanitize.c
@@ -526,22 +526,19 @@
 // NOSP-NOT: "-fsanitize=safe-stack"
 
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=safe-stack -### %s 2>&1 | 
FileCheck %s -check-prefix=NO-SP
-// RUN: %clang -target x86_64-linux-gnu -fsanitize=address,safe-stack -### %s 
2>&1 | FileCheck %s -check-prefix=NO-SP-ASAN
+// RUN: %clang -target x86_64-linux-gnu -fsanitize=address,safe-stack -### %s 
2>&1 | FileCheck %s -check-prefix=SP-ASAN
 // RUN: %clang -target x86_64-linux-gnu -fstack-protector 
-fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=safe-stack 
-fstack-protector-all -### %s 2>&1 | FileCheck %s -check-prefix=SP
 // RUN: %clang -target arm-linux-androideabi -fsanitize=safe-stack -### %s 
2>&1 | FileCheck %s -check-prefix=NO-SP
 // RUN: %clang -target aarch64-linux-android -fsanitize=safe-stack -### %s 
2>&1 | FileCheck %s -check-prefix=NO-SP
 // RUN: %clang -target i386-contiki-unknown -fsanitize=safe-stack -### %s 2>&1 
| FileCheck %s -check-prefix=NO-SP
 // NO-SP-NOT: stack-protector
 // NO-SP: "-fsanitize=safe-stack"
+// SP-ASAN: error: invalid argument '-fsanitize=address' not allowed with 
'-fsanitize=safe-stack'
 // SP: "-fsanitize=safe-stack"
 // SP: -stack-protector
 // NO-SP-NOT: stack-protector
 
-// NO-SP-ASAN-NOT: stack-protector
-// NO-SP-ASAN: "-fsanitize=address,safe-stack"
-// NO-SP-ASAN-NOT: stack-protector
-
 // RUN: %clang -target powerpc64-unknown-linux-gnu -fsanitize=memory %s -### 
2>&1 | FileCheck %s -check-prefix=CHECK-SANM
 // RUN: %clang -target powerpc64le-unknown-linux-gnu -fsanitize=memory %s -### 
2>&1 | FileCheck %s -check-prefix=CHECK-SANM
 // CHECK-SANM: "-fsanitize=memory"
Index: clang/lib/Driver/SanitizerArgs.cpp
===
--- clang/lib/Driver/SanitizerArgs.cpp
+++ clang/lib/Driver/SanitizerArgs.cpp
@@ -370,15 +370,19 @@
 
   // Warn about incompatible groups of sanitizers.
   std::pair IncompatibleGroups[] = {
-  std::make_pair(Address, Thread | Memory),
-  std::make_pair(Thread, Memory),
-  std::make_pair(Leak, Thread | Memory),
-  std::make_pair(KernelAddress, Address | Leak | Thread | Memory),
-  std::make_pair(HWAddress, Address | Thread | Memory | KernelAddress),
+  std::make_pair(Address, Thread | Memory | SafeStack),
+  std::make_pair(Thread, Memory | SafeStack),
+  std::make_pair(Leak, Thread | Memory | SafeStack),
+  std::make_pair(KernelAddress, Address | Leak | Thread | Memory |
+SafeStack),
+  std::make_pair(HWAddress, Address | Thread | Memory | KernelAddress |
+SafeStack),
   std::make_pair(Efficiency, Address | HWAddress | Leak | Thread | Memory |
- KernelAddress),
+ KernelAddress | SafeStack),
   std::make_pair(Scudo, Address | HWAddress | Leak | Thread | Memory |
-KernelAddress | Efficiency)};
+KernelAddress | Efficiency),
+  std::make_pair(SafeStack, Address | HWAddress | Leak | Thread | Memory |
+KernelAddress | Efficiency)};
   for (auto G : IncompatibleGroups) {
 SanitizerMask Group = G.first;
 if (Kinds & Group) {


Index: clang/test/Driver/fsanitize.c
===
--- clang/test/Driver/fsanitize.c
+++ clang/test/Driver/fsanitize.c
@@ -526,22 +526,19 @@
 // NOSP-NOT: "-fsanitize=safe-stack"
 
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP
-// RUN: %clang -target x86_64-linux-gnu -fsanitize=address,safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP-ASAN
+// RUN: %clang -target x86_64-linux-gnu -fsanitize=address,safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP-ASAN
 // RUN: %clang -target x86_64-linux-gnu -fstack-protector -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=safe-stack -fstack-protector-all -### %s 2>&1 | FileCheck %s -check-prefix=SP
 // RUN: %clang -target arm-linux-androideabi -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP
 // RUN: %clang -target aarch64-linux-android -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP
 // RUN: %clang -target i386-contiki-unknown -fsaniti

[PATCH] D43545: [Driver] Make -fno-common default for Fuchsia

2018-02-23 Thread Petr Hosek via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL325945: [Driver] Make -fno-common default for Fuchsia 
(authored by phosek, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D43545?vs=135193&id=135675#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D43545

Files:
  cfe/trunk/lib/Driver/ToolChains/Clang.cpp
  cfe/trunk/test/Driver/fuchsia.c


Index: cfe/trunk/test/Driver/fuchsia.c
===
--- cfe/trunk/test/Driver/fuchsia.c
+++ cfe/trunk/test/Driver/fuchsia.c
@@ -10,6 +10,7 @@
 // CHECK: "-fuse-init-array"
 // CHECK: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK: "-internal-externc-isystem" "[[SYSROOT]]{{/|}}include"
+// CHECK: "-fno-common"
 // CHECK: {{.*}}ld.lld{{.*}}" "-z" "rodynamic"
 // CHECK: "--sysroot=[[SYSROOT]]"
 // CHECK: "-pie"
Index: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
===
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp
@@ -1306,6 +1306,8 @@
 static bool isNoCommonDefault(const llvm::Triple &Triple) {
   switch (Triple.getArch()) {
   default:
+if (Triple.isOSFuchsia())
+  return true;
 return false;
 
   case llvm::Triple::xcore:


Index: cfe/trunk/test/Driver/fuchsia.c
===
--- cfe/trunk/test/Driver/fuchsia.c
+++ cfe/trunk/test/Driver/fuchsia.c
@@ -10,6 +10,7 @@
 // CHECK: "-fuse-init-array"
 // CHECK: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK: "-internal-externc-isystem" "[[SYSROOT]]{{/|}}include"
+// CHECK: "-fno-common"
 // CHECK: {{.*}}ld.lld{{.*}}" "-z" "rodynamic"
 // CHECK: "--sysroot=[[SYSROOT]]"
 // CHECK: "-pie"
Index: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
===
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp
@@ -1306,6 +1306,8 @@
 static bool isNoCommonDefault(const llvm::Triple &Triple) {
   switch (Triple.getArch()) {
   default:
+if (Triple.isOSFuchsia())
+  return true;
 return false;
 
   case llvm::Triple::xcore:
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D43606: [Driver] Add SafeStack to a map of incompatible sanitizers

2018-02-26 Thread Petr Hosek via Phabricator via cfe-commits
phosek updated this revision to Diff 136002.
phosek marked an inline comment as done.
Herald added subscribers: Sanitizers, llvm-commits.

Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D43606

Files:
  clang/lib/Driver/SanitizerArgs.cpp
  clang/test/Driver/fsanitize.c


Index: clang/test/Driver/fsanitize.c
===
--- clang/test/Driver/fsanitize.c
+++ clang/test/Driver/fsanitize.c
@@ -526,22 +526,19 @@
 // NOSP-NOT: "-fsanitize=safe-stack"
 
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=safe-stack -### %s 2>&1 | 
FileCheck %s -check-prefix=NO-SP
-// RUN: %clang -target x86_64-linux-gnu -fsanitize=address,safe-stack -### %s 
2>&1 | FileCheck %s -check-prefix=NO-SP-ASAN
+// RUN: %clang -target x86_64-linux-gnu -fsanitize=address,safe-stack -### %s 
2>&1 | FileCheck %s -check-prefix=SP-ASAN
 // RUN: %clang -target x86_64-linux-gnu -fstack-protector 
-fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=safe-stack 
-fstack-protector-all -### %s 2>&1 | FileCheck %s -check-prefix=SP
 // RUN: %clang -target arm-linux-androideabi -fsanitize=safe-stack -### %s 
2>&1 | FileCheck %s -check-prefix=NO-SP
 // RUN: %clang -target aarch64-linux-android -fsanitize=safe-stack -### %s 
2>&1 | FileCheck %s -check-prefix=NO-SP
 // RUN: %clang -target i386-contiki-unknown -fsanitize=safe-stack -### %s 2>&1 
| FileCheck %s -check-prefix=NO-SP
 // NO-SP-NOT: stack-protector
 // NO-SP: "-fsanitize=safe-stack"
+// SP-ASAN: error: invalid argument '-fsanitize=safe-stack' not allowed with 
'-fsanitize=address'
 // SP: "-fsanitize=safe-stack"
 // SP: -stack-protector
 // NO-SP-NOT: stack-protector
 
-// NO-SP-ASAN-NOT: stack-protector
-// NO-SP-ASAN: "-fsanitize=address,safe-stack"
-// NO-SP-ASAN-NOT: stack-protector
-
 // RUN: %clang -target powerpc64-unknown-linux-gnu -fsanitize=memory %s -### 
2>&1 | FileCheck %s -check-prefix=CHECK-SANM
 // RUN: %clang -target powerpc64le-unknown-linux-gnu -fsanitize=memory %s -### 
2>&1 | FileCheck %s -check-prefix=CHECK-SANM
 // CHECK-SANM: "-fsanitize=memory"
Index: clang/lib/Driver/SanitizerArgs.cpp
===
--- clang/lib/Driver/SanitizerArgs.cpp
+++ clang/lib/Driver/SanitizerArgs.cpp
@@ -378,7 +378,9 @@
   std::make_pair(Efficiency, Address | HWAddress | Leak | Thread | Memory |
  KernelAddress),
   std::make_pair(Scudo, Address | HWAddress | Leak | Thread | Memory |
-KernelAddress | Efficiency)};
+KernelAddress | Efficiency),
+  std::make_pair(SafeStack, Address | HWAddress | Leak | Thread | Memory |
+KernelAddress | Efficiency)};
   for (auto G : IncompatibleGroups) {
 SanitizerMask Group = G.first;
 if (Kinds & Group) {


Index: clang/test/Driver/fsanitize.c
===
--- clang/test/Driver/fsanitize.c
+++ clang/test/Driver/fsanitize.c
@@ -526,22 +526,19 @@
 // NOSP-NOT: "-fsanitize=safe-stack"
 
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP
-// RUN: %clang -target x86_64-linux-gnu -fsanitize=address,safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP-ASAN
+// RUN: %clang -target x86_64-linux-gnu -fsanitize=address,safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP-ASAN
 // RUN: %clang -target x86_64-linux-gnu -fstack-protector -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=safe-stack -fstack-protector-all -### %s 2>&1 | FileCheck %s -check-prefix=SP
 // RUN: %clang -target arm-linux-androideabi -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP
 // RUN: %clang -target aarch64-linux-android -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP
 // RUN: %clang -target i386-contiki-unknown -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP
 // NO-SP-NOT: stack-protector
 // NO-SP: "-fsanitize=safe-stack"
+// SP-ASAN: error: invalid argument '-fsanitize=safe-stack' not allowed with '-fsanitize=address'
 // SP: "-fsanitize=safe-stack"
 // SP: -stack-protector
 // NO-SP-NOT: stack-protector
 
-// NO-SP-ASAN-NOT: stack-protector
-// NO-SP-ASAN: "-fsanitize=address,safe-stack"
-// NO-SP-ASAN-NOT: stack-protector
-
 // RUN: %clang -target powerpc64-unknown-linux-gnu -fsanitize=memory %s -### 2>&1 | FileCheck %s -check-prefix=CHECK-SANM
 // RUN: %clang -target powerpc64le-unknown-linux-gnu -fsanitize=memory %s -### 2>&1 | FileCheck %s -check-prefix=CHECK-SANM
 // CHECK-SANM: "-fsanitize=memory"
Index: clang/lib/Driver/SanitizerArgs.cpp
===
--- clang/lib/Driver/SanitizerArgs.cpp
+++ clang/lib/Driver/SanitizerArgs.cpp
@@ -378,7

  1   2   3   4   5   6   7   8   9   10   >