Skip to content

Commit 99cd4cb

Browse files
authored
[LLD][MINGW] Add --undefined-glob flag support (#109866)
1 parent c58e51a commit 99cd4cb

File tree

4 files changed

+8
-0
lines changed

4 files changed

+8
-0
lines changed

lld/MinGW/Driver.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,8 @@ bool link(ArrayRef<const char *> argsArr, llvm::raw_ostream &stdoutOS,
514514

515515
for (auto *a : args.filtered(OPT_require_defined))
516516
add("-include:" + StringRef(a->getValue()));
517+
for (auto *a : args.filtered(OPT_undefined_glob))
518+
add("-includeglob:" + StringRef(a->getValue()));
517519
for (auto *a : args.filtered(OPT_undefined))
518520
add("-includeoptional:" + StringRef(a->getValue()));
519521
for (auto *a : args.filtered(OPT_delayload))

lld/MinGW/Options.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ defm threads
139139
defm tsaware: B_disable<"tsaware",
140140
"Set the 'Terminal Server aware' flag", "Don't set the 'Terminal Server aware' flag">;
141141
defm undefined: Eq<"undefined", "Include symbol in the link, if available">;
142+
defm undefined_glob: EEq<"undefined-glob", "Force undefined symbol during linking">,
143+
MetaVarName<"<pattern>">;
142144
defm whole_archive: B<"whole-archive",
143145
"Include all object files for following archives",
144146
"No longer include all object files for following archives">;

lld/docs/ReleaseNotes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ COFF Improvements
4545

4646
MinGW Improvements
4747
------------------
48+
* ``--undefined-glob`` is now supported by translating into the ``/includeglob`` flag.
4849

4950
MachO Improvements
5051
------------------

lld/test/MinGW/driver.test

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,9 @@ REQUIRE-DEFINED: -include:_foo -include:_bar -include:_baz -include:_foo2
249249
RUN: ld.lld -### foo.o -m i386pe -u _foo --undefined _bar -undefined=_baz --undefined=_foo2 -u_foo3 2>&1 | FileCheck -check-prefix=UNDEFINED %s
250250
UNDEFINED: -includeoptional:_foo -includeoptional:_bar -includeoptional:_baz -includeoptional:_foo2 -includeoptional:_foo3
251251

252+
RUN: ld.lld -### foo.o -m i386pe --undefined-glob="_foo*" 2>&1 | FileCheck -check-prefix=UNDEFINED-GLOB %s
253+
UNDEFINED-GLOB: -includeglob:_foo*
254+
252255
RUN: ld.lld -### -m i386pep foo.o -Llibpath 2>&1 | FileCheck -check-prefix LIBPATH %s
253256
LIBPATH: -libpath:libpath
254257

0 commit comments

Comments
 (0)