[PATCH] D58331: [compiler-rt] Passthrough RUNTIMES_BUILD to the custom libc++ build

Petr Hosek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 17 15:07:15 PST 2019

phosek created this revision.
phosek added reviewers: Hahnfeld, vitalybuka, morehouse.
Herald added subscribers: llvm-commits, Sanitizers, jdoerfert, christof, mgorny, dberris.
Herald added a reviewer: EricWF.
Herald added projects: LLVM, Sanitizers.

We use it to decide whether to include -nostdlib++ in the required
compiler flags. This addresses the issue introduced in rCRT354231 <https://reviews.llvm.org/rCRT354231>
which broke the runtimes build.

  rCRT Compiler Runtime



Index: compiler-rt/cmake/Modules/CustomLibcxx/CMakeLists.txt
--- compiler-rt/cmake/Modules/CustomLibcxx/CMakeLists.txt
+++ compiler-rt/cmake/Modules/CustomLibcxx/CMakeLists.txt
@@ -1,5 +1,24 @@
 cmake_minimum_required(VERSION 3.4.3)
+# TODO: We shouldn't need a working C++ library, we're building C++ library
+# using this file after all. However, libc++abi and libc++ in standalone mode
+# include LLVM's HandleLLVMOptions which checks whether the compiler support
+# C++ using check_cxx_compiler_flag which tries to link C++ library and that
+# breaks C++ library hasn't been built yet (e.g. in the runtimes build where
+# C++ library is being built using the just built compiler).
+# We need to prevent CMake from trying to use the C++ library. One way to do
+# that is by using -nostdlib and then only including -lc plus runtimes which
+# requires handling runtimes compiler-rt builtins and libgcc which adds another
+# layer of complexity. We could use -nostdlib++ but that flag is only supported
+# by newer Clang versions.
+# For now, we pass the RUNTIMES_BUILD option through to detect whether we're
+# performing the runtimes build, and if so we use the -nostdlib++ flag.
 # Build static libcxxabi.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58331.187176.patch
Type: text/x-patch
Size: 1467 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190217/7e36e791/attachment.bin>

More information about the llvm-commits mailing list