[lld] 460830a - [LLD][MinGW] Add --heap argument support

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 29 14:03:53 PST 2022


Author: Mateusz Mikuła
Date: 2022-01-30T00:01:45+02:00
New Revision: 460830a9c664e8cce959c660648faa7747ad8bdc

URL: https://github.com/llvm/llvm-project/commit/460830a9c664e8cce959c660648faa7747ad8bdc
DIFF: https://github.com/llvm/llvm-project/commit/460830a9c664e8cce959c660648faa7747ad8bdc.diff

LOG: [LLD][MinGW] Add --heap argument support

Noticed in https://github.com/msys2/MINGW-packages/pull/10567.

Differential Revision: https://reviews.llvm.org/D118405

Added: 
    

Modified: 
    lld/MinGW/Driver.cpp
    lld/MinGW/Options.td
    lld/test/MinGW/driver.test

Removed: 
    


################################################################################
diff  --git a/lld/MinGW/Driver.cpp b/lld/MinGW/Driver.cpp
index 10ff7cf5a7123..93a2664b06c09 100644
--- a/lld/MinGW/Driver.cpp
+++ b/lld/MinGW/Driver.cpp
@@ -264,6 +264,8 @@ bool mingw::link(ArrayRef<const char *> argsArr, llvm::raw_ostream &stdoutOS,
     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
index 019ff74ad9712..b96449ff93d9e 100644
--- a/lld/MinGW/Options.td
+++ b/lld/MinGW/Options.td
@@ -66,6 +66,7 @@ defm file_alignment: Eq<"file-alignment", "Set file alignment">;
 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
index 0077128614112..e8b00aea367a6 100644
--- a/lld/test/MinGW/driver.test
+++ b/lld/test/MinGW/driver.test
@@ -340,3 +340,8 @@ DISABLE-FIXUP: -stdcall-fixup:no
 
 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


        


More information about the llvm-commits mailing list