authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-09-08 13:32:20-04:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2021-09-08 13:32:20-04:00
log6237dc0ab8fcb6fc14b97b2ea5494a488e94e492
tree5859d6c7c5cb3b2eff175caf8f5f81f543fd3f42
parent501e6cf2f3ff26246173df98b3bc5194afec5681
parent343547d4a4cf8a98b6380881aa310fa7868e7486
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Merge pull request #9700 from marler8997/bootstrapAarch64Windows

changes to build zig-bootstrap aarch64-windows

3 files changed, 62 insertions(+), 4 deletions(-)

lib/libc/mingw/math/arm-common/scalbn.c created+45
...@@ -0,0 +1,45 @@
1/**
2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the mingw-w64 runtime package.
4 * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5 */
6
7#include <math.h>
8
9double scalbn(double x, int exp)
10{
11 return x * exp2(exp);
12}
13
14float scalbnf(float x, int exp)
15{
16 return x * exp2f(exp);
17}
18
19long double scalbnl(long double x, int exp)
20{
21#if defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_)
22 return scalbn(x, exp);
23#else
24#error Not supported on your platform yet
25#endif
26}
27
28double scalbln(double x, long exp)
29{
30 return x * exp2(exp);
31}
32
33float scalblnf(float x, long exp)
34{
35 return x * exp2f(exp);
36}
37
38long double scalblnl(long double x, long exp)
39{
40#if defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_)
41 return scalbln(x, exp);
42#else
43#error Not supported on your platform yet
44#endif
45}
src/mingw.zig+1
...@@ -1025,6 +1025,7 @@ const mingwex_arm64_src = [_][]const u8{...@@ -1025,6 +1025,7 @@ const mingwex_arm64_src = [_][]const u8{
1025 "misc" ++ path.sep_str ++ "initenv.c",1025 "misc" ++ path.sep_str ++ "initenv.c",
1026 "math" ++ path.sep_str ++ "arm-common" ++ path.sep_str ++ "log2.c",1026 "math" ++ path.sep_str ++ "arm-common" ++ path.sep_str ++ "log2.c",
1027 "math" ++ path.sep_str ++ "arm-common" ++ path.sep_str ++ "pow.c",1027 "math" ++ path.sep_str ++ "arm-common" ++ path.sep_str ++ "pow.c",
1028 "math" ++ path.sep_str ++ "arm-common" ++ path.sep_str ++ "scalbn.c",
1028 "math" ++ path.sep_str ++ "arm64" ++ path.sep_str ++ "_chgsignl.S",1029 "math" ++ path.sep_str ++ "arm64" ++ path.sep_str ++ "_chgsignl.S",
1029 "math" ++ path.sep_str ++ "arm64" ++ path.sep_str ++ "rint.c",1030 "math" ++ path.sep_str ++ "arm64" ++ path.sep_str ++ "rint.c",
1030 "math" ++ path.sep_str ++ "arm64" ++ path.sep_str ++ "rintf.c",1031 "math" ++ path.sep_str ++ "arm64" ++ path.sep_str ++ "rintf.c",
src/windows_sdk.cpp+16-4
...@@ -23,16 +23,19 @@ enum NativeArch {...@@ -23,16 +23,19 @@ enum NativeArch {
23 NativeArchArm,23 NativeArchArm,
24 NativeArchi386,24 NativeArchi386,
25 NativeArchx86_64,25 NativeArchx86_64,
26 NativeArchAarch64,
26};27};
2728
28#if defined(_M_ARM) || defined(__arm_)29#if defined(_M_ARM) || defined(__arm_)
29static const NativeArch native_arch = NativeArchArm;30static const NativeArch native_arch = NativeArchArm;
30#endif31#elif defined(_M_IX86) || defined(__i386__)
31#if defined(_M_IX86) || defined(__i386__)
32static const NativeArch native_arch = NativeArchi386;32static const NativeArch native_arch = NativeArchi386;
33#endif33#elif defined(_M_X64) || defined(__x86_64__)
34#if defined(_M_X64) || defined(__x86_64__)
35static const NativeArch native_arch = NativeArchx86_64;34static const NativeArch native_arch = NativeArchx86_64;
35#elif defined(_M_ARM64) || defined(__aarch64__)
36static const NativeArch native_arch = NativeArchAarch64;
37#else
38#error unsupported architecture
36#endif39#endif
3740
38void zig_free_windows_sdk(struct ZigWindowsSDK *sdk) {41void zig_free_windows_sdk(struct ZigWindowsSDK *sdk) {
...@@ -116,6 +119,9 @@ static ZigFindWindowsSdkError find_msvc_lib_dir(ZigWindowsSDKPrivate *priv) {...@@ -116,6 +119,9 @@ static ZigFindWindowsSdkError find_msvc_lib_dir(ZigWindowsSDKPrivate *priv) {
116 case NativeArchArm:119 case NativeArchArm:
117 out_append_ptr += sprintf(out_append_ptr, "arm\\");120 out_append_ptr += sprintf(out_append_ptr, "arm\\");
118 break;121 break;
122 case NativeArchAarch64:
123 out_append_ptr += sprintf(out_append_ptr, "arm64\\");
124 break;
119 }125 }
120 sprintf(tmp_buf, "%s%s", output_path, "vcruntime.lib");126 sprintf(tmp_buf, "%s%s", output_path, "vcruntime.lib");
121127
...@@ -161,6 +167,9 @@ com_done:;...@@ -161,6 +167,9 @@ com_done:;
161 case NativeArchArm:167 case NativeArchArm:
162 tmp_buf_append_ptr += sprintf(tmp_buf_append_ptr, "arm\\");168 tmp_buf_append_ptr += sprintf(tmp_buf_append_ptr, "arm\\");
163 break;169 break;
170 case NativeArchAarch64:
171 tmp_buf_append_ptr += sprintf(tmp_buf_append_ptr, "arm64\\");
172 break;
164 }173 }
165174
166 char *output_path = strdup(tmp_buf);175 char *output_path = strdup(tmp_buf);
...@@ -204,6 +213,9 @@ static ZigFindWindowsSdkError find_10_version(ZigWindowsSDKPrivate *priv) {...@@ -204,6 +213,9 @@ static ZigFindWindowsSdkError find_10_version(ZigWindowsSDKPrivate *priv) {
204 case NativeArchArm:213 case NativeArchArm:
205 option_name = "OptionId.DesktopCPParm";214 option_name = "OptionId.DesktopCPParm";
206 break;215 break;
216 case NativeArchAarch64:
217 option_name = "OptionId.DesktopCPParm64";
218 break;
207 case NativeArchx86_64:219 case NativeArchx86_64:
208 option_name = "OptionId.DesktopCPPx64";220 option_name = "OptionId.DesktopCPPx64";
209 break;221 break;