static void CollectARMPACBTIOptions(const ToolChain &TC, const ArgList &Args,
ArgStringList &CmdArgs, bool isAArch64) {
+ const llvm::Triple &Triple = TC.getEffectiveTriple();
const Arg *A = isAArch64
? Args.getLastArg(options::OPT_msign_return_address_EQ,
options::OPT_mbranch_protection_EQ)
: Args.getLastArg(options::OPT_mbranch_protection_EQ);
- if (!A)
+ if (!A) {
+ if (Triple.isOSOpenBSD()) {
+ CmdArgs.push_back("-msign-return-address=non-leaf");
+ CmdArgs.push_back("-msign-return-address-key=a_key");
+ CmdArgs.push_back("-mbranch-target-enforce");
+ }
return;
+ }
const Driver &D = TC.getDriver();
- const llvm::Triple &Triple = TC.getEffectiveTriple();
if (!(isAArch64 || (Triple.isArmT32() && Triple.isArmMClass())))
D.Diag(diag::warn_incompatible_branch_protection_option)
<< Triple.getArchName();
Args.MakeArgString(Twine("-msign-return-address-key=") + Key));
if (IndirectBranches)
CmdArgs.push_back("-mbranch-target-enforce");
- else {
- if (Triple.isOSOpenBSD()) {
- CmdArgs.push_back("-msign-return-address=non-leaf");
- CmdArgs.push_back("-msign-return-address-key=a_key");
- CmdArgs.push_back("-mbranch-target-enforce");
- }
- }
}
void Clang::AddARMTargetArgs(const llvm::Triple &Triple, const ArgList &Args,