From 73e2324144f59967982e71346a00f3cf3de702f6 Mon Sep 17 00:00:00 2001 From: deraadt Date: Wed, 11 Jan 2023 14:33:33 +0000 Subject: [PATCH] arm64 and riscv64 can now do --execute-only by default ok kettenis --- gnu/llvm/lld/ELF/Driver.cpp | 14 ++++++++++++-- gnu/llvm/lld/docs/ld.lld.1 | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/gnu/llvm/lld/ELF/Driver.cpp b/gnu/llvm/lld/ELF/Driver.cpp index 4eb87a2b199..aaad7010b01 100644 --- a/gnu/llvm/lld/ELF/Driver.cpp +++ b/gnu/llvm/lld/ELF/Driver.cpp @@ -1052,8 +1052,6 @@ static void readConfigs(opt::InputArgList &args) { errorHandler().errorHandlingScript = args.getLastArgValue(OPT_error_handling_script); - config->executeOnly = - args.hasFlag(OPT_execute_only, OPT_no_execute_only, false); config->exportDynamic = args.hasFlag(OPT_export_dynamic, OPT_no_export_dynamic, false); config->filterList = args::getStrings(args, OPT_filter); @@ -1476,6 +1474,18 @@ static void setConfigs(opt::InputArgList &args) { args.hasFlag(OPT_toc_optimize, OPT_no_toc_optimize, m == EM_PPC64); config->pcRelOptimize = args.hasFlag(OPT_pcrel_optimize, OPT_no_pcrel_optimize, m == EM_PPC64); + + config->executeOnly = false; +#ifdef __OpenBSD__ + switch (m) { + case EM_AARCH64: + case EM_RISCV: + config->executeOnly = true; + break; + } +#endif + config->executeOnly = + args.hasFlag(OPT_execute_only, OPT_no_execute_only, config->executeOnly); } // Returns a value of "-format" option. diff --git a/gnu/llvm/lld/docs/ld.lld.1 b/gnu/llvm/lld/docs/ld.lld.1 index bd67e58daa4..9e08ab4f666 100644 --- a/gnu/llvm/lld/docs/ld.lld.1 +++ b/gnu/llvm/lld/docs/ld.lld.1 @@ -212,7 +212,7 @@ followed by the name of the missing library. followed by the name of the undefined symbol. .It Fl -execute-only Mark executable sections unreadable. -This option is currently only supported on AArch64. +This option is currently only supported on AArch64 and RISC-V. .It Fl -exclude-libs Ns = Ns Ar value Exclude static libraries from automatic export. .It Fl -export-dynamic , Fl E -- 2.20.1