Refactor ccDynamic for static binaries

ccLibrary uses ccDynamic for linking shared libraries, but bypasses
it by calling directly into ccBase for static libraries.  Instead of
duplicating the same mess for ccBinary, rename ccDynamic to ccLinked
and add the logic for dealing with static or shared linkage.  This
also allows moving the stl logic out of ccBase and into ccLinked.

Change-Id: Idfa6d86de16911c8851f694d6ed92681c8939281
This commit is contained in:
Colin Cross
2015-03-26 14:43:45 -07:00
parent be96168ee3
commit ed4cf0b655
3 changed files with 298 additions and 178 deletions

View File

@@ -21,10 +21,11 @@ package cc
import (
"android/soong/common"
"github.com/google/blueprint"
"github.com/google/blueprint/pathtools"
"path/filepath"
"strings"
"github.com/google/blueprint"
"github.com/google/blueprint/pathtools"
)
const (
@@ -185,7 +186,7 @@ func TransformObjToStaticLib(ctx common.AndroidModuleContext, objFiles []string,
// and shared libraires, to a shared library (.so) or dynamic executable
func TransformObjToDynamicBinary(ctx common.AndroidModuleContext,
objFiles, sharedLibs, staticLibs, lateStaticLibs, wholeStaticLibs []string,
crtBegin, crtEnd string, flags builderFlags, outputFile string) {
crtBegin, crtEnd string, groupLate bool, flags builderFlags, outputFile string) {
var ldCmd string
if flags.clang {
@@ -218,7 +219,13 @@ func TransformObjToDynamicBinary(ctx common.AndroidModuleContext,
ldDirs = append(ldDirs, dir)
}
if groupLate {
libFlagsList = append(libFlagsList, "-Wl,--start-group")
}
libFlagsList = append(libFlagsList, lateStaticLibs...)
if groupLate {
libFlagsList = append(libFlagsList, "-Wl,--end-group")
}
deps := []string{ldCmd}
deps = append(deps, sharedLibs...)