[commit: ghc] wip/nfs-locking: Add argSizeLimit function (mainly for Ar builder). (cff887e)

git at git.haskell.org git at git.haskell.org
Thu Oct 26 23:06:44 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/nfs-locking
Link       : http://ghc.haskell.org/trac/ghc/changeset/cff887e3d3e30b187542580e8f5c4671bbe126b9/ghc

>---------------------------------------------------------------

commit cff887e3d3e30b187542580e8f5c4671bbe126b9
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Thu Jan 15 02:05:05 2015 +0000

    Add argSizeLimit function (mainly for Ar builder).


>---------------------------------------------------------------

cff887e3d3e30b187542580e8f5c4671bbe126b9
 src/Package/Base.hs | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/Package/Base.hs b/src/Package/Base.hs
index 9cf8fc8..a1eab2c 100644
--- a/src/Package/Base.hs
+++ b/src/Package/Base.hs
@@ -9,7 +9,8 @@ module Package.Base (
     commonCcArgs, commonLdArgs, commonCppArgs, commonCcWarninigArgs,
     bootPkgConstraints,
     pathArgs, packageArgs, includeArgs, pkgHsSources,
-    pkgDepObjects, pkgLibObjects
+    pkgDepObjects, pkgLibObjects,
+    argSizeLimit
     ) where
 
 import Base
@@ -147,3 +148,14 @@ findModuleFiles pkgData directories suffixes = do
         suffix  <- suffixes
         return $ dir </> modPath ++ suffix
     return $ map (toStandard . normaliseEx) files
+
+-- The argument list has a limited size on Windows. Since Windows 7 the limit
+-- is 32768 (theoretically). In practice we use 31000 to leave some breathing
+-- space for the builder's path & name, auxiliary flags, and other overheads.
+-- Use this function to set limits for other operating systems if necessary.
+argSizeLimit :: Action Int
+argSizeLimit = do
+    windows <- windowsHost
+    return $ if windows
+             then 31000
+             else 1048576 -- surely, 1MB should be enough?



More information about the ghc-commits mailing list