[compiler-rt] r334220 - [CMake] Fix Libc++ Modules build.
Eric Fiselier via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 7 12:57:43 PDT 2018
Author: ericwf
Date: Thu Jun 7 12:57:43 2018
New Revision: 334220
URL: http://llvm.org/viewvc/llvm-project?rev=334220&view=rev
Log:
[CMake] Fix Libc++ Modules build.
When building the dylib, the C++ headers are fundamentally non-module.
They require special versions of the headers in order to provide C++03 and
legacy ABI definitions. This causes ODR issues when modules are enabled
during both the build and the usage of the libc++ headers.
This patch fixes the build error by disabling modules when building the
libc++ sources.
Modified:
compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake
Modified: compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake?rev=334220&r1=334219&r2=334220&view=diff
==============================================================================
--- compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake (original)
+++ compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake Thu Jun 7 12:57:43 2018
@@ -537,6 +537,14 @@ macro(add_custom_libcxx name prefix)
string(REPLACE "-Wl,-z,defs" "" LIBCXX_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}")
string(REPLACE "-Wl,-z,defs" "" LIBCXX_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
+ # The libc++ sources are fundamentally non-modular. They need special
+ # versions of the headers in order to provide C++03 and legacy ABI definitions.
+ # NOTE: The public headers can be used with modules in all other contexts
+ if (LLVM_ENABLE_MODULES)
+ set(LIBCXX_CXX_FLAGS "${LIBCXX_CXX_FLAGS} -Wno-unused-command-line-argument")
+ set(LIBCXX_CXX_FLAGS "${LIBCXX_CXX_FLAGS} -fno-modules")
+ endif()
+
ExternalProject_Add(${name}
DEPENDS ${name}-clobber ${LIBCXX_DEPS}
PREFIX ${prefix}
More information about the llvm-commits
mailing list