[lld] [LLD] [COFF] Print a warning when using /dependentloadflag without load config (PR #117400)

via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 2 00:43:36 PST 2024


================
@@ -2307,8 +2307,11 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
 
   // Handle /dependentloadflag
   for (auto *arg :
-       args.filtered(OPT_dependentloadflag, OPT_dependentloadflag_opt))
+       args.filtered(OPT_dependentloadflag, OPT_dependentloadflag_opt)) {
     parseDependentLoadFlags(arg);
+    if (!ctx.symtab.findUnderscore("_load_config_used"))
+      warn("_load_config_used not found, /delayloadflag will have no effect");
+  }
----------------
alvinhochun wrote:

My preference would be to put the check closer to where the field in `_load_config_used` is being set, and given that `Writer::prepareLoadConfig` already does other checks on `_load_config_used`, it just seems to me to be the more logical place to add the check.

(I was also a bit concerned that resolving the symbol earlier than before may subtly change the behaviour and output of LLD, but I guess there isn't really much to break here.)

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


More information about the llvm-commits mailing list