[lld] [ELF] Move PT_OPENBSD_WXNEEDED under osabi check like PT_OPENBSD_NOBTCFI (PR #120665)
Brad Smith via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 19 17:20:12 PST 2024
https://github.com/brad0 created https://github.com/llvm/llvm-project/pull/120665
None
>From 66cd37da1e8f32a011b781549599ed4b7fdb6dc3 Mon Sep 17 00:00:00 2001
From: Brad Smith <brad at comstyle.com>
Date: Thu, 19 Dec 2024 20:18:47 -0500
Subject: [PATCH] [ELF] Move PT_OPENBSD_WXNEEDED under osabi check like
PT_OPENBSD_NOBTCFI
---
lld/ELF/Config.h | 2 +-
lld/ELF/Driver.cpp | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)
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) {
More information about the llvm-commits
mailing list