From 1b9805c14dbaa3af39cf3d9e5a88d3b150c69dc8 Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Sun, 22 Dec 2024 06:11:50 -0500 Subject: [PATCH] [ELF] Move PT_OPENBSD_NOBTCFI check to readConfigs() (#120678) --- 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) {