[lld] [ELF] Move PT_OPENBSD_NOBTCFI check to readConfigs() (PR #120678)

Brad Smith via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 19 23:08:17 PST 2024


https://github.com/brad0 updated https://github.com/llvm/llvm-project/pull/120678

>From ea6808e7737c096e4e8586a6b1f2f79292cbe044 Mon Sep 17 00:00:00 2001
From: Brad Smith <brad at comstyle.com>
Date: Thu, 19 Dec 2024 22:35:04 -0500
Subject: [PATCH] [ELF] Move PT_OPENBSD_NOBTCFI check to readConfigs()

---
 lld/ELF/Config.h   | 2 +-
 lld/ELF/Driver.cpp | 4 +---
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/lld/ELF/Config.h b/lld/ELF/Config.h
index 48f0db6c214982..b2859486d58e93 100644
--- a/lld/ELF/Config.h
+++ b/lld/ELF/Config.h
@@ -363,7 +363,7 @@ struct Config {
   bool zInterpose;
   bool zKeepTextSectionPrefix;
   bool zLrodataAfterBss;
-  bool zNoBtCfi = false;
+  bool zNoBtCfi;
   bool zNodefaultlib;
   bool zNodelete;
   bool zNodlopen;
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index dfb17f9257c8f5..f573a8d3e19f3b 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -1487,6 +1487,7 @@ static void readConfigs(Ctx &ctx, opt::InputArgList &args) {
       args, "keep-text-section-prefix", "nokeep-text-section-prefix", false);
   ctx.arg.zLrodataAfterBss =
       getZFlag(args, "lrodata-after-bss", "nolrodata-after-bss", false);
+  ctx.arg.zNoBtCfi = hasZOption(args, "nobtcfi");
   ctx.arg.zNodefaultlib = hasZOption(args, "nodefaultlib");
   ctx.arg.zNodelete = hasZOption(args, "nodelete");
   ctx.arg.zNodlopen = hasZOption(args, "nodlopen");
@@ -1897,9 +1898,6 @@ static void setConfigs(Ctx &ctx, opt::InputArgList &args) {
       ErrAlways(ctx) << "cannot open --why-extract= file " << ctx.arg.whyExtract
                      << ": " << e.message();
   }
-
-  if (ctx.arg.osabi == ELFOSABI_OPENBSD)
-    ctx.arg.zNoBtCfi = hasZOption(args, "nobtcfi");
 }
 
 static bool isFormatBinary(Ctx &ctx, StringRef s) {



More information about the llvm-commits mailing list