diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2021-09-08 13:32:20 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-08 13:32:20 -0400 |
| commit | 6237dc0ab8fcb6fc14b97b2ea5494a488e94e492 (patch) | |
| tree | 5859d6c7c5cb3b2eff175caf8f5f81f543fd3f42 | |
| parent | 501e6cf2f3ff26246173df98b3bc5194afec5681 (diff) | |
| parent | 343547d4a4cf8a98b6380881aa310fa7868e7486 (diff) | |
| download | zig-6237dc0ab8fcb6fc14b97b2ea5494a488e94e492.tar.gz zig-6237dc0ab8fcb6fc14b97b2ea5494a488e94e492.zip | |
Merge pull request #9700 from marler8997/bootstrapAarch64Windows
changes to build zig-bootstrap aarch64-windows
| -rw-r--r-- | lib/libc/mingw/math/arm-common/scalbn.c | 45 | ||||
| -rw-r--r-- | src/mingw.zig | 1 | ||||
| -rw-r--r-- | src/windows_sdk.cpp | 20 |
3 files changed, 62 insertions, 4 deletions
diff --git a/lib/libc/mingw/math/arm-common/scalbn.c b/lib/libc/mingw/math/arm-common/scalbn.c new file mode 100644 index 0000000000..0e2f14ab7c --- /dev/null +++ b/lib/libc/mingw/math/arm-common/scalbn.c @@ -0,0 +1,45 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the mingw-w64 runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ + +#include <math.h> + +double scalbn(double x, int exp) +{ + return x * exp2(exp); +} + +float scalbnf(float x, int exp) +{ + return x * exp2f(exp); +} + +long double scalbnl(long double x, int exp) +{ +#if defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_) + return scalbn(x, exp); +#else +#error Not supported on your platform yet +#endif +} + +double scalbln(double x, long exp) +{ + return x * exp2(exp); +} + +float scalblnf(float x, long exp) +{ + return x * exp2f(exp); +} + +long double scalblnl(long double x, long exp) +{ +#if defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_) + return scalbln(x, exp); +#else +#error Not supported on your platform yet +#endif +} diff --git a/src/mingw.zig b/src/mingw.zig index ca5fa6a01f..587f019270 100644 --- a/src/mingw.zig +++ b/src/mingw.zig @@ -1025,6 +1025,7 @@ const mingwex_arm64_src = [_][]const u8{ "misc" ++ path.sep_str ++ "initenv.c", "math" ++ path.sep_str ++ "arm-common" ++ path.sep_str ++ "log2.c", "math" ++ path.sep_str ++ "arm-common" ++ path.sep_str ++ "pow.c", + "math" ++ path.sep_str ++ "arm-common" ++ path.sep_str ++ "scalbn.c", "math" ++ path.sep_str ++ "arm64" ++ path.sep_str ++ "_chgsignl.S", "math" ++ path.sep_str ++ "arm64" ++ path.sep_str ++ "rint.c", "math" ++ path.sep_str ++ "arm64" ++ path.sep_str ++ "rintf.c", diff --git a/src/windows_sdk.cpp b/src/windows_sdk.cpp index fd88374311..25620805cd 100644 --- a/src/windows_sdk.cpp +++ b/src/windows_sdk.cpp @@ -23,16 +23,19 @@ enum NativeArch { NativeArchArm, NativeArchi386, NativeArchx86_64, + NativeArchAarch64, }; #if defined(_M_ARM) || defined(__arm_) static const NativeArch native_arch = NativeArchArm; -#endif -#if defined(_M_IX86) || defined(__i386__) +#elif defined(_M_IX86) || defined(__i386__) static const NativeArch native_arch = NativeArchi386; -#endif -#if defined(_M_X64) || defined(__x86_64__) +#elif defined(_M_X64) || defined(__x86_64__) static const NativeArch native_arch = NativeArchx86_64; +#elif defined(_M_ARM64) || defined(__aarch64__) +static const NativeArch native_arch = NativeArchAarch64; +#else +#error unsupported architecture #endif void zig_free_windows_sdk(struct ZigWindowsSDK *sdk) { @@ -116,6 +119,9 @@ static ZigFindWindowsSdkError find_msvc_lib_dir(ZigWindowsSDKPrivate *priv) { case NativeArchArm: out_append_ptr += sprintf(out_append_ptr, "arm\\"); break; + case NativeArchAarch64: + out_append_ptr += sprintf(out_append_ptr, "arm64\\"); + break; } sprintf(tmp_buf, "%s%s", output_path, "vcruntime.lib"); @@ -161,6 +167,9 @@ com_done:; case NativeArchArm: tmp_buf_append_ptr += sprintf(tmp_buf_append_ptr, "arm\\"); break; + case NativeArchAarch64: + tmp_buf_append_ptr += sprintf(tmp_buf_append_ptr, "arm64\\"); + break; } char *output_path = strdup(tmp_buf); @@ -204,6 +213,9 @@ static ZigFindWindowsSdkError find_10_version(ZigWindowsSDKPrivate *priv) { case NativeArchArm: option_name = "OptionId.DesktopCPParm"; break; + case NativeArchAarch64: + option_name = "OptionId.DesktopCPParm64"; + break; case NativeArchx86_64: option_name = "OptionId.DesktopCPPx64"; break; |
