Use @files for ld and ar

ld and ar command lines often end up larger than ARG_MAX, use Ninja's
rsp file support to automatically write the object files to a temporary
file and pass it in using @file support.

This isn't going to work on Darwin host builds, where the host
toolchains don't support @.

Change-Id: Ida2f4e114ab02df6967e863577fa324e197827d5
This commit is contained in:
Colin Cross
2015-03-30 17:47:53 -07:00
parent 577f6e4baf
commit 7d21c4430d

View File

@@ -47,9 +47,11 @@ var (
ld = pctx.StaticRule("ld",
blueprint.RuleParams{
Command: "$ldCmd ${ldDirFlags} ${crtBegin} ${in} " +
Command: "$ldCmd ${ldDirFlags} ${crtBegin} @${out}.rsp " +
"${libFlags} ${crtEnd} -o ${out} ${ldFlags} ${ldLibs}",
Description: "ld $out",
Description: "ld $out",
Rspfile: "${out}.rsp",
RspfileContent: "${in}",
},
"ldCmd", "ldDirFlags", "crtBegin", "libFlags", "crtEnd", "ldFlags", "ldLibs")
@@ -62,8 +64,10 @@ var (
ar = pctx.StaticRule("ar",
blueprint.RuleParams{
Command: "rm -f ${out} && $arCmd $arFlags $out $in",
Description: "ar $out",
Command: "rm -f ${out} && $arCmd $arFlags $out @${out}.rsp",
Description: "ar $out",
Rspfile: "${out}.rsp",
RspfileContent: "${in}",
},
"arCmd", "arFlags")