From 7d21c4430d506e25fb9d99d144e0e2f49d667270 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Mon, 30 Mar 2015 17:47:53 -0700 Subject: [PATCH] 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 --- cc/builder.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/cc/builder.go b/cc/builder.go index c843c2d61..cb2bf9ac0 100644 --- a/cc/builder.go +++ b/cc/builder.go @@ -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")