endif
# Filter out stuff that gcc cannot compile (these are only needed for clang-generated code anywasys).
-CommonFunctions_gcc := $(filter-out atomic enable_execute_stack,$(CommonFunctions))
+CommonFunctions_gcc := $(filter-out atomic% enable_execute_stack,$(CommonFunctions))
# Filter out stuff which is not available on specific target
# For example, sync_fetch_and_add_4 uses Thumb instructions, which are unavailable
sync_fetch_and_umin_8
endif
+# Disable emutls on MIPS
+# Rust uses GCC 4.4 to cross-compile, which doesn't have some builtins
+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)))