Add late static libraries for libgcc
libgcc has to be last on the command line, after -lc for libc. Change-Id: I5c867cef59ca84e23ff5cea406da3ec3f261aa76
This commit is contained in:
parent
13af54da2d
commit
77b00fa6f1
|
@ -184,8 +184,8 @@ func TransformObjToStaticLib(ctx common.AndroidModuleContext, objFiles []string,
|
|||
// Generate a rule for compiling multiple .o files, plus static libraries, whole static libraries,
|
||||
// and shared libraires, to a shared library (.so) or dynamic executable
|
||||
func TransformObjToDynamicBinary(ctx common.AndroidModuleContext,
|
||||
objFiles, sharedLibs, staticLibs, wholeStaticLibs []string, crtBegin, crtEnd string,
|
||||
flags builderFlags, outputFile string) {
|
||||
objFiles, sharedLibs, staticLibs, lateStaticLibs, wholeStaticLibs []string,
|
||||
crtBegin, crtEnd string, flags builderFlags, outputFile string) {
|
||||
|
||||
var ldCmd string
|
||||
if flags.clang {
|
||||
|
@ -218,6 +218,8 @@ func TransformObjToDynamicBinary(ctx common.AndroidModuleContext,
|
|||
ldDirs = append(ldDirs, dir)
|
||||
}
|
||||
|
||||
libFlagsList = append(libFlagsList, lateStaticLibs...)
|
||||
|
||||
deps := []string{ldCmd}
|
||||
deps = append(deps, sharedLibs...)
|
||||
deps = append(deps, staticLibs...)
|
||||
|
|
24
cc/cc.go
24
cc/cc.go
|
@ -276,7 +276,7 @@ func (c *ccBase) findToolchain(ctx common.AndroidModuleContext) toolchain {
|
|||
}
|
||||
|
||||
type ccDeps struct {
|
||||
staticLibs, sharedLibs, wholeStaticLibs, objFiles, includeDirs []string
|
||||
staticLibs, sharedLibs, lateStaticLibs, wholeStaticLibs, objFiles, includeDirs []string
|
||||
|
||||
crtBegin, crtEnd string
|
||||
}
|
||||
|
@ -641,7 +641,7 @@ func (c *ccDynamic) AndroidDynamicDependencies(ctx common.AndroidDynamicDepender
|
|||
ctx.AddVariationDependencies([]blueprint.Variation{{"link", "shared"}}, c.systemSharedLibs()...)
|
||||
ctx.AddVariationDependencies([]blueprint.Variation{{"link", "static"}},
|
||||
"libcompiler_rt-extras",
|
||||
//"libgcov",
|
||||
"libgcov",
|
||||
"libatomic",
|
||||
"libgcc")
|
||||
|
||||
|
@ -659,8 +659,6 @@ func (c *ccDynamic) AndroidDynamicDependencies(ctx common.AndroidDynamicDepender
|
|||
return deps
|
||||
}
|
||||
|
||||
var implicitStaticLibs = []string{"libcompiler_rt-extras" /*"libgcov",*/, "libatomic", "libgcc"}
|
||||
|
||||
func (c *ccDynamic) collectDeps(ctx common.AndroidModuleContext, flags ccFlags) (ccDeps, ccFlags) {
|
||||
var newIncludeDirs []string
|
||||
|
||||
|
@ -677,10 +675,16 @@ func (c *ccDynamic) collectDeps(ctx common.AndroidModuleContext, flags ccFlags)
|
|||
|
||||
if ctx.Arch().HostOrDevice.Device() {
|
||||
var staticLibs []string
|
||||
staticLibNames := implicitStaticLibs
|
||||
staticLibNames := []string{"libcompiler_rt-extras"}
|
||||
_, staticLibs, newIncludeDirs = c.collectDepsFromList(ctx, staticLibNames)
|
||||
deps.staticLibs = append(deps.staticLibs, staticLibs...)
|
||||
deps.includeDirs = append(deps.includeDirs, newIncludeDirs...)
|
||||
|
||||
// libgcc and libatomic have to be last on the command line
|
||||
staticLibNames = []string{"libgcov", "libatomic", "libgcc"}
|
||||
_, staticLibs, newIncludeDirs = c.collectDepsFromList(ctx, staticLibNames)
|
||||
deps.lateStaticLibs = append(deps.lateStaticLibs, staticLibs...)
|
||||
deps.includeDirs = append(deps.includeDirs, newIncludeDirs...)
|
||||
}
|
||||
|
||||
ctx.VisitDirectDeps(func(m blueprint.Module) {
|
||||
|
@ -889,8 +893,9 @@ func (c *ccLibrary) compileSharedLibrary(ctx common.AndroidModuleContext,
|
|||
|
||||
outputFile := filepath.Join(common.ModuleOutDir(ctx), ctx.ModuleName()+sharedLibraryExtension)
|
||||
|
||||
TransformObjToDynamicBinary(ctx, objFiles, deps.sharedLibs, deps.staticLibs, deps.wholeStaticLibs,
|
||||
deps.crtBegin, deps.crtEnd, ccFlagsToBuilderFlags(flags), outputFile)
|
||||
TransformObjToDynamicBinary(ctx, objFiles, deps.sharedLibs, deps.staticLibs,
|
||||
deps.lateStaticLibs, deps.wholeStaticLibs, deps.crtBegin, deps.crtEnd,
|
||||
ccFlagsToBuilderFlags(flags), outputFile)
|
||||
|
||||
c.out = outputFile
|
||||
c.exportIncludeDirs = pathtools.PrefixPaths(c.properties.Export_include_dirs,
|
||||
|
@ -1059,8 +1064,9 @@ func (c *ccBinary) compileModule(ctx common.AndroidModuleContext,
|
|||
|
||||
outputFile := filepath.Join(common.ModuleOutDir(ctx), c.getStem(ctx))
|
||||
|
||||
TransformObjToDynamicBinary(ctx, objFiles, deps.sharedLibs, deps.staticLibs, deps.wholeStaticLibs,
|
||||
deps.crtBegin, deps.crtEnd, ccFlagsToBuilderFlags(flags), outputFile)
|
||||
TransformObjToDynamicBinary(ctx, objFiles, deps.sharedLibs, deps.staticLibs,
|
||||
deps.lateStaticLibs, deps.wholeStaticLibs, deps.crtBegin, deps.crtEnd,
|
||||
ccFlagsToBuilderFlags(flags), outputFile)
|
||||
|
||||
ctx.InstallFile("bin", outputFile)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue