Merge pull request #9700 from marler8997/bootstrapAarch64Windows

changes to build zig-bootstrap aarch64-windows
This commit is contained in:
Andrew Kelley 2021-09-08 13:32:20 -04:00 committed by GitHub
commit 6237dc0ab8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 62 additions and 4 deletions

45
lib/libc/mingw/math/arm-common/scalbn.c vendored Normal file
View file

@ -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
}

View file

@ -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",

View file

@ -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;