diff options
author | Colin Cross <ccross@android.com> | 2015-11-23 14:01:42 -0800 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2015-11-24 21:33:29 +0000 |
commit | 41280a4225d9cd454969169da219e810b931c5bc (patch) | |
tree | dfaa90994f381e8848425eedc807f6ba77d9eb6b /cc | |
parent | c4bde7683244907d80a0b112a1fc69d01e65b32f (diff) | |
download | build_soong-41280a4225d9cd454969169da219e810b931c5bc.tar.gz build_soong-41280a4225d9cd454969169da219e810b931c5bc.tar.bz2 build_soong-41280a4225d9cd454969169da219e810b931c5bc.zip |
pass ldflags to partial ld rules
x86 crt partial ld steps need to pass -m32 through ldflags. Use gcc to
run partial ld instead of going directly to ld. Allows reusing
ToolchainLdflags, which have linker arguments prefixed with "-Wl,".
Change-Id: I1e01ca5831061a11c9f550ab198d8e5b8dccf8bd
Diffstat (limited to 'cc')
-rw-r--r-- | cc/builder.go | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/cc/builder.go b/cc/builder.go index a1d7f2c4..e3b9983b 100644 --- a/cc/builder.go +++ b/cc/builder.go @@ -63,11 +63,11 @@ var ( partialLd = pctx.StaticRule("partialLd", blueprint.RuleParams{ - Command: "$ldCmd -r ${in} -o ${out}", + Command: "$ldCmd -nostdlib -Wl,-r ${in} -o ${out} ${ldFlags}", CommandDeps: []string{"$ldCmd"}, Description: "partialLd $out", }, - "ldCmd") + "ldCmd", "ldFlags") ar = pctx.StaticRule("ar", blueprint.RuleParams{ @@ -370,7 +370,12 @@ func TransformObjToDynamicBinary(ctx common.AndroidModuleContext, func TransformObjsToObj(ctx common.AndroidModuleContext, objFiles []string, flags builderFlags, outputFile string) { - ldCmd := gccCmd(flags.toolchain, "ld") + var ldCmd string + if flags.clang { + ldCmd = "${clangPath}clang++" + } else { + ldCmd = gccCmd(flags.toolchain, "g++") + } ctx.Build(pctx, blueprint.BuildParams{ Rule: partialLd, @@ -378,6 +383,7 @@ func TransformObjsToObj(ctx common.AndroidModuleContext, objFiles []string, Inputs: objFiles, Args: map[string]string{ "ldCmd": ldCmd, + "ldFlags": flags.ldFlags, }, }) } |