Merge "Enable toc support for Darwin and Windows"
am: d3ab493fa0
Change-Id: I5041fd3a6fc03ddd2f143de275755d7e5efd8a8d
This commit is contained in:
@@ -144,11 +144,11 @@ var (
|
||||
blueprint.RuleParams{
|
||||
Depfile: "${out}.d",
|
||||
Deps: blueprint.DepsGCC,
|
||||
Command: "CROSS_COMPILE=$crossCompile $tocPath -i ${in} -o ${out} -d ${out}.d",
|
||||
Command: "CROSS_COMPILE=$crossCompile $tocPath $format -i ${in} -o ${out} -d ${out}.d",
|
||||
CommandDeps: []string{"$tocPath"},
|
||||
Restat: true,
|
||||
},
|
||||
"crossCompile")
|
||||
"crossCompile", "format")
|
||||
|
||||
clangTidy = pctx.AndroidStaticRule("clangTidy",
|
||||
blueprint.RuleParams{
|
||||
@@ -759,7 +759,18 @@ func SourceAbiDiff(ctx android.ModuleContext, inputDump android.Path, referenceD
|
||||
func TransformSharedObjectToToc(ctx android.ModuleContext, inputFile android.Path,
|
||||
outputFile android.WritablePath, flags builderFlags) {
|
||||
|
||||
crossCompile := gccCmd(flags.toolchain, "")
|
||||
var format string
|
||||
var crossCompile string
|
||||
if ctx.Darwin() {
|
||||
format = "--macho"
|
||||
crossCompile = "${config.MacToolPath}"
|
||||
} else if ctx.Windows() {
|
||||
format = "--pe"
|
||||
crossCompile = gccCmd(flags.toolchain, "")
|
||||
} else {
|
||||
format = "--elf"
|
||||
crossCompile = gccCmd(flags.toolchain, "")
|
||||
}
|
||||
|
||||
ctx.Build(pctx, android.BuildParams{
|
||||
Rule: toc,
|
||||
@@ -768,6 +779,7 @@ func TransformSharedObjectToToc(ctx android.ModuleContext, inputFile android.Pat
|
||||
Input: inputFile,
|
||||
Args: map[string]string{
|
||||
"crossCompile": crossCompile,
|
||||
"format": format,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
@@ -544,15 +544,13 @@ func (library *libraryDecorator) linkShared(ctx ModuleContext,
|
||||
|
||||
builderFlags := flagsToBuilderFlags(flags)
|
||||
|
||||
if !ctx.Darwin() && !ctx.Windows() {
|
||||
// Optimize out relinking against shared libraries whose interface hasn't changed by
|
||||
// depending on a table of contents file instead of the library itself.
|
||||
tocPath := outputFile.RelPathString()
|
||||
tocPath = pathtools.ReplaceExtension(tocPath, flags.Toolchain.ShlibSuffix()[1:]+".toc")
|
||||
tocFile := android.PathForOutput(ctx, tocPath)
|
||||
library.tocFile = android.OptionalPathForPath(tocFile)
|
||||
TransformSharedObjectToToc(ctx, outputFile, tocFile, builderFlags)
|
||||
}
|
||||
// Optimize out relinking against shared libraries whose interface hasn't changed by
|
||||
// depending on a table of contents file instead of the library itself.
|
||||
tocPath := outputFile.RelPathString()
|
||||
tocPath = pathtools.ReplaceExtension(tocPath, flags.Toolchain.ShlibSuffix()[1:]+".toc")
|
||||
tocFile := android.PathForOutput(ctx, tocPath)
|
||||
library.tocFile = android.OptionalPathForPath(tocFile)
|
||||
TransformSharedObjectToToc(ctx, outputFile, tocFile, builderFlags)
|
||||
|
||||
if library.stripper.needsStrip(ctx) {
|
||||
// b/80093681, GNU strip/objcopy bug.
|
||||
|
Reference in New Issue
Block a user