authorgravatar for johnnymarler@gmail.comJonathan Marler <johnnymarler@gmail.com> 2021-09-07 14:27:50-06:00
committergravatar for johnnymarler@gmail.comJonathan Marler <johnnymarler@gmail.com> 2021-09-07 14:27:50-06:00
log375619820ecb8e34d38749fb4dc339258b2766a6
treecdb09fdc9c5b6685ccffdd48f50f4c508c8a7968
parentd305ba7f2d5ae524fd71365852fb5196e98fdbaf

changes to build zig-bootstrap aarch64-windows


3 files changed, 65 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+19-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(__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,10 @@ static ZigFindWindowsSdkError find_msvc_lib_dir(ZigWindowsSDKPrivate *priv) {...@@ -116,6 +119,10 @@ 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 // TODO: is this right?
124 out_append_ptr += sprintf(out_append_ptr, "aarch64\\");
125 break;
119 }126 }
120 sprintf(tmp_buf, "%s%s", output_path, "vcruntime.lib");127 sprintf(tmp_buf, "%s%s", output_path, "vcruntime.lib");
121128
...@@ -161,6 +168,10 @@ com_done:;...@@ -161,6 +168,10 @@ com_done:;
161 case NativeArchArm:168 case NativeArchArm:
162 tmp_buf_append_ptr += sprintf(tmp_buf_append_ptr, "arm\\");169 tmp_buf_append_ptr += sprintf(tmp_buf_append_ptr, "arm\\");
163 break;170 break;
171 case NativeArchAarch64:
172 // TODO: is this right?
173 tmp_buf_append_ptr += sprintf(tmp_buf_append_ptr, "aarch64\\");
174 break;
164 }175 }
165176
166 char *output_path = strdup(tmp_buf);177 char *output_path = strdup(tmp_buf);
...@@ -204,6 +215,10 @@ static ZigFindWindowsSdkError find_10_version(ZigWindowsSDKPrivate *priv) {...@@ -204,6 +215,10 @@ static ZigFindWindowsSdkError find_10_version(ZigWindowsSDKPrivate *priv) {
204 case NativeArchArm:215 case NativeArchArm:
205 option_name = "OptionId.DesktopCPParm";216 option_name = "OptionId.DesktopCPParm";
206 break;217 break;
218 case NativeArchAarch64:
219 // TODO: is this right?
220 option_name = "OptionId.DesktopCPParm64";
221 break;
207 case NativeArchx86_64:222 case NativeArchx86_64:
208 option_name = "OptionId.DesktopCPPx64";223 option_name = "OptionId.DesktopCPPx64";
209 break;224 break;