Hi, currently our clang for ARM64 creates code thinking it can do unaligned access. Which is kinda true, since our kernel does not enforce strict alignment yet. The Pine64 on the other hand enforces strict alignment at least as long as EFI is running. This means efiboot needs to be compiled with strict alignment, while it wouldn't yet matter on kernel or userland.
Still, we probably want to make strict alignment the default and then enforce it. This diff makes clang use strict alignment on OpenBSD if it wasn't overridden by any flags. ok? Patrick diff --git a/gnu/llvm/tools/clang/lib/Driver/Tools.cpp b/gnu/llvm/tools/clang/lib/Driver/Tools.cpp index bc7b9a98bb6..2e88668e866 100644 --- a/gnu/llvm/tools/clang/lib/Driver/Tools.cpp +++ b/gnu/llvm/tools/clang/lib/Driver/Tools.cpp @@ -2470,7 +2470,9 @@ getAArch64MicroArchFeaturesFromMcpu(const Driver &D, StringRef Mcpu, return getAArch64MicroArchFeaturesFromMtune(D, CPU, Args, Features); } -static void getAArch64TargetFeatures(const Driver &D, const ArgList &Args, +static void getAArch64TargetFeatures(const Driver &D, + const llvm::Triple &Triple, + const ArgList &Args, std::vector<const char *> &Features) { Arg *A; bool success = true; @@ -2512,9 +2514,11 @@ static void getAArch64TargetFeatures(const Driver &D, const ArgList &Args, } if (Arg *A = Args.getLastArg(options::OPT_mno_unaligned_access, - options::OPT_munaligned_access)) + options::OPT_munaligned_access)) { if (A->getOption().matches(options::OPT_mno_unaligned_access)) Features.push_back("+strict-align"); + } else if (Triple.isOSOpenBSD()) + Features.push_back("+strict-align"); if (Args.hasArg(options::OPT_ffixed_x18)) Features.push_back("+reserve-x18"); @@ -2600,7 +2604,7 @@ static void getTargetFeatures(const ToolChain &TC, const llvm::Triple &Triple, break; case llvm::Triple::aarch64: case llvm::Triple::aarch64_be: - getAArch64TargetFeatures(D, Args, Features); + getAArch64TargetFeatures(D, Triple, Args, Features); break; case llvm::Triple::x86: case llvm::Triple::x86_64: