diff --git a/cc/cc.go b/cc/cc.go index ea523ca6a..0e1d8962b 100644 --- a/cc/cc.go +++ b/cc/cc.go @@ -140,6 +140,9 @@ type Flags struct { type ObjectLinkerProperties struct { // names of other cc_object modules to link into this module using partial linking Objs []string `android:"arch_variant"` + + // if set, add an extra objcopy --prefix-symbols= step + Prefix_symbols string } // Properties used to compile all C or C++ modules diff --git a/cc/object.go b/cc/object.go index 3cc089cb0..59d523dd5 100644 --- a/cc/object.go +++ b/cc/object.go @@ -78,12 +78,29 @@ func (object *objectLinker) link(ctx ModuleContext, objs = objs.Append(deps.Objs) var outputFile android.Path + builderFlags := flagsToBuilderFlags(flags) + if len(objs.objFiles) == 1 { outputFile = objs.objFiles[0] + + if object.Properties.Prefix_symbols != "" { + output := android.PathForModuleOut(ctx, ctx.ModuleName()+objectExtension) + TransformBinaryPrefixSymbols(ctx, object.Properties.Prefix_symbols, outputFile, + builderFlags, output) + outputFile = output + } } else { output := android.PathForModuleOut(ctx, ctx.ModuleName()+objectExtension) - TransformObjsToObj(ctx, objs.objFiles, flagsToBuilderFlags(flags), output) outputFile = output + + if object.Properties.Prefix_symbols != "" { + input := android.PathForModuleOut(ctx, "unprefixed", ctx.ModuleName()+objectExtension) + TransformBinaryPrefixSymbols(ctx, object.Properties.Prefix_symbols, input, + builderFlags, output) + output = input + } + + TransformObjsToObj(ctx, objs.objFiles, builderFlags, output) } ctx.CheckbuildFile(outputFile)