@@ -374,25 +374,28 @@ void arm::getARMTargetFeatures(const ToolChain &TC,
374
374
}
375
375
376
376
// Generate execute-only output (no data access to code sections).
377
- // Supported only on ARMv6T2 and ARMv7 and above.
378
- // Cannot be combined with -mno-movt or -mlong-calls
379
- if (Arg *A = Args.getLastArg (options::OPT_mexecute_only, options::OPT_mno_execute_only)) {
380
- if (A->getOption ().matches (options::OPT_mexecute_only)) {
381
- if (getARMSubArchVersionNumber (Triple) < 7 &&
382
- llvm::ARM::parseArch (Triple.getArchName ()) != llvm::ARM::AK_ARMV6T2)
383
- D.Diag (diag::err_target_unsupported_execute_only) << Triple.getArchName ();
384
- else if (Arg *B = Args.getLastArg (options::OPT_mno_movt))
385
- D.Diag (diag::err_opt_not_valid_with_opt) << A->getAsString (Args) << B->getAsString (Args);
386
- // Long calls create constant pool entries and have not yet been fixed up
387
- // to play nicely with execute-only. Hence, they cannot be used in
388
- // execute-only code for now
389
- else if (Arg *B = Args.getLastArg (options::OPT_mlong_calls, options::OPT_mno_long_calls)) {
390
- if (B->getOption ().matches (options::OPT_mlong_calls))
377
+ // This only makes sense for the compiler, not for the assembler.
378
+ if (!ForAS) {
379
+ // Supported only on ARMv6T2 and ARMv7 and above.
380
+ // Cannot be combined with -mno-movt or -mlong-calls
381
+ if (Arg *A = Args.getLastArg (options::OPT_mexecute_only, options::OPT_mno_execute_only)) {
382
+ if (A->getOption ().matches (options::OPT_mexecute_only)) {
383
+ if (getARMSubArchVersionNumber (Triple) < 7 &&
384
+ llvm::ARM::parseArch (Triple.getArchName ()) != llvm::ARM::AK_ARMV6T2)
385
+ D.Diag (diag::err_target_unsupported_execute_only) << Triple.getArchName ();
386
+ else if (Arg *B = Args.getLastArg (options::OPT_mno_movt))
391
387
D.Diag (diag::err_opt_not_valid_with_opt) << A->getAsString (Args) << B->getAsString (Args);
388
+ // Long calls create constant pool entries and have not yet been fixed up
389
+ // to play nicely with execute-only. Hence, they cannot be used in
390
+ // execute-only code for now
391
+ else if (Arg *B = Args.getLastArg (options::OPT_mlong_calls, options::OPT_mno_long_calls)) {
392
+ if (B->getOption ().matches (options::OPT_mlong_calls))
393
+ D.Diag (diag::err_opt_not_valid_with_opt) << A->getAsString (Args) << B->getAsString (Args);
394
+ }
395
+
396
+ CmdArgs.push_back (" -backend-option" );
397
+ CmdArgs.push_back (" -arm-execute-only" );
392
398
}
393
-
394
- CmdArgs.push_back (" -backend-option" );
395
- CmdArgs.push_back (" -arm-execute-only" );
396
399
}
397
400
}
398
401
0 commit comments