add native aarch64 (arm64) support

use -mcpu=native on arm64 targets

build-appimage.sh kernel architecture detection
This commit is contained in:
theofficialgman
2026-08-27 00:37:17 -04:00
parent 806f4127bb
commit 6ddc153e44
11 changed files with 390 additions and 69 deletions
+6 -2
View File
@@ -273,8 +273,12 @@ void EnsureReservation() {
std::ostringstream oss;
oss << "Unable to reserve the 4 GiB flat guest address space at 0x" << std::hex
<< reinterpret_cast<uintptr_t>(requested) << std::dec
<< ". Something else in this process already occupies part of the 16 TiB region - "
"an injected library, an overlay or a debugging tool is the usual cause.";
<< ". Either something else in this process already occupies that address (an "
"injected library, an overlay or a debugging tool is the usual cause), or this "
"kernel's virtual address space does not reach that high (common on some 32-bit-"
"userspace-compatible or older AArch64 configurations, e.g. a kernel built for "
"39-bit virtual addresses) - in the latter case mmap() silently substitutes an "
"address near the top of the space it does have instead of honoring the request.";
throw std::runtime_error(oss.str());
}
#endif
+15
View File
@@ -4,6 +4,13 @@
// build/PCH) and runs from a priority-101 C initializer, ahead of every C++ dynamic initializer
// and thus the first AVX2 code that could execute. Keep it free of anything that could pull in
// vectorized code: no iostreams, no std::string, no runtime-wide headers.
//
// x86-64-v3 is an x86-specific optional-feature baseline (AVX2/BMI2/FMA and friends are not
// guaranteed present on every x86_64 chip); nothing here applies on AArch64, where ASIMD/NEON is
// mandatory in the base architecture and PublicProducts.cmake never applies an -march=x86-64-v3
// equivalent flag to begin with. That branch below is a no-op stub, not a port of this check.
#if defined(__x86_64__)
#include <cstdint>
#include <cstdio>
@@ -214,3 +221,11 @@ extern "C" int MkwHostCpuBaselineInit() {
__attribute__((constructor(101))) static void MkwHostCpuBaselineCtor() {
MkwHostCpuBaselineInit();
}
#else // !defined(__x86_64__)
extern "C" int MkwHostCpuBaselineInit() {
return 0;
}
#endif // defined(__x86_64__)