[clang] 11c67e5 - [clang][driver] Don't pass -Wunaligned-access to cc1as
Archibald Elliott via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 7 02:45:58 PST 2022
Author: Archibald Elliott
Date: 2022-01-07T10:45:26Z
New Revision: 11c67e5a4e99f51ec66c9781710f81955cfd5e24
URL: https://github.com/llvm/llvm-project/commit/11c67e5a4e99f51ec66c9781710f81955cfd5e24
DIFF: https://github.com/llvm/llvm-project/commit/11c67e5a4e99f51ec66c9781710f81955cfd5e24.diff
LOG: [clang][driver] Don't pass -Wunaligned-access to cc1as
This is to fix some failing assembler tests.
Added:
Modified:
clang/lib/Driver/ToolChains/Arch/AArch64.cpp
clang/lib/Driver/ToolChains/Arch/ARM.cpp
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/Arch/AArch64.cpp b/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
index fe62384eeb98d..89a77a368ef02 100644
--- a/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
+++ b/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
@@ -467,11 +467,13 @@ void aarch64::getAArch64TargetFeatures(const Driver &D,
options::OPT_munaligned_access)) {
if (A->getOption().matches(options::OPT_mno_unaligned_access)) {
Features.push_back("+strict-align");
- CmdArgs.push_back("-Wunaligned-access");
+ if (!ForAS)
+ CmdArgs.push_back("-Wunaligned-access");
}
} else if (Triple.isOSOpenBSD()) {
Features.push_back("+strict-align");
- CmdArgs.push_back("-Wunaligned-access");
+ if (!ForAS)
+ CmdArgs.push_back("-Wunaligned-access");
}
if (Args.hasArg(options::OPT_ffixed_x1))
diff --git a/clang/lib/Driver/ToolChains/Arch/ARM.cpp b/clang/lib/Driver/ToolChains/Arch/ARM.cpp
index 69f1a8337517b..1055d7800b63e 100644
--- a/clang/lib/Driver/ToolChains/Arch/ARM.cpp
+++ b/clang/lib/Driver/ToolChains/Arch/ARM.cpp
@@ -771,7 +771,8 @@ void arm::getARMTargetFeatures(const Driver &D, const llvm::Triple &Triple,
// Kernel code has more strict alignment requirements.
if (KernelOrKext) {
Features.push_back("+strict-align");
- CmdArgs.push_back("-Wunaligned-access");
+ if (!ForAS)
+ CmdArgs.push_back("-Wunaligned-access");
} else if (Arg *A = Args.getLastArg(options::OPT_mno_unaligned_access,
options::OPT_munaligned_access)) {
if (A->getOption().matches(options::OPT_munaligned_access)) {
@@ -784,7 +785,8 @@ void arm::getARMTargetFeatures(const Driver &D, const llvm::Triple &Triple,
D.Diag(diag::err_target_unsupported_unaligned) << "v8m.base";
} else {
Features.push_back("+strict-align");
- CmdArgs.push_back("-Wunaligned-access");
+ if (!ForAS)
+ CmdArgs.push_back("-Wunaligned-access");
}
} else {
// Assume pre-ARMv6 doesn't support unaligned accesses.
@@ -806,17 +808,20 @@ void arm::getARMTargetFeatures(const Driver &D, const llvm::Triple &Triple,
if (VersionNum < 6 ||
Triple.getSubArch() == llvm::Triple::SubArchType::ARMSubArch_v6m) {
Features.push_back("+strict-align");
- CmdArgs.push_back("-Wunaligned-access");
+ if (!ForAS)
+ CmdArgs.push_back("-Wunaligned-access");
}
} else if (Triple.isOSLinux() || Triple.isOSNaCl() ||
Triple.isOSWindows()) {
if (VersionNum < 7) {
Features.push_back("+strict-align");
- CmdArgs.push_back("-Wunaligned-access");
+ if (!ForAS)
+ CmdArgs.push_back("-Wunaligned-access");
}
} else {
Features.push_back("+strict-align");
- CmdArgs.push_back("-Wunaligned-access");
+ if (!ForAS)
+ CmdArgs.push_back("-Wunaligned-access");
}
}
More information about the cfe-commits
mailing list