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
signature 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{
10251025 "misc" ++ path.sep_str ++ "initenv.c",
10261026 "math" ++ path.sep_str ++ "arm-common" ++ path.sep_str ++ "log2.c",
10271027 "math" ++ path.sep_str ++ "arm-common" ++ path.sep_str ++ "pow.c",
1028 "math" ++ path.sep_str ++ "arm-common" ++ path.sep_str ++ "scalbn.c",
10281029 "math" ++ path.sep_str ++ "arm64" ++ path.sep_str ++ "_chgsignl.S",
10291030 "math" ++ path.sep_str ++ "arm64" ++ path.sep_str ++ "rint.c",
10301031 "math" ++ path.sep_str ++ "arm64" ++ path.sep_str ++ "rintf.c",
src/windows_sdk.cpp+16-4
......@@ -23,16 +23,19 @@ enum NativeArch {
2323 NativeArchArm,
2424 NativeArchi386,
2525 NativeArchx86_64,
26 NativeArchAarch64,
2627};
2728
2829#if defined(_M_ARM) || defined(__arm_)
2930static const NativeArch native_arch = NativeArchArm;
30#endif
31#if defined(_M_IX86) || defined(__i386__)
31#elif defined(_M_IX86) || defined(__i386__)
3232static const NativeArch native_arch = NativeArchi386;
33#endif
34#if defined(_M_X64) || defined(__x86_64__)
33#elif defined(_M_X64) || defined(__x86_64__)
3534static 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
3639#endif
3740
3841void zig_free_windows_sdk(struct ZigWindowsSDK *sdk) {
......@@ -116,6 +119,9 @@ static ZigFindWindowsSdkError find_msvc_lib_dir(ZigWindowsSDKPrivate *priv) {
116119 case NativeArchArm:
117120 out_append_ptr += sprintf(out_append_ptr, "arm\\");
118121 break;
122 case NativeArchAarch64:
123 out_append_ptr += sprintf(out_append_ptr, "arm64\\");
124 break;
119125 }
120126 sprintf(tmp_buf, "%s%s", output_path, "vcruntime.lib");
121127
......@@ -161,6 +167,9 @@ com_done:;
161167 case NativeArchArm:
162168 tmp_buf_append_ptr += sprintf(tmp_buf_append_ptr, "arm\\");
163169 break;
170 case NativeArchAarch64:
171 tmp_buf_append_ptr += sprintf(tmp_buf_append_ptr, "arm64\\");
172 break;
164173 }
165174
166175 char *output_path = strdup(tmp_buf);
......@@ -204,6 +213,9 @@ static ZigFindWindowsSdkError find_10_version(ZigWindowsSDKPrivate *priv) {
204213 case NativeArchArm:
205214 option_name = "OptionId.DesktopCPParm";
206215 break;
216 case NativeArchAarch64:
217 option_name = "OptionId.DesktopCPParm64";
218 break;
207219 case NativeArchx86_64:
208220 option_name = "OptionId.DesktopCPPx64";
209221 break;