diff --git a/lld/COFF/DriverUtils.cpp b/lld/COFF/DriverUtils.cpp index 10a3934d53284..42c7f93381510 100644 --- a/lld/COFF/DriverUtils.cpp +++ b/lld/COFF/DriverUtils.cpp @@ -862,6 +862,9 @@ opt::InputArgList ArgParser::parse(ArrayRef argv) { << "', did you mean '" << nearest << "'"; } + if (args.hasArg(OPT_link)) + Warn(ctx) << "ignoring /link, did you pass it multiple times?"; + if (args.hasArg(OPT_lib)) Warn(ctx) << "ignoring /lib since it's not the first argument"; diff --git a/lld/COFF/Options.td b/lld/COFF/Options.td index d77478fc9c987..6c4c7f897513d 100644 --- a/lld/COFF/Options.td +++ b/lld/COFF/Options.td @@ -71,6 +71,7 @@ def noimplib : F<"noimplib">, def lib : F<"lib">, HelpText<"Act like lib.exe; must be first argument if present">; def libpath : P<"libpath", "Additional library search path">; +def link : F<"link">, HelpText<"Ignored for compatibility">; def linkrepro : Joined<["/", "-", "/?", "-?"], "linkrepro:">, MetaVarName<"directory">, HelpText<"Write repro.tar containing inputs and command to reproduce link">; diff --git a/lld/test/COFF/driver.test b/lld/test/COFF/driver.test index 8f58ff44e83e3..1c265bff75df5 100644 --- a/lld/test/COFF/driver.test +++ b/lld/test/COFF/driver.test @@ -17,6 +17,9 @@ LIBHELP: OVERVIEW: LLVM Lib # RUN: env LLD_IN_TEST=1 not lld-link /WX /lib 2>&1 | FileCheck -check-prefix=LIBBAD %s LIBBAD: ignoring /lib since it's not the first argument +# RUN: env LLD_IN_TEST=1 not lld-link /link 2>&1 | FileCheck -check-prefix=LINKBAD %s +LINKBAD: ignoring /link, did you pass it multiple times? + # RUN: yaml2obj %p/Inputs/hello32.yaml -o %t.obj # RUN: not lld-link /out:/ %t.obj 2>&1 | FileCheck -check-prefix=DIR %s DIR: cannot open output file