diff --git a/patches/compiler-rt-0001.patch b/patches/compiler-rt-0001.patch index 81a7c8a..e49fde4 100644 --- a/patches/compiler-rt-0001.patch +++ b/patches/compiler-rt-0001.patch @@ -1,13 +1,15 @@ -From b362e07e7a8e0d11291d1bc681eebef2cc000b74 Mon Sep 17 00:00:00 2001 -From: Martell Malone -Date: Tue, 16 Aug 2016 15:50:50 -0700 -Subject: [PATCH 1/2] builtins: add support for windows arm divide functions +From 43abf42d132d75e8f51519b8c946e7a57e94175b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Martin=20Storsj=C3=B6?= +Date: Fri, 7 Oct 2016 16:44:22 +0300 +Subject: [PATCH] builtins: Allow building windows arm functions for mingw + +When building for MSVC, the msvcrt libraries contain these functions. +When building in a mingw environment, we need to provide them somehow, +e.g. via compiler-rt. The divmod functions work in the same way as the corresponding __rt_*div* functions for windows, but their parameters are swapped. --- - cmake/base-config-ix.cmake | 2 +- - cmake/builtin-config-ix.cmake | 2 +- lib/builtins/CMakeLists.txt | 25 ++++++++++++++++++++++++- lib/builtins/arm/aeabi_idivmod.S | 9 +++++++++ lib/builtins/arm/aeabi_ldivmod.S | 12 ++++++++++++ @@ -21,44 +23,18 @@ __rt_*div* functions for windows, but their parameters are swapped. lib/builtins/floatdisf.c | 8 ++++++++ lib/builtins/floatundidf.c | 8 ++++++++ lib/builtins/floatundisf.c | 8 ++++++++ - 15 files changed, 132 insertions(+), 3 deletions(-) + 13 files changed, 130 insertions(+), 1 deletion(-) -diff --git a/cmake/base-config-ix.cmake b/cmake/base-config-ix.cmake -index 830e443..644cea2 100644 ---- a/cmake/base-config-ix.cmake -+++ b/cmake/base-config-ix.cmake -@@ -153,7 +153,7 @@ macro(test_targets) - elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "mips") - test_target_arch(mips "" "-mips32r2" "--target=mips-linux-gnu") - test_target_arch(mips64 "" "-mips64r2" "--target=mips64-linux-gnu" "-mabi=64") -- elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "arm") -+ elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "arm|armv7") - if(WIN32) - test_target_arch(arm "" "" "") - else() -diff --git a/cmake/builtin-config-ix.cmake b/cmake/builtin-config-ix.cmake -index 9289618..bf15570 100644 ---- a/cmake/builtin-config-ix.cmake -+++ b/cmake/builtin-config-ix.cmake -@@ -2,7 +2,7 @@ include(BuiltinTests) - include(CheckCSourceCompiles) - - # Make all the tests only check the compiler --set(TEST_COMPILE_ONLY On) -+set(TEST_COMPILE_ONLY TRUE) - - builtin_check_c_compiler_flag(-fPIC COMPILER_RT_HAS_FPIC_FLAG) - builtin_check_c_compiler_flag(-fPIE COMPILER_RT_HAS_FPIE_FLAG) diff --git a/lib/builtins/CMakeLists.txt b/lib/builtins/CMakeLists.txt -index a7d665e..18bdee9 100644 +index 5cbc1cb..1fc4b32 100644 --- a/lib/builtins/CMakeLists.txt +++ b/lib/builtins/CMakeLists.txt -@@ -367,7 +367,30 @@ set(arm_Thumb1_SOURCES +@@ -371,7 +371,30 @@ set(arm_Thumb1_SOURCES ${arm_Thumb1_VFPv2_SOURCES} ${arm_Thumb1_icache_SOURCES}) -if(NOT WIN32) -+if(WIN32) ++if(MINGW) + set(arm_SOURCES + fixdfdi.c + fixsfdi.c @@ -81,7 +57,7 @@ index a7d665e..18bdee9 100644 + udivmodsi4.c + udivsi3.c + umoddi3.c) -+else(WIN32) ++else(MINGW) # TODO the EABI sources should only be added to EABI targets set(arm_SOURCES ${arm_SOURCES} diff --git a/patches/compiler-rt-0002.patch b/patches/compiler-rt-0002.patch deleted file mode 100644 index 00f4fd2..0000000 --- a/patches/compiler-rt-0002.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 608efc9306e10f9e9daf0ea981f53deb98851772 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Martin=20Storsj=C3=B6?= -Date: Thu, 25 Aug 2016 10:02:16 +0300 -Subject: [PATCH 2/2] builtins: Allow building the necessary helper functions - for msvc mode with cmake - ---- - lib/builtins/CMakeLists.txt | 13 ++++++++++++- - 1 file changed, 12 insertions(+), 1 deletion(-) - -diff --git a/lib/builtins/CMakeLists.txt b/lib/builtins/CMakeLists.txt -index 18bdee9..003d5b8 100644 ---- a/lib/builtins/CMakeLists.txt -+++ b/lib/builtins/CMakeLists.txt -@@ -367,7 +367,7 @@ set(arm_Thumb1_SOURCES - ${arm_Thumb1_VFPv2_SOURCES} - ${arm_Thumb1_icache_SOURCES}) - --if(WIN32) -+if(WIN32 AND MINGW) - set(arm_SOURCES - fixdfdi.c - fixsfdi.c -@@ -390,6 +390,17 @@ if(WIN32) - udivmodsi4.c - udivsi3.c - umoddi3.c) -+elseif(WIN32) -+ set(arm_SOURCES -+ umoddi3.c -+ moddi3.c -+ udivmoddi4.c -+ divsi3.c -+ udivsi3.c -+ umodsi3.c -+ udivdi3.c -+ modsi3.c -+ divdi3.c) - else(WIN32) - # TODO the EABI sources should only be added to EABI targets - set(arm_SOURCES --- -2.7.4 -