[lld] [LLD] [COFF] Print a warning when using /dependentloadflag without load config (PR #117400)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 22 15:17:07 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-platform-windows
Author: Mateusz MikuĊa (mati865)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/117400.diff
2 Files Affected:
- (modified) lld/COFF/Driver.cpp (+4-1)
- (modified) lld/test/COFF/dependentflags.test (+2)
``````````diff
diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp
index a0bff69c6302a2..8fe61d322cbec0 100644
--- a/lld/COFF/Driver.cpp
+++ b/lld/COFF/Driver.cpp
@@ -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");
+ }
if (tar) {
llvm::TimeTraceScope timeScope("Reproducer: response file");
diff --git a/lld/test/COFF/dependentflags.test b/lld/test/COFF/dependentflags.test
index 3e90511591c75e..620e65ae0ff4f3 100644
--- a/lld/test/COFF/dependentflags.test
+++ b/lld/test/COFF/dependentflags.test
@@ -20,6 +20,7 @@ RUN: not lld-link %S/Inputs/precomp-a.obj %t.ldcfg.obj /out:%t.exe /nodefaultlib
RUN: not lld-link %S/Inputs/precomp-a.obj %t.ldcfg.obj /out:%t.exe /nodefaultlib /force /dependentloadflag:zz 2>&1 | FileCheck %s --check-prefix FAIL
RUN: not lld-link %S/Inputs/precomp-a.obj %t.ldcfg.obj /out:%t.exe /nodefaultlib /force /dependentloadflag:0xf0000 2>&1 | FileCheck %s --check-prefix FAIL-RANGE
+RUN: lld-link %S/Inputs/precomp-a.obj /out:%t.exe /nodefaultlib /force /dependentloadflag:0x800 2>&1 | FileCheck %s --check-prefix WARN-NOBASE
BASE: DependentLoadFlags: 0x0
FLAGS-800: DependentLoadFlags: 0x800
@@ -29,3 +30,4 @@ FAIL: lld-link: error: /dependentloadflag: invalid argument: zz
FAIL-RANGE: lld-link: error: /dependentloadflag: invalid argument: 0xf0000
FAIL-NOARG: lld-link: error: /dependentloadflag: no argument specified
+WARN-NOBASE: lld-link: warning: _load_config_used not found, /delayloadflag will have no effect
``````````
</details>
https://github.com/llvm/llvm-project/pull/117400
More information about the llvm-commits
mailing list