diff --git a/libcxx/cmake/caches/MinGW.cmake b/libcxx/cmake/caches/MinGW.cmake new file mode 100644 --- /dev/null +++ b/libcxx/cmake/caches/MinGW.cmake @@ -0,0 +1,20 @@ +set(LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY OFF CACHE BOOL "") +set(LIBCXX_HAS_WIN32_THREAD_API ON CACHE BOOL "") + +set(LIBCXX_CXX_ABI libcxxabi CACHE STRING "") +set(LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "") + +set(LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "") +set(LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE BOOL "") + +set(LIBCXX_USE_COMPILER_RT ON CACHE BOOL "") +set(LIBCXXABI_USE_COMPILER_RT ON CACHE BOOL "") +set(LIBUNWIND_USE_COMPILER_RT ON CACHE BOOL "") + +set(LIBCXX_TARGET_INFO "libcxx.test.target_info.MingwLocalTI" CACHE STRING "") + +# Without these flags, 'long double' (which is 80 bit on x86 mingw, but +# 64 bit in MSVC) isn't handled correctly in printf. +set(CMAKE_C_FLAGS "-D__USE_MINGW_ANSI_STDIO=1" CACHE STRING "") +set(CMAKE_CXX_FLAGS "-D__USE_MINGW_ANSI_STDIO=1" CACHE STRING "") +set(LIBCXX_TEST_COMPILER_FLAGS "-D__USE_MINGW_ANSI_STDIO=1" CACHE STRING "") diff --git a/libcxx/docs/index.rst b/libcxx/docs/index.rst --- a/libcxx/docs/index.rst +++ b/libcxx/docs/index.rst @@ -117,7 +117,7 @@ macOS 10.9+ i386, x86_64, arm64 Building the shared library itself requires targetting macOS 10.11+ FreeBSD 10+ i386, x86_64, arm Linux i386, x86_64, arm, arm64 -Windows x86_64 +Windows x86_64 Both MSVC and MinGW style environments AIX powerpc, powerpc64 =============== ========================= ============================ diff --git a/libcxx/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/pointer.volatile.pass.cpp b/libcxx/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/pointer.volatile.pass.cpp --- a/libcxx/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/pointer.volatile.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/pointer.volatile.pass.cpp @@ -10,6 +10,13 @@ // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 +// This test fails on MinGW DLL configurations, due to +// __exclude_from_explicit_instantiation__ not behaving as it should in +// combination with dllimport (https://llvm.org/PR41018), in combination +// with running tests in c++2b mode while building the library in c++20 mode. +// (If the library was built in c++2b mode, this test would succeed.) +// XFAIL: target={{.+}}-windows-gnu && windows-dll + // template > // class basic_ostream; diff --git a/libcxx/utils/ci/buildkite-pipeline.yml b/libcxx/utils/ci/buildkite-pipeline.yml --- a/libcxx/utils/ci/buildkite-pipeline.yml +++ b/libcxx/utils/ci/buildkite-pipeline.yml @@ -506,8 +506,8 @@ timeout_in_minutes: 120 # Tests on non-Unix platforms - - label: "Windows (DLL)" - command: "bash libcxx/utils/ci/run-buildbot windows-dll" + - label: "Clang-cl (DLL)" + command: "bash libcxx/utils/ci/run-buildbot clang-cl-dll" artifact_paths: - "**/test-results.xml" agents: @@ -518,8 +518,32 @@ limit: 2 timeout_in_minutes: 120 - - label: "Windows (Static)" - command: "bash libcxx/utils/ci/run-buildbot windows-static" + - label: "Clang-cl (Static)" + command: "bash libcxx/utils/ci/run-buildbot clang-cl-static" + artifact_paths: + - "**/test-results.xml" + agents: + queue: "windows" + retry: + automatic: + - exit_status: -1 # Agent was lost + limit: 2 + timeout_in_minutes: 120 + + - label: "MinGW (DLL)" + command: "bash libcxx/utils/ci/run-buildbot mingw-dll" + artifact_paths: + - "**/test-results.xml" + agents: + queue: "windows" + retry: + automatic: + - exit_status: -1 # Agent was lost + limit: 2 + timeout_in_minutes: 120 + + - label: "MinGW (Static)" + command: "bash libcxx/utils/ci/run-buildbot mingw-static" artifact_paths: - "**/test-results.xml" agents: diff --git a/libcxx/utils/ci/run-buildbot b/libcxx/utils/ci/run-buildbot --- a/libcxx/utils/ci/run-buildbot +++ b/libcxx/utils/ci/run-buildbot @@ -597,7 +597,7 @@ -DLIBUNWIND_TEST_CONFIG="llvm-libunwind-shared.cfg.in" check-runtimes ;; -windows-dll) +clang-cl-dll) clean # TODO: Currently, building with the experimental library breaks running # tests (the test linking look for the c++experimental library with the @@ -609,12 +609,37 @@ echo "+++ Running the libc++ tests" ${NINJA} -vC "${BUILD_DIR}" check-cxx ;; -windows-static) +clang-cl-static) clean generate-cmake-libcxx-win -DLIBCXX_ENABLE_SHARED=OFF echo "+++ Running the libc++ tests" ${NINJA} -vC "${BUILD_DIR}" check-cxx ;; +mingw-dll) + clean + # Explicitly specify the compiler with a triple prefix. The CI + # environment has got two installations of Clang; the default one + # defaults to MSVC mode, while there's an installation of llvm-mingw + # further back in PATH. By calling the compiler with an explicit + # triple prefix, we use the one that is bundled with a mingw sysroot. + generate-cmake \ + -DCMAKE_C_COMPILER=x86_64-w64-mingw32-clang \ + -DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-clang++ \ + -C "${MONOREPO_ROOT}/libcxx/cmake/caches/MinGW.cmake" + echo "+++ Running the libc++ tests" + ${NINJA} -vC "${BUILD_DIR}" check-cxx +;; +mingw-static) + clean + generate-cmake \ + -DCMAKE_C_COMPILER=x86_64-w64-mingw32-clang \ + -DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-clang++ \ + -C "${MONOREPO_ROOT}/libcxx/cmake/caches/MinGW.cmake" \ + -DLIBCXX_ENABLE_SHARED=OFF \ + -DLIBUNWIND_ENABLE_SHARED=OFF + echo "+++ Running the libc++ tests" + ${NINJA} -vC "${BUILD_DIR}" check-cxx +;; aix) export CC=ibm-clang export CXX=ibm-clang++_r