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

via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 19 19:37:19 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/120678.diff


1 Files Affected:

- (modified) lld/ELF/Driver.cpp (+3-3) 


``````````diff
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index dfb17f9257c8f5..a925a714b810e2 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -1507,6 +1507,9 @@ static void readConfigs(Ctx &ctx, opt::InputArgList &args) {
   setUnresolvedSymbolPolicy(ctx, args);
   ctx.arg.power10Stubs = args.getLastArgValue(OPT_power10_stubs_eq) != "no";
 
+  if (ctx.arg.osabi == ELFOSABI_OPENBSD)
+    ctx.arg.zNoBtCfi = hasZOption(args, "nobtcfi");
+
   if (opt::Arg *arg = args.getLastArg(OPT_eb, OPT_el)) {
     if (arg->getOption().matches(OPT_eb))
       ctx.arg.optEB = true;
@@ -1897,9 +1900,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) {

``````````

</details>


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


More information about the llvm-commits mailing list