Skip to content

Commit 10fbd99

Browse files
committed
[LLD] [MinGW] Implement --dependent-load-flag option
Implement MSVC's `/DEPENDENTLOADFLAG` as `--dependent-load-flag` and forward it to COFF. I'm not sure about the name as ld.bfd doesn't support it (yet?). There is no solid need for it yet, but it's being considered: msys2/MINGW-packages#22216 (comment)
1 parent cfc574a commit 10fbd99

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

lld/MinGW/Driver.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,9 @@ bool link(ArrayRef<const char *> argsArr, llvm::raw_ostream &stdoutOS,
407407
OPT_no_allow_multiple_definition, false))
408408
add("-force:multiple");
409409

410+
if (auto *a = args.getLastArg(OPT_dependent_load_flag))
411+
add("-dependentloadflag:" + StringRef(a->getValue()));
412+
410413
if (auto *a = args.getLastArg(OPT_icf)) {
411414
StringRef s = a->getValue();
412415
if (s == "all")

lld/MinGW/Options.td

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ defm demangle: B<"demangle",
6161
"Do not demangle symbol names">;
6262
def disable_auto_import: F<"disable-auto-import">,
6363
HelpText<"Don't automatically import data symbols from other DLLs without dllimport">;
64+
defm dependent_load_flag: EEq<"dependent-load-flag", "Override default LibraryLoad flags">;
6465
def disable_runtime_pseudo_reloc: F<"disable-runtime-pseudo-reloc">,
6566
HelpText<"Don't do automatic imports that require runtime fixups">;
6667
def disable_stdcall_fixup: F<"disable-stdcall-fixup">,

lld/test/MinGW/driver.test

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,3 +462,6 @@ RUN: ld.lld -### foo.o -m i386pep --rpath foo 2>&1 | FileCheck -check-prefix=WAR
462462
RUN: ld.lld -### foo.o -m i386pep -rpath=foo 2>&1 | FileCheck -check-prefix=WARN_RPATH %s
463463
RUN: ld.lld -### foo.o -m i386pep --rpath=foo 2>&1 | FileCheck -check-prefix=WARN_RPATH %s
464464
WARN_RPATH: warning: parameter -{{-?}}rpath has no effect on PE/COFF targets
465+
466+
RUN: ld.lld -### foo.o -m i386pe --dependent-load-flag=0x800 2>&1 | FileCheck -check-prefix=DEPENDENT_LOAD_FLAG %s
467+
DEPENDENT_LOAD_FLAG: -dependentloadflag:0x800

0 commit comments

Comments
 (0)