Index: lld/trunk/MinGW/Driver.cpp =================================================================== --- lld/trunk/MinGW/Driver.cpp +++ lld/trunk/MinGW/Driver.cpp @@ -269,6 +269,8 @@ for (auto *A : Args.filtered(OPT_require_defined)) Add("-include:" + StringRef(A->getValue())); + for (auto *A : Args.filtered(OPT_undefined)) + Add("-includeoptional:" + StringRef(A->getValue())); std::vector SearchPaths; for (auto *A : Args.filtered(OPT_L)) { Index: lld/trunk/MinGW/Options.td =================================================================== --- lld/trunk/MinGW/Options.td +++ lld/trunk/MinGW/Options.td @@ -46,6 +46,10 @@ HelpText<"Omit all symbol information from the output binary">; def strip_debug: F<"strip-debug">, HelpText<"Omit all debug information, but keep symbol information">; +def undefined: S<"u">, + HelpText<"Include symbol in the link, if available">; +def undefined_long: S<"undefined">, Alias; +def undefined_eq: J<"undefined=">, Alias; def whole_archive: F<"whole-archive">, HelpText<"Include all object files for following archives">; def v: Flag<["-"], "v">, HelpText<"Display the version number">; Index: lld/trunk/test/MinGW/driver.test =================================================================== --- lld/trunk/test/MinGW/driver.test +++ lld/trunk/test/MinGW/driver.test @@ -157,6 +157,9 @@ RUN: ld.lld -### foo.o -m i386pe -require-defined _foo --require-defined _bar -require-defined=_baz --require-defined=_foo2 | FileCheck -check-prefix=REQUIRE-DEFINED %s REQUIRE-DEFINED: -include:_foo -include:_bar -include:_baz -include:_foo2 +RUN: ld.lld -### foo.o -m i386pe -u _foo --undefined _bar -undefined=_baz --undefined=_foo2 | FileCheck -check-prefix=UNDEFINED %s +UNDEFINED: -includeoptional:_foo -includeoptional:_bar -includeoptional:_baz -includeoptional:_foo2 + RUN: ld.lld -### -m i386pep foo.o -Llibpath | FileCheck -check-prefix LIBPATH %s LIBPATH: -libpath:libpath