[clang] Add -mno-unaligned-access and -mbig-endian to ARM and AArch64 multilib flags (PR #114782)
Lucas Duarte Prates via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 4 07:32:00 PST 2024
================
@@ -230,6 +230,17 @@ static void getAArch64MultilibFlags(const Driver &D,
Result.push_back(BranchProtectionArg->getAsString(Args));
}
+ const Arg *StrictAlignArg = Args.getLastArgNoClaim(
+ options::OPT_mstrict_align, options::OPT_mno_unaligned_access);
+ if (StrictAlignArg) {
----------------
pratlucas wrote:
I think the presence of `-munaligned-access` or `-mno-strict-align` also needs to be considered here.
Looking at `clang/lib/Driver/Toolchains/Arch/AArch64.cpp`, it looks like the last of these options is the one which takes effect:
```
if (Arg *A = Args.getLastArg(
options::OPT_mstrict_align, options::OPT_mno_strict_align,
options::OPT_mno_unaligned_access, options::OPT_munaligned_access)) {
if (A->getOption().matches(options::OPT_mstrict_align) ||
A->getOption().matches(options::OPT_mno_unaligned_access))
Features.push_back("+strict-align");
```
I'd recommend using the same logic here.
https://github.com/llvm/llvm-project/pull/114782
More information about the cfe-commits
mailing list