Index: MinGW/Driver.cpp =================================================================== --- MinGW/Driver.cpp +++ MinGW/Driver.cpp @@ -136,6 +136,8 @@ Add("-output-def:" + StringRef(A->getValue())); if (auto *A = Args.getLastArg(OPT_image_base)) Add("-base:" + StringRef(A->getValue())); + if (auto *A = Args.getLastArg(OPT_map)) + Add("-lldmap:" + StringRef(A->getValue())); if (auto *A = Args.getLastArg(OPT_o)) Add("-out:" + StringRef(A->getValue())); Index: MinGW/Options.td =================================================================== --- MinGW/Options.td +++ MinGW/Options.td @@ -18,6 +18,8 @@ def l: JoinedOrSeparate<["-"], "l">, MetaVarName<"">, HelpText<"Root name of library to use">; def m: JoinedOrSeparate<["-"], "m">, HelpText<"Set target emulation">; +def map: S<"Map">, HelpText<"Output a linker map">; +def map_eq: J<"Map=">, Alias; def no_whole_archive: F<"no-whole-archive">, HelpText<"No longer include all object files for following archives">; def large_address_aware: Flag<["--"], "large-address-aware">, Index: test/MinGW/driver.test =================================================================== --- test/MinGW/driver.test +++ test/MinGW/driver.test @@ -134,3 +134,9 @@ RUN: ld.lld -### foo.o -m i386pe -shared --kill-at | FileCheck -check-prefix=KILL-AT %s RUN: ld.lld -### foo.o -m i386pe -shared -kill-at | FileCheck -check-prefix=KILL-AT %s KILL-AT: -kill-at + +RUN: ld.lld -### foo.o -m i386pep -Map bar.map | FileCheck -check-prefix=MAP %s +RUN: ld.lld -### foo.o -m i386pep --Map bar.map | FileCheck -check-prefix=MAP %s +RUN: ld.lld -### foo.o -m i386pep -Map=bar.map | FileCheck -check-prefix=MAP %s +RUN: ld.lld -### foo.o -m i386pep --Map=bar.map | FileCheck -check-prefix=MAP %s +MAP: -lldmap:bar.map