Merge pull request #80389 from 3405691582/nobtcfi

Add a build flavor to opt-out of BTCFI on OpenBSD.
This commit is contained in:
Doug Gregor
2025-04-03 13:29:04 -07:00
committed by GitHub
7 changed files with 52 additions and 1 deletions

View File

@@ -205,12 +205,14 @@ void ToolChain::addCommonFrontendArgs(const OutputInfo &OI,
}
if (Triple.isOSOpenBSD() && Triple.getArch() == llvm::Triple::aarch64) {
#ifdef SWIFT_OPENBSD_BTCFI
arguments.push_back("-Xcc");
arguments.push_back("-Xclang=-mbranch-target-enforce");
arguments.push_back("-Xcc");
arguments.push_back("-Xclang=-msign-return-address=non-leaf");
arguments.push_back("-Xcc");
arguments.push_back("-Xclang=-msign-return-address-key=a_key");
#endif
}
if (inputArgs.getLastArg(options::OPT_experimental_serialize_debug_info)) {