diff --git a/lib/builtins/CMakeLists.txt b/lib/builtins/CMakeLists.txt index 25bd921fcb..571137a0b2 100644 --- a/lib/builtins/CMakeLists.txt +++ b/lib/builtins/CMakeLists.txt @@ -361,11 +361,18 @@ else () endif () endforeach () + # Rust: don't insert a reference to MSVCRT.lib/etc + if (MSVC) + set(_cflags -Zl) + else () + set(_cflags -std=c99) + endif () + add_compiler_rt_runtime(clang_rt.builtins STATIC ARCHS ${arch} SOURCES ${${arch}_SOURCES} - CFLAGS "-std=c99" + CFLAGS ${_cflags} PARENT_TARGET builtins) endif () endforeach () diff --git a/lib/builtins/int_math.h b/lib/builtins/int_math.h index fc81fb7f02..9a8b751e44 100644 --- a/lib/builtins/int_math.h +++ b/lib/builtins/int_math.h @@ -28,7 +28,9 @@ #if defined(_MSC_VER) && !defined(__clang__) #include #include -#include +// Rust: need to upstream this +// don't include ymath.h, it's not needed + pulls in the C++ stdlib for some reason +// #include #endif #if defined(_MSC_VER) && !defined(__clang__) diff --git a/make/platform/triple.mk b/make/platform/triple.mk index 7e3450e395..0d68b2eafd 100644 --- a/make/platform/triple.mk +++ b/make/platform/triple.mk @@ -60,6 +60,12 @@ ifneq (,$(findstring mips,$(TargetTriple))) CommonDisabledFunctions := emutls endif +# Disable emutls on Windows +# emutls works on POSIX only as it uses pthreads +ifneq (,$(findstring windows,$(TargetTriple))) + CommonDisabledFunctions := emutls +endif + # Clear cache is builtin on aarch64-apple-ios # arm64 and aarch64 are synonims, but iOS targets usually use arm64 (history reasons) ifeq (aarch64-apple-ios,$(subst arm64,aarch64,$(TargetTriple)))