diff options
author | Colin Cross <ccross@android.com> | 2019-05-17 15:36:46 -0700 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2019-05-20 15:13:47 -0700 |
commit | 954bb27cd901a66351b625d3536e86ca10f5bbfc (patch) | |
tree | 3fb3309fbc2e745302c10769eecb15e50e97d7c0 | |
parent | 2c6484e334521754c6b725f9b31c71fda3c6f50d (diff) | |
download | build_soong-954bb27cd901a66351b625d3536e86ca10f5bbfc.tar.gz build_soong-954bb27cd901a66351b625d3536e86ca10f5bbfc.tar.bz2 build_soong-954bb27cd901a66351b625d3536e86ca10f5bbfc.zip |
Limit calls to strip.sh on darwin
strip.sh can use a file descriptor per .o file when run on .a files,
which can hit the system file descriptor limit on darwin. This
causes failures when manay variants of libgcc_stripped are built
simultaneously. Put all strip rules on darwin into a pool that
limits them to 10 concurrent processes, which will limit the file
descriptor usage to ~7500.
Fixes: 132822437
Test: no mention of darwinStripPool in out/soong/build.ninja on linux
Test: m libgcc_stripped on darwin
Change-Id: I3d4fbbd8d44d2e9059a79df113ab95336ec2c658
Merged-In: I3d4fbbd8d44d2e9059a79df113ab95336ec2c658
(cherry picked from commit ee3ea31a244d65ecac2e5816132db311dcfe24df)
-rw-r--r-- | cc/builder.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/cc/builder.go b/cc/builder.go index c42f56cc..f9b309d2 100644 --- a/cc/builder.go +++ b/cc/builder.go @@ -122,12 +122,25 @@ var ( _ = pctx.SourcePathVariable("stripPath", "build/soong/scripts/strip.sh") _ = pctx.SourcePathVariable("xzCmd", "prebuilts/build-tools/${config.HostPrebuiltTag}/bin/xz") + // b/132822437: objcopy uses a file descriptor per .o file when called on .a files, which runs the system out of + // file descriptors on darwin. Limit concurrent calls to 10 on darwin. + darwinStripPool = func() blueprint.Pool { + if runtime.GOOS == "darwin" { + return pctx.StaticPool("darwinStripPool", blueprint.PoolParams{ + Depth: 10, + }) + } else { + return nil + } + }() + strip = pctx.AndroidStaticRule("strip", blueprint.RuleParams{ Depfile: "${out}.d", Deps: blueprint.DepsGCC, Command: "CROSS_COMPILE=$crossCompile XZ=$xzCmd CLANG_BIN=${config.ClangBin} $stripPath ${args} -i ${in} -o ${out} -d ${out}.d", CommandDeps: []string{"$stripPath", "$xzCmd"}, + Pool: darwinStripPool, }, "args", "crossCompile") |