@@ -1340,59 +1340,6 @@ void AddUnalignedAccessWarning(ArgStringList &CmdArgs) {
13401340}
13411341}
13421342
1343- // Each combination of options here forms a signing schema, and in most cases
1344- // each signing schema is its own incompatible ABI. The default values of the
1345- // options represent the default signing schema.
1346- static void handlePAuthABI (const ArgList &DriverArgs, ArgStringList &CC1Args) {
1347- if (!DriverArgs.hasArg (options::OPT_fptrauth_intrinsics,
1348- options::OPT_fno_ptrauth_intrinsics))
1349- CC1Args.push_back (" -fptrauth-intrinsics" );
1350-
1351- if (!DriverArgs.hasArg (options::OPT_fptrauth_calls,
1352- options::OPT_fno_ptrauth_calls))
1353- CC1Args.push_back (" -fptrauth-calls" );
1354-
1355- if (!DriverArgs.hasArg (options::OPT_fptrauth_returns,
1356- options::OPT_fno_ptrauth_returns))
1357- CC1Args.push_back (" -fptrauth-returns" );
1358-
1359- if (!DriverArgs.hasArg (options::OPT_fptrauth_auth_traps,
1360- options::OPT_fno_ptrauth_auth_traps))
1361- CC1Args.push_back (" -fptrauth-auth-traps" );
1362-
1363- if (!DriverArgs.hasArg (
1364- options::OPT_fptrauth_vtable_pointer_address_discrimination,
1365- options::OPT_fno_ptrauth_vtable_pointer_address_discrimination))
1366- CC1Args.push_back (" -fptrauth-vtable-pointer-address-discrimination" );
1367-
1368- if (!DriverArgs.hasArg (
1369- options::OPT_fptrauth_vtable_pointer_type_discrimination,
1370- options::OPT_fno_ptrauth_vtable_pointer_type_discrimination))
1371- CC1Args.push_back (" -fptrauth-vtable-pointer-type-discrimination" );
1372-
1373- if (!DriverArgs.hasArg (
1374- options::OPT_fptrauth_type_info_vtable_pointer_discrimination,
1375- options::OPT_fno_ptrauth_type_info_vtable_pointer_discrimination))
1376- CC1Args.push_back (" -fptrauth-type-info-vtable-pointer-discrimination" );
1377-
1378- if (!DriverArgs.hasArg (options::OPT_fptrauth_indirect_gotos,
1379- options::OPT_fno_ptrauth_indirect_gotos))
1380- CC1Args.push_back (" -fptrauth-indirect-gotos" );
1381-
1382- if (!DriverArgs.hasArg (options::OPT_fptrauth_init_fini,
1383- options::OPT_fno_ptrauth_init_fini))
1384- CC1Args.push_back (" -fptrauth-init-fini" );
1385-
1386- if (!DriverArgs.hasArg (
1387- options::OPT_fptrauth_init_fini_address_discrimination,
1388- options::OPT_fno_ptrauth_init_fini_address_discrimination))
1389- CC1Args.push_back (" -fptrauth-init-fini-address-discrimination" );
1390-
1391- if (!DriverArgs.hasArg (options::OPT_faarch64_jump_table_hardening,
1392- options::OPT_fno_aarch64_jump_table_hardening))
1393- CC1Args.push_back (" -faarch64-jump-table-hardening" );
1394- }
1395-
13961343static void CollectARMPACBTIOptions (const ToolChain &TC, const ArgList &Args,
13971344 ArgStringList &CmdArgs, bool isAArch64) {
13981345 const llvm::Triple &Triple = TC.getEffectiveTriple ();
@@ -1630,7 +1577,9 @@ void RenderAArch64ABI(const llvm::Triple &Triple, const ArgList &Args,
16301577 ABIName = A->getValue ();
16311578 else if (Triple.isOSDarwin ())
16321579 ABIName = " darwinpcs" ;
1633- else if (Triple.getEnvironment () == llvm::Triple::PAuthTest)
1580+ // TODO: we probably want to have some target hook here.
1581+ else if (Triple.isOSLinux () &&
1582+ Triple.getEnvironment () == llvm::Triple::PAuthTest)
16341583 ABIName = " pauthtest" ;
16351584 else
16361585 ABIName = " aapcs" ;
@@ -1665,6 +1614,9 @@ void Clang::AddAArch64TargetArgs(const ArgList &Args,
16651614 CmdArgs.push_back (" -aarch64-enable-global-merge=true" );
16661615 }
16671616
1617+ // Enable/disable return address signing and indirect branch targets.
1618+ CollectARMPACBTIOptions (getToolChain (), Args, CmdArgs, true /* isAArch64*/ );
1619+
16681620 // Handle -msve_vector_bits=<bits>
16691621 auto HandleVectorBits = [&](Arg *A, StringRef VScaleMin,
16701622 StringRef VScaleMax) {
@@ -1750,8 +1702,6 @@ void Clang::AddAArch64TargetArgs(const ArgList &Args,
17501702 options::OPT_fno_ptrauth_objc_interface_sel);
17511703 Args.addOptInFlag (CmdArgs, options::OPT_fptrauth_objc_class_ro,
17521704 options::OPT_fno_ptrauth_objc_class_ro);
1753- if (Triple.getEnvironment () == llvm::Triple::PAuthTest)
1754- handlePAuthABI (Args, CmdArgs);
17551705
17561706 // Enable/disable return address signing and indirect branch targets.
17571707 CollectARMPACBTIOptions (getToolChain (), Args, CmdArgs, true /* isAArch64*/ );
0 commit comments