[lld] [ELF] Move PT_OPENBSD_WXNEEDED under osabi check like PT_OPENBSD_NOBTCFI (PR #120665)

via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 19 17:20:47 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lld

Author: Brad Smith (brad0)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/120665.diff


2 Files Affected:

- (modified) lld/ELF/Config.h (+1-1) 
- (modified) lld/ELF/Driver.cpp (+3-2) 


``````````diff
diff --git a/lld/ELF/Config.h b/lld/ELF/Config.h
index 48f0db6c214982..bf9df121c0378d 100644
--- a/lld/ELF/Config.h
+++ b/lld/ELF/Config.h
@@ -378,7 +378,7 @@ struct Config {
   uint8_t zStartStopVisibility;
   bool zText;
   bool zRetpolineplt;
-  bool zWxneeded;
+  bool zWxneeded = false;
   DiscardPolicy discard;
   GnuStackKind zGnustack;
   ICFLevel icf;
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index dfb17f9257c8f5..05e01b1a98331a 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -1503,7 +1503,6 @@ static void readConfigs(Ctx &ctx, opt::InputArgList &args) {
       getZFlag(args, "start-stop-gc", "nostart-stop-gc", true);
   ctx.arg.zStartStopVisibility = getZStartStopVisibility(ctx, args);
   ctx.arg.zText = getZFlag(args, "text", "notext", true);
-  ctx.arg.zWxneeded = hasZOption(args, "wxneeded");
   setUnresolvedSymbolPolicy(ctx, args);
   ctx.arg.power10Stubs = args.getLastArgValue(OPT_power10_stubs_eq) != "no";
 
@@ -1898,8 +1897,10 @@ static void setConfigs(Ctx &ctx, opt::InputArgList &args) {
                      << ": " << e.message();
   }
 
-  if (ctx.arg.osabi == ELFOSABI_OPENBSD)
+  if (ctx.arg.osabi == ELFOSABI_OPENBSD) {
     ctx.arg.zNoBtCfi = hasZOption(args, "nobtcfi");
+    ctx.arg.zWxneeded = hasZOption(args, "wxneeded");
+  }
 }
 
 static bool isFormatBinary(Ctx &ctx, StringRef s) {

``````````

</details>


https://github.com/llvm/llvm-project/pull/120665


More information about the llvm-commits mailing list