[PATCH] D99680: Allow /STACK in #pragma comment(linker, ...)

Alex Reinking via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 31 13:03:17 PDT 2021


alexreinking created this revision.
alexreinking added a project: lld.
alexreinking requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The Halide project uses `#pragma comment(linker, "/STACK:...")` to set the stack size high enough for our embedded compiler to run in end-user programs on Windows.

Unfortunately, lld-link.exe breaks on this when embedded in a COFF object, despite supporting the flag on the command line. MSVC's link.exe supports this fine. This patch extends support for this to lld-link.exe for better compatibility with MSVC projects.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D99680

Files:
  lld/COFF/Driver.cpp


Index: lld/COFF/Driver.cpp
===================================================================
--- lld/COFF/Driver.cpp
+++ lld/COFF/Driver.cpp
@@ -408,6 +408,9 @@
     case OPT_section:
       parseSection(arg->getValue());
       break;
+    case OPT_stack:
+      parseNumbers(arg->getValue(), &config->stackReserve, &config->stackCommit);
+      break;
     case OPT_subsystem: {
       bool gotVersion = false;
       parseSubsystem(arg->getValue(), &config->subsystem,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99680.334515.patch
Type: text/x-patch
Size: 474 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210331/12ef588e/attachment.bin>


More information about the llvm-commits mailing list