Clang already generates code that doesn't use writeable data in executable
sections so the linker flag is all that is necessary.
-Wl,--no-execute-only can be used to turn this default off.
Differential Revision: https://reviews.llvm.org/D134289
}
if (ToolChain.getArch() == llvm::Triple::aarch64) {
+ CmdArgs.push_back("--execute-only");
+
std::string CPU = getCPUName(D, Args, Triple);
if (CPU.empty() || CPU == "generic" || CPU == "cortex-a53")
CmdArgs.push_back("--fix-cortex-a53-843419");
// CHECK: "-pie"
// CHECK: "--build-id"
// CHECK: "--hash-style=gnu"
-// CHECK-AARCH64: "--fix-cortex-a53-843419"
+// CHECK-AARCH64: "--execute-only" "--fix-cortex-a53-843419"
// CHECK: "-dynamic-linker" "ld.so.1"
// CHECK-RISCV64: "-X"
// CHECK: Scrt1.o