diff --git a/lld/MinGW/Driver.cpp b/lld/MinGW/Driver.cpp --- a/lld/MinGW/Driver.cpp +++ b/lld/MinGW/Driver.cpp @@ -264,6 +264,8 @@ add("-filealign:" + StringRef(a->getValue())); if (auto *a = args.getLastArg(OPT_section_alignment)) add("-align:" + StringRef(a->getValue())); + if (auto *a = args.getLastArg(OPT_heap)) + add("-heap:" + StringRef(a->getValue())); if (auto *a = args.getLastArg(OPT_o)) add("-out:" + StringRef(a->getValue())); diff --git a/lld/MinGW/Options.td b/lld/MinGW/Options.td --- a/lld/MinGW/Options.td +++ b/lld/MinGW/Options.td @@ -66,6 +66,7 @@ defm gc_sections: B<"gc-sections", "Remove unused sections", "Don't remove unused sections">; +defm heap: Eq<"heap", "Set size of the initial heap">; def help: F<"help">, HelpText<"Print option help">; defm high_entropy_va: B_disable<"high-entropy-va", "Set the 'high entropy VA' flag", "Don't set the 'high entropy VA' flag">; diff --git a/lld/test/MinGW/driver.test b/lld/test/MinGW/driver.test --- a/lld/test/MinGW/driver.test +++ b/lld/test/MinGW/driver.test @@ -340,3 +340,8 @@ RUN: ld.lld -### -m i386pep foo.o --disable-stdcall-fixup --enable-stdcall-fixup 2>&1 | FileCheck -check-prefix ENABLE-FIXUP %s ENABLE-FIXUP: -stdcall-fixup{{ }} + +RUN: ld.lld -### foo.o -m i386pep -heap 8388608,16384 2>&1 | FileCheck -check-prefix=HEAP %s +RUN: ld.lld -### foo.o -m i386pep --heap 8388608,16384 2>&1 | FileCheck -check-prefix=HEAP %s +RUN: ld.lld -### foo.o -m i386pep --heap=8388608,16384 2>&1 | FileCheck -check-prefix=HEAP %s +HEAP: -heap:8388608,16384