Emit diagnostic for -munaligned-access on v6m targets

Rather than silently disabling unaligned accesses for v6m targets as
in the previous patch to llvm, instead produce a warning saying that
this architecture doesn't support unaligned accesses.

Patch by Ben Foster

llvm-svn: 215531
This commit is contained in:
Oliver Stannard 2014-08-13 09:18:12 +00:00
parent 8edd497996
commit 76244be6d4
2 changed files with 7 additions and 1 deletions

View File

@ -123,6 +123,8 @@ def err_target_unknown_abi : Error<"unknown target ABI '%0'">;
def err_target_unknown_fpmath : Error<"unknown FP unit '%0'">;
def err_target_unsupported_fpmath : Error<
"the '%0' unit is not supported with this instruction set">;
def err_target_unsupported_unaligned : Error<
"the %0 sub-architecture does not support unaligned accesses">;
// Source manager
def err_cannot_open_file : Error<"cannot open file '%0': %1">, DefaultFatal;

View File

@ -806,10 +806,14 @@ void Clang::AddARMTargetArgs(const ArgList &Args,
CmdArgs.push_back("-backend-option");
if (A->getOption().matches(options::OPT_mno_unaligned_access))
CmdArgs.push_back("-arm-strict-align");
else
else {
if (getToolChain().getTriple().getSubArch() ==
llvm::Triple::SubArchType::ARMSubArch_v6m)
D.Diag(diag::err_target_unsupported_unaligned) << "v6m";
CmdArgs.push_back("-arm-no-strict-align");
}
}
}
// Setting -mno-global-merge disables the codegen global merge pass. Setting
// -mglobal-merge has no effect as the pass is enabled by default.