aboutsummaryrefslogtreecommitdiff
path: root/cc
diff options
context:
space:
mode:
Diffstat (limited to 'cc')
-rw-r--r--cc/Android.bp8
-rw-r--r--cc/afdo_test.go48
-rw-r--r--cc/androidmk.go19
-rw-r--r--cc/binary.go4
-rw-r--r--cc/binary_sdk_member.go69
-rw-r--r--cc/binary_sdk_member_gob_enc.go37
-rw-r--r--cc/builder.go35
-rw-r--r--cc/builder_gob_enc.go192
-rw-r--r--cc/cc.go502
-rw-r--r--cc/cc_gob_enc.go2290
-rw-r--r--cc/cc_test.go16
-rw-r--r--cc/cc_test_only_property_test.go8
-rw-r--r--cc/ccdeps.go41
-rw-r--r--cc/cmake_snapshot.go4
-rw-r--r--cc/cmakelists.go49
-rw-r--r--cc/compdb.go36
-rw-r--r--cc/config/arm64_device.go67
-rw-r--r--cc/config/arm64_linux_host.go11
-rw-r--r--cc/config/arm_device.go35
-rw-r--r--cc/config/arm_linux_host.go32
-rw-r--r--cc/config/darwin_host.go5
-rw-r--r--cc/config/global.go26
-rw-r--r--cc/config/riscv64_device.go17
-rw-r--r--cc/config/toolchain.go1
-rw-r--r--cc/config/x86_64_device.go11
-rw-r--r--cc/config/x86_device.go5
-rw-r--r--cc/config/x86_linux_bionic_host.go12
-rw-r--r--cc/config/x86_linux_host.go41
-rw-r--r--cc/config/x86_windows_host.go25
-rw-r--r--cc/coverage.go41
-rw-r--r--cc/fuzz.go217
-rw-r--r--cc/installer.go2
-rw-r--r--cc/library.go26
-rw-r--r--cc/library_headers_test.go4
-rw-r--r--cc/library_sdk_member.go68
-rw-r--r--cc/linkable.go9
-rw-r--r--cc/linkable_gob_enc.go190
-rw-r--r--cc/linker.go60
-rw-r--r--cc/llvm_coverage_tools_zip.go55
-rw-r--r--cc/lto_test.go26
-rw-r--r--cc/makevars.go16
-rw-r--r--cc/misc_disted_files.go5
-rw-r--r--cc/ndk_library.go8
-rw-r--r--cc/ndk_test.go4
-rw-r--r--cc/ndk_translation_package.go270
-rw-r--r--cc/object.go4
-rw-r--r--cc/orderfile_test.go20
-rw-r--r--cc/prebuilt_test.go65
-rw-r--r--cc/sanitize.go35
-rw-r--r--cc/sanitize_gob_enc.go631
-rw-r--r--cc/sdk.go16
-rw-r--r--cc/test.go95
-rw-r--r--cc/testing.go2
53 files changed, 4614 insertions, 901 deletions
diff --git a/cc/Android.bp b/cc/Android.bp
index 1ac5a4a8f..fd9ad0e93 100644
--- a/cc/Android.bp
+++ b/cc/Android.bp
@@ -25,7 +25,9 @@ bootstrap_go_package {
"androidmk.go",
"api_level.go",
"builder.go",
+ "builder_gob_enc.go",
"cc.go",
+ "cc_gob_enc.go",
"ccdeps.go",
"cc_preprocess_no_configuration.go",
"check.go",
@@ -34,6 +36,8 @@ bootstrap_go_package {
"generated_cc_library.go",
"image.go",
"linkable.go",
+ "linkable_gob_enc.go",
+ "llvm_coverage_tools_zip.go",
"lto.go",
"makevars.go",
"misc_disted_files.go",
@@ -42,6 +46,7 @@ bootstrap_go_package {
"proto.go",
"rs.go",
"sanitize.go",
+ "sanitize_gob_enc.go",
"sabi.go",
"sdk.go",
"snapshot_prebuilt.go",
@@ -61,6 +66,7 @@ bootstrap_go_package {
"binary.go",
"binary_sdk_member.go",
+ "binary_sdk_member_gob_enc.go",
"fuzz.go",
"image_sdk_traits.go",
"library.go",
@@ -75,6 +81,8 @@ bootstrap_go_package {
"ndk_library.go",
"ndk_sysroot.go",
+ "ndk_translation_package.go",
+
"llndk_library.go",
"kernel_headers.go",
diff --git a/cc/afdo_test.go b/cc/afdo_test.go
index d2d5584ff..940cb697f 100644
--- a/cc/afdo_test.go
+++ b/cc/afdo_test.go
@@ -20,24 +20,8 @@ import (
"testing"
"android/soong/android"
-
- "github.com/google/blueprint"
)
-type visitDirectDepsInterface interface {
- VisitDirectDeps(blueprint.Module, func(dep blueprint.Module))
-}
-
-func hasDirectDep(ctx visitDirectDepsInterface, m android.Module, wantDep android.Module) bool {
- var found bool
- ctx.VisitDirectDeps(m, func(dep blueprint.Module) {
- if dep == wantDep {
- found = true
- }
- })
- return found
-}
-
func TestAfdoDeps(t *testing.T) {
t.Parallel()
bp := `
@@ -129,11 +113,11 @@ func TestAfdoDeps(t *testing.T) {
}
// Check dependency edge from afdo-enabled module to static deps
- if !hasDirectDep(result, libTest.Module(), libFooAfdoVariant.Module()) {
+ if !android.HasDirectDep(result, libTest.Module(), libFooAfdoVariant.Module()) {
t.Errorf("libTest missing dependency on afdo variant of libFoo")
}
- if !hasDirectDep(result, libFooAfdoVariant.Module(), libBarAfdoVariant.Module()) {
+ if !android.HasDirectDep(result, libFooAfdoVariant.Module(), libBarAfdoVariant.Module()) {
t.Errorf("libTest missing dependency on afdo variant of libBar")
}
@@ -157,11 +141,11 @@ func TestAfdoDeps(t *testing.T) {
}
// Check dependency edges of static deps
- if hasDirectDep(result, libTest.Module(), libFoo.Module()) {
+ if android.HasDirectDep(result, libTest.Module(), libFoo.Module()) {
t.Errorf("libTest should not depend on non-afdo variant of libFoo")
}
- if !hasDirectDep(result, libFoo.Module(), libBar.Module()) {
+ if !android.HasDirectDep(result, libFoo.Module(), libBar.Module()) {
t.Errorf("libFoo missing dependency on non-afdo variant of libBar")
}
@@ -191,11 +175,11 @@ func TestAfdoDeps(t *testing.T) {
}
// Check dependency edge from afdo-enabled module to static deps
- if !hasDirectDep(result, libTest32.Module(), libFooAfdoVariant32.Module()) {
+ if !android.HasDirectDep(result, libTest32.Module(), libFooAfdoVariant32.Module()) {
t.Errorf("arm32 libTest missing dependency on afdo variant of libFoo")
}
- if !hasDirectDep(result, libFooAfdoVariant32.Module(), libBarAfdoVariant32.Module()) {
+ if !android.HasDirectDep(result, libFooAfdoVariant32.Module(), libBarAfdoVariant32.Module()) {
t.Errorf("arm32 libTest missing dependency on afdo variant of libBar")
}
@@ -240,11 +224,11 @@ func TestAfdoDeps(t *testing.T) {
}
// Check dependency edge from afdo-enabled module to static deps
- if !hasDirectDep(result, libTestHost.Module(), libFooHost.Module()) {
+ if !android.HasDirectDep(result, libTestHost.Module(), libFooHost.Module()) {
t.Errorf("host libTest missing dependency on non-afdo variant of libFoo")
}
- if !hasDirectDep(result, libFooHost.Module(), libBarHost.Module()) {
+ if !android.HasDirectDep(result, libFooHost.Module(), libBarHost.Module()) {
t.Errorf("host libTest missing dependency on non-afdo variant of libBar")
}
@@ -305,11 +289,11 @@ func TestAfdoEnabledOnStaticDepNoAfdo(t *testing.T) {
libFoo := result.ModuleForTests(t, "libFoo", "android_arm64_armv8-a_static")
libBar := result.ModuleForTests(t, "libBar", "android_arm64_armv8-a_static").Module()
- if !hasDirectDep(result, libTest, libFoo.Module()) {
+ if !android.HasDirectDep(result, libTest, libFoo.Module()) {
t.Errorf("libTest missing dependency on non-afdo variant of libFoo")
}
- if !hasDirectDep(result, libFoo.Module(), libBar) {
+ if !android.HasDirectDep(result, libFoo.Module(), libBar) {
t.Errorf("libFoo missing dependency on non-afdo variant of libBar")
}
@@ -503,11 +487,11 @@ func TestMultipleAfdoRDeps(t *testing.T) {
}
// Check dependency edges of static deps
- if !hasDirectDep(result, libTest.Module(), libFooAfdoVariantWithLibTest.Module()) {
+ if !android.HasDirectDep(result, libTest.Module(), libFooAfdoVariantWithLibTest.Module()) {
t.Errorf("libTest missing dependency on afdo variant of libFoo")
}
- if !hasDirectDep(result, libBar.Module(), libFooAfdoVariantWithLibBar.Module()) {
+ if !android.HasDirectDep(result, libBar.Module(), libFooAfdoVariantWithLibBar.Module()) {
t.Errorf("libFoo missing dependency on non-afdo variant of libBar")
}
}
@@ -563,11 +547,11 @@ func TestAfdoDepsWithoutProfile(t *testing.T) {
t.Errorf("Expected 'libBarAfdoVariant' to enable afdo, but did not find %q in cflags %q", expectedCFlag, cFlags)
}
// Check dependency edge from afdo-enabled module to static deps
- if !hasDirectDep(result, libTest.Module(), libFooAfdoVariant.Module()) {
+ if !android.HasDirectDep(result, libTest.Module(), libFooAfdoVariant.Module()) {
t.Errorf("libTest missing dependency on afdo variant of libFoo")
}
- if !hasDirectDep(result, libFooAfdoVariant.Module(), libBarAfdoVariant.Module()) {
+ if !android.HasDirectDep(result, libFooAfdoVariant.Module(), libBarAfdoVariant.Module()) {
t.Errorf("libTest missing dependency on afdo variant of libBar")
}
@@ -585,11 +569,11 @@ func TestAfdoDepsWithoutProfile(t *testing.T) {
}
// Check dependency edges of static deps
- if hasDirectDep(result, libTest.Module(), libFoo.Module()) {
+ if android.HasDirectDep(result, libTest.Module(), libFoo.Module()) {
t.Errorf("libTest should not depend on non-afdo variant of libFoo")
}
- if !hasDirectDep(result, libFoo.Module(), libBar.Module()) {
+ if !android.HasDirectDep(result, libFoo.Module(), libBar.Module()) {
t.Errorf("libFoo missing dependency on non-afdo variant of libBar")
}
}
diff --git a/cc/androidmk.go b/cc/androidmk.go
index b016788ee..f6255829f 100644
--- a/cc/androidmk.go
+++ b/cc/androidmk.go
@@ -16,7 +16,6 @@ package cc
import (
"fmt"
- "io"
"path/filepath"
"strings"
@@ -212,19 +211,6 @@ func (library *libraryDecorator) androidMkWriteExportedFlags(entries *android.An
}
}
-func (library *libraryDecorator) androidMkEntriesWriteAdditionalDependenciesForSourceAbiDiff(entries *android.AndroidMkInfo) {
- if !library.static() {
- entries.AddPaths("LOCAL_ADDITIONAL_DEPENDENCIES", library.sAbiDiff)
- }
-}
-
-// TODO(ccross): remove this once apex/androidmk.go is converted to AndroidMkEntries
-func (library *libraryDecorator) androidMkWriteAdditionalDependenciesForSourceAbiDiff(w io.Writer) {
- if !library.static() {
- fmt.Fprintln(w, "LOCAL_ADDITIONAL_DEPENDENCIES +=", strings.Join(library.sAbiDiff.Strings(), " "))
- }
-}
-
func (library *libraryDecorator) prepareAndroidMKProviderInfo(config android.Config, ctx AndroidMkContext, entries *android.AndroidMkInfo) {
if library.static() {
entries.Class = "STATIC_LIBRARIES"
@@ -245,7 +231,6 @@ func (library *libraryDecorator) prepareAndroidMKProviderInfo(config android.Con
}
library.androidMkWriteExportedFlags(entries)
- library.androidMkEntriesWriteAdditionalDependenciesForSourceAbiDiff(entries)
if entries.OutputFile.Valid() {
_, _, ext := android.SplitFileExt(entries.OutputFile.Path().Base())
@@ -391,10 +376,6 @@ func (fuzz *fuzzBinary) prepareAndroidMKProviderInfo(config android.Config, ctx
ctx.subAndroidMk(config, entries, fuzz.binaryDecorator)
entries.SetBool("LOCAL_IS_FUZZ_TARGET", true)
- if fuzz.installedSharedDeps != nil {
- // TOOD: move to install dep
- entries.AddStrings("LOCAL_FUZZ_INSTALLED_SHARED_DEPS", fuzz.installedSharedDeps...)
- }
}
func (test *testLibrary) prepareAndroidMKProviderInfo(config android.Config, ctx AndroidMkContext, entries *android.AndroidMkInfo) {
diff --git a/cc/binary.go b/cc/binary.go
index 608251afc..627d5e560 100644
--- a/cc/binary.go
+++ b/cc/binary.go
@@ -551,10 +551,6 @@ func (binary *binaryDecorator) moduleInfoJSON(ctx ModuleContext, moduleInfoJSON
binary.baseLinker.moduleInfoJSON(ctx, moduleInfoJSON)
}
-func (binary *binaryDecorator) testSuiteInfo(ctx ModuleContext) {
- // not a test
-}
-
var _ overridable = (*binaryDecorator)(nil)
func init() {
diff --git a/cc/binary_sdk_member.go b/cc/binary_sdk_member.go
index 4063714ab..eabdb8c19 100644
--- a/cc/binary_sdk_member.go
+++ b/cc/binary_sdk_member.go
@@ -15,6 +15,7 @@
package cc
import (
+ "fmt"
"path/filepath"
"android/soong/android"
@@ -23,6 +24,8 @@ import (
"github.com/google/blueprint/proptools"
)
+//go:generate go run ../../blueprint/gobtools/codegen/gob_gen.go
+
func init() {
android.RegisterSdkMemberType(ccBinarySdkMemberType)
}
@@ -34,6 +37,7 @@ var ccBinarySdkMemberType = &binarySdkMemberType{
},
}
+// @auto-generate: gob
type binarySdkMemberType struct {
android.SdkMemberTypeBase
}
@@ -52,11 +56,11 @@ func (mt *binarySdkMemberType) AddDependencies(ctx android.SdkDependencyContext,
}
}
-func (mt *binarySdkMemberType) IsInstance(module android.Module) bool {
+func (mt *binarySdkMemberType) IsInstance(ctx android.ModuleContext, module android.ModuleProxy) bool {
// Check the module to see if it can be used with this module type.
- if m, ok := module.(*Module); ok {
- for _, allowableMemberType := range m.sdkMemberTypes {
- if allowableMemberType == mt {
+ if m, ok := android.OtherModuleProvider(ctx, module, CcInfoProvider); ok {
+ for _, allowableMemberType := range m.SdkMemberTypes {
+ if allowableMemberType.SdkPropertyName() == mt.SdkPropertyName() {
return true
}
}
@@ -68,10 +72,13 @@ func (mt *binarySdkMemberType) IsInstance(module android.Module) bool {
func (mt *binarySdkMemberType) AddPrebuiltModule(ctx android.SdkMemberContext, member android.SdkMember) android.BpModule {
pbm := ctx.SnapshotBuilder().AddPrebuiltModule(member, "cc_prebuilt_binary")
- ccModule := member.Variants()[0].(*Module)
+ info, ok := android.OtherModuleProvider(ctx.SdkModuleContext(), member.Variants()[0], CcInfoProvider)
+ if !ok {
+ panic(fmt.Errorf("not a cc module: %s", member.Variants()[0]))
+ }
- if stl := ccModule.stl.Properties.Stl; stl != nil {
- pbm.AddProperty("stl", proptools.String(stl))
+ if info.StlInfo != nil && info.StlInfo.Stl != nil {
+ pbm.AddProperty("stl", proptools.String(info.StlInfo.Stl))
}
return pbm
@@ -120,19 +127,49 @@ type nativeBinaryInfoProperties struct {
Nocrt bool
}
-func (p *nativeBinaryInfoProperties) PopulateFromVariant(ctx android.SdkMemberContext, variant android.Module) {
- ccModule := variant.(*Module)
+func setSharedAndSystemLibs(specifiedDeps *specifiedDeps, sharedLibs []string, systemLibs []string) {
+ specifiedDeps.sharedLibs = append(specifiedDeps.sharedLibs, sharedLibs...)
+ // Must distinguish nil and [] in system_shared_libs - ensure that [] in
+ // either input list doesn't come out as nil.
+ if specifiedDeps.systemSharedLibs == nil {
+ specifiedDeps.systemSharedLibs = systemLibs
+ } else {
+ specifiedDeps.systemSharedLibs = append(specifiedDeps.systemSharedLibs, systemLibs...)
+ }
+}
+
+func setLinkerSpecifiedDeps(linker *LinkerInfo, specifiedDeps *specifiedDeps) {
+ if linker.ObjectLinkerInfo != nil {
+ setSharedAndSystemLibs(specifiedDeps, linker.ObjectLinkerInfo.SharedLibs, linker.ObjectLinkerInfo.SystemSharedLibs)
+ return
+ }
+
+ setSharedAndSystemLibs(specifiedDeps, linker.SharedLibs, linker.SystemSharedLibs)
+
+ if linker.LibraryDecoratorInfo != nil {
+ setSharedAndSystemLibs(specifiedDeps, linker.LibraryDecoratorInfo.SharedLibs, linker.LibraryDecoratorInfo.SystemSharedLibs)
+ specifiedDeps.sharedLibs = android.FirstUniqueStrings(specifiedDeps.sharedLibs)
+ if len(specifiedDeps.systemSharedLibs) > 0 {
+ // Skip this if systemSharedLibs is either nil or [], to ensure they are
+ // retained.
+ specifiedDeps.systemSharedLibs = android.FirstUniqueStrings(specifiedDeps.systemSharedLibs)
+ }
+ }
+}
- p.archType = ccModule.Target().Arch.ArchType.String()
- p.outputFile = getRequiredMemberOutputFile(ctx, ccModule)
+func (p *nativeBinaryInfoProperties) PopulateFromVariant(ctx android.SdkMemberContext, variant android.ModuleProxy) {
+ commonInfo := android.OtherModulePointerProviderOrDefault(ctx.SdkModuleContext(), variant, android.CommonModuleInfoProvider)
+ ccInfo := android.OtherModulePointerProviderOrDefault(ctx.SdkModuleContext(), variant, CcInfoProvider)
+ p.archType = commonInfo.Target.Arch.ArchType.String()
+ p.outputFile = getRequiredMemberOutputFile(ctx, variant)
- binaryLinker := ccModule.linker.(*binaryDecorator)
- p.StaticExecutable = binaryLinker.static()
- p.Nocrt = Bool(binaryLinker.baseLinker.Properties.Nocrt)
+ if ccInfo.LinkerInfo != nil {
+ binaryLinker := ccInfo.LinkerInfo.BinaryDecoratorInfo
+ p.StaticExecutable = binaryLinker.StaticExecutable
+ p.Nocrt = binaryLinker.Nocrt
- if ccModule.linker != nil {
specifiedDeps := specifiedDeps{}
- specifiedDeps = ccModule.linker.linkerSpecifiedDeps(ctx.SdkModuleContext(), ccModule, specifiedDeps)
+ setLinkerSpecifiedDeps(ccInfo.LinkerInfo, &specifiedDeps)
p.SharedLibs = specifiedDeps.sharedLibs
p.SystemSharedLibs = specifiedDeps.systemSharedLibs
diff --git a/cc/binary_sdk_member_gob_enc.go b/cc/binary_sdk_member_gob_enc.go
new file mode 100644
index 000000000..d9e38473c
--- /dev/null
+++ b/cc/binary_sdk_member_gob_enc.go
@@ -0,0 +1,37 @@
+// Code generated by go run gob_gen.go; DO NOT EDIT.
+
+package cc
+
+import (
+ "bytes"
+ "github.com/google/blueprint/gobtools"
+)
+
+func init() {
+ binarySdkMemberTypeGobRegId = gobtools.RegisterType(func() gobtools.CustomDec { return new(binarySdkMemberType) })
+}
+
+func (r binarySdkMemberType) Encode(buf *bytes.Buffer) error {
+ var err error
+
+ if err = r.SdkMemberTypeBase.Encode(buf); err != nil {
+ return err
+ }
+ return err
+}
+
+func (r *binarySdkMemberType) Decode(buf *bytes.Reader) error {
+ var err error
+
+ if err = r.SdkMemberTypeBase.Decode(buf); err != nil {
+ return err
+ }
+
+ return err
+}
+
+var binarySdkMemberTypeGobRegId int16
+
+func (r binarySdkMemberType) GetTypeId() int16 {
+ return binarySdkMemberTypeGobRegId
+}
diff --git a/cc/builder.go b/cc/builder.go
index f4f85962d..ed1bad2f4 100644
--- a/cc/builder.go
+++ b/cc/builder.go
@@ -34,6 +34,8 @@ import (
"android/soong/remoteexec"
)
+//go:generate go run ../../blueprint/gobtools/codegen/gob_gen.go
+
const (
objectExtension = ".o"
staticLibraryExtension = ".a"
@@ -43,7 +45,7 @@ var (
pctx = android.NewPackageContext("android/soong/cc")
// Rule to invoke gcc with given command, flags, and dependencies. Outputs a .d depfile.
- cc = pctx.AndroidRemoteStaticRule("cc", android.RemoteRuleSupports{Goma: true, RBE: true},
+ cc = pctx.AndroidRemoteStaticRule("cc", android.RemoteRuleSupports{RBE: true},
blueprint.RuleParams{
Depfile: "${out}.d",
Deps: blueprint.DepsGCC,
@@ -304,8 +306,10 @@ var (
sAbiDiff = pctx.RuleFunc("sAbiDiff",
func(ctx android.PackageRuleContext) blueprint.RuleParams {
commandStr := "($sAbiDiffer ${extraFlags} -lib ${libName} -arch ${arch} -o ${out} -new ${in} -old ${referenceDump})"
- commandStr += "|| (echo '${errorMessage}'"
- commandStr += " && (mkdir -p $$DIST_DIR/abidiffs && cp ${out} $$DIST_DIR/abidiffs/)"
+ commandStr += "|| (echo 'First 50 lines of abidiff:'"
+ commandStr += " && head -n 50 ${out}"
+ commandStr += " && echo '${errorMessage}'"
+ commandStr += " && (test -n \"$$DIST_DIR\" && mkdir -p $$DIST_DIR/abidiffs && cp ${out} ${in} $$DIST_DIR/abidiffs/)"
commandStr += " && exit 1)"
return blueprint.RuleParams{
Command: commandStr,
@@ -345,6 +349,13 @@ var (
},
"cFlags")
+ // Rule to generate the elf mapping textproto file from the symbols file.
+ elfSymbolsToProto = pctx.AndroidStaticRule("elf_symbols_to_proto", blueprint.RuleParams{
+ Command: `${symbols_map} -elf $in -write_if_changed $out`,
+ Restat: true,
+ CommandDeps: []string{"${symbols_map}"},
+ })
+
// Function pointer for producting staticlibs from rlibs. Corresponds to
// rust.TransformRlibstoStaticlib(), initialized in soong-rust (rust/builder.go init())
//
@@ -370,6 +381,8 @@ func init() {
pctx.StaticVariable("relPwd", PwdPrefix())
pctx.HostBinToolVariable("SoongZipCmd", "soong_zip")
+
+ pctx.HostBinToolVariable("symbols_map", "symbols_map")
}
// builderFlags contains various types of command line flags (and settings) for use in building
@@ -440,6 +453,7 @@ type StripFlags struct {
}
// Objects is a collection of file paths corresponding to outputs for C++ related build statements.
+// @auto-generate: gob
type Objects struct {
objFiles android.Paths
tidyFiles android.Paths
@@ -471,6 +485,17 @@ func (a Objects) Append(b Objects) Objects {
}
}
+func (a Objects) Dedup() Objects {
+ return Objects{
+ objFiles: android.FirstUniquePaths(a.objFiles),
+ tidyFiles: android.FirstUniquePaths(a.tidyFiles),
+ tidyDepFiles: android.FirstUniquePaths(a.tidyDepFiles),
+ coverageFiles: android.FirstUniquePaths(a.coverageFiles),
+ sAbiDumpFiles: android.FirstUniquePaths(a.sAbiDumpFiles),
+ kytheFiles: android.FirstUniquePaths(a.kytheFiles),
+ }
+}
+
// Generate rules for compiling multiple .c, .cpp, or .S files to individual .o files
func transformSourceToObj(ctx android.ModuleContext, subdir string, srcFiles, noTidySrcs, timeoutTidySrcs android.Paths,
flags builderFlags, pathDeps android.Paths, cFlagsDeps android.Paths, sharedFlags *SharedFlags) Objects {
@@ -508,7 +533,7 @@ func transformSourceToObj(ctx android.ModuleContext, subdir string, srcFiles, no
coverageFiles = make(android.Paths, 0, len(srcObjFiles))
}
var kytheFiles android.Paths
- if flags.emitXrefs && ctx.Module() == ctx.PrimaryModule() {
+ if flags.emitXrefs && ctx.IsPrimaryModule(ctx.Module()) {
kytheFiles = make(android.Paths, 0, len(srcObjFiles))
}
@@ -685,7 +710,7 @@ func transformSourceToObj(ctx android.ModuleContext, subdir string, srcFiles, no
})
// Register post-process build statements (such as for tidy or kythe).
- if emitXref && ctx.Module() == ctx.PrimaryModule() {
+ if emitXref && ctx.IsPrimaryModule(ctx.Module()) {
kytheFile := android.ObjPathWithExt(ctx, subdir, srcFile, "kzip")
ctx.Build(pctx, android.BuildParams{
Rule: kytheExtract,
diff --git a/cc/builder_gob_enc.go b/cc/builder_gob_enc.go
new file mode 100644
index 000000000..a02b4d347
--- /dev/null
+++ b/cc/builder_gob_enc.go
@@ -0,0 +1,192 @@
+// Code generated by go run gob_gen.go; DO NOT EDIT.
+
+package cc
+
+import (
+ "android/soong/android"
+ "bytes"
+ "github.com/google/blueprint/gobtools"
+)
+
+func init() {
+ ObjectsGobRegId = gobtools.RegisterType(func() gobtools.CustomDec { return new(Objects) })
+}
+
+func (r Objects) Encode(buf *bytes.Buffer) error {
+ var err error
+
+ if err = gobtools.EncodeSimple(buf, int32(len(r.objFiles))); err != nil {
+ return err
+ }
+ for val1 := 0; val1 < len(r.objFiles); val1++ {
+ if err = gobtools.EncodeInterface(buf, r.objFiles[val1]); err != nil {
+ return err
+ }
+ }
+
+ if err = gobtools.EncodeSimple(buf, int32(len(r.tidyFiles))); err != nil {
+ return err
+ }
+ for val2 := 0; val2 < len(r.tidyFiles); val2++ {
+ if err = gobtools.EncodeInterface(buf, r.tidyFiles[val2]); err != nil {
+ return err
+ }
+ }
+
+ if err = gobtools.EncodeSimple(buf, int32(len(r.tidyDepFiles))); err != nil {
+ return err
+ }
+ for val3 := 0; val3 < len(r.tidyDepFiles); val3++ {
+ if err = gobtools.EncodeInterface(buf, r.tidyDepFiles[val3]); err != nil {
+ return err
+ }
+ }
+
+ if err = gobtools.EncodeSimple(buf, int32(len(r.coverageFiles))); err != nil {
+ return err
+ }
+ for val4 := 0; val4 < len(r.coverageFiles); val4++ {
+ if err = gobtools.EncodeInterface(buf, r.coverageFiles[val4]); err != nil {
+ return err
+ }
+ }
+
+ if err = gobtools.EncodeSimple(buf, int32(len(r.sAbiDumpFiles))); err != nil {
+ return err
+ }
+ for val5 := 0; val5 < len(r.sAbiDumpFiles); val5++ {
+ if err = gobtools.EncodeInterface(buf, r.sAbiDumpFiles[val5]); err != nil {
+ return err
+ }
+ }
+
+ if err = gobtools.EncodeSimple(buf, int32(len(r.kytheFiles))); err != nil {
+ return err
+ }
+ for val6 := 0; val6 < len(r.kytheFiles); val6++ {
+ if err = gobtools.EncodeInterface(buf, r.kytheFiles[val6]); err != nil {
+ return err
+ }
+ }
+ return err
+}
+
+func (r *Objects) Decode(buf *bytes.Reader) error {
+ var err error
+
+ var val3 int32
+ err = gobtools.DecodeSimple[int32](buf, &val3)
+ if err != nil {
+ return err
+ }
+ if val3 > 0 {
+ r.objFiles = make([]android.Path, val3)
+ for val4 := 0; val4 < int(val3); val4++ {
+ if val6, err := gobtools.DecodeInterface(buf); err != nil {
+ return err
+ } else if val6 == nil {
+ r.objFiles[val4] = nil
+ } else {
+ r.objFiles[val4] = val6.(android.Path)
+ }
+ }
+ }
+
+ var val9 int32
+ err = gobtools.DecodeSimple[int32](buf, &val9)
+ if err != nil {
+ return err
+ }
+ if val9 > 0 {
+ r.tidyFiles = make([]android.Path, val9)
+ for val10 := 0; val10 < int(val9); val10++ {
+ if val12, err := gobtools.DecodeInterface(buf); err != nil {
+ return err
+ } else if val12 == nil {
+ r.tidyFiles[val10] = nil
+ } else {
+ r.tidyFiles[val10] = val12.(android.Path)
+ }
+ }
+ }
+
+ var val15 int32
+ err = gobtools.DecodeSimple[int32](buf, &val15)
+ if err != nil {
+ return err
+ }
+ if val15 > 0 {
+ r.tidyDepFiles = make([]android.Path, val15)
+ for val16 := 0; val16 < int(val15); val16++ {
+ if val18, err := gobtools.DecodeInterface(buf); err != nil {
+ return err
+ } else if val18 == nil {
+ r.tidyDepFiles[val16] = nil
+ } else {
+ r.tidyDepFiles[val16] = val18.(android.Path)
+ }
+ }
+ }
+
+ var val21 int32
+ err = gobtools.DecodeSimple[int32](buf, &val21)
+ if err != nil {
+ return err
+ }
+ if val21 > 0 {
+ r.coverageFiles = make([]android.Path, val21)
+ for val22 := 0; val22 < int(val21); val22++ {
+ if val24, err := gobtools.DecodeInterface(buf); err != nil {
+ return err
+ } else if val24 == nil {
+ r.coverageFiles[val22] = nil
+ } else {
+ r.coverageFiles[val22] = val24.(android.Path)
+ }
+ }
+ }
+
+ var val27 int32
+ err = gobtools.DecodeSimple[int32](buf, &val27)
+ if err != nil {
+ return err
+ }
+ if val27 > 0 {
+ r.sAbiDumpFiles = make([]android.Path, val27)
+ for val28 := 0; val28 < int(val27); val28++ {
+ if val30, err := gobtools.DecodeInterface(buf); err != nil {
+ return err
+ } else if val30 == nil {
+ r.sAbiDumpFiles[val28] = nil
+ } else {
+ r.sAbiDumpFiles[val28] = val30.(android.Path)
+ }
+ }
+ }
+
+ var val33 int32
+ err = gobtools.DecodeSimple[int32](buf, &val33)
+ if err != nil {
+ return err
+ }
+ if val33 > 0 {
+ r.kytheFiles = make([]android.Path, val33)
+ for val34 := 0; val34 < int(val33); val34++ {
+ if val36, err := gobtools.DecodeInterface(buf); err != nil {
+ return err
+ } else if val36 == nil {
+ r.kytheFiles[val34] = nil
+ } else {
+ r.kytheFiles[val34] = val36.(android.Path)
+ }
+ }
+ }
+
+ return err
+}
+
+var ObjectsGobRegId int16
+
+func (r Objects) GetTypeId() int16 {
+ return ObjectsGobRegId
+}
diff --git a/cc/cc.go b/cc/cc.go
index b15ed6c7f..1e8731b10 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -21,7 +21,7 @@ package cc
import (
"errors"
"fmt"
- "io"
+ "path/filepath"
"slices"
"strconv"
"strings"
@@ -36,6 +36,9 @@ import (
"android/soong/fuzz"
)
+//go:generate go run ../../blueprint/gobtools/codegen/gob_gen.go
+
+// @auto-generate: gob
type CcMakeVarsInfo struct {
WarningsAllowed string
UsingWnoError string
@@ -44,6 +47,7 @@ type CcMakeVarsInfo struct {
var CcMakeVarsInfoProvider = blueprint.NewProvider[*CcMakeVarsInfo]()
+// @auto-generate: gob
type CcObjectInfo struct {
ObjFiles android.Paths
TidyFiles android.Paths
@@ -52,6 +56,7 @@ type CcObjectInfo struct {
var CcObjectInfoProvider = blueprint.NewProvider[CcObjectInfo]()
+// @auto-generate: gob
type AidlInterfaceInfo struct {
// list of aidl_interface sources
Sources []string
@@ -63,6 +68,7 @@ type AidlInterfaceInfo struct {
Flags []string
}
+// @auto-generate: gob
type CompilerInfo struct {
Srcs android.Paths
// list of module-specific flags that will be used for C and C++ compiles.
@@ -71,6 +77,7 @@ type CompilerInfo struct {
LibraryDecoratorInfo *LibraryDecoratorInfo
}
+// @auto-generate: gob
type LinkerInfo struct {
WholeStaticLibs []string
// list of modules that should be statically linked into this module.
@@ -79,6 +86,7 @@ type LinkerInfo struct {
SharedLibs []string
// list of modules that should only provide headers for this module.
HeaderLibs []string
+ SystemSharedLibs []string
ImplementationModuleName *string
BinaryDecoratorInfo *BinaryDecoratorInfo
@@ -90,7 +98,13 @@ type LinkerInfo struct {
PrebuiltLibraryLinkerInfo *PrebuiltLibraryLinkerInfo
}
-type BinaryDecoratorInfo struct{}
+// @auto-generate: gob
+type BinaryDecoratorInfo struct {
+ StaticExecutable bool
+ Nocrt bool
+}
+
+// @auto-generate: gob
type LibraryDecoratorInfo struct {
ExportIncludeDirs []string
InjectBsslHash bool
@@ -98,17 +112,27 @@ type LibraryDecoratorInfo struct {
// not included in the NDK.
NdkSysrootPath android.Path
VndkFileName string
+ // rename host libraries to prevent overlap with system installed libraries
+ UniqueHostSoname *bool
+ SharedLibs []string
+ SystemSharedLibs []string
+ StubsSymbolFilePath android.Path
}
+// @auto-generate: gob
type SnapshotInfo struct {
SnapshotAndroidMkSuffix string
}
+// @auto-generate: gob
type TestBinaryInfo struct {
Gtest bool
}
+
+// @auto-generate: gob
type BenchmarkDecoratorInfo struct{}
+// @auto-generate: gob
type StubDecoratorInfo struct {
AbiDumpPath android.OutputPath
HasAbiDump bool
@@ -116,24 +140,32 @@ type StubDecoratorInfo struct {
InstallPath android.Path
}
+// @auto-generate: gob
type ObjectLinkerInfo struct {
// Location of the object in the sysroot. Empty if the object is not
// included in the NDK.
- NdkSysrootPath android.Path
+ NdkSysrootPath android.Path
+ SharedLibs []string
+ SystemSharedLibs []string
}
+// @auto-generate: gob
type PrebuiltLibraryLinkerInfo struct {
VndkFileName string
}
+// @auto-generate: gob
type LibraryInfo struct {
- BuildStubs bool
+ BuildStubs bool
+ AllStubsVersions []string
}
+// @auto-generate: gob
type InstallerInfo struct {
StubDecoratorInfo *StubDecoratorInfo
}
+// @auto-generate: gob
type LocalOrGlobalFlagsInfo struct {
CommonFlags []string // Flags that apply to C, C++, and assembly source files
CFlags []string // Flags that apply to C and C++ source files
@@ -141,21 +173,47 @@ type LocalOrGlobalFlagsInfo struct {
CppFlags []string // Flags that apply to C++ source files
}
+// @auto-generate: gob
+type SanitizeInfo struct {
+ IsUnsanitizedVariant bool
+ Sanitize SanitizeUserProps
+}
+
+// @auto-generate: gob
+type StlInfo struct {
+ Stl *string
+}
+
// Common info about the cc module.
+// @auto-generate: gob
type CcInfo struct {
IsPrebuilt bool
CmakeSnapshotSupported bool
HasLlndkStubs bool
DataPaths []android.DataPath
- CompilerInfo *CompilerInfo
- LinkerInfo *LinkerInfo
- SnapshotInfo *SnapshotInfo
- LibraryInfo *LibraryInfo
- InstallerInfo *InstallerInfo
+ VendorAvailable bool
+ OdmAvailable bool
+ ProductAvailable bool
+ IsVendorPublicLibrary bool
+ DoubleLoadable bool
+ // Allowable SdkMemberTypes of this module type.
+ SdkMemberTypes []android.SdkMemberType
+ LocalFlags LocalOrGlobalFlagsInfo
+ GlobalFlags LocalOrGlobalFlagsInfo
+ SystemIncludeFlags []string
+ NoOverrideFlags []string
+ CompilerInfo *CompilerInfo
+ LinkerInfo *LinkerInfo
+ SnapshotInfo *SnapshotInfo
+ LibraryInfo *LibraryInfo
+ InstallerInfo *InstallerInfo
+ StlInfo *StlInfo
+ SanitizeInfo *SanitizeInfo
}
var CcInfoProvider = blueprint.NewProvider[*CcInfo]()
+// @auto-generate: gob
type LinkableInfo struct {
// StaticExecutable returns true if this is a binary module with "static_executable: true".
StaticExecutable bool
@@ -170,6 +228,7 @@ type LinkableInfo struct {
CoverageFiles android.Paths
// CoverageOutputFile returns the output archive of gcno coverage information files.
CoverageOutputFile android.OptionalPath
+ LinkCoverage bool
SAbiDumpFiles android.Paths
// Partition returns the partition string for this module.
Partition string
@@ -209,13 +268,21 @@ type LinkableInfo struct {
APIListCoverageXMLPath android.ModuleOutPath
// FuzzSharedLibraries returns the shared library dependencies for this module.
// Expects that IsFuzzModule returns true.
- FuzzSharedLibraries android.RuleBuilderInstalls
+ FuzzSharedLibraries InstallPairs
IsVndkPrebuiltLibrary bool
HasLLNDKStubs bool
IsLLNDKMovedToApex bool
ImplementationModuleName string
}
+// @auto-generate: gob
+type InstallPair struct {
+ Src android.Path
+ Dst android.InstallPath
+}
+
+type InstallPairs []InstallPair
+
var LinkableInfoProvider = blueprint.NewProvider[*LinkableInfo]()
func init() {
@@ -255,7 +322,6 @@ func RegisterCCBuildComponents(ctx android.RegistrationContext) {
ctx.Transition("lto", &ltoTransitionMutator{})
ctx.BottomUp("check_linktype", checkLinkTypeMutator)
- ctx.BottomUp("double_loadable", checkDoubleLoadableLibraries)
})
ctx.PostApexMutators(func(ctx android.RegisterMutatorsContext) {
@@ -699,7 +765,6 @@ type ModuleContextIntf interface {
isCfi() bool
isFuzzer() bool
isNDKStubLibrary() bool
- useClangLld(actx ModuleContext) bool
apexVariationName() string
bootstrap() bool
nativeCoverage() bool
@@ -779,7 +844,6 @@ type linker interface {
linkerFlags(ctx ModuleContext, flags Flags) Flags
linkerProps() []interface{}
baseLinkerProps() BaseLinkerProperties
- useClangLld(actx ModuleContext) bool
link(ctx ModuleContext, flags Flags, deps PathDeps, objs Objects) android.Path
appendLdflags([]string)
@@ -797,8 +861,6 @@ type linker interface {
defaultDistFiles() []android.Path
moduleInfoJSON(ctx ModuleContext, moduleInfoJSON *android.ModuleInfoJSON)
-
- testSuiteInfo(ctx ModuleContext)
}
// specifiedDeps is a tuple struct representing dependencies of a linked binary owned by the linker.
@@ -966,6 +1028,46 @@ type installDependencyTag struct {
name string
}
+type SymbolInfo struct {
+ Name string
+ ModuleDir string
+ Uninstallable bool
+ UnstrippedBinaryPath android.Path
+ InstalledStem string
+ Stem string
+ Suffix string
+}
+
+func (s *SymbolInfo) equals(other *SymbolInfo) bool {
+ return s.Name == other.Name &&
+ s.ModuleDir == other.ModuleDir &&
+ s.Uninstallable == other.Uninstallable &&
+ s.UnstrippedBinaryPath == other.UnstrippedBinaryPath &&
+ s.InstalledStem == other.InstalledStem &&
+ s.Suffix == other.Suffix
+}
+
+type SymbolInfos struct {
+ Symbols []*SymbolInfo
+}
+
+func (si *SymbolInfos) containsSymbolInfo(other *SymbolInfo) bool {
+ for _, info := range si.Symbols {
+ if info.equals(other) {
+ return true
+ }
+ }
+ return false
+}
+
+func (si *SymbolInfos) AppendSymbols(infos ...*SymbolInfo) {
+ for _, info := range infos {
+ if info.UnstrippedBinaryPath != nil && !si.containsSymbolInfo(info) {
+ si.Symbols = append(si.Symbols, infos...)
+ }
+ }
+}
+
var (
genSourceDepTag = dependencyTag{name: "gen source"}
genHeaderDepTag = dependencyTag{name: "gen header"}
@@ -1109,47 +1211,6 @@ func (c *Module) IncrementalSupported() bool {
var _ blueprint.Incremental = (*Module)(nil)
-func (c *Module) AddJSONData(d *map[string]interface{}) {
- c.AndroidModuleBase().AddJSONData(d)
- (*d)["Cc"] = map[string]interface{}{
- "SdkVersion": c.SdkVersion(),
- "MinSdkVersion": c.MinSdkVersion(),
- "VndkVersion": c.VndkVersion(),
- "ProductSpecific": c.ProductSpecific(),
- "SocSpecific": c.SocSpecific(),
- "DeviceSpecific": c.DeviceSpecific(),
- "InProduct": c.InProduct(),
- "InVendor": c.InVendor(),
- "InRamdisk": c.InRamdisk(),
- "InVendorRamdisk": c.InVendorRamdisk(),
- "InRecovery": c.InRecovery(),
- "VendorAvailable": c.VendorAvailable(),
- "ProductAvailable": c.ProductAvailable(),
- "RamdiskAvailable": c.RamdiskAvailable(),
- "VendorRamdiskAvailable": c.VendorRamdiskAvailable(),
- "RecoveryAvailable": c.RecoveryAvailable(),
- "OdmAvailable": c.OdmAvailable(),
- "InstallInData": c.InstallInData(),
- "InstallInRamdisk": c.InstallInRamdisk(),
- "InstallInSanitizerDir": c.InstallInSanitizerDir(),
- "InstallInVendorRamdisk": c.InstallInVendorRamdisk(),
- "InstallInRecovery": c.InstallInRecovery(),
- "InstallInRoot": c.InstallInRoot(),
- "IsLlndk": c.IsLlndk(),
- "IsVendorPublicLibrary": c.IsVendorPublicLibrary(),
- "ApexSdkVersion": c.apexSdkVersion,
- "AidlSrcs": c.hasAidl,
- "LexSrcs": c.hasLex,
- "ProtoSrcs": c.hasProto,
- "RenderscriptSrcs": c.hasRenderscript,
- "SyspropSrcs": c.hasSysprop,
- "WinMsgSrcs": c.hasWinMsg,
- "YaccSrsc": c.hasYacc,
- "OnlyCSrcs": !(c.hasAidl || c.hasLex || c.hasProto || c.hasRenderscript || c.hasSysprop || c.hasWinMsg || c.hasYacc),
- "OptimizeForSize": c.OptimizeForSize(),
- }
-}
-
func (c *Module) SetPreventInstall() {
c.Properties.PreventInstall = true
}
@@ -1319,7 +1380,7 @@ func (c *Module) FuzzPackagedModule() fuzz.FuzzPackagedModule {
panic(fmt.Errorf("FuzzPackagedModule called on non-fuzz module: %q", c.BaseModuleName()))
}
-func (c *Module) FuzzSharedLibraries() android.RuleBuilderInstalls {
+func (c *Module) FuzzSharedLibraries() InstallPairs {
if fuzzer, ok := c.compiler.(*fuzzBinary); ok {
return fuzzer.sharedLibraries
}
@@ -1413,6 +1474,10 @@ func (c *Module) CoverageOutputFile() android.OptionalPath {
return android.OptionalPath{}
}
+func (c *Module) LinkCoverage() bool {
+ return c.coverage != nil && c.coverage.linkCoverage
+}
+
func (c *Module) RelativeInstallPath() string {
if c.installer != nil {
return c.installer.relativeInstallPath()
@@ -1863,10 +1928,6 @@ func (ctx *moduleContextImpl) selectedStl() string {
return ""
}
-func (ctx *moduleContextImpl) useClangLld(actx ModuleContext) bool {
- return ctx.mod.linker.useClangLld(actx)
-}
-
func (ctx *moduleContextImpl) baseModuleName() string {
return ctx.mod.BaseModuleName()
}
@@ -2083,6 +2144,164 @@ var (
}
)
+func (c *Module) getSymbolInfo(ctx android.ModuleContext, t any, info *SymbolInfo) *SymbolInfo {
+ switch tt := t.(type) {
+ case *baseInstaller:
+ if tt.path != (android.InstallPath{}) {
+ path, file := filepath.Split(tt.path.String())
+ stem, suffix, _ := android.SplitFileExt(file)
+ info.ModuleDir = path
+ info.Stem = stem
+ info.Suffix = suffix
+ }
+ case *binaryDecorator:
+ c.getSymbolInfo(ctx, tt.baseInstaller, info)
+ info.UnstrippedBinaryPath = tt.unstrippedOutputFile
+ case *benchmarkDecorator:
+ c.getSymbolInfo(ctx, tt.binaryDecorator, info)
+ case *testBinary:
+ c.getSymbolInfo(ctx, tt.binaryDecorator, info)
+ c.getSymbolInfo(ctx, tt.testDecorator, info)
+ case *fuzzBinary:
+ c.getSymbolInfo(ctx, tt.binaryDecorator, info)
+ case *testLibrary:
+ c.getSymbolInfo(ctx, tt.libraryDecorator, info)
+ c.getSymbolInfo(ctx, tt.testDecorator, info)
+ case *stubDecorator:
+ info.Uninstallable = true
+ case *libraryDecorator:
+ if tt.shared() && !tt.BuildStubs() {
+ if tt.unstrippedOutputFile != nil {
+ info.UnstrippedBinaryPath = tt.unstrippedOutputFile
+ }
+ c.getSymbolInfo(ctx, tt.baseInstaller, info)
+ } else {
+ info.Uninstallable = true
+ }
+ case *prebuiltLibraryLinker:
+ c.getSymbolInfo(ctx, tt.libraryDecorator, info)
+ if tt.shared() {
+ c.getSymbolInfo(ctx, &tt.prebuiltLinker, info)
+ }
+ case *prebuiltBinaryLinker:
+ c.getSymbolInfo(ctx, tt.binaryDecorator, info)
+ c.getSymbolInfo(ctx, &tt.prebuiltLinker, info)
+ case *vndkPrebuiltLibraryDecorator:
+ info.Uninstallable = true
+ case *kernelHeadersDecorator:
+ c.getSymbolInfo(ctx, tt.libraryDecorator, info)
+ }
+ return info
+}
+
+func (c *Module) baseSymbolInfo(ctx android.ModuleContext) *SymbolInfo {
+ return &SymbolInfo{
+ Name: c.BaseModuleName() + c.SubName(),
+ ModuleDir: ctx.ModuleDir(),
+ Uninstallable: c.IsSkipInstall() || !proptools.BoolDefault(c.Properties.Installable, true) || c.NoFullInstall(),
+ }
+}
+
+func targetOutUnstripped(ctx android.ModuleContext) android.InstallPath {
+ return android.PathForModuleInPartitionInstall(ctx, "symbols")
+}
+
+func elfSymbolMappingDir(ctx android.ModuleContext) android.InstallPath {
+ return android.PathForModuleInPartitionInstall(ctx, "obj", "PACKAGING", "elf_symbol_mapping_intermediates")
+}
+
+// Generates the information to copy the symbols file to $PRODUCT_OUT/symbols directory based on
+// the symbols info. The actual copying is done in [CopySymbolsAndSetSymbolsInfoProvider].
+func getSymbolicOutputInfos(ctx android.ModuleContext, info *SymbolInfo) *android.SymbolicOutputInfo {
+
+ if info.Uninstallable || info.UnstrippedBinaryPath == nil {
+ return nil
+ }
+
+ mySymbolPath := info.ModuleDir
+
+ myUnstrippedPath := targetOutUnstripped(ctx).Join(ctx, strings.TrimPrefix(mySymbolPath, android.PathForModuleInPartitionInstall(ctx, "").String()+"/"))
+
+ myInstalledModuleStem := info.InstalledStem
+ if len(myInstalledModuleStem) == 0 {
+ myModuleStem := info.Stem
+ if len(myModuleStem) == 0 {
+ myModuleStem = info.Name
+ }
+ myInstalledModuleStem = myModuleStem + info.Suffix
+ }
+
+ symbolicOutput := myUnstrippedPath.Join(ctx, myInstalledModuleStem)
+
+ return &android.SymbolicOutputInfo{
+ UnstrippedOutputFile: info.UnstrippedBinaryPath,
+ SymbolicOutputPath: symbolicOutput,
+ }
+}
+
+func CopySymbolsAndSetSymbolsInfoProvider(ctx android.ModuleContext, symbolInfos *SymbolInfos) {
+ if android.ShouldSkipAndroidMkProcessing(ctx, ctx.Module()) {
+ return
+ }
+ var symbolicOutputInfos android.SymbolicOutputInfos
+ for _, info := range symbolInfos.Symbols {
+ if so := getSymbolicOutputInfos(ctx, info); so != nil {
+ symbolicOutputInfos = append(symbolicOutputInfos, so)
+ }
+ }
+
+ // Remove duplicates
+ symbolicOutputInfos = android.FirstUniqueFunc(symbolicOutputInfos, func(a, b *android.SymbolicOutputInfo) bool {
+ return a.UnstrippedOutputFile.String() == b.UnstrippedOutputFile.String() &&
+ a.SymbolicOutputPath.String() == b.SymbolicOutputPath.String()
+ })
+
+ // Copy the symbols files to $PRODUCT_OUT/symbols directory
+ for _, info := range symbolicOutputInfos {
+ ctx.Build(pctx, android.BuildParams{
+ Rule: android.CpNoPreserveSymlink,
+ Input: info.UnstrippedOutputFile,
+ Output: info.SymbolicOutputPath,
+ })
+ }
+
+ // Generate the elf mapping textproto file from the copied symbols file
+ for _, info := range symbolicOutputInfos {
+ symbolPath := info.SymbolicOutputPath
+ symbolSubDir := strings.TrimPrefix(filepath.Dir(symbolPath.String()), targetOutUnstripped(ctx).String()+"/")
+ protoBase := filepath.Base(symbolPath.String()) + ".textproto"
+ info.ElfMappingProtoPath = elfSymbolMappingDir(ctx).Join(ctx, symbolSubDir, protoBase)
+
+ ctx.Build(pctx, android.BuildParams{
+ Rule: elfSymbolsToProto,
+ Input: symbolPath,
+ Output: info.ElfMappingProtoPath,
+ })
+ }
+
+ android.SetProvider(ctx, android.SymbolInfosProvider, symbolicOutputInfos)
+
+ ctx.CheckbuildFile(symbolicOutputInfos.SortedUniqueSymbolicOutputPaths()...)
+ ctx.CheckbuildFile(symbolicOutputInfos.SortedUniqueElfMappingProtoPaths()...)
+}
+
+func (c *Module) collectSymbolsInfo(ctx android.ModuleContext) {
+ if !c.hideApexVariantFromMake && !c.Properties.HideFromMake {
+ infos := &SymbolInfos{}
+ for _, feature := range c.features {
+ infos.AppendSymbols(c.getSymbolInfo(ctx, feature, c.baseSymbolInfo(ctx)))
+ }
+ infos.AppendSymbols(c.getSymbolInfo(ctx, c.compiler, c.baseSymbolInfo(ctx)))
+ infos.AppendSymbols(c.getSymbolInfo(ctx, c.linker, c.baseSymbolInfo(ctx)))
+ if c.sanitize != nil {
+ infos.AppendSymbols(c.getSymbolInfo(ctx, c.sanitize, c.baseSymbolInfo(ctx)))
+ }
+ infos.AppendSymbols(c.getSymbolInfo(ctx, c.installer, c.baseSymbolInfo(ctx)))
+
+ CopySymbolsAndSetSymbolsInfoProvider(ctx, infos)
+ }
+}
+
// Returns true if a stub library could be installed in multiple apexes
func (c *Module) stubLibraryMultipleApexViolation(ctx android.ModuleContext) bool {
// If this is not an apex variant, no check necessary
@@ -2304,6 +2523,8 @@ func (c *Module) GenerateAndroidBuildActions(actx android.ModuleContext) {
buildComplianceMetadataInfo(ctx, c, deps)
+ c.checkDoubleLoadableLibraries(ctx)
+
if b, ok := c.compiler.(*baseCompiler); ok {
c.hasAidl = b.hasSrcExt(ctx, ".aidl")
c.hasLex = b.hasSrcExt(ctx, ".l") || b.hasSrcExt(ctx, ".ll")
@@ -2344,6 +2565,26 @@ func (c *Module) GenerateAndroidBuildActions(actx android.ModuleContext) {
CmakeSnapshotSupported: proptools.Bool(c.Properties.Cmake_snapshot_supported),
HasLlndkStubs: c.HasLlndkStubs(),
DataPaths: c.DataPaths(),
+ VendorAvailable: c.VendorAvailable(),
+ OdmAvailable: c.OdmAvailable(),
+ ProductAvailable: c.ProductAvailable(),
+ SdkMemberTypes: c.sdkMemberTypes,
+ IsVendorPublicLibrary: c.IsVendorPublicLibrary(),
+ DoubleLoadable: Bool(c.VendorProperties.Double_loadable),
+ LocalFlags: LocalOrGlobalFlagsInfo{
+ CommonFlags: c.flags.Local.CommonFlags,
+ CFlags: c.flags.Local.CFlags,
+ ConlyFlags: c.flags.Local.ConlyFlags,
+ CppFlags: c.flags.Local.CppFlags,
+ },
+ GlobalFlags: LocalOrGlobalFlagsInfo{
+ CommonFlags: c.flags.Global.CommonFlags,
+ CFlags: c.flags.Global.CFlags,
+ ConlyFlags: c.flags.Global.ConlyFlags,
+ CppFlags: c.flags.Global.CppFlags,
+ },
+ SystemIncludeFlags: c.flags.SystemIncludeFlags,
+ NoOverrideFlags: c.flags.NoOverrideFlags,
}
if c.compiler != nil {
cflags := c.compiler.baseCompilerProps().Cflags
@@ -2367,21 +2608,34 @@ func (c *Module) GenerateAndroidBuildActions(actx android.ModuleContext) {
if c.linker != nil {
baseLinkerProps := c.linker.baseLinkerProps()
ccInfo.LinkerInfo = &LinkerInfo{
- WholeStaticLibs: baseLinkerProps.Whole_static_libs.GetOrDefault(ctx, nil),
- StaticLibs: baseLinkerProps.Static_libs.GetOrDefault(ctx, nil),
- SharedLibs: baseLinkerProps.Shared_libs.GetOrDefault(ctx, nil),
- HeaderLibs: baseLinkerProps.Header_libs.GetOrDefault(ctx, nil),
+ WholeStaticLibs: baseLinkerProps.Whole_static_libs.GetOrDefault(ctx, nil),
+ StaticLibs: baseLinkerProps.Static_libs.GetOrDefault(ctx, nil),
+ SharedLibs: baseLinkerProps.Shared_libs.GetOrDefault(ctx, nil),
+ HeaderLibs: baseLinkerProps.Header_libs.GetOrDefault(ctx, nil),
+ SystemSharedLibs: baseLinkerProps.System_shared_libs,
}
switch decorator := c.linker.(type) {
case *binaryDecorator:
- ccInfo.LinkerInfo.BinaryDecoratorInfo = &BinaryDecoratorInfo{}
+ ccInfo.LinkerInfo.BinaryDecoratorInfo = &BinaryDecoratorInfo{
+ StaticExecutable: decorator.static(),
+ Nocrt: Bool(decorator.baseLinker.Properties.Nocrt),
+ }
case *libraryDecorator:
- lk := c.linker.(*libraryDecorator)
ccInfo.LinkerInfo.LibraryDecoratorInfo = &LibraryDecoratorInfo{
- InjectBsslHash: Bool(lk.Properties.Inject_bssl_hash),
- NdkSysrootPath: lk.ndkSysrootPath,
- VndkFileName: lk.getLibNameHelper(c.BaseModuleName(), true, false) + ".so",
+ InjectBsslHash: Bool(decorator.Properties.Inject_bssl_hash),
+ NdkSysrootPath: decorator.ndkSysrootPath,
+ VndkFileName: decorator.getLibNameHelper(c.BaseModuleName(), true, false) + ".so",
+ UniqueHostSoname: decorator.Properties.Unique_host_soname,
+ StubsSymbolFilePath: decorator.stubsSymbolFilePath,
}
+ var properties StaticOrSharedProperties
+ if decorator.static() {
+ properties = decorator.StaticProperties.Static
+ } else if decorator.shared() {
+ properties = decorator.SharedProperties.Shared
+ }
+ ccInfo.LinkerInfo.LibraryDecoratorInfo.SharedLibs = properties.Shared_libs.GetOrDefault(ctx, nil)
+ ccInfo.LinkerInfo.LibraryDecoratorInfo.SystemSharedLibs = properties.System_shared_libs
case *testBinary:
ccInfo.LinkerInfo.TestBinaryInfo = &TestBinaryInfo{
Gtest: decorator.testDecorator.gtest(),
@@ -2390,7 +2644,9 @@ func (c *Module) GenerateAndroidBuildActions(actx android.ModuleContext) {
ccInfo.LinkerInfo.BenchmarkDecoratorInfo = &BenchmarkDecoratorInfo{}
case *objectLinker:
ccInfo.LinkerInfo.ObjectLinkerInfo = &ObjectLinkerInfo{
- NdkSysrootPath: c.linker.(*objectLinker).ndkSysrootPath,
+ NdkSysrootPath: c.linker.(*objectLinker).ndkSysrootPath,
+ SharedLibs: decorator.Properties.Shared_libs.GetOrDefault(ctx, nil),
+ SystemSharedLibs: decorator.Properties.System_shared_libs,
}
case *stubDecorator:
ccInfo.LinkerInfo.StubDecoratorInfo = &StubDecoratorInfo{}
@@ -2410,12 +2666,11 @@ func (c *Module) GenerateAndroidBuildActions(actx android.ModuleContext) {
name := v.ImplementationModuleName(ctx.OtherModuleName(c))
ccInfo.LinkerInfo.ImplementationModuleName = &name
}
-
- c.linker.testSuiteInfo(ctx)
}
if c.library != nil {
ccInfo.LibraryInfo = &LibraryInfo{
- BuildStubs: c.library.BuildStubs(),
+ BuildStubs: c.library.BuildStubs(),
+ AllStubsVersions: c.library.AllStubsVersions(),
}
}
if c.installer != nil {
@@ -2429,13 +2684,66 @@ func (c *Module) GenerateAndroidBuildActions(actx android.ModuleContext) {
}
}
}
+ if c.stl != nil {
+ ccInfo.StlInfo = &StlInfo{
+ Stl: c.stl.Properties.Stl,
+ }
+ }
+ if c.sanitize != nil {
+ ccInfo.SanitizeInfo = &SanitizeInfo{
+ IsUnsanitizedVariant: c.sanitize.isUnsanitizedVariant(),
+ Sanitize: c.sanitize.Properties.Sanitize,
+ }
+ }
android.SetProvider(ctx, CcInfoProvider, &ccInfo)
+ android.SetProvider(ctx, android.TestSuiteSharedLibsInfoProvider, android.TestSuiteSharedLibsInfo{
+ MakeNames: c.Properties.AndroidMkSharedLibs,
+ })
+
+ // TODO: Refactor MakeLibName so we don't have to fake CommonModuleInfo like this
+ myCommonInfo := android.CommonModuleInfo{
+ BaseModuleName: c.BaseModuleName(),
+ Target: ctx.Target(),
+ }
+ android.SetProvider(ctx, android.MakeNameInfoProvider, android.MakeNameInfo{
+ Name: MakeLibName(&ccInfo, linkableInfo, &myCommonInfo, ctx.ModuleName()),
+ })
+
c.setOutputFiles(ctx)
if c.makeVarsInfo != nil {
android.SetProvider(ctx, CcMakeVarsInfoProvider, c.makeVarsInfo)
}
+
+ if !c.hideApexVariantFromMake && !c.Properties.HideFromMake {
+ c.collectSymbolsInfo(ctx)
+ }
+
+ ctx.FreeModuleAfterGenerateBuildActions()
+}
+
+func (c *Module) CleanupAfterBuildActions() {
+ // Clear as much of Module as possible to reduce memory usage.
+ c.generators = nil
+ c.installer = nil
+ c.features = nil
+ c.coverage = nil
+ c.fuzzer = nil
+ c.sabi = nil
+ c.lto = nil
+ c.afdo = nil
+ c.orderfile = nil
+
+ // TODO: these can be cleared after nativeBinaryInfoProperties and nativeLibInfoProperties are switched to
+ // using providers.
+ // c.linker = nil
+ // c.stl = nil
+ // c.sanitize = nil
+ // c.library = nil
+
+ // TODO: this can be cleared after ccdeps.go is switched to using providers.
+ // c.compiler = nil
}
func CreateCommonLinkableInfo(ctx android.ModuleContext, mod VersionedLinkableInterface) *LinkableInfo {
@@ -2445,6 +2753,7 @@ func CreateCommonLinkableInfo(ctx android.ModuleContext, mod VersionedLinkableIn
OutputFile: mod.OutputFile(),
UnstrippedOutputFile: mod.UnstrippedOutputFile(),
CoverageOutputFile: mod.CoverageOutputFile(),
+ LinkCoverage: mod.LinkCoverage(),
Partition: mod.Partition(),
IsStubs: mod.IsStubs(),
CcLibrary: mod.CcLibrary(),
@@ -2481,6 +2790,7 @@ func CreateCommonLinkableInfo(ctx android.ModuleContext, mod VersionedLinkableIn
info.HasLLNDKStubs = vi.HasLLNDKStubs()
info.IsLLNDKMovedToApex = vi.IsLLNDKMovedToApex()
info.ImplementationModuleName = vi.ImplementationModuleName(mod.BaseModuleName())
+ vi.AllStubsVersions()
}
if !mod.PreventInstall() && fuzz.IsValid(ctx, mod.FuzzModuleStruct()) && mod.IsFuzzModule() {
@@ -3269,14 +3579,15 @@ func checkLinkTypeMutator(ctx android.BottomUpMutatorContext) {
// If a library has a vendor variant and is a (transitive) dependency of an LLNDK library,
// it is subject to be double loaded. Such lib should be explicitly marked as double_loadable: true
// or as vndk-sp (vndk: { enabled: true, support_system_process: true}).
-func checkDoubleLoadableLibraries(ctx android.BottomUpMutatorContext) {
- check := func(child, parent android.Module) bool {
- to, ok := child.(*Module)
+func (c *Module) checkDoubleLoadableLibraries(ctx android.ModuleContext) {
+ check := func(child, parent android.ModuleProxy) bool {
+ ccInfo, ok := android.OtherModuleProvider(ctx, child, CcInfoProvider)
if !ok {
return false
}
- if lib, ok := to.linker.(*libraryDecorator); !ok || !lib.shared() {
+ linkableInfo, ok := android.OtherModuleProvider(ctx, child, LinkableInfoProvider)
+ if !ok || !linkableInfo.Shared {
return false
}
@@ -3299,30 +3610,28 @@ func checkDoubleLoadableLibraries(ctx android.BottomUpMutatorContext) {
// Even if target lib has no vendor variant, keep checking dependency
// graph in case it depends on vendor_available or product_available
// but not double_loadable transtively.
- if !to.HasNonSystemVariants() {
+ if !linkableInfo.HasNonSystemVariants {
return true
}
// The happy path. Keep tracking dependencies until we hit a non double-loadable
// one.
- if Bool(to.VendorProperties.Double_loadable) {
+ if ccInfo.DoubleLoadable {
return true
}
- if to.IsLlndk() {
+ if linkableInfo.IsLlndk {
return false
}
ctx.ModuleErrorf("links a library %q which is not LL-NDK, "+
"VNDK-SP, or explicitly marked as 'double_loadable:true'. "+
- "Dependency list: %s", ctx.OtherModuleName(to), ctx.GetPathString(false))
+ "Dependency list: %s", ctx.OtherModuleName(child), ctx.GetPathString(false))
return false
}
- if module, ok := ctx.Module().(*Module); ok {
- if lib, ok := module.linker.(*libraryDecorator); ok && lib.shared() {
- if lib.HasLLNDKStubs() {
- ctx.WalkDeps(check)
- }
+ if lib, ok := c.linker.(*libraryDecorator); ok && lib.shared() {
+ if lib.HasLLNDKStubs() {
+ ctx.WalkDepsProxy(check)
}
}
}
@@ -3444,7 +3753,8 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
commonInfo := android.OtherModulePointerProviderOrDefault(ctx, dep, android.CommonModuleInfoProvider)
if commonInfo.Target.Os != ctx.Os() {
- ctx.ModuleErrorf("OS mismatch between %q (%s) and %q (%s)", ctx.ModuleName(), ctx.Os().Name, depName, dep.Target().Os.Name)
+ ctx.ModuleErrorf("OS mismatch between %q (%s) and %q (%s)", ctx.ModuleName(), ctx.Os().Name, depName,
+ commonInfo.Target.Os.Name)
return
}
if commonInfo.Target.Arch.ArchType != ctx.Arch().ArchType {
@@ -3749,6 +4059,10 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
depPaths.GeneratedDeps = android.FirstUniquePaths(depPaths.GeneratedDeps)
depPaths.RustRlibDeps = android.FirstUniqueFunc(depPaths.RustRlibDeps, EqRustRlibDeps)
+ depPaths.WholeStaticLibObjs = depPaths.WholeStaticLibObjs.Dedup()
+ depPaths.WholeStaticLibsFromPrebuilts = android.FirstUniquePaths(depPaths.WholeStaticLibsFromPrebuilts)
+ depPaths.Objs = depPaths.Objs.Dedup()
+
depPaths.ReexportedDirs = android.FirstUniquePaths(depPaths.ReexportedDirs)
depPaths.ReexportedSystemDirs = android.FirstUniquePaths(depPaths.ReexportedSystemDirs)
depPaths.ReexportedFlags = android.FirstUniqueStrings(depPaths.ReexportedFlags)
@@ -3764,11 +4078,11 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
return depPaths
}
-func ShouldUseStubForApex(ctx android.ModuleContext, parent android.Module, dep android.ModuleProxy) bool {
+func ShouldUseStubForApex(ctx android.ModuleContext, parent android.ModuleOrProxy, dep android.ModuleProxy) bool {
inVendorOrProduct := false
bootstrap := false
if android.EqualModules(ctx.Module(), parent) {
- if linkable, ok := parent.(LinkableInterface); !ok {
+ if linkable, ok := ctx.Module().(LinkableInterface); !ok {
ctx.ModuleErrorf("Not a Linkable module: %q", ctx.ModuleName())
} else {
inVendorOrProduct = linkable.InVendorOrProduct()
@@ -4151,14 +4465,6 @@ func installable(c LinkableInterface, apexInfo android.ApexInfo) bool {
return false
}
-func (c *Module) AndroidMkWriteAdditionalDependenciesForSourceAbiDiff(w io.Writer) {
- if c.linker != nil {
- if library, ok := c.linker.(*libraryDecorator); ok {
- library.androidMkWriteAdditionalDependenciesForSourceAbiDiff(w)
- }
- }
-}
-
var _ android.ApexModule = (*Module)(nil)
// Implements android.ApexModule
diff --git a/cc/cc_gob_enc.go b/cc/cc_gob_enc.go
new file mode 100644
index 000000000..35c003d81
--- /dev/null
+++ b/cc/cc_gob_enc.go
@@ -0,0 +1,2290 @@
+// Code generated by go run gob_gen.go; DO NOT EDIT.
+
+package cc
+
+import (
+ "android/soong/android"
+ "bytes"
+ "github.com/google/blueprint/gobtools"
+)
+
+func init() {
+ CcMakeVarsInfoGobRegId = gobtools.RegisterType(func() gobtools.CustomDec { return new(CcMakeVarsInfo) })
+ CcObjectInfoGobRegId = gobtools.RegisterType(func() gobtools.CustomDec { return new(CcObjectInfo) })
+ AidlInterfaceInfoGobRegId = gobtools.RegisterType(func() gobtools.CustomDec { return new(AidlInterfaceInfo) })
+ CompilerInfoGobRegId = gobtools.RegisterType(func() gobtools.CustomDec { return new(CompilerInfo) })
+ LinkerInfoGobRegId = gobtools.RegisterType(func() gobtools.CustomDec { return new(LinkerInfo) })
+ BinaryDecoratorInfoGobRegId = gobtools.RegisterType(func() gobtools.CustomDec { return new(BinaryDecoratorInfo) })
+ LibraryDecoratorInfoGobRegId = gobtools.RegisterType(func() gobtools.CustomDec { return new(LibraryDecoratorInfo) })
+ SnapshotInfoGobRegId = gobtools.RegisterType(func() gobtools.CustomDec { return new(SnapshotInfo) })
+ TestBinaryInfoGobRegId = gobtools.RegisterType(func() gobtools.CustomDec { return new(TestBinaryInfo) })
+ BenchmarkDecoratorInfoGobRegId = gobtools.RegisterType(func() gobtools.CustomDec { return new(BenchmarkDecoratorInfo) })
+ StubDecoratorInfoGobRegId = gobtools.RegisterType(func() gobtools.CustomDec { return new(StubDecoratorInfo) })
+ ObjectLinkerInfoGobRegId = gobtools.RegisterType(func() gobtools.CustomDec { return new(ObjectLinkerInfo) })
+ PrebuiltLibraryLinkerInfoGobRegId = gobtools.RegisterType(func() gobtools.CustomDec { return new(PrebuiltLibraryLinkerInfo) })
+ LibraryInfoGobRegId = gobtools.RegisterType(func() gobtools.CustomDec { return new(LibraryInfo) })
+ InstallerInfoGobRegId = gobtools.RegisterType(func() gobtools.CustomDec { return new(InstallerInfo) })
+ LocalOrGlobalFlagsInfoGobRegId = gobtools.RegisterType(func() gobtools.CustomDec { return new(LocalOrGlobalFlagsInfo) })
+ SanitizeInfoGobRegId = gobtools.RegisterType(func() gobtools.CustomDec { return new(SanitizeInfo) })
+ StlInfoGobRegId = gobtools.RegisterType(func() gobtools.CustomDec { return new(StlInfo) })
+ CcInfoGobRegId = gobtools.RegisterType(func() gobtools.CustomDec { return new(CcInfo) })
+ LinkableInfoGobRegId = gobtools.RegisterType(func() gobtools.CustomDec { return new(LinkableInfo) })
+ InstallPairGobRegId = gobtools.RegisterType(func() gobtools.CustomDec { return new(InstallPair) })
+}
+
+func (r CcMakeVarsInfo) Encode(buf *bytes.Buffer) error {
+ var err error
+
+ if err = gobtools.EncodeString(buf, r.WarningsAllowed); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeString(buf, r.UsingWnoError); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeString(buf, r.MissingProfile); err != nil {
+ return err
+ }
+ return err
+}
+
+func (r *CcMakeVarsInfo) Decode(buf *bytes.Reader) error {
+ var err error
+
+ err = gobtools.DecodeString(buf, &r.WarningsAllowed)
+ if err != nil {
+ return err
+ }
+
+ err = gobtools.DecodeString(buf, &r.UsingWnoError)
+ if err != nil {
+ return err
+ }
+
+ err = gobtools.DecodeString(buf, &r.MissingProfile)
+ if err != nil {
+ return err
+ }
+
+ return err
+}
+
+var CcMakeVarsInfoGobRegId int16
+
+func (r CcMakeVarsInfo) GetTypeId() int16 {
+ return CcMakeVarsInfoGobRegId
+}
+
+func (r CcObjectInfo) Encode(buf *bytes.Buffer) error {
+ var err error
+
+ if err = gobtools.EncodeSimple(buf, int32(len(r.ObjFiles))); err != nil {
+ return err
+ }
+ for val1 := 0; val1 < len(r.ObjFiles); val1++ {
+ if err = gobtools.EncodeInterface(buf, r.ObjFiles[val1]); err != nil {
+ return err
+ }
+ }
+
+ if err = gobtools.EncodeSimple(buf, int32(len(r.TidyFiles))); err != nil {
+ return err
+ }
+ for val2 := 0; val2 < len(r.TidyFiles); val2++ {
+ if err = gobtools.EncodeInterface(buf, r.TidyFiles[val2]); err != nil {
+ return err
+ }
+ }
+
+ if err = gobtools.EncodeSimple(buf, int32(len(r.KytheFiles))); err != nil {
+ return err
+ }
+ for val3 := 0; val3 < len(r.KytheFiles); val3++ {
+ if err = gobtools.EncodeInterface(buf, r.KytheFiles[val3]); err != nil {
+ return err
+ }
+ }
+ return err
+}
+
+func (r *CcObjectInfo) Decode(buf *bytes.Reader) error {
+ var err error
+
+ var val3 int32
+ err = gobtools.DecodeSimple[int32](buf, &val3)
+ if err != nil {
+ return err
+ }
+ if val3 > 0 {
+ r.ObjFiles = make([]android.Path, val3)
+ for val4 := 0; val4 < int(val3); val4++ {
+ if val6, err := gobtools.DecodeInterface(buf); err != nil {
+ return err
+ } else if val6 == nil {
+ r.ObjFiles[val4] = nil
+ } else {
+ r.ObjFiles[val4] = val6.(android.Path)
+ }
+ }
+ }
+
+ var val9 int32
+ err = gobtools.DecodeSimple[int32](buf, &val9)
+ if err != nil {
+ return err
+ }
+ if val9 > 0 {
+ r.TidyFiles = make([]android.Path, val9)
+ for val10 := 0; val10 < int(val9); val10++ {
+ if val12, err := gobtools.DecodeInterface(buf); err != nil {
+ return err
+ } else if val12 == nil {
+ r.TidyFiles[val10] = nil
+ } else {
+ r.TidyFiles[val10] = val12.(android.Path)
+ }
+ }
+ }
+
+ var val15 int32
+ err = gobtools.DecodeSimple[int32](buf, &val15)
+ if err != nil {
+ return err
+ }
+ if val15 > 0 {
+ r.KytheFiles = make([]android.Path, val15)
+ for val16 := 0; val16 < int(val15); val16++ {
+ if val18, err := gobtools.DecodeInterface(buf); err != nil {
+ return err
+ } else if val18 == nil {
+ r.KytheFiles[val16] = nil
+ } else {
+ r.KytheFiles[val16] = val18.(android.Path)
+ }
+ }
+ }
+
+ return err
+}
+
+var CcObjectInfoGobRegId int16
+
+func (r CcObjectInfo) GetTypeId() int16 {
+ return CcObjectInfoGobRegId
+}
+
+func (r AidlInterfaceInfo) Encode(buf *bytes.Buffer) error {
+ var err error
+
+ if err = gobtools.EncodeSimple(buf, int32(len(r.Sources))); err != nil {
+ return err
+ }
+ for val1 := 0; val1 < len(r.Sources); val1++ {
+ if err = gobtools.EncodeString(buf, r.Sources[val1]); err != nil {
+ return err
+ }
+ }
+
+ if err = gobtools.EncodeString(buf, r.AidlRoot); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeString(buf, r.Lang); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeSimple(buf, int32(len(r.Flags))); err != nil {
+ return err
+ }
+ for val2 := 0; val2 < len(r.Flags); val2++ {
+ if err = gobtools.EncodeString(buf, r.Flags[val2]); err != nil {
+ return err
+ }
+ }
+ return err
+}
+
+func (r *AidlInterfaceInfo) Decode(buf *bytes.Reader) error {
+ var err error
+
+ var val2 int32
+ err = gobtools.DecodeSimple[int32](buf, &val2)
+ if err != nil {
+ return err
+ }
+ if val2 > 0 {
+ r.Sources = make([]string, val2)
+ for val3 := 0; val3 < int(val2); val3++ {
+ err = gobtools.DecodeString(buf, &r.Sources[val3])
+ if err != nil {
+ return err
+ }
+ }
+ }
+
+ err = gobtools.DecodeString(buf, &r.AidlRoot)
+ if err != nil {
+ return err
+ }
+
+ err = gobtools.DecodeString(buf, &r.Lang)
+ if err != nil {
+ return err
+ }
+
+ var val8 int32
+ err = gobtools.DecodeSimple[int32](buf, &val8)
+ if err != nil {
+ return err
+ }
+ if val8 > 0 {
+ r.Flags = make([]string, val8)
+ for val9 := 0; val9 < int(val8); val9++ {
+ err = gobtools.DecodeString(buf, &r.Flags[val9])
+ if err != nil {
+ return err
+ }
+ }
+ }
+
+ return err
+}
+
+var AidlInterfaceInfoGobRegId int16
+
+func (r AidlInterfaceInfo) GetTypeId() int16 {
+ return AidlInterfaceInfoGobRegId
+}
+
+func (r CompilerInfo) Encode(buf *bytes.Buffer) error {
+ var err error
+
+ if err = gobtools.EncodeSimple(buf, int32(len(r.Srcs))); err != nil {
+ return err
+ }
+ for val1 := 0; val1 < len(r.Srcs); val1++ {
+ if err = gobtools.EncodeInterface(buf, r.Srcs[val1]); err != nil {
+ return err
+ }
+ }
+
+ if err = gobtools.EncodeSimple(buf, int32(len(r.Cflags))); err != nil {
+ return err
+ }
+ for val2 := 0; val2 < len(r.Cflags); val2++ {
+ if err = gobtools.EncodeString(buf, r.Cflags[val2]); err != nil {
+ return err
+ }
+ }
+
+ if err = r.AidlInterfaceInfo.Encode(buf); err != nil {
+ return err
+ }
+
+ val3 := r.LibraryDecoratorInfo == nil
+ if err = gobtools.EncodeSimple(buf, val3); err != nil {
+ return err
+ }
+ if !val3 {
+ if err = (*r.LibraryDecoratorInfo).Encode(buf); err != nil {
+ return err
+ }
+ }
+ return err
+}
+
+func (r *CompilerInfo) Decode(buf *bytes.Reader) error {
+ var err error
+
+ var val3 int32
+ err = gobtools.DecodeSimple[int32](buf, &val3)
+ if err != nil {
+ return err
+ }
+ if val3 > 0 {
+ r.Srcs = make([]android.Path, val3)
+ for val4 := 0; val4 < int(val3); val4++ {
+ if val6, err := gobtools.DecodeInterface(buf); err != nil {
+ return err
+ } else if val6 == nil {
+ r.Srcs[val4] = nil
+ } else {
+ r.Srcs[val4] = val6.(android.Path)
+ }
+ }
+ }
+
+ var val8 int32
+ err = gobtools.DecodeSimple[int32](buf, &val8)
+ if err != nil {
+ return err
+ }
+ if val8 > 0 {
+ r.Cflags = make([]string, val8)
+ for val9 := 0; val9 < int(val8); val9++ {
+ err = gobtools.DecodeString(buf, &r.Cflags[val9])
+ if err != nil {
+ return err
+ }
+ }
+ }
+
+ if err = r.AidlInterfaceInfo.Decode(buf); err != nil {
+ return err
+ }
+
+ var val13 bool
+ if err = gobtools.DecodeSimple(buf, &val13); err != nil {
+ return err
+ }
+ if !val13 {
+ var val12 LibraryDecoratorInfo
+ if err = val12.Decode(buf); err != nil {
+ return err
+ }
+ r.LibraryDecoratorInfo = &val12
+ }
+
+ return err
+}
+
+var CompilerInfoGobRegId int16
+
+func (r CompilerInfo) GetTypeId() int16 {
+ return CompilerInfoGobRegId
+}
+
+func (r LinkerInfo) Encode(buf *bytes.Buffer) error {
+ var err error
+
+ if err = gobtools.EncodeSimple(buf, int32(len(r.WholeStaticLibs))); err != nil {
+ return err
+ }
+ for val1 := 0; val1 < len(r.WholeStaticLibs); val1++ {
+ if err = gobtools.EncodeString(buf, r.WholeStaticLibs[val1]); err != nil {
+ return err
+ }
+ }
+
+ if err = gobtools.EncodeSimple(buf, int32(len(r.StaticLibs))); err != nil {
+ return err
+ }
+ for val2 := 0; val2 < len(r.StaticLibs); val2++ {
+ if err = gobtools.EncodeString(buf, r.StaticLibs[val2]); err != nil {
+ return err
+ }
+ }
+
+ if err = gobtools.EncodeSimple(buf, int32(len(r.SharedLibs))); err != nil {
+ return err
+ }
+ for val3 := 0; val3 < len(r.SharedLibs); val3++ {
+ if err = gobtools.EncodeString(buf, r.SharedLibs[val3]); err != nil {
+ return err
+ }
+ }
+
+ if err = gobtools.EncodeSimple(buf, int32(len(r.HeaderLibs))); err != nil {
+ return err
+ }
+ for val4 := 0; val4 < len(r.HeaderLibs); val4++ {
+ if err = gobtools.EncodeString(buf, r.HeaderLibs[val4]); err != nil {
+ return err
+ }
+ }
+
+ if err = gobtools.EncodeSimple(buf, int32(len(r.SystemSharedLibs))); err != nil {
+ return err
+ }
+ for val5 := 0; val5 < len(r.SystemSharedLibs); val5++ {
+ if err = gobtools.EncodeString(buf, r.SystemSharedLibs[val5]); err != nil {
+ return err
+ }
+ }
+
+ val6 := r.ImplementationModuleName == nil
+ if err = gobtools.EncodeSimple(buf, val6); err != nil {
+ return err
+ }
+ if !val6 {
+ if err = gobtools.EncodeString(buf, (*r.ImplementationModuleName)); err != nil {
+ return err
+ }
+ }
+
+ val7 := r.BinaryDecoratorInfo == nil
+ if err = gobtools.EncodeSimple(buf, val7); err != nil {
+ return err
+ }
+ if !val7 {
+ if err = (*r.BinaryDecoratorInfo).Encode(buf); err != nil {
+ return err
+ }
+ }
+
+ val8 := r.LibraryDecoratorInfo == nil
+ if err = gobtools.EncodeSimple(buf, val8); err != nil {
+ return err
+ }
+ if !val8 {
+ if err = (*r.LibraryDecoratorInfo).Encode(buf); err != nil {
+ return err
+ }
+ }
+
+ val9 := r.TestBinaryInfo == nil
+ if err = gobtools.EncodeSimple(buf, val9); err != nil {
+ return err
+ }
+ if !val9 {
+ if err = (*r.TestBinaryInfo).Encode(buf); err != nil {
+ return err
+ }
+ }
+
+ val10 := r.BenchmarkDecoratorInfo == nil
+ if err = gobtools.EncodeSimple(buf, val10); err != nil {
+ return err
+ }
+ if !val10 {
+ if err = (*r.BenchmarkDecoratorInfo).Encode(buf); err != nil {
+ return err
+ }
+ }
+
+ val11 := r.ObjectLinkerInfo == nil
+ if err = gobtools.EncodeSimple(buf, val11); err != nil {
+ return err
+ }
+ if !val11 {
+ if err = (*r.ObjectLinkerInfo).Encode(buf); err != nil {
+ return err
+ }
+ }
+
+ val12 := r.StubDecoratorInfo == nil
+ if err = gobtools.EncodeSimple(buf, val12); err != nil {
+ return err
+ }
+ if !val12 {
+ if err = (*r.StubDecoratorInfo).Encode(buf); err != nil {
+ return err
+ }
+ }
+
+ val13 := r.PrebuiltLibraryLinkerInfo == nil
+ if err = gobtools.EncodeSimple(buf, val13); err != nil {
+ return err
+ }
+ if !val13 {
+ if err = (*r.PrebuiltLibraryLinkerInfo).Encode(buf); err != nil {
+ return err
+ }
+ }
+ return err
+}
+
+func (r *LinkerInfo) Decode(buf *bytes.Reader) error {
+ var err error
+
+ var val2 int32
+ err = gobtools.DecodeSimple[int32](buf, &val2)
+ if err != nil {
+ return err
+ }
+ if val2 > 0 {
+ r.WholeStaticLibs = make([]string, val2)
+ for val3 := 0; val3 < int(val2); val3++ {
+ err = gobtools.DecodeString(buf, &r.WholeStaticLibs[val3])
+ if err != nil {
+ return err
+ }
+ }
+ }
+
+ var val6 int32
+ err = gobtools.DecodeSimple[int32](buf, &val6)
+ if err != nil {
+ return err
+ }
+ if val6 > 0 {
+ r.StaticLibs = make([]string, val6)
+ for val7 := 0; val7 < int(val6); val7++ {
+ err = gobtools.DecodeString(buf, &r.StaticLibs[val7])
+ if err != nil {
+ return err
+ }
+ }
+ }
+
+ var val10 int32
+ err = gobtools.DecodeSimple[int32](buf, &val10)
+ if err != nil {
+ return err
+ }
+ if val10 > 0 {
+ r.SharedLibs = make([]string, val10)
+ for val11 := 0; val11 < int(val10); val11++ {
+ err = gobtools.DecodeString(buf, &r.SharedLibs[val11])
+ if err != nil {
+ return err
+ }
+ }
+ }
+
+ var val14 int32
+ err = gobtools.DecodeSimple[int32](buf, &val14)
+ if err != nil {
+ return err
+ }
+ if val14 > 0 {
+ r.HeaderLibs = make([]string, val14)
+ for val15 := 0; val15 < int(val14); val15++ {
+ err = gobtools.DecodeString(buf, &r.HeaderLibs[val15])
+ if err != nil {
+ return err
+ }
+ }
+ }
+
+ var val18 int32
+ err = gobtools.DecodeSimple[int32](buf, &val18)
+ if err != nil {
+ return err
+ }
+ if val18 > 0 {
+ r.SystemSharedLibs = make([]string, val18)
+ for val19 := 0; val19 < int(val18); val19++ {
+ err = gobtools.DecodeString(buf, &r.SystemSharedLibs[val19])
+ if err != nil {
+ return err
+ }
+ }
+ }
+
+ var val22 bool
+ if err = gobtools.DecodeSimple(buf, &val22); err != nil {
+ return err
+ }
+ if !val22 {
+ var val21 string
+ err = gobtools.DecodeString(buf, &val21)
+ if err != nil {
+ return err
+ }
+ r.ImplementationModuleName = &val21
+ }
+
+ var val25 bool
+ if err = gobtools.DecodeSimple(buf, &val25); err != nil {
+ return err
+ }
+ if !val25 {
+ var val24 BinaryDecoratorInfo
+ if err = val24.Decode(buf); err != nil {
+ return err
+ }
+ r.BinaryDecoratorInfo = &val24
+ }
+
+ var val28 bool
+ if err = gobtools.DecodeSimple(buf, &val28); err != nil {
+ return err
+ }
+ if !val28 {
+ var val27 LibraryDecoratorInfo
+ if err = val27.Decode(buf); err != nil {
+ return err
+ }
+ r.LibraryDecoratorInfo = &val27
+ }
+
+ var val31 bool
+ if err = gobtools.DecodeSimple(buf, &val31); err != nil {
+ return err
+ }
+ if !val31 {
+ var val30 TestBinaryInfo
+ if err = val30.Decode(buf); err != nil {
+ return err
+ }
+ r.TestBinaryInfo = &val30
+ }
+
+ var val34 bool
+ if err = gobtools.DecodeSimple(buf, &val34); err != nil {
+ return err
+ }
+ if !val34 {
+ var val33 BenchmarkDecoratorInfo
+ if err = val33.Decode(buf); err != nil {
+ return err
+ }
+ r.BenchmarkDecoratorInfo = &val33
+ }
+
+ var val37 bool
+ if err = gobtools.DecodeSimple(buf, &val37); err != nil {
+ return err
+ }
+ if !val37 {
+ var val36 ObjectLinkerInfo
+ if err = val36.Decode(buf); err != nil {
+ return err
+ }
+ r.ObjectLinkerInfo = &val36
+ }
+
+ var val40 bool
+ if err = gobtools.DecodeSimple(buf, &val40); err != nil {
+ return err
+ }
+ if !val40 {
+ var val39 StubDecoratorInfo
+ if err = val39.Decode(buf); err != nil {
+ return err
+ }
+ r.StubDecoratorInfo = &val39
+ }
+
+ var val43 bool
+ if err = gobtools.DecodeSimple(buf, &val43); err != nil {
+ return err
+ }
+ if !val43 {
+ var val42 PrebuiltLibraryLinkerInfo
+ if err = val42.Decode(buf); err != nil {
+ return err
+ }
+ r.PrebuiltLibraryLinkerInfo = &val42
+ }
+
+ return err
+}
+
+var LinkerInfoGobRegId int16
+
+func (r LinkerInfo) GetTypeId() int16 {
+ return LinkerInfoGobRegId
+}
+
+func (r BinaryDecoratorInfo) Encode(buf *bytes.Buffer) error {
+ var err error
+
+ if err = gobtools.EncodeSimple(buf, r.StaticExecutable); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeSimple(buf, r.Nocrt); err != nil {
+ return err
+ }
+ return err
+}
+
+func (r *BinaryDecoratorInfo) Decode(buf *bytes.Reader) error {
+ var err error
+
+ err = gobtools.DecodeSimple[bool](buf, &r.StaticExecutable)
+ if err != nil {
+ return err
+ }
+
+ err = gobtools.DecodeSimple[bool](buf, &r.Nocrt)
+ if err != nil {
+ return err
+ }
+
+ return err
+}
+
+var BinaryDecoratorInfoGobRegId int16
+
+func (r BinaryDecoratorInfo) GetTypeId() int16 {
+ return BinaryDecoratorInfoGobRegId
+}
+
+func (r LibraryDecoratorInfo) Encode(buf *bytes.Buffer) error {
+ var err error
+
+ if err = gobtools.EncodeSimple(buf, int32(len(r.ExportIncludeDirs))); err != nil {
+ return err
+ }
+ for val1 := 0; val1 < len(r.ExportIncludeDirs); val1++ {
+ if err = gobtools.EncodeString(buf, r.ExportIncludeDirs[val1]); err != nil {
+ return err
+ }
+ }
+
+ if err = gobtools.EncodeSimple(buf, r.InjectBsslHash); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeInterface(buf, r.NdkSysrootPath); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeString(buf, r.VndkFileName); err != nil {
+ return err
+ }
+
+ val2 := r.UniqueHostSoname == nil
+ if err = gobtools.EncodeSimple(buf, val2); err != nil {
+ return err
+ }
+ if !val2 {
+ if err = gobtools.EncodeSimple(buf, (*r.UniqueHostSoname)); err != nil {
+ return err
+ }
+ }
+
+ if err = gobtools.EncodeSimple(buf, int32(len(r.SharedLibs))); err != nil {
+ return err
+ }
+ for val3 := 0; val3 < len(r.SharedLibs); val3++ {
+ if err = gobtools.EncodeString(buf, r.SharedLibs[val3]); err != nil {
+ return err
+ }
+ }
+
+ if err = gobtools.EncodeSimple(buf, int32(len(r.SystemSharedLibs))); err != nil {
+ return err
+ }
+ for val4 := 0; val4 < len(r.SystemSharedLibs); val4++ {
+ if err = gobtools.EncodeString(buf, r.SystemSharedLibs[val4]); err != nil {
+ return err
+ }
+ }
+
+ if err = gobtools.EncodeInterface(buf, r.StubsSymbolFilePath); err != nil {
+ return err
+ }
+ return err
+}
+
+func (r *LibraryDecoratorInfo) Decode(buf *bytes.Reader) error {
+ var err error
+
+ var val2 int32
+ err = gobtools.DecodeSimple[int32](buf, &val2)
+ if err != nil {
+ return err
+ }
+ if val2 > 0 {
+ r.ExportIncludeDirs = make([]string, val2)
+ for val3 := 0; val3 < int(val2); val3++ {
+ err = gobtools.DecodeString(buf, &r.ExportIncludeDirs[val3])
+ if err != nil {
+ return err
+ }
+ }
+ }
+
+ err = gobtools.DecodeSimple[bool](buf, &r.InjectBsslHash)
+ if err != nil {
+ return err
+ }
+
+ if val7, err := gobtools.DecodeInterface(buf); err != nil {
+ return err
+ } else if val7 == nil {
+ r.NdkSysrootPath = nil
+ } else {
+ r.NdkSysrootPath = val7.(android.Path)
+ }
+
+ err = gobtools.DecodeString(buf, &r.VndkFileName)
+ if err != nil {
+ return err
+ }
+
+ var val10 bool
+ if err = gobtools.DecodeSimple(buf, &val10); err != nil {
+ return err
+ }
+ if !val10 {
+ var val9 bool
+ err = gobtools.DecodeSimple[bool](buf, &val9)
+ if err != nil {
+ return err
+ }
+ r.UniqueHostSoname = &val9
+ }
+
+ var val13 int32
+ err = gobtools.DecodeSimple[int32](buf, &val13)
+ if err != nil {
+ return err
+ }
+ if val13 > 0 {
+ r.SharedLibs = make([]string, val13)
+ for val14 := 0; val14 < int(val13); val14++ {
+ err = gobtools.DecodeString(buf, &r.SharedLibs[val14])
+ if err != nil {
+ return err
+ }
+ }
+ }
+
+ var val17 int32
+ err = gobtools.DecodeSimple[int32](buf, &val17)
+ if err != nil {
+ return err
+ }
+ if val17 > 0 {
+ r.SystemSharedLibs = make([]string, val17)
+ for val18 := 0; val18 < int(val17); val18++ {
+ err = gobtools.DecodeString(buf, &r.SystemSharedLibs[val18])
+ if err != nil {
+ return err
+ }
+ }
+ }
+
+ if val21, err := gobtools.DecodeInterface(buf); err != nil {
+ return err
+ } else if val21 == nil {
+ r.StubsSymbolFilePath = nil
+ } else {
+ r.StubsSymbolFilePath = val21.(android.Path)
+ }
+
+ return err
+}
+
+var LibraryDecoratorInfoGobRegId int16
+
+func (r LibraryDecoratorInfo) GetTypeId() int16 {
+ return LibraryDecoratorInfoGobRegId
+}
+
+func (r SnapshotInfo) Encode(buf *bytes.Buffer) error {
+ var err error
+
+ if err = gobtools.EncodeString(buf, r.SnapshotAndroidMkSuffix); err != nil {
+ return err
+ }
+ return err
+}
+
+func (r *SnapshotInfo) Decode(buf *bytes.Reader) error {
+ var err error
+
+ err = gobtools.DecodeString(buf, &r.SnapshotAndroidMkSuffix)
+ if err != nil {
+ return err
+ }
+
+ return err
+}
+
+var SnapshotInfoGobRegId int16
+
+func (r SnapshotInfo) GetTypeId() int16 {
+ return SnapshotInfoGobRegId
+}
+
+func (r TestBinaryInfo) Encode(buf *bytes.Buffer) error {
+ var err error
+
+ if err = gobtools.EncodeSimple(buf, r.Gtest); err != nil {
+ return err
+ }
+ return err
+}
+
+func (r *TestBinaryInfo) Decode(buf *bytes.Reader) error {
+ var err error
+
+ err = gobtools.DecodeSimple[bool](buf, &r.Gtest)
+ if err != nil {
+ return err
+ }
+
+ return err
+}
+
+var TestBinaryInfoGobRegId int16
+
+func (r TestBinaryInfo) GetTypeId() int16 {
+ return TestBinaryInfoGobRegId
+}
+
+func (r BenchmarkDecoratorInfo) Encode(buf *bytes.Buffer) error {
+ var err error
+ return err
+}
+
+func (r *BenchmarkDecoratorInfo) Decode(buf *bytes.Reader) error {
+ var err error
+
+ return err
+}
+
+var BenchmarkDecoratorInfoGobRegId int16
+
+func (r BenchmarkDecoratorInfo) GetTypeId() int16 {
+ return BenchmarkDecoratorInfoGobRegId
+}
+
+func (r StubDecoratorInfo) Encode(buf *bytes.Buffer) error {
+ var err error
+
+ if err = r.AbiDumpPath.Encode(buf); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeSimple(buf, r.HasAbiDump); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeSimple(buf, int32(len(r.AbiDiffPaths))); err != nil {
+ return err
+ }
+ for val1 := 0; val1 < len(r.AbiDiffPaths); val1++ {
+ if err = gobtools.EncodeInterface(buf, r.AbiDiffPaths[val1]); err != nil {
+ return err
+ }
+ }
+
+ if err = gobtools.EncodeInterface(buf, r.InstallPath); err != nil {
+ return err
+ }
+ return err
+}
+
+func (r *StubDecoratorInfo) Decode(buf *bytes.Reader) error {
+ var err error
+
+ if err = r.AbiDumpPath.Decode(buf); err != nil {
+ return err
+ }
+
+ err = gobtools.DecodeSimple[bool](buf, &r.HasAbiDump)
+ if err != nil {
+ return err
+ }
+
+ var val5 int32
+ err = gobtools.DecodeSimple[int32](buf, &val5)
+ if err != nil {
+ return err
+ }
+ if val5 > 0 {
+ r.AbiDiffPaths = make([]android.Path, val5)
+ for val6 := 0; val6 < int(val5); val6++ {
+ if val8, err := gobtools.DecodeInterface(buf); err != nil {
+ return err
+ } else if val8 == nil {
+ r.AbiDiffPaths[val6] = nil
+ } else {
+ r.AbiDiffPaths[val6] = val8.(android.Path)
+ }
+ }
+ }
+
+ if val10, err := gobtools.DecodeInterface(buf); err != nil {
+ return err
+ } else if val10 == nil {
+ r.InstallPath = nil
+ } else {
+ r.InstallPath = val10.(android.Path)
+ }
+
+ return err
+}
+
+var StubDecoratorInfoGobRegId int16
+
+func (r StubDecoratorInfo) GetTypeId() int16 {
+ return StubDecoratorInfoGobRegId
+}
+
+func (r ObjectLinkerInfo) Encode(buf *bytes.Buffer) error {
+ var err error
+
+ if err = gobtools.EncodeInterface(buf, r.NdkSysrootPath); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeSimple(buf, int32(len(r.SharedLibs))); err != nil {
+ return err
+ }
+ for val1 := 0; val1 < len(r.SharedLibs); val1++ {
+ if err = gobtools.EncodeString(buf, r.SharedLibs[val1]); err != nil {
+ return err
+ }
+ }
+
+ if err = gobtools.EncodeSimple(buf, int32(len(r.SystemSharedLibs))); err != nil {
+ return err
+ }
+ for val2 := 0; val2 < len(r.SystemSharedLibs); val2++ {
+ if err = gobtools.EncodeString(buf, r.SystemSharedLibs[val2]); err != nil {
+ return err
+ }
+ }
+ return err
+}
+
+func (r *ObjectLinkerInfo) Decode(buf *bytes.Reader) error {
+ var err error
+
+ if val2, err := gobtools.DecodeInterface(buf); err != nil {
+ return err
+ } else if val2 == nil {
+ r.NdkSysrootPath = nil
+ } else {
+ r.NdkSysrootPath = val2.(android.Path)
+ }
+
+ var val4 int32
+ err = gobtools.DecodeSimple[int32](buf, &val4)
+ if err != nil {
+ return err
+ }
+ if val4 > 0 {
+ r.SharedLibs = make([]string, val4)
+ for val5 := 0; val5 < int(val4); val5++ {
+ err = gobtools.DecodeString(buf, &r.SharedLibs[val5])
+ if err != nil {
+ return err
+ }
+ }
+ }
+
+ var val8 int32
+ err = gobtools.DecodeSimple[int32](buf, &val8)
+ if err != nil {
+ return err
+ }
+ if val8 > 0 {
+ r.SystemSharedLibs = make([]string, val8)
+ for val9 := 0; val9 < int(val8); val9++ {
+ err = gobtools.DecodeString(buf, &r.SystemSharedLibs[val9])
+ if err != nil {
+ return err
+ }
+ }
+ }
+
+ return err
+}
+
+var ObjectLinkerInfoGobRegId int16
+
+func (r ObjectLinkerInfo) GetTypeId() int16 {
+ return ObjectLinkerInfoGobRegId
+}
+
+func (r PrebuiltLibraryLinkerInfo) Encode(buf *bytes.Buffer) error {
+ var err error
+
+ if err = gobtools.EncodeString(buf, r.VndkFileName); err != nil {
+ return err
+ }
+ return err
+}
+
+func (r *PrebuiltLibraryLinkerInfo) Decode(buf *bytes.Reader) error {
+ var err error
+
+ err = gobtools.DecodeString(buf, &r.VndkFileName)
+ if err != nil {
+ return err
+ }
+
+ return err
+}
+
+var PrebuiltLibraryLinkerInfoGobRegId int16
+
+func (r PrebuiltLibraryLinkerInfo) GetTypeId() int16 {
+ return PrebuiltLibraryLinkerInfoGobRegId
+}
+
+func (r LibraryInfo) Encode(buf *bytes.Buffer) error {
+ var err error
+
+ if err = gobtools.EncodeSimple(buf, r.BuildStubs); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeSimple(buf, int32(len(r.AllStubsVersions))); err != nil {
+ return err
+ }
+ for val1 := 0; val1 < len(r.AllStubsVersions); val1++ {
+ if err = gobtools.EncodeString(buf, r.AllStubsVersions[val1]); err != nil {
+ return err
+ }
+ }
+ return err
+}
+
+func (r *LibraryInfo) Decode(buf *bytes.Reader) error {
+ var err error
+
+ err = gobtools.DecodeSimple[bool](buf, &r.BuildStubs)
+ if err != nil {
+ return err
+ }
+
+ var val3 int32
+ err = gobtools.DecodeSimple[int32](buf, &val3)
+ if err != nil {
+ return err
+ }
+ if val3 > 0 {
+ r.AllStubsVersions = make([]string, val3)
+ for val4 := 0; val4 < int(val3); val4++ {
+ err = gobtools.DecodeString(buf, &r.AllStubsVersions[val4])
+ if err != nil {
+ return err
+ }
+ }
+ }
+
+ return err
+}
+
+var LibraryInfoGobRegId int16
+
+func (r LibraryInfo) GetTypeId() int16 {
+ return LibraryInfoGobRegId
+}
+
+func (r InstallerInfo) Encode(buf *bytes.Buffer) error {
+ var err error
+
+ val1 := r.StubDecoratorInfo == nil
+ if err = gobtools.EncodeSimple(buf, val1); err != nil {
+ return err
+ }
+ if !val1 {
+ if err = (*r.StubDecoratorInfo).Encode(buf); err != nil {
+ return err
+ }
+ }
+ return err
+}
+
+func (r *InstallerInfo) Decode(buf *bytes.Reader) error {
+ var err error
+
+ var val2 bool
+ if err = gobtools.DecodeSimple(buf, &val2); err != nil {
+ return err
+ }
+ if !val2 {
+ var val1 StubDecoratorInfo
+ if err = val1.Decode(buf); err != nil {
+ return err
+ }
+ r.StubDecoratorInfo = &val1
+ }
+
+ return err
+}
+
+var InstallerInfoGobRegId int16
+
+func (r InstallerInfo) GetTypeId() int16 {
+ return InstallerInfoGobRegId
+}
+
+func (r LocalOrGlobalFlagsInfo) Encode(buf *bytes.Buffer) error {
+ var err error
+
+ if err = gobtools.EncodeSimple(buf, int32(len(r.CommonFlags))); err != nil {
+ return err
+ }
+ for val1 := 0; val1 < len(r.CommonFlags); val1++ {
+ if err = gobtools.EncodeString(buf, r.CommonFlags[val1]); err != nil {
+ return err
+ }
+ }
+
+ if err = gobtools.EncodeSimple(buf, int32(len(r.CFlags))); err != nil {
+ return err
+ }
+ for val2 := 0; val2 < len(r.CFlags); val2++ {
+ if err = gobtools.EncodeString(buf, r.CFlags[val2]); err != nil {
+ return err
+ }
+ }
+
+ if err = gobtools.EncodeSimple(buf, int32(len(r.ConlyFlags))); err != nil {
+ return err
+ }
+ for val3 := 0; val3 < len(r.ConlyFlags); val3++ {
+ if err = gobtools.EncodeString(buf, r.ConlyFlags[val3]); err != nil {
+ return err
+ }
+ }
+
+ if err = gobtools.EncodeSimple(buf, int32(len(r.CppFlags))); err != nil {
+ return err
+ }
+ for val4 := 0; val4 < len(r.CppFlags); val4++ {
+ if err = gobtools.EncodeString(buf, r.CppFlags[val4]); err != nil {
+ return err
+ }
+ }
+ return err
+}
+
+func (r *LocalOrGlobalFlagsInfo) Decode(buf *bytes.Reader) error {
+ var err error
+
+ var val2 int32
+ err = gobtools.DecodeSimple[int32](buf, &val2)
+ if err != nil {
+ return err
+ }
+ if val2 > 0 {
+ r.CommonFlags = make([]string, val2)
+ for val3 := 0; val3 < int(val2); val3++ {
+ err = gobtools.DecodeString(buf, &r.CommonFlags[val3])
+ if err != nil {
+ return err
+ }
+ }
+ }
+
+ var val6 int32
+ err = gobtools.DecodeSimple[int32](buf, &val6)
+ if err != nil {
+ return err
+ }
+ if val6 > 0 {
+ r.CFlags = make([]string, val6)
+ for val7 := 0; val7 < int(val6); val7++ {
+ err = gobtools.DecodeString(buf, &r.CFlags[val7])
+ if err != nil {
+ return err
+ }
+ }
+ }
+
+ var val10 int32
+ err = gobtools.DecodeSimple[int32](buf, &val10)
+ if err != nil {
+ return err
+ }
+ if val10 > 0 {
+ r.ConlyFlags = make([]string, val10)
+ for val11 := 0; val11 < int(val10); val11++ {
+ err = gobtools.DecodeString(buf, &r.ConlyFlags[val11])
+ if err != nil {
+ return err
+ }
+ }
+ }
+
+ var val14 int32
+ err = gobtools.DecodeSimple[int32](buf, &val14)
+ if err != nil {
+ return err
+ }
+ if val14 > 0 {
+ r.CppFlags = make([]string, val14)
+ for val15 := 0; val15 < int(val14); val15++ {
+ err = gobtools.DecodeString(buf, &r.CppFlags[val15])
+ if err != nil {
+ return err
+ }
+ }
+ }
+
+ return err
+}
+
+var LocalOrGlobalFlagsInfoGobRegId int16
+
+func (r LocalOrGlobalFlagsInfo) GetTypeId() int16 {
+ return LocalOrGlobalFlagsInfoGobRegId
+}
+
+func (r SanitizeInfo) Encode(buf *bytes.Buffer) error {
+ var err error
+
+ if err = gobtools.EncodeSimple(buf, r.IsUnsanitizedVariant); err != nil {
+ return err
+ }
+
+ if err = r.Sanitize.Encode(buf); err != nil {
+ return err
+ }
+ return err
+}
+
+func (r *SanitizeInfo) Decode(buf *bytes.Reader) error {
+ var err error
+
+ err = gobtools.DecodeSimple[bool](buf, &r.IsUnsanitizedVariant)
+ if err != nil {
+ return err
+ }
+
+ if err = r.Sanitize.Decode(buf); err != nil {
+ return err
+ }
+
+ return err
+}
+
+var SanitizeInfoGobRegId int16
+
+func (r SanitizeInfo) GetTypeId() int16 {
+ return SanitizeInfoGobRegId
+}
+
+func (r StlInfo) Encode(buf *bytes.Buffer) error {
+ var err error
+
+ val1 := r.Stl == nil
+ if err = gobtools.EncodeSimple(buf, val1); err != nil {
+ return err
+ }
+ if !val1 {
+ if err = gobtools.EncodeString(buf, (*r.Stl)); err != nil {
+ return err
+ }
+ }
+ return err
+}
+
+func (r *StlInfo) Decode(buf *bytes.Reader) error {
+ var err error
+
+ var val2 bool
+ if err = gobtools.DecodeSimple(buf, &val2); err != nil {
+ return err
+ }
+ if !val2 {
+ var val1 string
+ err = gobtools.DecodeString(buf, &val1)
+ if err != nil {
+ return err
+ }
+ r.Stl = &val1
+ }
+
+ return err
+}
+
+var StlInfoGobRegId int16
+
+func (r StlInfo) GetTypeId() int16 {
+ return StlInfoGobRegId
+}
+
+func (r CcInfo) Encode(buf *bytes.Buffer) error {
+ var err error
+
+ if err = gobtools.EncodeSimple(buf, r.IsPrebuilt); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeSimple(buf, r.CmakeSnapshotSupported); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeSimple(buf, r.HasLlndkStubs); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeSimple(buf, int32(len(r.DataPaths))); err != nil {
+ return err
+ }
+ for val1 := 0; val1 < len(r.DataPaths); val1++ {
+ if err = r.DataPaths[val1].Encode(buf); err != nil {
+ return err
+ }
+ }
+
+ if err = gobtools.EncodeSimple(buf, r.VendorAvailable); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeSimple(buf, r.OdmAvailable); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeSimple(buf, r.ProductAvailable); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeSimple(buf, r.IsVendorPublicLibrary); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeSimple(buf, r.DoubleLoadable); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeSimple(buf, int32(len(r.SdkMemberTypes))); err != nil {
+ return err
+ }
+ for val2 := 0; val2 < len(r.SdkMemberTypes); val2++ {
+ if err = gobtools.EncodeInterface(buf, r.SdkMemberTypes[val2]); err != nil {
+ return err
+ }
+ }
+
+ if err = r.LocalFlags.Encode(buf); err != nil {
+ return err
+ }
+
+ if err = r.GlobalFlags.Encode(buf); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeSimple(buf, int32(len(r.SystemIncludeFlags))); err != nil {
+ return err
+ }
+ for val3 := 0; val3 < len(r.SystemIncludeFlags); val3++ {
+ if err = gobtools.EncodeString(buf, r.SystemIncludeFlags[val3]); err != nil {
+ return err
+ }
+ }
+
+ if err = gobtools.EncodeSimple(buf, int32(len(r.NoOverrideFlags))); err != nil {
+ return err
+ }
+ for val4 := 0; val4 < len(r.NoOverrideFlags); val4++ {
+ if err = gobtools.EncodeString(buf, r.NoOverrideFlags[val4]); err != nil {
+ return err
+ }
+ }
+
+ val5 := r.CompilerInfo == nil
+ if err = gobtools.EncodeSimple(buf, val5); err != nil {
+ return err
+ }
+ if !val5 {
+ if err = (*r.CompilerInfo).Encode(buf); err != nil {
+ return err
+ }
+ }
+
+ val6 := r.LinkerInfo == nil
+ if err = gobtools.EncodeSimple(buf, val6); err != nil {
+ return err
+ }
+ if !val6 {
+ if err = (*r.LinkerInfo).Encode(buf); err != nil {
+ return err
+ }
+ }
+
+ val7 := r.SnapshotInfo == nil
+ if err = gobtools.EncodeSimple(buf, val7); err != nil {
+ return err
+ }
+ if !val7 {
+ if err = (*r.SnapshotInfo).Encode(buf); err != nil {
+ return err
+ }
+ }
+
+ val8 := r.LibraryInfo == nil
+ if err = gobtools.EncodeSimple(buf, val8); err != nil {
+ return err
+ }
+ if !val8 {
+ if err = (*r.LibraryInfo).Encode(buf); err != nil {
+ return err
+ }
+ }
+
+ val9 := r.InstallerInfo == nil
+ if err = gobtools.EncodeSimple(buf, val9); err != nil {
+ return err
+ }
+ if !val9 {
+ if err = (*r.InstallerInfo).Encode(buf); err != nil {
+ return err
+ }
+ }
+
+ val10 := r.StlInfo == nil
+ if err = gobtools.EncodeSimple(buf, val10); err != nil {
+ return err
+ }
+ if !val10 {
+ if err = (*r.StlInfo).Encode(buf); err != nil {
+ return err
+ }
+ }
+
+ val11 := r.SanitizeInfo == nil
+ if err = gobtools.EncodeSimple(buf, val11); err != nil {
+ return err
+ }
+ if !val11 {
+ if err = (*r.SanitizeInfo).Encode(buf); err != nil {
+ return err
+ }
+ }
+ return err
+}
+
+func (r *CcInfo) Decode(buf *bytes.Reader) error {
+ var err error
+
+ err = gobtools.DecodeSimple[bool](buf, &r.IsPrebuilt)
+ if err != nil {
+ return err
+ }
+
+ err = gobtools.DecodeSimple[bool](buf, &r.CmakeSnapshotSupported)
+ if err != nil {
+ return err
+ }
+
+ err = gobtools.DecodeSimple[bool](buf, &r.HasLlndkStubs)
+ if err != nil {
+ return err
+ }
+
+ var val5 int32
+ err = gobtools.DecodeSimple[int32](buf, &val5)
+ if err != nil {
+ return err
+ }
+ if val5 > 0 {
+ r.DataPaths = make([]android.DataPath, val5)
+ for val6 := 0; val6 < int(val5); val6++ {
+ if err = r.DataPaths[val6].Decode(buf); err != nil {
+ return err
+ }
+ }
+ }
+
+ err = gobtools.DecodeSimple[bool](buf, &r.VendorAvailable)
+ if err != nil {
+ return err
+ }
+
+ err = gobtools.DecodeSimple[bool](buf, &r.OdmAvailable)
+ if err != nil {
+ return err
+ }
+
+ err = gobtools.DecodeSimple[bool](buf, &r.ProductAvailable)
+ if err != nil {
+ return err
+ }
+
+ err = gobtools.DecodeSimple[bool](buf, &r.IsVendorPublicLibrary)
+ if err != nil {
+ return err
+ }
+
+ err = gobtools.DecodeSimple[bool](buf, &r.DoubleLoadable)
+ if err != nil {
+ return err
+ }
+
+ var val14 int32
+ err = gobtools.DecodeSimple[int32](buf, &val14)
+ if err != nil {
+ return err
+ }
+ if val14 > 0 {
+ r.SdkMemberTypes = make([]android.SdkMemberType, val14)
+ for val15 := 0; val15 < int(val14); val15++ {
+ if val17, err := gobtools.DecodeInterface(buf); err != nil {
+ return err
+ } else if val17 == nil {
+ r.SdkMemberTypes[val15] = nil
+ } else {
+ r.SdkMemberTypes[val15] = val17.(android.SdkMemberType)
+ }
+ }
+ }
+
+ if err = r.LocalFlags.Decode(buf); err != nil {
+ return err
+ }
+
+ if err = r.GlobalFlags.Decode(buf); err != nil {
+ return err
+ }
+
+ var val21 int32
+ err = gobtools.DecodeSimple[int32](buf, &val21)
+ if err != nil {
+ return err
+ }
+ if val21 > 0 {
+ r.SystemIncludeFlags = make([]string, val21)
+ for val22 := 0; val22 < int(val21); val22++ {
+ err = gobtools.DecodeString(buf, &r.SystemIncludeFlags[val22])
+ if err != nil {
+ return err
+ }
+ }
+ }
+
+ var val25 int32
+ err = gobtools.DecodeSimple[int32](buf, &val25)
+ if err != nil {
+ return err
+ }
+ if val25 > 0 {
+ r.NoOverrideFlags = make([]string, val25)
+ for val26 := 0; val26 < int(val25); val26++ {
+ err = gobtools.DecodeString(buf, &r.NoOverrideFlags[val26])
+ if err != nil {
+ return err
+ }
+ }
+ }
+
+ var val29 bool
+ if err = gobtools.DecodeSimple(buf, &val29); err != nil {
+ return err
+ }
+ if !val29 {
+ var val28 CompilerInfo
+ if err = val28.Decode(buf); err != nil {
+ return err
+ }
+ r.CompilerInfo = &val28
+ }
+
+ var val32 bool
+ if err = gobtools.DecodeSimple(buf, &val32); err != nil {
+ return err
+ }
+ if !val32 {
+ var val31 LinkerInfo
+ if err = val31.Decode(buf); err != nil {
+ return err
+ }
+ r.LinkerInfo = &val31
+ }
+
+ var val35 bool
+ if err = gobtools.DecodeSimple(buf, &val35); err != nil {
+ return err
+ }
+ if !val35 {
+ var val34 SnapshotInfo
+ if err = val34.Decode(buf); err != nil {
+ return err
+ }
+ r.SnapshotInfo = &val34
+ }
+
+ var val38 bool
+ if err = gobtools.DecodeSimple(buf, &val38); err != nil {
+ return err
+ }
+ if !val38 {
+ var val37 LibraryInfo
+ if err = val37.Decode(buf); err != nil {
+ return err
+ }
+ r.LibraryInfo = &val37
+ }
+
+ var val41 bool
+ if err = gobtools.DecodeSimple(buf, &val41); err != nil {
+ return err
+ }
+ if !val41 {
+ var val40 InstallerInfo
+ if err = val40.Decode(buf); err != nil {
+ return err
+ }
+ r.InstallerInfo = &val40
+ }
+
+ var val44 bool
+ if err = gobtools.DecodeSimple(buf, &val44); err != nil {
+ return err
+ }
+ if !val44 {
+ var val43 StlInfo
+ if err = val43.Decode(buf); err != nil {
+ return err
+ }
+ r.StlInfo = &val43
+ }
+
+ var val47 bool
+ if err = gobtools.DecodeSimple(buf, &val47); err != nil {
+ return err
+ }
+ if !val47 {
+ var val46 SanitizeInfo
+ if err = val46.Decode(buf); err != nil {
+ return err
+ }
+ r.SanitizeInfo = &val46
+ }
+
+ return err
+}
+
+var CcInfoGobRegId int16
+
+func (r CcInfo) GetTypeId() int16 {
+ return CcInfoGobRegId
+}
+
+func (r LinkableInfo) Encode(buf *bytes.Buffer) error {
+ var err error
+
+ if err = gobtools.EncodeSimple(buf, r.StaticExecutable); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeSimple(buf, r.Static); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeSimple(buf, r.Shared); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeSimple(buf, r.Header); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeSimple(buf, r.HasStubsVariants); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeString(buf, r.StubsVersion); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeSimple(buf, r.IsStubs); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeInterface(buf, r.UnstrippedOutputFile); err != nil {
+ return err
+ }
+
+ if err = r.OutputFile.Encode(buf); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeSimple(buf, int32(len(r.CoverageFiles))); err != nil {
+ return err
+ }
+ for val1 := 0; val1 < len(r.CoverageFiles); val1++ {
+ if err = gobtools.EncodeInterface(buf, r.CoverageFiles[val1]); err != nil {
+ return err
+ }
+ }
+
+ if err = r.CoverageOutputFile.Encode(buf); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeSimple(buf, r.LinkCoverage); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeSimple(buf, int32(len(r.SAbiDumpFiles))); err != nil {
+ return err
+ }
+ for val2 := 0; val2 < len(r.SAbiDumpFiles); val2++ {
+ if err = gobtools.EncodeInterface(buf, r.SAbiDumpFiles[val2]); err != nil {
+ return err
+ }
+ }
+
+ if err = gobtools.EncodeString(buf, r.Partition); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeSimple(buf, r.CcLibrary); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeSimple(buf, r.CcLibraryInterface); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeSimple(buf, r.RustLibraryInterface); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeString(buf, r.CrateName); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeSimple(buf, int32(len(r.ExportedCrateLinkDirs))); err != nil {
+ return err
+ }
+ for val3 := 0; val3 < len(r.ExportedCrateLinkDirs); val3++ {
+ if err = gobtools.EncodeString(buf, r.ExportedCrateLinkDirs[val3]); err != nil {
+ return err
+ }
+ }
+
+ if err = gobtools.EncodeSimple(buf, r.HasNonSystemVariants); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeSimple(buf, r.IsLlndk); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeSimple(buf, r.IsNdk); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeSimple(buf, r.InVendorOrProduct); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeString(buf, r.SubName); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeSimple(buf, r.InRamdisk); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeSimple(buf, r.OnlyInRamdisk); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeSimple(buf, r.InVendorRamdisk); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeSimple(buf, r.OnlyInVendorRamdisk); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeSimple(buf, r.InRecovery); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeSimple(buf, r.OnlyInRecovery); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeSimple(buf, r.InVendor); err != nil {
+ return err
+ }
+
+ val4 := r.Installable == nil
+ if err = gobtools.EncodeSimple(buf, val4); err != nil {
+ return err
+ }
+ if !val4 {
+ if err = gobtools.EncodeSimple(buf, (*r.Installable)); err != nil {
+ return err
+ }
+ }
+
+ if err = gobtools.EncodeString(buf, r.RelativeInstallPath); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeSimple(buf, r.RustApexExclude); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeSimple(buf, r.Bootstrap); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeString(buf, r.Multilib); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeString(buf, r.ImplementationModuleNameForMake); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeSimple(buf, r.IsStubsImplementationRequired); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeSimple(buf, int32(len(r.Symlinks))); err != nil {
+ return err
+ }
+ for val5 := 0; val5 < len(r.Symlinks); val5++ {
+ if err = gobtools.EncodeString(buf, r.Symlinks[val5]); err != nil {
+ return err
+ }
+ }
+
+ if err = r.APIListCoverageXMLPath.Encode(buf); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeSimple(buf, int32(len(r.FuzzSharedLibraries))); err != nil {
+ return err
+ }
+ for val6 := 0; val6 < len(r.FuzzSharedLibraries); val6++ {
+ if err = r.FuzzSharedLibraries[val6].Encode(buf); err != nil {
+ return err
+ }
+ }
+
+ if err = gobtools.EncodeSimple(buf, r.IsVndkPrebuiltLibrary); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeSimple(buf, r.HasLLNDKStubs); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeSimple(buf, r.IsLLNDKMovedToApex); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeString(buf, r.ImplementationModuleName); err != nil {
+ return err
+ }
+ return err
+}
+
+func (r *LinkableInfo) Decode(buf *bytes.Reader) error {
+ var err error
+
+ err = gobtools.DecodeSimple[bool](buf, &r.StaticExecutable)
+ if err != nil {
+ return err
+ }
+
+ err = gobtools.DecodeSimple[bool](buf, &r.Static)
+ if err != nil {
+ return err
+ }
+
+ err = gobtools.DecodeSimple[bool](buf, &r.Shared)
+ if err != nil {
+ return err
+ }
+
+ err = gobtools.DecodeSimple[bool](buf, &r.Header)
+ if err != nil {
+ return err
+ }
+
+ err = gobtools.DecodeSimple[bool](buf, &r.HasStubsVariants)
+ if err != nil {
+ return err
+ }
+
+ err = gobtools.DecodeString(buf, &r.StubsVersion)
+ if err != nil {
+ return err
+ }
+
+ err = gobtools.DecodeSimple[bool](buf, &r.IsStubs)
+ if err != nil {
+ return err
+ }
+
+ if val9, err := gobtools.DecodeInterface(buf); err != nil {
+ return err
+ } else if val9 == nil {
+ r.UnstrippedOutputFile = nil
+ } else {
+ r.UnstrippedOutputFile = val9.(android.Path)
+ }
+
+ if err = r.OutputFile.Decode(buf); err != nil {
+ return err
+ }
+
+ var val13 int32
+ err = gobtools.DecodeSimple[int32](buf, &val13)
+ if err != nil {
+ return err
+ }
+ if val13 > 0 {
+ r.CoverageFiles = make([]android.Path, val13)
+ for val14 := 0; val14 < int(val13); val14++ {
+ if val16, err := gobtools.DecodeInterface(buf); err != nil {
+ return err
+ } else if val16 == nil {
+ r.CoverageFiles[val14] = nil
+ } else {
+ r.CoverageFiles[val14] = val16.(android.Path)
+ }
+ }
+ }
+
+ if err = r.CoverageOutputFile.Decode(buf); err != nil {
+ return err
+ }
+
+ err = gobtools.DecodeSimple[bool](buf, &r.LinkCoverage)
+ if err != nil {
+ return err
+ }
+
+ var val21 int32
+ err = gobtools.DecodeSimple[int32](buf, &val21)
+ if err != nil {
+ return err
+ }
+ if val21 > 0 {
+ r.SAbiDumpFiles = make([]android.Path, val21)
+ for val22 := 0; val22 < int(val21); val22++ {
+ if val24, err := gobtools.DecodeInterface(buf); err != nil {
+ return err
+ } else if val24 == nil {
+ r.SAbiDumpFiles[val22] = nil
+ } else {
+ r.SAbiDumpFiles[val22] = val24.(android.Path)
+ }
+ }
+ }
+
+ err = gobtools.DecodeString(buf, &r.Partition)
+ if err != nil {
+ return err
+ }
+
+ err = gobtools.DecodeSimple[bool](buf, &r.CcLibrary)
+ if err != nil {
+ return err
+ }
+
+ err = gobtools.DecodeSimple[bool](buf, &r.CcLibraryInterface)
+ if err != nil {
+ return err
+ }
+
+ err = gobtools.DecodeSimple[bool](buf, &r.RustLibraryInterface)
+ if err != nil {
+ return err
+ }
+
+ err = gobtools.DecodeString(buf, &r.CrateName)
+ if err != nil {
+ return err
+ }
+
+ var val31 int32
+ err = gobtools.DecodeSimple[int32](buf, &val31)
+ if err != nil {
+ return err
+ }
+ if val31 > 0 {
+ r.ExportedCrateLinkDirs = make([]string, val31)
+ for val32 := 0; val32 < int(val31); val32++ {
+ err = gobtools.DecodeString(buf, &r.ExportedCrateLinkDirs[val32])
+ if err != nil {
+ return err
+ }
+ }
+ }
+
+ err = gobtools.DecodeSimple[bool](buf, &r.HasNonSystemVariants)
+ if err != nil {
+ return err
+ }
+
+ err = gobtools.DecodeSimple[bool](buf, &r.IsLlndk)
+ if err != nil {
+ return err
+ }
+
+ err = gobtools.DecodeSimple[bool](buf, &r.IsNdk)
+ if err != nil {
+ return err
+ }
+
+ err = gobtools.DecodeSimple[bool](buf, &r.InVendorOrProduct)
+ if err != nil {
+ return err
+ }
+
+ err = gobtools.DecodeString(buf, &r.SubName)
+ if err != nil {
+ return err
+ }
+
+ err = gobtools.DecodeSimple[bool](buf, &r.InRamdisk)
+ if err != nil {
+ return err
+ }
+
+ err = gobtools.DecodeSimple[bool](buf, &r.OnlyInRamdisk)
+ if err != nil {
+ return err
+ }
+
+ err = gobtools.DecodeSimple[bool](buf, &r.InVendorRamdisk)
+ if err != nil {
+ return err
+ }
+
+ err = gobtools.DecodeSimple[bool](buf, &r.OnlyInVendorRamdisk)
+ if err != nil {
+ return err
+ }
+
+ err = gobtools.DecodeSimple[bool](buf, &r.InRecovery)
+ if err != nil {
+ return err
+ }
+
+ err = gobtools.DecodeSimple[bool](buf, &r.OnlyInRecovery)
+ if err != nil {
+ return err
+ }
+
+ err = gobtools.DecodeSimple[bool](buf, &r.InVendor)
+ if err != nil {
+ return err
+ }
+
+ var val47 bool
+ if err = gobtools.DecodeSimple(buf, &val47); err != nil {
+ return err
+ }
+ if !val47 {
+ var val46 bool
+ err = gobtools.DecodeSimple[bool](buf, &val46)
+ if err != nil {
+ return err
+ }
+ r.Installable = &val46
+ }
+
+ err = gobtools.DecodeString(buf, &r.RelativeInstallPath)
+ if err != nil {
+ return err
+ }
+
+ err = gobtools.DecodeSimple[bool](buf, &r.RustApexExclude)
+ if err != nil {
+ return err
+ }
+
+ err = gobtools.DecodeSimple[bool](buf, &r.Bootstrap)
+ if err != nil {
+ return err
+ }
+
+ err = gobtools.DecodeString(buf, &r.Multilib)
+ if err != nil {
+ return err
+ }
+
+ err = gobtools.DecodeString(buf, &r.ImplementationModuleNameForMake)
+ if err != nil {
+ return err
+ }
+
+ err = gobtools.DecodeSimple[bool](buf, &r.IsStubsImplementationRequired)
+ if err != nil {
+ return err
+ }
+
+ var val56 int32
+ err = gobtools.DecodeSimple[int32](buf, &val56)
+ if err != nil {
+ return err
+ }
+ if val56 > 0 {
+ r.Symlinks = make([]string, val56)
+ for val57 := 0; val57 < int(val56); val57++ {
+ err = gobtools.DecodeString(buf, &r.Symlinks[val57])
+ if err != nil {
+ return err
+ }
+ }
+ }
+
+ if err = r.APIListCoverageXMLPath.Decode(buf); err != nil {
+ return err
+ }
+
+ var val62 int32
+ err = gobtools.DecodeSimple[int32](buf, &val62)
+ if err != nil {
+ return err
+ }
+ if val62 > 0 {
+ r.FuzzSharedLibraries = make([]InstallPair, val62)
+ for val63 := 0; val63 < int(val62); val63++ {
+ if err = r.FuzzSharedLibraries[val63].Decode(buf); err != nil {
+ return err
+ }
+ }
+ }
+
+ err = gobtools.DecodeSimple[bool](buf, &r.IsVndkPrebuiltLibrary)
+ if err != nil {
+ return err
+ }
+
+ err = gobtools.DecodeSimple[bool](buf, &r.HasLLNDKStubs)
+ if err != nil {
+ return err
+ }
+
+ err = gobtools.DecodeSimple[bool](buf, &r.IsLLNDKMovedToApex)
+ if err != nil {
+ return err
+ }
+
+ err = gobtools.DecodeString(buf, &r.ImplementationModuleName)
+ if err != nil {
+ return err
+ }
+
+ return err
+}
+
+var LinkableInfoGobRegId int16
+
+func (r LinkableInfo) GetTypeId() int16 {
+ return LinkableInfoGobRegId
+}
+
+func (r InstallPair) Encode(buf *bytes.Buffer) error {
+ var err error
+
+ if err = gobtools.EncodeInterface(buf, r.Src); err != nil {
+ return err
+ }
+
+ if err = r.Dst.Encode(buf); err != nil {
+ return err
+ }
+ return err
+}
+
+func (r *InstallPair) Decode(buf *bytes.Reader) error {
+ var err error
+
+ if val2, err := gobtools.DecodeInterface(buf); err != nil {
+ return err
+ } else if val2 == nil {
+ r.Src = nil
+ } else {
+ r.Src = val2.(android.Path)
+ }
+
+ if err = r.Dst.Decode(buf); err != nil {
+ return err
+ }
+
+ return err
+}
+
+var InstallPairGobRegId int16
+
+func (r InstallPair) GetTypeId() int16 {
+ return InstallPairGobRegId
+}
diff --git a/cc/cc_test.go b/cc/cc_test.go
index 7240ea587..e9d2474ac 100644
--- a/cc/cc_test.go
+++ b/cc/cc_test.go
@@ -26,8 +26,6 @@ import (
"android/soong/aidl_library"
"android/soong/android"
-
- "github.com/google/blueprint"
)
func init() {
@@ -3124,17 +3122,6 @@ func TestImageVariants(t *testing.T) {
ctx := prepareForCcTest.RunTestWithBp(t, bp)
- hasDep := func(m android.Module, wantDep android.Module) bool {
- t.Helper()
- var found bool
- ctx.VisitDirectDeps(m, func(dep blueprint.Module) {
- if dep == wantDep {
- found = true
- }
- })
- return found
- }
-
testDepWithVariant := func(imageVariant string) {
imageVariantStr := ""
if imageVariant != "core" {
@@ -3142,7 +3129,8 @@ func TestImageVariants(t *testing.T) {
}
binFooModule := ctx.ModuleForTests(t, "binfoo", "android"+imageVariantStr+"_arm64_armv8-a").Module()
libBarModule := ctx.ModuleForTests(t, "libbar", "android"+imageVariantStr+"_arm64_armv8-a_shared").Module()
- android.AssertBoolEquals(t, "binfoo should have dependency on libbar with image variant "+imageVariant, true, hasDep(binFooModule, libBarModule))
+ android.AssertBoolEquals(t, "binfoo should have dependency on libbar with image variant "+imageVariant, true,
+ android.HasDirectDep(ctx, binFooModule, libBarModule))
}
testDepWithVariant("core")
diff --git a/cc/cc_test_only_property_test.go b/cc/cc_test_only_property_test.go
index a178cad68..fe4fb56a2 100644
--- a/cc/cc_test_only_property_test.go
+++ b/cc/cc_test_only_property_test.go
@@ -15,13 +15,13 @@
package cc
import (
- "android/soong/android"
- "android/soong/android/team_proto"
"log"
"strings"
"testing"
- "github.com/google/blueprint"
+ "android/soong/android"
+ "android/soong/android/team_proto"
+
"google.golang.org/protobuf/proto"
)
@@ -56,7 +56,7 @@ func TestTestOnlyProvider(t *testing.T) {
// marked as test-only are marked as test-only.
actualTestOnly := []string{}
- ctx.VisitAllModules(func(m blueprint.Module) {
+ ctx.VisitAllModules(func(m android.Module) {
if provider, ok := android.OtherModuleProvider(ctx.TestContext.OtherModuleProviderAdaptor(), m, android.TestOnlyProviderKey); ok {
if provider.TestOnly {
actualTestOnly = append(actualTestOnly, m.Name())
diff --git a/cc/ccdeps.go b/cc/ccdeps.go
index 4247778e8..fefd57f91 100644
--- a/cc/ccdeps.go
+++ b/cc/ccdeps.go
@@ -90,10 +90,10 @@ func (c *ccdepsGeneratorSingleton) GenerateBuildActions(ctx android.SingletonCon
moduleDeps.C_clang = fmt.Sprintf("%s%s", buildCMakePath(pathToCC), cClang)
moduleDeps.Cpp_clang = fmt.Sprintf("%s%s", buildCMakePath(pathToCC), cppClang)
- ctx.VisitAllModules(func(module android.Module) {
- if ccModule, ok := module.(*Module); ok {
- if compiledModule, ok := ccModule.compiler.(CompiledInterface); ok {
- generateCLionProjectData(ctx, compiledModule, ccModule, bestVariantFound, moduleInfos)
+ ctx.VisitAllModuleProxies(func(module android.ModuleProxy) {
+ if ccModule, ok := android.OtherModuleProvider(ctx, module, CcInfoProvider); ok {
+ if ccModule.CompilerInfo != nil {
+ generateCLionProjectData(ctx, module, ccModule, bestVariantFound, moduleInfos)
}
}
})
@@ -169,11 +169,12 @@ func parseCompilerCCParameters(ctx android.SingletonContext, params []string) cc
return compilerParams
}
-func generateCLionProjectData(ctx android.SingletonContext, compiledModule CompiledInterface,
- ccModule *Module, bestVariantFound map[string]bool, moduleInfos map[string]ccIdeInfo) {
- moduleName := ccModule.ModuleBase.Name()
- srcs := compiledModule.Srcs()
-
+func generateCLionProjectData(ctx android.SingletonContext, module android.ModuleProxy,
+ ccModule *CcInfo, bestVariantFound map[string]bool, moduleInfos map[string]ccIdeInfo) {
+ commonInfo := android.OtherModuleProviderOrDefault(ctx, module, android.CommonModuleInfoProvider)
+ moduleName := commonInfo.BaseModuleName
+ srcs := ccModule.CompilerInfo.Srcs
+ target := commonInfo.Target
// Skip if best variant has already been found.
if bestVariantFound[moduleName] {
return
@@ -185,7 +186,7 @@ func generateCLionProjectData(ctx android.SingletonContext, compiledModule Compi
}
// Check if device arch matches, in which case this is the best variant and takes precedence.
- if ccModule.Device() && ccModule.ModuleBase.Arch().ArchType.Name == ctx.DeviceConfig().DeviceArch() {
+ if target.Os.Class == android.Device && target.Arch.ArchType.Name == ctx.DeviceConfig().DeviceArch() {
bestVariantFound[moduleName] = true
} else if _, ok := moduleInfos[moduleName]; ok {
// Skip because this isn't the best variant and a previous one has already been added.
@@ -195,20 +196,20 @@ func generateCLionProjectData(ctx android.SingletonContext, compiledModule Compi
dpInfo := ccIdeInfo{}
- dpInfo.Path = append(dpInfo.Path, path.Dir(ctx.BlueprintFile(ccModule)))
+ dpInfo.Path = append(dpInfo.Path, path.Dir(ctx.BlueprintFile(module)))
dpInfo.Srcs = append(dpInfo.Srcs, srcs.Strings()...)
dpInfo.Path = android.FirstUniqueStrings(dpInfo.Path)
dpInfo.Srcs = android.FirstUniqueStrings(dpInfo.Srcs)
- dpInfo.Global_Common_Flags = parseCompilerCCParameters(ctx, ccModule.flags.Global.CommonFlags)
- dpInfo.Local_Common_Flags = parseCompilerCCParameters(ctx, ccModule.flags.Local.CommonFlags)
- dpInfo.Global_C_flags = parseCompilerCCParameters(ctx, ccModule.flags.Global.CFlags)
- dpInfo.Local_C_flags = parseCompilerCCParameters(ctx, ccModule.flags.Local.CFlags)
- dpInfo.Global_C_only_flags = parseCompilerCCParameters(ctx, ccModule.flags.Global.ConlyFlags)
- dpInfo.Local_C_only_flags = parseCompilerCCParameters(ctx, ccModule.flags.Local.ConlyFlags)
- dpInfo.Global_Cpp_flags = parseCompilerCCParameters(ctx, ccModule.flags.Global.CppFlags)
- dpInfo.Local_Cpp_flags = parseCompilerCCParameters(ctx, ccModule.flags.Local.CppFlags)
- dpInfo.System_include_flags = parseCompilerCCParameters(ctx, ccModule.flags.SystemIncludeFlags)
+ dpInfo.Global_Common_Flags = parseCompilerCCParameters(ctx, ccModule.GlobalFlags.CommonFlags)
+ dpInfo.Local_Common_Flags = parseCompilerCCParameters(ctx, ccModule.LocalFlags.CommonFlags)
+ dpInfo.Global_C_flags = parseCompilerCCParameters(ctx, ccModule.GlobalFlags.CFlags)
+ dpInfo.Local_C_flags = parseCompilerCCParameters(ctx, ccModule.LocalFlags.CFlags)
+ dpInfo.Global_C_only_flags = parseCompilerCCParameters(ctx, ccModule.GlobalFlags.ConlyFlags)
+ dpInfo.Local_C_only_flags = parseCompilerCCParameters(ctx, ccModule.LocalFlags.ConlyFlags)
+ dpInfo.Global_Cpp_flags = parseCompilerCCParameters(ctx, ccModule.GlobalFlags.CppFlags)
+ dpInfo.Local_Cpp_flags = parseCompilerCCParameters(ctx, ccModule.LocalFlags.CppFlags)
+ dpInfo.System_include_flags = parseCompilerCCParameters(ctx, ccModule.SystemIncludeFlags)
dpInfo.Module_name = moduleName
diff --git a/cc/cmake_snapshot.go b/cc/cmake_snapshot.go
index 3f6a01d1b..c51fa10dd 100644
--- a/cc/cmake_snapshot.go
+++ b/cc/cmake_snapshot.go
@@ -503,6 +503,10 @@ func (m *CmakeSnapshot) GenerateAndroidBuildActions(ctx android.ModuleContext) {
zipRule.Build(m.zipPath.String(), "archiving "+ctx.ModuleName())
ctx.SetOutputFiles(android.Paths{m.zipPath}, "")
+
+ moduleInfoJSON := ctx.ModuleInfoJSON()
+ moduleInfoJSON.Class = []string{"DATA"}
+ moduleInfoJSON.SystemSharedLibs = []string{"none"}
}
func (m *CmakeSnapshot) AndroidMkEntries() []android.AndroidMkEntries {
diff --git a/cc/cmakelists.go b/cc/cmakelists.go
index 0f3f02da5..c2bd17ad9 100644
--- a/cc/cmakelists.go
+++ b/cc/cmakelists.go
@@ -16,12 +16,12 @@ package cc
import (
"fmt"
-
- "android/soong/android"
"os"
"path"
"path/filepath"
"strings"
+
+ "android/soong/android"
)
// This singleton generates CMakeLists.txt files. It does so for each blueprint Android.bp resulting in a cc.Module
@@ -65,10 +65,10 @@ func (c *cmakelistsGeneratorSingleton) GenerateBuildActions(ctx android.Singleto
// variant for each project.
seenProjects := map[string]bool{}
- ctx.VisitAllModules(func(module android.Module) {
- if ccModule, ok := module.(*Module); ok {
- if compiledModule, ok := ccModule.compiler.(CompiledInterface); ok {
- generateCLionProject(compiledModule, ctx, ccModule, seenProjects)
+ ctx.VisitAllModuleProxies(func(module android.ModuleProxy) {
+ if ccModule, ok := android.OtherModuleProvider(ctx, module, CcInfoProvider); ok {
+ if ccModule.CompilerInfo != nil {
+ generateCLionProject(ctx, module, ccModule, seenProjects)
}
}
})
@@ -117,15 +117,15 @@ func linkAggregateCMakeListsFiles(path string, info os.FileInfo, err error) erro
return nil
}
-func generateCLionProject(compiledModule CompiledInterface, ctx android.SingletonContext, ccModule *Module,
+func generateCLionProject(ctx android.SingletonContext, module android.ModuleProxy, ccModule *CcInfo,
seenProjects map[string]bool) {
- srcs := compiledModule.Srcs()
+ srcs := ccModule.CompilerInfo.Srcs
if len(srcs) == 0 {
return
}
// Only write CMakeLists.txt for the first variant of each architecture of each module
- clionprojectLocation := getCMakeListsForModule(ccModule, ctx)
+ clionprojectLocation := getCMakeListsForModule(ctx, module)
if seenProjects[clionprojectLocation] {
return
}
@@ -146,7 +146,7 @@ func generateCLionProject(compiledModule CompiledInterface, ctx android.Singleto
f.WriteString("# To improve project view in Clion :\n")
f.WriteString("# Tools > CMake > Change Project Root \n\n")
f.WriteString(fmt.Sprintf("cmake_minimum_required(VERSION %s)\n", minimumCMakeVersionSupported))
- f.WriteString(fmt.Sprintf("project(%s)\n", ccModule.ModuleBase.Name()))
+ f.WriteString(fmt.Sprintf("project(%s)\n", module.Name()))
f.WriteString(fmt.Sprintf("set(ANDROID_ROOT %s)\n\n", android.AbsSrcDirForExistingUseCases()))
pathToCC, _ := evalVariable(ctx, "${config.ClangBin}/")
@@ -163,44 +163,44 @@ func generateCLionProject(compiledModule CompiledInterface, ctx android.Singleto
// Add all header search path and compiler parameters (-D, -W, -f, -XXXX)
f.WriteString("\n# GLOBAL ALL FLAGS:\n")
- globalAllParameters := parseCompilerParameters(ccModule.flags.Global.CommonFlags, ctx, f)
+ globalAllParameters := parseCompilerParameters(ccModule.GlobalFlags.CommonFlags, ctx, f)
translateToCMake(globalAllParameters, f, true, true)
f.WriteString("\n# LOCAL ALL FLAGS:\n")
- localAllParameters := parseCompilerParameters(ccModule.flags.Local.CommonFlags, ctx, f)
+ localAllParameters := parseCompilerParameters(ccModule.LocalFlags.CommonFlags, ctx, f)
translateToCMake(localAllParameters, f, true, true)
f.WriteString("\n# GLOBAL CFLAGS:\n")
- globalCParameters := parseCompilerParameters(ccModule.flags.Global.CFlags, ctx, f)
+ globalCParameters := parseCompilerParameters(ccModule.GlobalFlags.CFlags, ctx, f)
translateToCMake(globalCParameters, f, true, true)
f.WriteString("\n# LOCAL CFLAGS:\n")
- localCParameters := parseCompilerParameters(ccModule.flags.Local.CFlags, ctx, f)
+ localCParameters := parseCompilerParameters(ccModule.LocalFlags.CFlags, ctx, f)
translateToCMake(localCParameters, f, true, true)
f.WriteString("\n# GLOBAL C ONLY FLAGS:\n")
- globalConlyParameters := parseCompilerParameters(ccModule.flags.Global.ConlyFlags, ctx, f)
+ globalConlyParameters := parseCompilerParameters(ccModule.GlobalFlags.ConlyFlags, ctx, f)
translateToCMake(globalConlyParameters, f, true, false)
f.WriteString("\n# LOCAL C ONLY FLAGS:\n")
- localConlyParameters := parseCompilerParameters(ccModule.flags.Local.ConlyFlags, ctx, f)
+ localConlyParameters := parseCompilerParameters(ccModule.LocalFlags.ConlyFlags, ctx, f)
translateToCMake(localConlyParameters, f, true, false)
f.WriteString("\n# GLOBAL CPP FLAGS:\n")
- globalCppParameters := parseCompilerParameters(ccModule.flags.Global.CppFlags, ctx, f)
+ globalCppParameters := parseCompilerParameters(ccModule.GlobalFlags.CppFlags, ctx, f)
translateToCMake(globalCppParameters, f, false, true)
f.WriteString("\n# LOCAL CPP FLAGS:\n")
- localCppParameters := parseCompilerParameters(ccModule.flags.Local.CppFlags, ctx, f)
+ localCppParameters := parseCompilerParameters(ccModule.LocalFlags.CppFlags, ctx, f)
translateToCMake(localCppParameters, f, false, true)
f.WriteString("\n# GLOBAL SYSTEM INCLUDE FLAGS:\n")
- globalIncludeParameters := parseCompilerParameters(ccModule.flags.SystemIncludeFlags, ctx, f)
+ globalIncludeParameters := parseCompilerParameters(ccModule.SystemIncludeFlags, ctx, f)
translateToCMake(globalIncludeParameters, f, true, true)
// Add project executable.
f.WriteString(fmt.Sprintf("\nadd_executable(%s ${SOURCE_FILES})\n",
- cleanExecutableName(ccModule.ModuleBase.Name())))
+ cleanExecutableName(module.Name())))
}
func cleanExecutableName(s string) string {
@@ -467,12 +467,13 @@ func evalVariable(ctx android.SingletonContext, str string) (string, error) {
return "", err
}
-func getCMakeListsForModule(module *Module, ctx android.SingletonContext) string {
+func getCMakeListsForModule(ctx android.SingletonContext, module android.ModuleProxy) string {
+ commonInfo := android.OtherModuleProviderOrDefault(ctx, module, android.CommonModuleInfoProvider)
return filepath.Join(android.AbsSrcDirForExistingUseCases(),
cLionOutputProjectsDirectory,
path.Dir(ctx.BlueprintFile(module)),
- module.ModuleBase.Name()+"-"+
- module.ModuleBase.Arch().ArchType.Name+"-"+
- module.ModuleBase.Os().Name,
+ module.Name()+"-"+
+ commonInfo.Target.Arch.ArchType.Name+"-"+
+ commonInfo.Target.Os.Name,
cMakeListsFilename)
}
diff --git a/cc/compdb.go b/cc/compdb.go
index 3818e9c46..4f61e5793 100644
--- a/cc/compdb.go
+++ b/cc/compdb.go
@@ -69,10 +69,10 @@ func (c *compdbGeneratorSingleton) GenerateBuildActions(ctx android.SingletonCon
// We only want one entry per file. We don't care what module/isa it's from
m := make(map[string]compDbEntry)
- ctx.VisitAllModules(func(module android.Module) {
- if ccModule, ok := module.(*Module); ok {
- if compiledModule, ok := ccModule.compiler.(CompiledInterface); ok {
- generateCompdbProject(compiledModule, ctx, ccModule, m)
+ ctx.VisitAllModuleProxies(func(module android.ModuleProxy) {
+ if ccModule, ok := android.OtherModuleProvider(ctx, module, CcInfoProvider); ok {
+ if ccModule.CompilerInfo != nil {
+ generateCompdbProject(ctx, module, ccModule, m)
}
}
})
@@ -127,7 +127,7 @@ func expandAllVars(ctx android.SingletonContext, args []string) []string {
return out
}
-func getArguments(src android.Path, ctx android.SingletonContext, ccModule *Module, ccPath string, cxxPath string) []string {
+func getArguments(ctx android.SingletonContext, src android.Path, ccModule *CcInfo, ccPath string, cxxPath string) []string {
var args []string
isCpp := false
isAsm := false
@@ -155,25 +155,25 @@ func getArguments(src android.Path, ctx android.SingletonContext, ccModule *Modu
clangPath = ccPath
}
args = append(args, clangPath)
- args = append(args, expandAllVars(ctx, ccModule.flags.Global.CommonFlags)...)
- args = append(args, expandAllVars(ctx, ccModule.flags.Local.CommonFlags)...)
- args = append(args, expandAllVars(ctx, ccModule.flags.Global.CFlags)...)
- args = append(args, expandAllVars(ctx, ccModule.flags.Local.CFlags)...)
+ args = append(args, expandAllVars(ctx, ccModule.GlobalFlags.CommonFlags)...)
+ args = append(args, expandAllVars(ctx, ccModule.LocalFlags.CommonFlags)...)
+ args = append(args, expandAllVars(ctx, ccModule.GlobalFlags.CFlags)...)
+ args = append(args, expandAllVars(ctx, ccModule.LocalFlags.CFlags)...)
if isCpp {
- args = append(args, expandAllVars(ctx, ccModule.flags.Global.CppFlags)...)
- args = append(args, expandAllVars(ctx, ccModule.flags.Local.CppFlags)...)
+ args = append(args, expandAllVars(ctx, ccModule.GlobalFlags.CppFlags)...)
+ args = append(args, expandAllVars(ctx, ccModule.LocalFlags.CppFlags)...)
} else if !isAsm {
- args = append(args, expandAllVars(ctx, ccModule.flags.Global.ConlyFlags)...)
- args = append(args, expandAllVars(ctx, ccModule.flags.Local.ConlyFlags)...)
+ args = append(args, expandAllVars(ctx, ccModule.GlobalFlags.ConlyFlags)...)
+ args = append(args, expandAllVars(ctx, ccModule.LocalFlags.ConlyFlags)...)
}
- args = append(args, expandAllVars(ctx, ccModule.flags.SystemIncludeFlags)...)
- args = append(args, expandAllVars(ctx, ccModule.flags.NoOverrideFlags)...)
+ args = append(args, expandAllVars(ctx, ccModule.SystemIncludeFlags)...)
+ args = append(args, expandAllVars(ctx, ccModule.NoOverrideFlags)...)
args = append(args, src.String())
return args
}
-func generateCompdbProject(compiledModule CompiledInterface, ctx android.SingletonContext, ccModule *Module, builds map[string]compDbEntry) {
- srcs := compiledModule.Srcs()
+func generateCompdbProject(ctx android.SingletonContext, module android.ModuleProxy, ccModule *CcInfo, builds map[string]compDbEntry) {
+ srcs := ccModule.CompilerInfo.Srcs
if len(srcs) == 0 {
return
}
@@ -187,7 +187,7 @@ func generateCompdbProject(compiledModule CompiledInterface, ctx android.Singlet
}
for _, src := range srcs {
if _, ok := builds[src.String()]; !ok {
- args := getArguments(src, ctx, ccModule, ccPath, cxxPath)
+ args := getArguments(ctx, src, ccModule, ccPath, cxxPath)
if args == nil {
continue
}
diff --git a/cc/config/arm64_device.go b/cc/config/arm64_device.go
index 25edb798d..332c138c7 100644
--- a/cc/config/arm64_device.go
+++ b/cc/config/arm64_device.go
@@ -28,38 +28,21 @@ var (
}
arm64ArchVariantCflags = map[string][]string{
- "armv8-a": []string{
- "-march=armv8-a",
- },
- "armv8-a-branchprot": []string{
- "-march=armv8-a",
- "-mbranch-protection=standard",
- },
- "armv8-2a": []string{
- "-march=armv8.2-a",
- },
- "armv8-2a-dotprod": []string{
- "-march=armv8.2-a+dotprod",
- },
- // On ARMv9 and later, Pointer Authentication Codes (PAC) are mandatory,
- // so -fstack-protector is unnecessary.
- "armv9-a": []string{
- "-march=armv9-a",
- "-mbranch-protection=standard",
- "-fno-stack-protector",
- },
- "armv9-2a": []string{
- "-march=armv9.2-a",
- "-mbranch-protection=standard",
- "-fno-stack-protector",
- },
- "armv9-3a": []string{
- "-march=armv9.3-a",
- "-mbranch-protection=standard",
- "-fno-stack-protector",
- },
- "armv9-4a": []string{
- "-march=armv9.4-a",
+ "armv8-a": {"-march=armv8-a"},
+ "armv8-a-branchprot": {"-march=armv8-a"},
+ "armv8-2a": {"-march=armv8.2-a"},
+ "armv8-2a-dotprod": {"-march=armv8.2-a+dotprod"},
+ "armv8-5a": {"-march=armv8.5-a"},
+ "armv8-7a": {"-march=armv8.7-a"},
+ "armv9-a": {"-march=armv9-a"},
+ "armv9-2a": {"-march=armv9.2-a"},
+ "armv9-3a": {"-march=armv9.3-a"},
+ "armv9-4a": {"-march=armv9.4-a"},
+ }
+
+ arm64ArchFeatureCflags = map[string][]string{
+ // When Pointer Authentication Codes (PAC) are available, -fstack-protector is unnecessary.
+ "branchprot": {
"-mbranch-protection=standard",
"-fno-stack-protector",
},
@@ -70,8 +53,6 @@ var (
"-Wl,-z,separate-loadable-segments",
}
- arm64Lldflags = arm64Ldflags
-
arm64Cppflags = []string{}
arm64CpuVariantCflags = map[string][]string{
@@ -108,11 +89,9 @@ var (
)
func init() {
- pctx.StaticVariable("Arm64Ldflags", strings.Join(arm64Ldflags, " "))
-
- pctx.VariableFunc("Arm64Lldflags", func(ctx android.PackageVarContext) string {
+ pctx.VariableFunc("Arm64Ldflags", func(ctx android.PackageVarContext) string {
maxPageSizeFlag := "-Wl,-z,max-page-size=" + ctx.Config().MaxPageSizeSupported()
- flags := append(arm64Lldflags, maxPageSizeFlag)
+ flags := append(arm64Ldflags, maxPageSizeFlag)
return strings.Join(flags, " ")
})
@@ -170,7 +149,6 @@ type toolchainArm64 struct {
toolchain64Bit
ldflags string
- lldflags string
toolchainCflags string
}
@@ -198,10 +176,6 @@ func (t *toolchainArm64) Ldflags() string {
return t.ldflags
}
-func (t *toolchainArm64) Lldflags() string {
- return t.lldflags
-}
-
func (t *toolchainArm64) ToolchainCflags() string {
return t.toolchainCflags
}
@@ -219,6 +193,9 @@ func arm64ToolchainFactory(arch android.Arch) Toolchain {
toolchainCflags := []string{"${config.Arm64" + arch.ArchVariant + "VariantCflags}"}
toolchainCflags = append(toolchainCflags,
variantOrDefault(arm64CpuVariantCflagsVar, arch.CpuVariant))
+ for _, feature := range arch.ArchFeatures {
+ toolchainCflags = append(toolchainCflags, arm64ArchFeatureCflags[feature]...)
+ }
extraLdflags := variantOrDefault(arm64CpuVariantLdflags, arch.CpuVariant)
return &toolchainArm64{
@@ -226,10 +203,6 @@ func arm64ToolchainFactory(arch android.Arch) Toolchain {
"${config.Arm64Ldflags}",
extraLdflags,
}, " "),
- lldflags: strings.Join([]string{
- "${config.Arm64Lldflags}",
- extraLdflags,
- }, " "),
toolchainCflags: strings.Join(toolchainCflags, " "),
}
}
diff --git a/cc/config/arm64_linux_host.go b/cc/config/arm64_linux_host.go
index a19b0ed92..32cf722c5 100644
--- a/cc/config/arm64_linux_host.go
+++ b/cc/config/arm64_linux_host.go
@@ -43,11 +43,8 @@ var (
"-Wl,--build-id=md5",
"-Wl,--fatal-warnings",
"-Wl,--no-undefined-version",
- }
-
- linuxCrossLldflags = append(linuxCrossLdflags,
"-Wl,--compress-debug-sections=zstd",
- )
+ }
// Embed the linker into host bionic binaries. This is needed to support host bionic,
// as the linux kernel requires that the ELF interpreter referenced by PT_INTERP be
@@ -63,7 +60,6 @@ var (
func init() {
pctx.StaticVariable("LinuxBionicArm64Cflags", strings.Join(linuxCrossCflags, " "))
pctx.StaticVariable("LinuxBionicArm64Ldflags", strings.Join(linuxCrossLdflags, " "))
- pctx.StaticVariable("LinuxBionicArm64Lldflags", strings.Join(linuxCrossLldflags, " "))
}
// toolchain config for ARM64 Linux CrossHost. Almost everything is the same as the ARM64 Android
@@ -102,11 +98,6 @@ func linuxBionicArm64ToolchainFactory(arch android.Arch) Toolchain {
"${config.LinuxBionicArm64Ldflags}",
extraLdflags,
}, " ")
- ret.toolchainArm64.lldflags = strings.Join([]string{
- "${config.Arm64Lldflags}",
- "${config.LinuxBionicArm64Ldflags}",
- extraLdflags,
- }, " ")
ret.toolchainArm64.toolchainCflags = strings.Join(toolchainCflags, " ")
return &ret
}
diff --git a/cc/config/arm_device.go b/cc/config/arm_device.go
index 3cb190966..de9c749b0 100644
--- a/cc/config/arm_device.go
+++ b/cc/config/arm_device.go
@@ -15,7 +15,6 @@
package config
import (
- "fmt"
"strings"
"android/soong/android"
@@ -43,8 +42,6 @@ var (
"-Wl,-mllvm", "-Wl,-enable-shrink-wrap=false",
}
- armLldflags = armLdflags
-
armFixCortexA8LdFlags = []string{"-Wl,--fix-cortex-a8"}
armNoFixCortexA8LdFlags = []string{"-Wl,--no-fix-cortex-a8"}
@@ -186,7 +183,6 @@ const (
func init() {
pctx.StaticVariable("ArmLdflags", strings.Join(armLdflags, " "))
- pctx.StaticVariable("ArmLldflags", strings.Join(armLldflags, " "))
pctx.StaticVariable("ArmFixCortexA8LdFlags", strings.Join(armFixCortexA8LdFlags, " "))
pctx.StaticVariable("ArmNoFixCortexA8LdFlags", strings.Join(armNoFixCortexA8LdFlags, " "))
@@ -252,7 +248,6 @@ type toolchainArm struct {
toolchainBionic
toolchain32Bit
ldflags string
- lldflags string
toolchainCflags string
}
@@ -287,11 +282,7 @@ func (t *toolchainArm) Cppflags() string {
}
func (t *toolchainArm) Ldflags() string {
- return t.ldflags
-}
-
-func (t *toolchainArm) Lldflags() string {
- return t.lldflags // TODO: handle V8 cases
+ return t.ldflags // TODO: handle V8 cases
}
func (t *toolchainArm) InstructionSetFlags(isa string) (string, error) {
@@ -310,7 +301,6 @@ func (toolchainArm) LibclangRuntimeLibraryArch() string {
}
func armToolchainFactory(arch android.Arch) Toolchain {
- var fixCortexA8 string
toolchainCflags := make([]string, 2, 3)
toolchainCflags[0] = "${config.ArmToolchainCflags}"
@@ -319,29 +309,8 @@ func armToolchainFactory(arch android.Arch) Toolchain {
toolchainCflags = append(toolchainCflags,
variantOrDefault(armCpuVariantCflagsVar, arch.CpuVariant))
- switch arch.ArchVariant {
- case "armv7-a-neon":
- switch arch.CpuVariant {
- case "cortex-a8", "":
- // Generic ARM might be a Cortex A8 -- better safe than sorry
- fixCortexA8 = "${config.ArmFixCortexA8LdFlags}"
- default:
- fixCortexA8 = "${config.ArmNoFixCortexA8LdFlags}"
- }
- case "armv7-a":
- fixCortexA8 = "${config.ArmFixCortexA8LdFlags}"
- case "armv8-a", "armv8-2a":
- // Nothing extra for armv8-a/armv8-2a
- default:
- panic(fmt.Sprintf("Unknown ARM architecture version: %q", arch.ArchVariant))
- }
-
return &toolchainArm{
- ldflags: strings.Join([]string{
- "${config.ArmLdflags}",
- fixCortexA8,
- }, " "),
- lldflags: "${config.ArmLldflags}",
+ ldflags: "${config.ArmLdflags}",
toolchainCflags: strings.Join(toolchainCflags, " "),
}
}
diff --git a/cc/config/arm_linux_host.go b/cc/config/arm_linux_host.go
index e7c7bc466..ebac56f8a 100644
--- a/cc/config/arm_linux_host.go
+++ b/cc/config/arm_linux_host.go
@@ -15,8 +15,9 @@
package config
import (
- "android/soong/android"
"strings"
+
+ "android/soong/android"
)
var (
@@ -28,26 +29,19 @@ var (
linuxArmLdflags = []string{
"-march=armv7a",
- }
-
- linuxArmLldflags = append(linuxArmLdflags,
"-Wl,--compress-debug-sections=zstd",
- )
-
- linuxArm64Ldflags = []string{}
+ }
- linuxArm64Lldflags = append(linuxArm64Ldflags,
+ linuxArm64Ldflags = []string{
"-Wl,--compress-debug-sections=zstd",
- )
+ }
)
func init() {
pctx.StaticVariable("LinuxArmCflags", strings.Join(linuxArmCflags, " "))
pctx.StaticVariable("LinuxArm64Cflags", strings.Join(linuxArm64Cflags, " "))
pctx.StaticVariable("LinuxArmLdflags", strings.Join(linuxArmLdflags, " "))
- pctx.StaticVariable("LinuxArmLldflags", strings.Join(linuxArmLldflags, " "))
pctx.StaticVariable("LinuxArm64Ldflags", strings.Join(linuxArm64Ldflags, " "))
- pctx.StaticVariable("LinuxArm64Lldflags", strings.Join(linuxArm64Lldflags, " "))
pctx.StaticVariable("LinuxArmYasmFlags", "-f elf32 -m arm")
pctx.StaticVariable("LinuxArm64YasmFlags", "-f elf64 -m aarch64")
@@ -93,18 +87,10 @@ func (t *toolchainLinuxArm) Ldflags() string {
return "${config.LinuxLdflags} ${config.LinuxArmLdflags}"
}
-func (t *toolchainLinuxArm) Lldflags() string {
- return "${config.LinuxLldflags} ${config.LinuxArmLldflags}"
-}
-
func (t *toolchainLinuxArm64) Ldflags() string {
return "${config.LinuxLdflags} ${config.LinuxArm64Ldflags}"
}
-func (t *toolchainLinuxArm64) Lldflags() string {
- return "${config.LinuxLldflags} ${config.LinuxArm64Lldflags}"
-}
-
func (t *toolchainLinuxArm) YasmFlags() string {
return "${config.LinuxArmYasmFlags}"
}
@@ -148,10 +134,6 @@ func (t *toolchainLinuxMuslArm) Ldflags() string {
return t.toolchainLinuxArm.Ldflags() + " " + t.toolchainMusl.Ldflags()
}
-func (t *toolchainLinuxMuslArm) Lldflags() string {
- return t.toolchainLinuxArm.Lldflags() + " " + t.toolchainMusl.Lldflags()
-}
-
func (t *toolchainLinuxMuslArm64) ClangTriple() string {
return "aarch64-linux-musl"
}
@@ -164,10 +146,6 @@ func (t *toolchainLinuxMuslArm64) Ldflags() string {
return t.toolchainLinuxArm64.Ldflags() + " " + t.toolchainMusl.Ldflags()
}
-func (t *toolchainLinuxMuslArm64) Lldflags() string {
- return t.toolchainLinuxArm64.Lldflags() + " " + t.toolchainMusl.Lldflags()
-}
-
var toolchainLinuxMuslArmSingleton Toolchain = &toolchainLinuxMuslArm{}
var toolchainLinuxMuslArm64Singleton Toolchain = &toolchainLinuxMuslArm64{}
diff --git a/cc/config/darwin_host.go b/cc/config/darwin_host.go
index 716965a3a..03eefc096 100644
--- a/cc/config/darwin_host.go
+++ b/cc/config/darwin_host.go
@@ -99,7 +99,6 @@ func init() {
pctx.StaticVariable("DarwinCflags", strings.Join(darwinCflags, " "))
pctx.StaticVariable("DarwinLdflags", strings.Join(darwinLdflags, " "))
- pctx.StaticVariable("DarwinLldflags", strings.Join(darwinLdflags, " "))
pctx.StaticVariable("DarwinYasmFlags", "-f macho -m amd64")
}
@@ -212,10 +211,6 @@ func (t *toolchainDarwin) Ldflags() string {
return "${config.DarwinLdflags}"
}
-func (t *toolchainDarwin) Lldflags() string {
- return "${config.DarwinLldflags}"
-}
-
func (t *toolchainDarwin) YasmFlags() string {
return "${config.DarwinYasmFlags}"
}
diff --git a/cc/config/global.go b/cc/config/global.go
index e81ac0d47..b08ac6f7e 100644
--- a/cc/config/global.go
+++ b/cc/config/global.go
@@ -177,7 +177,7 @@ var (
"-Werror=format-security",
}
- commonGlobalLldflags = []string{
+ commonGlobalLdflags = []string{
"-fuse-ld=lld",
"-Wl,--icf=safe",
"-Wl,--no-demangle",
@@ -188,7 +188,7 @@ var (
}
// Linking flags for device code; not applied to host binaries.
- deviceGlobalLdflags = []string{
+ deviceGlobalLdflags = slices.Concat([]string{
"-Wl,-z,noexecstack",
"-Wl,-z,relro",
"-Wl,-z,now",
@@ -201,19 +201,14 @@ var (
"-Wl,--exclude-libs,libgcc_stripped.a",
"-Wl,--exclude-libs,libunwind_llvm.a",
"-Wl,--exclude-libs,libunwind.a",
- }
-
- deviceGlobalLldflags = append(append(deviceGlobalLdflags, commonGlobalLldflags...),
"-Wl,--compress-debug-sections=zstd",
- )
+ }, commonGlobalLdflags)
hostGlobalCflags = []string{}
hostGlobalCppflags = []string{}
- hostGlobalLdflags = []string{}
-
- hostGlobalLldflags = commonGlobalLldflags
+ hostGlobalLdflags = commonGlobalLdflags
commonGlobalCppflags = []string{
// -Wimplicit-fallthrough is not enabled by -Wall.
@@ -376,11 +371,13 @@ var (
"-pedantic",
"-pedantic-errors",
"-Werror=pedantic",
+ "-Wno-all",
+ "-Wno-everything",
}
CStdVersion = "gnu23"
CppStdVersion = "gnu++20"
- ExperimentalCStdVersion = "gnu2x"
+ ExperimentalCStdVersion = "gnu2y"
ExperimentalCppStdVersion = "gnu++2b"
// prebuilts/clang default settings.
@@ -409,10 +406,8 @@ func init() {
pctx.StaticVariable("CommonGlobalAsflags", strings.Join(commonGlobalAsflags, " "))
pctx.StaticVariable("DeviceGlobalCppflags", strings.Join(deviceGlobalCppflags, " "))
pctx.StaticVariable("DeviceGlobalLdflags", strings.Join(deviceGlobalLdflags, " "))
- pctx.StaticVariable("DeviceGlobalLldflags", strings.Join(deviceGlobalLldflags, " "))
pctx.StaticVariable("HostGlobalCppflags", strings.Join(hostGlobalCppflags, " "))
pctx.StaticVariable("HostGlobalLdflags", strings.Join(hostGlobalLdflags, " "))
- pctx.StaticVariable("HostGlobalLldflags", strings.Join(hostGlobalLldflags, " "))
pctx.VariableFunc("CommonGlobalCflags", func(ctx android.PackageVarContext) string {
flags := slices.Clone(commonGlobalCflags)
@@ -493,15 +488,12 @@ func init() {
}
pctx.PrefixedExistentPathsForSourcesVariable("CommonGlobalIncludes", "-I", commonGlobalIncludes)
- pctx.StaticVariable("CLANG_DEFAULT_VERSION", ClangDefaultVersion)
- pctx.StaticVariable("CLANG_DEFAULT_SHORT_VERSION", ClangDefaultShortVersion)
-
pctx.StaticVariableWithEnvOverride("ClangBase", "LLVM_PREBUILTS_BASE", ClangDefaultBase)
pctx.StaticVariableWithEnvOverride("ClangVersion", "LLVM_PREBUILTS_VERSION", ClangDefaultVersion)
+ pctx.StaticVariableWithEnvOverride("ClangShortVersion", "LLVM_RELEASE_VERSION", ClangDefaultShortVersion)
+
pctx.StaticVariable("ClangPath", "${ClangBase}/${HostPrebuiltTag}/${ClangVersion}")
pctx.StaticVariable("ClangBin", "${ClangPath}/bin")
-
- pctx.StaticVariableWithEnvOverride("ClangShortVersion", "LLVM_RELEASE_VERSION", ClangDefaultShortVersion)
pctx.StaticVariable("ClangAsanLibDir", "${ClangBase}/linux-x86/${ClangVersion}/lib/clang/${ClangShortVersion}/lib/linux")
pctx.StaticVariable("WarningAllowedProjects", strings.Join(WarningAllowedProjects, " "))
diff --git a/cc/config/riscv64_device.go b/cc/config/riscv64_device.go
index 6a5293f4c..4bbf9fcef 100644
--- a/cc/config/riscv64_device.go
+++ b/cc/config/riscv64_device.go
@@ -41,13 +41,8 @@ var (
// This is already the driver's Android default, but duplicated here (and
// above) for ease of experimentation with additional extensions.
"-march=rv64gcv_zba_zbb_zbs",
- // TODO: remove when clang default changed (https://github.com/google/android-riscv64/issues/124)
- "-Wl,-mllvm -Wl,-jump-is-expensive=false",
- }
-
- riscv64Lldflags = append(riscv64Ldflags,
"-Wl,-z,max-page-size=4096",
- )
+ }
riscv64Cppflags = []string{}
@@ -59,7 +54,6 @@ const ()
func init() {
pctx.StaticVariable("Riscv64Ldflags", strings.Join(riscv64Ldflags, " "))
- pctx.StaticVariable("Riscv64Lldflags", strings.Join(riscv64Lldflags, " "))
pctx.StaticVariable("Riscv64Cflags", strings.Join(riscv64Cflags, " "))
pctx.StaticVariable("Riscv64Cppflags", strings.Join(riscv64Cppflags, " "))
@@ -78,7 +72,6 @@ type toolchainRiscv64 struct {
toolchain64Bit
ldflags string
- lldflags string
toolchainCflags string
}
@@ -106,10 +99,6 @@ func (t *toolchainRiscv64) Ldflags() string {
return t.ldflags
}
-func (t *toolchainRiscv64) Lldflags() string {
- return t.lldflags
-}
-
func (t *toolchainRiscv64) ToolchainCflags() string {
return t.toolchainCflags
}
@@ -135,10 +124,6 @@ func riscv64ToolchainFactory(arch android.Arch) Toolchain {
"${config.Riscv64Ldflags}",
extraLdflags,
}, " "),
- lldflags: strings.Join([]string{
- "${config.Riscv64Lldflags}",
- extraLdflags,
- }, " "),
toolchainCflags: strings.Join(toolchainCflags, " "),
}
}
diff --git a/cc/config/toolchain.go b/cc/config/toolchain.go
index 5d8c351ab..7adb07beb 100644
--- a/cc/config/toolchain.go
+++ b/cc/config/toolchain.go
@@ -79,7 +79,6 @@ type Toolchain interface {
Cflags() string
Cppflags() string
Ldflags() string
- Lldflags() string
InstructionSetFlags(string) (string, error)
ndkTriple() string
diff --git a/cc/config/x86_64_device.go b/cc/config/x86_64_device.go
index e7ac03863..2ee425db0 100644
--- a/cc/config/x86_64_device.go
+++ b/cc/config/x86_64_device.go
@@ -33,8 +33,6 @@ var (
"-Wl,-z,separate-loadable-segments",
}
- X86_64Lldflags = x86_64Ldflags
-
x86_64ArchVariantCflags = map[string][]string{
"": []string{
"-march=x86-64",
@@ -103,10 +101,9 @@ func init() {
pctx.StaticVariable("X86_64ToolchainCflags", "-m64")
pctx.StaticVariable("X86_64ToolchainLdflags", "-m64")
- pctx.StaticVariable("X86_64Ldflags", strings.Join(x86_64Ldflags, " "))
- pctx.VariableFunc("X86_64Lldflags", func(ctx android.PackageVarContext) string {
+ pctx.VariableFunc("X86_64Ldflags", func(ctx android.PackageVarContext) string {
maxPageSizeFlag := "-Wl,-z,max-page-size=" + ctx.Config().MaxPageSizeSupported()
- flags := append(X86_64Lldflags, maxPageSizeFlag)
+ flags := append(x86_64Ldflags, maxPageSizeFlag)
return strings.Join(flags, " ")
})
@@ -170,10 +167,6 @@ func (t *toolchainX86_64) Ldflags() string {
return "${config.X86_64Ldflags}"
}
-func (t *toolchainX86_64) Lldflags() string {
- return "${config.X86_64Lldflags}"
-}
-
func (t *toolchainX86_64) YasmFlags() string {
return "${config.X86_64YasmFlags}"
}
diff --git a/cc/config/x86_device.go b/cc/config/x86_device.go
index a92881d91..bd8d9d6de 100644
--- a/cc/config/x86_device.go
+++ b/cc/config/x86_device.go
@@ -108,7 +108,6 @@ func init() {
pctx.StaticVariable("X86ToolchainLdflags", "-m32")
pctx.StaticVariable("X86Ldflags", strings.Join(x86Ldflags, " "))
- pctx.StaticVariable("X86Lldflags", strings.Join(x86Ldflags, " "))
// Clang cflags
pctx.StaticVariable("X86Cflags", strings.Join(x86Cflags, " "))
@@ -161,10 +160,6 @@ func (t *toolchainX86) Ldflags() string {
return "${config.X86Ldflags}"
}
-func (t *toolchainX86) Lldflags() string {
- return "${config.X86Lldflags}"
-}
-
func (t *toolchainX86) YasmFlags() string {
return "${config.X86YasmFlags}"
}
diff --git a/cc/config/x86_linux_bionic_host.go b/cc/config/x86_linux_bionic_host.go
index d2f88ef34..6d3512920 100644
--- a/cc/config/x86_linux_bionic_host.go
+++ b/cc/config/x86_linux_bionic_host.go
@@ -15,8 +15,9 @@
package config
import (
- "android/soong/android"
"strings"
+
+ "android/soong/android"
)
var (
@@ -53,11 +54,9 @@ var (
// Use the device gcc toolchain
"--gcc-toolchain=${LinuxBionicGccRoot}",
- }
- linuxBionicLldflags = append(linuxBionicLdflags,
"-Wl,--compress-debug-sections=zstd",
- )
+ }
// Embed the linker into host bionic binaries. This is needed to support host bionic,
// as the linux kernel requires that the ELF interpreter referenced by PT_INTERP be
@@ -77,7 +76,6 @@ const (
func init() {
pctx.StaticVariable("LinuxBionicCflags", strings.Join(linuxBionicCflags, " "))
pctx.StaticVariable("LinuxBionicLdflags", strings.Join(linuxBionicLdflags, " "))
- pctx.StaticVariable("LinuxBionicLldflags", strings.Join(linuxBionicLldflags, " "))
// Use the device gcc toolchain for now
pctx.StaticVariable("LinuxBionicGccVersion", x86_64GccVersion)
@@ -115,10 +113,6 @@ func (t *toolchainLinuxBionic) Ldflags() string {
return "${config.LinuxBionicLdflags}"
}
-func (t *toolchainLinuxBionic) Lldflags() string {
- return "${config.LinuxBionicLldflags}"
-}
-
func (t *toolchainLinuxBionic) ToolchainCflags() string {
return "-m64 -march=x86-64" +
// TODO: We're not really android, but we don't have a triple yet b/31393676
diff --git a/cc/config/x86_linux_host.go b/cc/config/x86_linux_host.go
index c3f25aa21..0601b2f7e 100644
--- a/cc/config/x86_linux_host.go
+++ b/cc/config/x86_linux_host.go
@@ -53,11 +53,9 @@ var (
"-Wl,--no-undefined-version",
"--gcc-toolchain=${LinuxGccRoot}",
- }
- linuxLldflags = append(linuxLdflags,
"-Wl,--compress-debug-sections=zstd",
- )
+ }
linuxGlibcLdflags = []string{
"--sysroot ${LinuxGccRoot}/sysroot",
@@ -138,20 +136,15 @@ func init() {
pctx.StaticVariable("LinuxCflags", strings.Join(linuxCflags, " "))
pctx.StaticVariable("LinuxLdflags", strings.Join(linuxLdflags, " "))
- pctx.StaticVariable("LinuxLldflags", strings.Join(linuxLldflags, " "))
pctx.StaticVariable("LinuxGlibcCflags", strings.Join(linuxGlibcCflags, " "))
pctx.StaticVariable("LinuxGlibcLdflags", strings.Join(linuxGlibcLdflags, " "))
- pctx.StaticVariable("LinuxGlibcLldflags", strings.Join(linuxGlibcLdflags, " "))
pctx.StaticVariable("LinuxMuslCflags", strings.Join(linuxMuslCflags, " "))
pctx.StaticVariable("LinuxMuslLdflags", strings.Join(linuxMuslLdflags, " "))
- pctx.StaticVariable("LinuxMuslLldflags", strings.Join(linuxMuslLdflags, " "))
pctx.StaticVariable("LinuxX86Cflags", strings.Join(linuxX86Cflags, " "))
pctx.StaticVariable("LinuxX8664Cflags", strings.Join(linuxX8664Cflags, " "))
pctx.StaticVariable("LinuxX86Ldflags", strings.Join(linuxX86Ldflags, " "))
- pctx.StaticVariable("LinuxX86Lldflags", strings.Join(linuxX86Ldflags, " "))
pctx.StaticVariable("LinuxX8664Ldflags", strings.Join(linuxX8664Ldflags, " "))
- pctx.StaticVariable("LinuxX8664Lldflags", strings.Join(linuxX8664Ldflags, " "))
// Yasm flags
pctx.StaticVariable("LinuxX86YasmFlags", "-f elf32 -m x86")
pctx.StaticVariable("LinuxX8664YasmFlags", "-f elf64 -m amd64")
@@ -204,18 +197,10 @@ func (t *toolchainLinuxX86) Ldflags() string {
return "${config.LinuxLdflags} ${config.LinuxX86Ldflags}"
}
-func (t *toolchainLinuxX86) Lldflags() string {
- return "${config.LinuxLldflags} ${config.LinuxX86Lldflags}"
-}
-
func (t *toolchainLinuxX8664) Ldflags() string {
return "${config.LinuxLdflags} ${config.LinuxX8664Ldflags}"
}
-func (t *toolchainLinuxX8664) Lldflags() string {
- return "${config.LinuxLldflags} ${config.LinuxX8664Lldflags}"
-}
-
func (t *toolchainLinuxX86) YasmFlags() string {
return "${config.LinuxX86YasmFlags}"
}
@@ -260,10 +245,6 @@ func (toolchainGlibc) Ldflags() string {
return "${config.LinuxGlibcLdflags}"
}
-func (toolchainGlibc) Lldflags() string {
- return "${config.LinuxGlibcLldflags}"
-}
-
type toolchainLinuxGlibcX86 struct {
toolchainLinuxX86
toolchainGlibc
@@ -286,10 +267,6 @@ func (t *toolchainLinuxGlibcX86) Ldflags() string {
return t.toolchainLinuxX86.Ldflags() + " " + t.toolchainGlibc.Ldflags()
}
-func (t *toolchainLinuxGlibcX86) Lldflags() string {
- return t.toolchainLinuxX86.Lldflags() + " " + t.toolchainGlibc.Lldflags()
-}
-
func (t *toolchainLinuxGlibcX8664) ClangTriple() string {
return "x86_64-linux-gnu"
}
@@ -302,10 +279,6 @@ func (t *toolchainLinuxGlibcX8664) Ldflags() string {
return t.toolchainLinuxX8664.Ldflags() + " " + t.toolchainGlibc.Ldflags()
}
-func (t *toolchainLinuxGlibcX8664) Lldflags() string {
- return t.toolchainLinuxX8664.Lldflags() + " " + t.toolchainGlibc.Lldflags()
-}
-
var toolchainLinuxGlibcX86Singleton Toolchain = &toolchainLinuxGlibcX86{}
var toolchainLinuxGlibcX8664Singleton Toolchain = &toolchainLinuxGlibcX8664{}
@@ -342,10 +315,6 @@ func (toolchainMusl) Ldflags() string {
return "${config.LinuxMuslLdflags}"
}
-func (toolchainMusl) Lldflags() string {
- return "${config.LinuxMuslLldflags}"
-}
-
type toolchainLinuxMuslX86 struct {
toolchainLinuxX86
toolchainMusl
@@ -368,10 +337,6 @@ func (t *toolchainLinuxMuslX86) Ldflags() string {
return t.toolchainLinuxX86.Ldflags() + " " + t.toolchainMusl.Ldflags()
}
-func (t *toolchainLinuxMuslX86) Lldflags() string {
- return t.toolchainLinuxX86.Lldflags() + " " + t.toolchainMusl.Lldflags()
-}
-
func (t *toolchainLinuxMuslX8664) ClangTriple() string {
return "x86_64-linux-musl"
}
@@ -384,10 +349,6 @@ func (t *toolchainLinuxMuslX8664) Ldflags() string {
return t.toolchainLinuxX8664.Ldflags() + " " + t.toolchainMusl.Ldflags()
}
-func (t *toolchainLinuxMuslX8664) Lldflags() string {
- return t.toolchainLinuxX8664.Lldflags() + " " + t.toolchainMusl.Lldflags()
-}
-
var toolchainLinuxMuslX86Singleton Toolchain = &toolchainLinuxMuslX86{}
var toolchainLinuxMuslX8664Singleton Toolchain = &toolchainLinuxMuslX8664{}
diff --git a/cc/config/x86_windows_host.go b/cc/config/x86_windows_host.go
index 505ddfab4..2f1048812 100644
--- a/cc/config/x86_windows_host.go
+++ b/cc/config/x86_windows_host.go
@@ -33,7 +33,8 @@ var (
// Use C99-compliant printf functions (%zd).
"-D__USE_MINGW_ANSI_STDIO=1",
- // Admit to using >= Windows 7. Both are needed because of <_mingw.h>.
+ // Admit to using >= Windows 7.
+ // Both #defines are needed: https://learn.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt
"-D_WIN32_WINNT=0x0601",
"-DWINVER=0x0601",
// Get 64-bit off_t and related functions.
@@ -68,10 +69,15 @@ var (
windowsLdflags = []string{
"-Wl,--dynamicbase",
"-Wl,--nxcompat",
- }
- windowsLldflags = append(windowsLdflags, []string{
+
"-Wl,--Xlink=-Brepro", // Enable deterministic build
- }...)
+
+ // Additional libraries required for generated static rustlibs
+ "-lssp",
+ "-lgcc_s",
+ "-ladvapi32",
+ "-lntdll",
+ }
windowsX86Cflags = []string{
"-m32",
@@ -141,15 +147,12 @@ func init() {
pctx.StaticVariable("WindowsCflags", strings.Join(windowsCflags, " "))
pctx.StaticVariable("WindowsLdflags", strings.Join(windowsLdflags, " "))
- pctx.StaticVariable("WindowsLldflags", strings.Join(windowsLldflags, " "))
pctx.StaticVariable("WindowsCppflags", strings.Join(windowsCppflags, " "))
pctx.StaticVariable("WindowsX86Cflags", strings.Join(windowsX86Cflags, " "))
pctx.StaticVariable("WindowsX8664Cflags", strings.Join(windowsX8664Cflags, " "))
pctx.StaticVariable("WindowsX86Ldflags", strings.Join(windowsX86Ldflags, " "))
- pctx.StaticVariable("WindowsX86Lldflags", strings.Join(windowsX86Ldflags, " "))
pctx.StaticVariable("WindowsX8664Ldflags", strings.Join(windowsX8664Ldflags, " "))
- pctx.StaticVariable("WindowsX8664Lldflags", strings.Join(windowsX8664Ldflags, " "))
pctx.StaticVariable("WindowsX86Cppflags", strings.Join(windowsX86Cppflags, " "))
pctx.StaticVariable("WindowsX8664Cppflags", strings.Join(windowsX8664Cppflags, " "))
@@ -223,18 +226,10 @@ func (t *toolchainWindowsX86) Ldflags() string {
return "${config.WindowsLdflags} ${config.WindowsX86Ldflags}"
}
-func (t *toolchainWindowsX86) Lldflags() string {
- return "${config.WindowsLldflags} ${config.WindowsX86Lldflags}"
-}
-
func (t *toolchainWindowsX8664) Ldflags() string {
return "${config.WindowsLdflags} ${config.WindowsX8664Ldflags}"
}
-func (t *toolchainWindowsX8664) Lldflags() string {
- return "${config.WindowsLldflags} ${config.WindowsX8664Lldflags}"
-}
-
func (t *toolchainWindowsX86) YasmFlags() string {
return "${config.WindowsX86YasmFlags}"
}
diff --git a/cc/coverage.go b/cc/coverage.go
index 757641cba..15eace601 100644
--- a/cc/coverage.go
+++ b/cc/coverage.go
@@ -38,6 +38,14 @@ var (
"-fcoverage-mapping",
"-Wno-pass-failed",
"-D__ANDROID_CLANG_COVERAGE__",
+
+ // Bug: http://b/408093589, http://b/396515430: LLVM change 4089763883 to
+ // global merge regressed code coverage, marking previously covered lines
+ // as uncovered. Disable global merge until the regression is fixed.
+ // -Wunused-command-line-argument needs to be disabled because
+ // -mno-global-merge is reported as unused in LTO mode.
+ "-mno-global-merge",
+ "-Wno-unused-command-line-argument",
}
clangCoverageHWASanFlags = []string{
"-mllvm",
@@ -149,11 +157,11 @@ func (cov *coverage) flags(ctx ModuleContext, flags Flags, deps PathDeps) (Flags
// For static libraries, the only thing that changes our object files
// are included whole static libraries, so check to see if any of
// those have coverage enabled.
- ctx.VisitDirectDeps(func(m android.Module) {
+ ctx.VisitDirectDepsProxy(func(m android.ModuleProxy) {
if depTag, ok := ctx.OtherModuleDependencyTag(m).(libraryDependencyTag); ok {
if depTag.static() && depTag.wholeStatic {
- if cc, ok := m.(*Module); ok && cc.coverage != nil {
- if cc.coverage.linkCoverage {
+ if info, ok := android.OtherModuleProvider(ctx, m, LinkableInfoProvider); ok {
+ if info.LinkCoverage {
cov.linkCoverage = true
}
}
@@ -163,18 +171,13 @@ func (cov *coverage) flags(ctx ModuleContext, flags Flags, deps PathDeps) (Flags
} else {
// For executables and shared libraries, we need to check all of
// our static dependencies.
- ctx.VisitDirectDeps(func(m android.Module) {
- cc, ok := m.(*Module)
- if !ok || cc.coverage == nil {
- return
- }
-
- if static, ok := cc.linker.(libraryInterface); !ok || !static.static() {
- return
- }
-
- if cc.coverage.linkCoverage {
- cov.linkCoverage = true
+ ctx.VisitDirectDepsProxy(func(m android.ModuleProxy) {
+ if _, ok := android.OtherModuleProvider(ctx, m, StaticLibraryInfoProvider); ok {
+ if info, ok := android.OtherModuleProvider(ctx, m, LinkableInfoProvider); ok {
+ if info.LinkCoverage {
+ cov.linkCoverage = true
+ }
+ }
}
})
}
@@ -185,8 +188,8 @@ func (cov *coverage) flags(ctx ModuleContext, flags Flags, deps PathDeps) (Flags
flags.Local.LdFlags = append(flags.Local.LdFlags, "--coverage")
if ctx.Device() {
- coverage := ctx.GetDirectDepWithTag(getGcovProfileLibraryName(ctx), CoverageDepTag).(*Module)
- deps.WholeStaticLibs = append(deps.WholeStaticLibs, coverage.OutputFile().Path())
+ coverage := ctx.GetDirectDepProxyWithTag(getGcovProfileLibraryName(ctx), CoverageDepTag)
+ deps.WholeStaticLibs = append(deps.WholeStaticLibs, android.OutputFileForModule(ctx, coverage, ""))
flags.Local.LdFlags = append(flags.Local.LdFlags, "-Wl,--wrap,getenv")
}
} else if clangCoverage {
@@ -196,8 +199,8 @@ func (cov *coverage) flags(ctx ModuleContext, flags Flags, deps PathDeps) (Flags
}
if ctx.Device() {
- coverage := ctx.GetDirectDepWithTag(getClangProfileLibraryName(ctx), CoverageDepTag).(*Module)
- deps.WholeStaticLibs = append(deps.WholeStaticLibs, coverage.OutputFile().Path())
+ coverage := ctx.GetDirectDepProxyWithTag(getClangProfileLibraryName(ctx), CoverageDepTag)
+ deps.WholeStaticLibs = append(deps.WholeStaticLibs, android.OutputFileForModule(ctx, coverage, ""))
flags.Local.LdFlags = append(flags.Local.LdFlags, "-Wl,--wrap,open")
}
}
diff --git a/cc/fuzz.go b/cc/fuzz.go
index 79874fc80..5798860b5 100644
--- a/cc/fuzz.go
+++ b/cc/fuzz.go
@@ -16,7 +16,6 @@ package cc
import (
"path/filepath"
- "sort"
"strings"
"github.com/google/blueprint/proptools"
@@ -141,10 +140,9 @@ func LibFuzzFactory() android.Module {
type fuzzBinary struct {
*binaryDecorator
*baseCompiler
- fuzzPackagedModule fuzz.FuzzPackagedModule
- installedSharedDeps []string
- sharedLibraries android.RuleBuilderInstalls
- data []android.DataPath
+ fuzzPackagedModule fuzz.FuzzPackagedModule
+ sharedLibraries InstallPairs
+ data []android.DataPath
}
func (fuzz *fuzzBinary) fuzzBinary() bool {
@@ -257,37 +255,15 @@ func isValidSharedDependency(ctx android.ModuleContext, dependency android.Modul
// If the same library is present both as source and a prebuilt we must pick
// only one to avoid a conflict. Always prefer the source since the prebuilt
// probably won't be built with sanitizers enabled.
- if prebuilt, ok := android.OtherModuleProvider(ctx, dependency, android.PrebuiltModuleInfoProvider); ok && prebuilt.SourceExists {
- return false
+ if info, ok := android.OtherModuleProvider(ctx, dependency, android.PrebuiltInfoProvider); ok {
+ if info.IsPrebuilt && info.PrebuiltSourceExists {
+ return false
+ }
}
return true
}
-func SharedLibraryInstallLocation(
- libraryBase string, isHost bool, isVendor bool, fuzzDir string, archString string) string {
- installLocation := "$(PRODUCT_OUT)/data"
- if isHost {
- installLocation = "$(HOST_OUT)"
- }
- subdir := "lib"
- if isVendor {
- subdir = "lib/vendor"
- }
- installLocation = filepath.Join(
- installLocation, fuzzDir, archString, subdir, libraryBase)
- return installLocation
-}
-
-// Get the device-only shared library symbols install directory.
-func SharedLibrarySymbolsInstallLocation(libraryBase string, isVendor bool, fuzzDir string, archString string) string {
- subdir := "lib"
- if isVendor {
- subdir = "lib/vendor"
- }
- return filepath.Join("$(PRODUCT_OUT)/symbols/data/", fuzzDir, archString, subdir, libraryBase)
-}
-
func (fuzzBin *fuzzBinary) install(ctx ModuleContext, file android.Path) {
fuzzBin.fuzzPackagedModule = PackageFuzzModule(ctx, fuzzBin.fuzzPackagedModule)
@@ -295,31 +271,12 @@ func (fuzzBin *fuzzBinary) install(ctx ModuleContext, file android.Path) {
// Grab the list of required shared libraries.
fuzzBin.sharedLibraries, _ = CollectAllSharedDependencies(ctx)
-
- // TODO: does not mirror Android linkernamespaces
- // the logic here has special cases for vendor, but it would need more work to
- // work in arbitrary partitions, so just surface errors early for a few cases
- //
- // Even without these, there are certain situations across linkernamespaces
- // that this won't support. For instance, you might have:
- //
- // my_fuzzer (vendor) -> libbinder_ndk (core) -> libbinder (vendor)
- //
- // This dependency chain wouldn't be possible to express in the current
- // logic because all the deps currently match the variant of the source
- // module.
-
- for _, ruleBuilderInstall := range fuzzBin.sharedLibraries {
- install := ruleBuilderInstall.To
- fuzzBin.installedSharedDeps = append(fuzzBin.installedSharedDeps,
- SharedLibraryInstallLocation(
- install, ctx.Host(), ctx.inVendor(), installBase, ctx.Arch().ArchType.String()))
-
- // Also add the dependency on the shared library symbols dir.
- if !ctx.Host() {
- fuzzBin.installedSharedDeps = append(fuzzBin.installedSharedDeps,
- SharedLibrarySymbolsInstallLocation(install, ctx.inVendor(), installBase, ctx.Arch().ArchType.String()))
- }
+ // Add the shared libraries to install deps.
+ for _, sharedLib := range fuzzBin.sharedLibraries {
+ fuzzBin.binaryDecorator.baseInstaller.installDeps = append(
+ fuzzBin.binaryDecorator.baseInstaller.installDeps,
+ sharedLib.Dst,
+ )
}
for _, d := range fuzzBin.fuzzPackagedModule.Corpus {
@@ -428,19 +385,15 @@ func NewFuzzer(hod android.HostOrDeviceSupported) *Module {
// their architecture & target/host specific zip file.
type ccRustFuzzPackager struct {
fuzz.FuzzPackager
- fuzzPackagingArchModules string
- fuzzTargetSharedDepsInstallPairs string
- allFuzzTargetsName string
- onlyIncludePresubmits bool
+ onlyIncludePresubmits bool
+ phonyName string
}
func fuzzPackagingFactory() android.Singleton {
fuzzPackager := &ccRustFuzzPackager{
- fuzzPackagingArchModules: "SOONG_FUZZ_PACKAGING_ARCH_MODULES",
- fuzzTargetSharedDepsInstallPairs: "FUZZ_TARGET_SHARED_DEPS_INSTALL_PAIRS",
- allFuzzTargetsName: "ALL_FUZZ_TARGETS",
- onlyIncludePresubmits: false,
+ onlyIncludePresubmits: false,
+ phonyName: "haiku",
}
return fuzzPackager
}
@@ -448,10 +401,8 @@ func fuzzPackagingFactory() android.Singleton {
func fuzzPackagingFactoryPresubmit() android.Singleton {
fuzzPackager := &ccRustFuzzPackager{
- fuzzPackagingArchModules: "SOONG_PRESUBMIT_FUZZ_PACKAGING_ARCH_MODULES",
- fuzzTargetSharedDepsInstallPairs: "PRESUBMIT_FUZZ_TARGET_SHARED_DEPS_INSTALL_PAIRS",
- allFuzzTargetsName: "ALL_PRESUBMIT_FUZZ_TARGETS",
- onlyIncludePresubmits: true,
+ onlyIncludePresubmits: true,
+ phonyName: "haiku-presubmit",
}
return fuzzPackager
}
@@ -468,7 +419,7 @@ func (s *ccRustFuzzPackager) GenerateBuildActions(ctx android.SingletonContext)
// Map tracking whether each shared library has an install rule to avoid duplicate install rules from
// multiple fuzzers that depend on the same shared library.
- sharedLibraryInstalled := make(map[string]bool)
+ sharedLibraryInstalled := make(map[string]InstallPair)
ctx.VisitAllModuleProxies(func(module android.ModuleProxy) {
ccModule, ok := android.OtherModuleProvider(ctx, module, LinkableInfoProvider)
@@ -511,9 +462,14 @@ func (s *ccRustFuzzPackager) GenerateBuildActions(ctx android.SingletonContext)
files = s.PackageArtifacts(ctx, module, &fuzzInfo, archDir, builder)
// Package shared libraries
- files = append(files, GetSharedLibsToZip(ccModule.FuzzSharedLibraries, isHost, ccModule.InVendor, &s.FuzzPackager,
- archString, sharedLibsInstallDirPrefix, &sharedLibraryInstalled)...)
-
+ files = append(files, GetSharedLibsToZip(ccModule.FuzzSharedLibraries, sharedLibsInstallDirPrefix)...)
+ if !s.onlyIncludePresubmits { // Create the copy rules from the `fuzzPackagingFactory` singleton and not `fuzzPackagingFactoryPresubmit` singleton.
+ for _, sharedLib := range ccModule.FuzzSharedLibraries {
+ if _, exists := sharedLibraryInstalled[sharedLib.Dst.String()]; !exists {
+ sharedLibraryInstalled[sharedLib.Dst.String()] = sharedLib
+ }
+ }
+ }
// The executable.
files = append(files, fuzz.FileToZip{SourceFilePath: android.OutputFileForModule(ctx, module, "unstripped")})
@@ -531,71 +487,39 @@ func (s *ccRustFuzzPackager) GenerateBuildActions(ctx android.SingletonContext)
}
})
- s.CreateFuzzPackage(ctx, archDirs, fuzz.Cc, pctx)
-}
-
-func (s *ccRustFuzzPackager) MakeVars(ctx android.MakeVarsContext) {
- packages := s.Packages.Strings()
- sort.Strings(packages)
- sort.Strings(s.FuzzPackager.SharedLibInstallStrings)
- // TODO(mitchp): Migrate this to use MakeVarsContext::DistForGoal() when it's
- // ready to handle phony targets created in Soong. In the meantime, this
- // exports the phony 'fuzz' target and dependencies on packages to
- // core/main.mk so that we can use dist-for-goals.
-
- ctx.Strict(s.fuzzPackagingArchModules, strings.Join(packages, " "))
+ for _, k := range android.SortedKeys(sharedLibraryInstalled) {
+ ctx.Build(pctx, android.BuildParams{
+ Rule: android.CpIfChanged,
+ Input: sharedLibraryInstalled[k].Src,
+ Output: sharedLibraryInstalled[k].Dst,
+ })
+ }
- ctx.Strict(s.fuzzTargetSharedDepsInstallPairs,
- strings.Join(s.FuzzPackager.SharedLibInstallStrings, " "))
+ s.CreateFuzzPackage(ctx, archDirs, fuzz.Cc, pctx)
- // Preallocate the slice of fuzz targets to minimise memory allocations.
- s.PreallocateSlice(ctx, s.allFuzzTargetsName)
+ // Create the phony and dist rules
+ ctx.Phony(s.phonyName, s.Packages...)
+ ctx.DistForGoals([]string{s.phonyName}, s.Packages...)
+ for _, target := range android.SortedKeys(s.FuzzTargets) {
+ ctx.Phony(s.phonyName, android.PathForPhony(ctx, target))
+ }
}
// GetSharedLibsToZip finds and marks all the transiently-dependent shared libraries for
// packaging.
-func GetSharedLibsToZip(sharedLibraries android.RuleBuilderInstalls, isHost bool, inVendor bool, s *fuzz.FuzzPackager,
- archString string, destinationPathPrefix string, sharedLibraryInstalled *map[string]bool) []fuzz.FileToZip {
+func GetSharedLibsToZip(sharedLibraries InstallPairs, destinationPathPrefix string) []fuzz.FileToZip {
var files []fuzz.FileToZip
- fuzzDir := "fuzz"
-
- for _, ruleBuilderInstall := range sharedLibraries {
- library := ruleBuilderInstall.From
- install := ruleBuilderInstall.To
+ for _, installPair := range sharedLibraries {
+ if strings.Contains(installPair.Dst.String(), "symbols/data/fuzz") {
+ // The unstripped so files would be copied from the main data/fuzz direcgtory.
+ continue
+ }
files = append(files, fuzz.FileToZip{
- SourceFilePath: library,
+ SourceFilePath: installPair.Src,
DestinationPathPrefix: destinationPathPrefix,
- DestinationPath: install,
+ DestinationPath: installPair.Dst.Base(),
})
-
- // For each architecture-specific shared library dependency, we need to
- // install it to the output directory. Setup the install destination here,
- // which will be used by $(copy-many-files) in the Make backend.
- installDestination := SharedLibraryInstallLocation(
- install, isHost, inVendor, fuzzDir, archString)
- if (*sharedLibraryInstalled)[installDestination] {
- continue
- }
- (*sharedLibraryInstalled)[installDestination] = true
-
- // Escape all the variables, as the install destination here will be called
- // via. $(eval) in Make.
- installDestination = strings.ReplaceAll(
- installDestination, "$", "$$")
- s.SharedLibInstallStrings = append(s.SharedLibInstallStrings,
- library.String()+":"+installDestination)
-
- // Ensure that on device, the library is also reinstalled to the /symbols/
- // dir. Symbolized DSO's are always installed to the device when fuzzing, but
- // we want symbolization tools (like `stack`) to be able to find the symbols
- // in $ANDROID_PRODUCT_OUT/symbols automagically.
- if !isHost {
- symbolsInstallDestination := SharedLibrarySymbolsInstallLocation(install, inVendor, fuzzDir, archString)
- symbolsInstallDestination = strings.ReplaceAll(symbolsInstallDestination, "$", "$$")
- s.SharedLibInstallStrings = append(s.SharedLibInstallStrings,
- library.String()+":"+symbolsInstallDestination)
- }
}
return files
}
@@ -605,12 +529,35 @@ func GetSharedLibsToZip(sharedLibraries android.RuleBuilderInstalls, isHost bool
// VisitDirectDeps is used first to avoid incorrectly using the core libraries (sanitizer
// runtimes, libc, libdl, etc.) from a dependency. This may cause issues when dependencies
// have explicit sanitizer tags, as we may get a dependency on an unsanitized libc, etc.
-func CollectAllSharedDependencies(ctx android.ModuleContext) (android.RuleBuilderInstalls, []android.ModuleProxy) {
+func CollectAllSharedDependencies(ctx android.ModuleContext) (InstallPairs, []android.ModuleProxy) {
+ sharedLibInstallPaths := func(src android.Path) InstallPairs {
+ var ret InstallPairs
+ // Install in data/fuzz
+ hostOrDevicePrefix := "data"
+ if ctx.Host() {
+ hostOrDevicePrefix = ""
+ }
+ installPath := android.PathForModuleInPartitionInstall(ctx, hostOrDevicePrefix, "fuzz", ctx.Target().Arch.ArchType.String(), "lib")
+ if ctx.InstallInVendor() {
+ installPath = installPath.Join(ctx, "vendor")
+ }
+ ret = append(ret, InstallPair{src, installPath.Join(ctx, src.Base())})
+ // Install in symbols/data/fuzz
+ if !ctx.Host() {
+ installPath := android.PathForModuleInPartitionInstall(ctx, "symbols", "data", "fuzz", ctx.Target().Arch.ArchType.String(), "lib")
+ if ctx.InstallInVendor() {
+ installPath = installPath.Join(ctx, "vendor")
+ }
+ ret = append(ret, InstallPair{src, installPath.Join(ctx, src.Base())})
+ }
+ return ret
+ }
+
seen := make(map[string]bool)
recursed := make(map[string]bool)
deps := []android.ModuleProxy{}
- var sharedLibraries android.RuleBuilderInstalls
+ var sharedLibraries InstallPairs
// Enumerate the first level of dependencies, as we discard all non-library
// modules in the BFS loop below.
@@ -618,7 +565,7 @@ func CollectAllSharedDependencies(ctx android.ModuleContext) (android.RuleBuilde
if !isValidSharedDependency(ctx, dep) {
return
}
- sharedLibraryInfo, hasSharedLibraryInfo := android.OtherModuleProvider(ctx, dep, SharedLibraryInfoProvider)
+ _, hasSharedLibraryInfo := android.OtherModuleProvider(ctx, dep, SharedLibraryInfoProvider)
if !hasSharedLibraryInfo {
return
}
@@ -628,9 +575,8 @@ func CollectAllSharedDependencies(ctx android.ModuleContext) (android.RuleBuilde
seen[ctx.OtherModuleName(dep)] = true
deps = append(deps, dep)
- installDestination := sharedLibraryInfo.SharedLibrary.Base()
- ruleBuilderInstall := android.RuleBuilderInstall{android.OutputFileForModule(ctx, dep, "unstripped"), installDestination}
- sharedLibraries = append(sharedLibraries, ruleBuilderInstall)
+ src := android.OutputFileForModule(ctx, dep, "unstripped")
+ sharedLibraries = append(sharedLibraries, sharedLibInstallPaths(src)...)
})
ctx.WalkDepsProxy(func(child, _ android.ModuleProxy) bool {
@@ -650,7 +596,7 @@ func CollectAllSharedDependencies(ctx android.ModuleContext) (android.RuleBuilde
if !isValidSharedDependency(ctx, child) {
return false
}
- sharedLibraryInfo, hasSharedLibraryInfo := android.OtherModuleProvider(ctx, child, SharedLibraryInfoProvider)
+ _, hasSharedLibraryInfo := android.OtherModuleProvider(ctx, child, SharedLibraryInfoProvider)
if !hasSharedLibraryInfo {
return false
}
@@ -658,9 +604,8 @@ func CollectAllSharedDependencies(ctx android.ModuleContext) (android.RuleBuilde
seen[ctx.OtherModuleName(child)] = true
deps = append(deps, child)
- installDestination := sharedLibraryInfo.SharedLibrary.Base()
- ruleBuilderInstall := android.RuleBuilderInstall{android.OutputFileForModule(ctx, child, "unstripped"), installDestination}
- sharedLibraries = append(sharedLibraries, ruleBuilderInstall)
+ src := android.OutputFileForModule(ctx, child, "unstripped")
+ sharedLibraries = append(sharedLibraries, sharedLibInstallPaths(src)...)
}
if recursed[ctx.OtherModuleName(child)] {
diff --git a/cc/installer.go b/cc/installer.go
index d7d8c6d22..99e220faa 100644
--- a/cc/installer.go
+++ b/cc/installer.go
@@ -108,7 +108,7 @@ func (installer *baseInstaller) installTestData(ctx ModuleContext, data []androi
}
func (installer *baseInstaller) installStandaloneTestDep(ctx ModuleContext, standaloneTestDep android.PackagingSpec) {
- installer.installTestData(ctx, []android.DataPath{{SrcPath: standaloneTestDep.ToGob().SrcPath, RelativeInstallPath: "standalone-libs"}})
+ installer.installTestData(ctx, []android.DataPath{{SrcPath: standaloneTestDep.SrcPath(), RelativeInstallPath: "standalone-libs"}})
}
func (installer *baseInstaller) everInstallable() bool {
diff --git a/cc/library.go b/cc/library.go
index 7b854864f..ac93f6634 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -16,7 +16,6 @@ package cc
import (
"fmt"
- "io"
"path/filepath"
"regexp"
"slices"
@@ -805,9 +804,6 @@ type libraryInterface interface {
// Gets the ABI properties for vendor, product, or platform variant
getHeaderAbiCheckerProperties(m *Module) headerAbiCheckerProperties
- // Write LOCAL_ADDITIONAL_DEPENDENCIES for ABI diff
- androidMkWriteAdditionalDependenciesForSourceAbiDiff(w io.Writer)
-
apexAvailable() []string
setAPIListCoverageXMLPath(out android.ModuleOutPath)
@@ -1085,10 +1081,6 @@ func (library *libraryDecorator) moduleInfoJSON(ctx ModuleContext, moduleInfoJSO
library.baseLinker.moduleInfoJSON(ctx, moduleInfoJSON)
}
-func (library *libraryDecorator) testSuiteInfo(ctx ModuleContext) {
- // not a test
-}
-
func (library *libraryDecorator) linkStatic(ctx ModuleContext,
flags Flags, deps PathDeps, objs Objects) android.Path {
@@ -1296,17 +1288,20 @@ func (library *libraryDecorator) linkShared(ctx ModuleContext,
}
}
+ objs.sAbiDumpFiles = append(objs.sAbiDumpFiles, deps.StaticLibObjs.sAbiDumpFiles...)
+ objs.sAbiDumpFiles = append(objs.sAbiDumpFiles, deps.WholeStaticLibObjs.sAbiDumpFiles...)
+ library.linkSAbiDumpFiles(ctx, deps, objs, fileName, unstrippedOutputFile)
+
+ validations := slices.Concat(objs.tidyDepFiles, library.sAbiDiff)
+
transformObjToDynamicBinary(ctx, objs.objFiles, sharedLibs,
deps.StaticLibs, deps.LateStaticLibs, deps.WholeStaticLibs, linkerDeps, deps.CrtBegin,
- deps.CrtEnd, false, builderFlags, outputFile, implicitOutputs, objs.tidyDepFiles)
+ deps.CrtEnd, false, builderFlags, outputFile, implicitOutputs, validations)
objs.coverageFiles = append(objs.coverageFiles, deps.StaticLibObjs.coverageFiles...)
objs.coverageFiles = append(objs.coverageFiles, deps.WholeStaticLibObjs.coverageFiles...)
- objs.sAbiDumpFiles = append(objs.sAbiDumpFiles, deps.StaticLibObjs.sAbiDumpFiles...)
- objs.sAbiDumpFiles = append(objs.sAbiDumpFiles, deps.WholeStaticLibObjs.sAbiDumpFiles...)
library.coverageOutputFile = transformCoverageFilesToZip(ctx, objs, library.getLibName(ctx))
- library.linkSAbiDumpFiles(ctx, deps, objs, fileName, unstrippedOutputFile)
var transitiveStaticLibrariesForOrdering depset.DepSet[android.Path]
if static := ctx.GetDirectDepsProxyWithTag(staticVariantTag); len(static) > 0 {
@@ -1563,7 +1558,10 @@ func (library *libraryDecorator) optInAbiDiff(ctx android.ModuleContext,
// Most opt-in libraries do not have dumps for all default architectures.
if ctx.Config().HasDeviceProduct() {
- errorMessage += " --product " + ctx.Config().DeviceProduct()
+ // Instead of showing the product name directly, use an env variable to
+ // the error message to avoid changing build rules just because of lunch
+ // target change.
+ errorMessage += " --product $$TARGET_PRODUCT"
}
library.sourceAbiDiff(ctx, sourceDump, referenceDump, baseName, nameExt,
@@ -1919,7 +1917,7 @@ func (library *libraryDecorator) install(ctx ModuleContext, file android.Path) {
CtxIsForPlatform(ctx) && !ctx.isPreventInstall() {
installPath := getUnversionedLibraryInstallPath(ctx).Join(ctx, file.Base())
- ctx.ModuleBuild(pctx, android.ModuleBuildParams{
+ ctx.Build(pctx, android.BuildParams{
Rule: android.Cp,
Description: "install " + installPath.Base(),
Output: installPath,
diff --git a/cc/library_headers_test.go b/cc/library_headers_test.go
index 88ccd4303..73e599672 100644
--- a/cc/library_headers_test.go
+++ b/cc/library_headers_test.go
@@ -19,8 +19,6 @@ import (
"testing"
"android/soong/android"
-
- "github.com/google/blueprint"
)
func TestLibraryHeaders(t *testing.T) {
@@ -85,7 +83,7 @@ func TestPrebuiltLibraryHeadersPreferred(t *testing.T) {
prebuiltDep := ctx.ModuleForTests(t, "prebuilt_headers", "android_arm64_armv8-a")
hasSourceDep := false
hasPrebuiltDep := false
- ctx.VisitDirectDeps(lib.Module(), func(dep blueprint.Module) {
+ ctx.VisitDirectDeps(lib.Module(), func(dep android.Module) {
if dep == sourceDep.Module() {
hasSourceDep = true
}
diff --git a/cc/library_sdk_member.go b/cc/library_sdk_member.go
index 46290300c..847436c2a 100644
--- a/cc/library_sdk_member.go
+++ b/cc/library_sdk_member.go
@@ -15,6 +15,7 @@
package cc
import (
+ "fmt"
"path/filepath"
"android/soong/android"
@@ -186,11 +187,11 @@ func (mt *librarySdkMemberType) AddDependencies(ctx android.SdkDependencyContext
}
}
-func (mt *librarySdkMemberType) IsInstance(module android.Module) bool {
+func (mt *librarySdkMemberType) IsInstance(ctx android.ModuleContext, module android.ModuleProxy) bool {
// Check the module to see if it can be used with this module type.
- if m, ok := module.(*Module); ok {
- for _, allowableMemberType := range m.sdkMemberTypes {
- if allowableMemberType == mt {
+ if m, ok := android.OtherModuleProvider(ctx, module, CcInfoProvider); ok {
+ for _, allowableMemberType := range m.SdkMemberTypes {
+ if allowableMemberType.SdkPropertyName() == mt.SdkPropertyName() {
return true
}
}
@@ -202,7 +203,11 @@ func (mt *librarySdkMemberType) IsInstance(module android.Module) bool {
func (mt *librarySdkMemberType) AddPrebuiltModule(ctx android.SdkMemberContext, member android.SdkMember) android.BpModule {
pbm := ctx.SnapshotBuilder().AddPrebuiltModule(member, mt.prebuiltModuleType)
- ccModule := member.Variants()[0].(*Module)
+ ccModule := member.Variants()[0]
+ info, ok := android.OtherModuleProvider(ctx.SdkModuleContext(), ccModule, CcInfoProvider)
+ if !ok {
+ panic(fmt.Errorf("not a cc module: %s", member.Variants()[0]))
+ }
if ctx.RequiresTrait(nativeBridgeSdkTrait) {
pbm.AddProperty("native_bridge_supported", true)
@@ -216,30 +221,30 @@ func (mt *librarySdkMemberType) AddPrebuiltModule(ctx android.SdkMemberContext,
pbm.AddProperty("recovery_available", true)
}
- if proptools.Bool(ccModule.VendorProperties.Vendor_available) {
+ if info.VendorAvailable {
pbm.AddProperty("vendor_available", true)
}
- if proptools.Bool(ccModule.VendorProperties.Odm_available) {
+ if info.OdmAvailable {
pbm.AddProperty("odm_available", true)
}
- if proptools.Bool(ccModule.VendorProperties.Product_available) {
+ if info.ProductAvailable {
pbm.AddProperty("product_available", true)
}
- sdkVersion := ccModule.SdkVersion()
+ sdkVersion := android.OtherModulePointerProviderOrDefault(ctx.SdkModuleContext(),
+ ccModule, android.CommonModuleInfoProvider).SdkVersion
if sdkVersion != "" {
pbm.AddProperty("sdk_version", sdkVersion)
}
- stl := ccModule.stl.Properties.Stl
- if stl != nil {
- pbm.AddProperty("stl", proptools.String(stl))
+ if info.StlInfo != nil && info.StlInfo.Stl != nil {
+ pbm.AddProperty("stl", proptools.String(info.StlInfo.Stl))
}
- if lib, ok := ccModule.linker.(*libraryDecorator); ok {
- uhs := lib.Properties.Unique_host_soname
+ if info.LinkerInfo != nil && info.LinkerInfo.LibraryDecoratorInfo != nil {
+ uhs := info.LinkerInfo.LibraryDecoratorInfo.UniqueHostSoname
if uhs != nil {
pbm.AddProperty("unique_host_soname", proptools.Bool(uhs))
}
@@ -496,21 +501,21 @@ type nativeLibInfoProperties struct {
outputFile android.Path
}
-func (p *nativeLibInfoProperties) PopulateFromVariant(ctx android.SdkMemberContext, variant android.Module) {
+func (p *nativeLibInfoProperties) PopulateFromVariant(ctx android.SdkMemberContext, variant android.ModuleProxy) {
addOutputFile := true
- ccModule := variant.(*Module)
+ ccInfo := android.OtherModulePointerProviderOrDefault(ctx.SdkModuleContext(), variant, CcInfoProvider)
- if s := ccModule.sanitize; s != nil {
+ if s := ccInfo.SanitizeInfo; s != nil {
// We currently do not capture sanitizer flags for libs with sanitizers
// enabled, because they may vary among variants that cannot be represented
// in the input blueprint files. In particular, sanitizerDepsMutator enables
// various sanitizers on dependencies, but in many cases only on static
// ones, and we cannot specify sanitizer flags at the link type level (i.e.
// in StaticOrSharedProperties).
- if s.isUnsanitizedVariant() {
+ if s.IsUnsanitizedVariant {
// This still captures explicitly disabled sanitizers, which may be
// necessary to avoid cyclic dependencies.
- p.Sanitize = s.Properties.Sanitize
+ p.Sanitize = s.Sanitize
} else {
// Do not add the output file to the snapshot if we don't represent it
// properly.
@@ -525,7 +530,7 @@ func (p *nativeLibInfoProperties) PopulateFromVariant(ctx android.SdkMemberConte
exportedIncludeDirs, exportedGeneratedIncludeDirs := android.FilterPathListPredicate(
exportedInfo.IncludeDirs, isGeneratedHeaderDirectory)
- target := ccModule.Target()
+ target := android.OtherModulePointerProviderOrDefault(ctx.SdkModuleContext(), variant, android.CommonModuleInfoProvider).Target
p.archSubDir = target.Arch.ArchType.String()
if target.NativeBridge == android.NativeBridgeEnabled {
p.archSubDir += "_native_bridge"
@@ -541,12 +546,13 @@ func (p *nativeLibInfoProperties) PopulateFromVariant(ctx android.SdkMemberConte
p.ExportedSystemIncludeDirs = android.FirstUniquePaths(dirs)
p.ExportedFlags = exportedInfo.Flags
- if ccModule.linker != nil {
+ if linker := ccInfo.LinkerInfo; linker != nil {
specifiedDeps := specifiedDeps{}
- specifiedDeps = ccModule.linker.linkerSpecifiedDeps(ctx.SdkModuleContext(), ccModule, specifiedDeps)
+ setLinkerSpecifiedDeps(linker, &specifiedDeps)
- if lib := ccModule.library; lib != nil {
- if !lib.HasStubsVariants() {
+ if lib := ccInfo.LibraryInfo; lib != nil {
+ linkableInfo := android.OtherModulePointerProviderOrDefault(ctx.SdkModuleContext(), variant, LinkableInfoProvider)
+ if !linkableInfo.HasStubsVariants {
// Propagate dynamic dependencies for implementation libs, but not stubs.
p.SharedLibs = specifiedDeps.sharedLibs
} else {
@@ -554,11 +560,11 @@ func (p *nativeLibInfoProperties) PopulateFromVariant(ctx android.SdkMemberConte
// ccModule.StubsVersion()) if the module is versioned. 2. Ensure that all
// the versioned stub libs are retained in the prebuilt tree; currently only
// the stub corresponding to ccModule.StubsVersion() is.
- p.StubsVersions = lib.AllStubsVersions()
- if lib.BuildStubs() && ccModule.stubsSymbolFilePath() == nil {
+ p.StubsVersions = lib.AllStubsVersions
+ if lib.BuildStubs && linker.LibraryDecoratorInfo.StubsSymbolFilePath == nil {
ctx.ModuleErrorf("Could not determine symbol_file")
} else {
- p.StubsSymbolFilePath = ccModule.stubsSymbolFilePath()
+ p.StubsSymbolFilePath = linker.LibraryDecoratorInfo.StubsSymbolFilePath
}
}
}
@@ -567,16 +573,16 @@ func (p *nativeLibInfoProperties) PopulateFromVariant(ctx android.SdkMemberConte
p.ExportedGeneratedHeaders = exportedInfo.GeneratedHeaders
if !p.memberType.noOutputFiles && addOutputFile {
- p.outputFile = getRequiredMemberOutputFile(ctx, ccModule)
+ p.outputFile = getRequiredMemberOutputFile(ctx, variant)
}
}
-func getRequiredMemberOutputFile(ctx android.SdkMemberContext, ccModule *Module) android.Path {
+func getRequiredMemberOutputFile(ctx android.SdkMemberContext, module android.ModuleOrProxy) android.Path {
var path android.Path
- if info, ok := android.OtherModuleProvider(ctx.SdkModuleContext(), ccModule, LinkableInfoProvider); ok && info.OutputFile.Valid() {
+ if info, ok := android.OtherModuleProvider(ctx.SdkModuleContext(), module, LinkableInfoProvider); ok && info.OutputFile.Valid() {
path = info.OutputFile.Path()
} else {
- ctx.SdkModuleContext().ModuleErrorf("member variant %s does not have a valid output file", ccModule)
+ ctx.SdkModuleContext().ModuleErrorf("member variant %s does not have a valid output file", module)
}
return path
}
diff --git a/cc/linkable.go b/cc/linkable.go
index f3aff1523..1877dc637 100644
--- a/cc/linkable.go
+++ b/cc/linkable.go
@@ -8,6 +8,8 @@ import (
"github.com/google/blueprint/depset"
)
+//go:generate go run ../../blueprint/gobtools/codegen/gob_gen.go
+
// PlatformSanitizeable is an interface for sanitizing platform modules.
type PlatformSanitizeable interface {
LinkableInterface
@@ -117,6 +119,8 @@ type LinkableInterface interface {
// CoverageOutputFile returns the output archive of gcno coverage information files.
CoverageOutputFile() android.OptionalPath
+ LinkCoverage() bool
+
NonCcVariants() bool
SelectedStl() string
@@ -138,7 +142,7 @@ type LinkableInterface interface {
// FuzzSharedLibraries returns the shared library dependencies for this module.
// Expects that IsFuzzModule returns true.
- FuzzSharedLibraries() android.RuleBuilderInstalls
+ FuzzSharedLibraries() InstallPairs
Device() bool
Host() bool
@@ -333,6 +337,7 @@ func HeaderDepTag() blueprint.DependencyTag {
}
// SharedLibraryInfo is a provider to propagate information about a shared C++ library.
+// @auto-generate: gob
type SharedLibraryInfo struct {
SharedLibrary android.Path
Target android.Target
@@ -371,6 +376,7 @@ type SharedLibraryStubsInfo struct {
var SharedLibraryStubsProvider = blueprint.NewProvider[SharedLibraryStubsInfo]()
// StaticLibraryInfo is a provider to propagate information about a static C++ library.
+// @auto-generate: gob
type StaticLibraryInfo struct {
StaticLibrary android.Path
Objects Objects
@@ -411,6 +417,7 @@ var FlagExporterInfoProvider = blueprint.NewProvider[FlagExporterInfo]()
var ImplementationDepInfoProvider = blueprint.NewProvider[*ImplementationDepInfo]()
+// @auto-generate: gob
type ImplementationDepInfo struct {
ImplementationDeps depset.DepSet[android.Path]
}
diff --git a/cc/linkable_gob_enc.go b/cc/linkable_gob_enc.go
new file mode 100644
index 000000000..06205771e
--- /dev/null
+++ b/cc/linkable_gob_enc.go
@@ -0,0 +1,190 @@
+// Code generated by go run gob_gen.go; DO NOT EDIT.
+
+package cc
+
+import (
+ "android/soong/android"
+ "bytes"
+ "github.com/google/blueprint/gobtools"
+)
+
+func init() {
+ SharedLibraryInfoGobRegId = gobtools.RegisterType(func() gobtools.CustomDec { return new(SharedLibraryInfo) })
+ StaticLibraryInfoGobRegId = gobtools.RegisterType(func() gobtools.CustomDec { return new(StaticLibraryInfo) })
+ ImplementationDepInfoGobRegId = gobtools.RegisterType(func() gobtools.CustomDec { return new(ImplementationDepInfo) })
+}
+
+func (r SharedLibraryInfo) Encode(buf *bytes.Buffer) error {
+ var err error
+
+ if err = gobtools.EncodeInterface(buf, r.SharedLibrary); err != nil {
+ return err
+ }
+
+ if err = r.Target.Encode(buf); err != nil {
+ return err
+ }
+
+ if err = r.TableOfContents.Encode(buf); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeSimple(buf, r.IsStubs); err != nil {
+ return err
+ }
+
+ if err = r.ImplementationDeps.EncodeString(buf); err != nil {
+ return err
+ }
+
+ if err = r.TransitiveStaticLibrariesForOrdering.EncodeInterface(buf); err != nil {
+ return err
+ }
+ return err
+}
+
+func (r *SharedLibraryInfo) Decode(buf *bytes.Reader) error {
+ var err error
+
+ if val2, err := gobtools.DecodeInterface(buf); err != nil {
+ return err
+ } else if val2 == nil {
+ r.SharedLibrary = nil
+ } else {
+ r.SharedLibrary = val2.(android.Path)
+ }
+
+ if err = r.Target.Decode(buf); err != nil {
+ return err
+ }
+
+ if err = r.TableOfContents.Decode(buf); err != nil {
+ return err
+ }
+
+ err = gobtools.DecodeSimple[bool](buf, &r.IsStubs)
+ if err != nil {
+ return err
+ }
+
+ if err = r.ImplementationDeps.DecodeString(buf); err != nil {
+ return err
+ }
+
+ if err = r.TransitiveStaticLibrariesForOrdering.DecodeInterface(buf); err != nil {
+ return err
+ }
+
+ return err
+}
+
+var SharedLibraryInfoGobRegId int16
+
+func (r SharedLibraryInfo) GetTypeId() int16 {
+ return SharedLibraryInfoGobRegId
+}
+
+func (r StaticLibraryInfo) Encode(buf *bytes.Buffer) error {
+ var err error
+
+ if err = gobtools.EncodeInterface(buf, r.StaticLibrary); err != nil {
+ return err
+ }
+
+ if err = r.Objects.Encode(buf); err != nil {
+ return err
+ }
+
+ if err = r.ReuseObjects.Encode(buf); err != nil {
+ return err
+ }
+
+ if err = gobtools.EncodeSimple(buf, int32(len(r.WholeStaticLibsFromPrebuilts))); err != nil {
+ return err
+ }
+ for val1 := 0; val1 < len(r.WholeStaticLibsFromPrebuilts); val1++ {
+ if err = gobtools.EncodeInterface(buf, r.WholeStaticLibsFromPrebuilts[val1]); err != nil {
+ return err
+ }
+ }
+
+ if err = r.TransitiveStaticLibrariesForOrdering.EncodeInterface(buf); err != nil {
+ return err
+ }
+ return err
+}
+
+func (r *StaticLibraryInfo) Decode(buf *bytes.Reader) error {
+ var err error
+
+ if val2, err := gobtools.DecodeInterface(buf); err != nil {
+ return err
+ } else if val2 == nil {
+ r.StaticLibrary = nil
+ } else {
+ r.StaticLibrary = val2.(android.Path)
+ }
+
+ if err = r.Objects.Decode(buf); err != nil {
+ return err
+ }
+
+ if err = r.ReuseObjects.Decode(buf); err != nil {
+ return err
+ }
+
+ var val7 int32
+ err = gobtools.DecodeSimple[int32](buf, &val7)
+ if err != nil {
+ return err
+ }
+ if val7 > 0 {
+ r.WholeStaticLibsFromPrebuilts = make([]android.Path, val7)
+ for val8 := 0; val8 < int(val7); val8++ {
+ if val10, err := gobtools.DecodeInterface(buf); err != nil {
+ return err
+ } else if val10 == nil {
+ r.WholeStaticLibsFromPrebuilts[val8] = nil
+ } else {
+ r.WholeStaticLibsFromPrebuilts[val8] = val10.(android.Path)
+ }
+ }
+ }
+
+ if err = r.TransitiveStaticLibrariesForOrdering.DecodeInterface(buf); err != nil {
+ return err
+ }
+
+ return err
+}
+
+var StaticLibraryInfoGobRegId int16
+
+func (r StaticLibraryInfo) GetTypeId() int16 {
+ return StaticLibraryInfoGobRegId
+}
+
+func (r ImplementationDepInfo) Encode(buf *bytes.Buffer) error {
+ var err error
+
+ if err = r.ImplementationDeps.EncodeInterface(buf); err != nil {
+ return err
+ }
+ return err
+}
+
+func (r *ImplementationDepInfo) Decode(buf *bytes.Reader) error {
+ var err error
+
+ if err = r.ImplementationDeps.DecodeInterface(buf); err != nil {
+ return err
+ }
+
+ return err
+}
+
+var ImplementationDepInfoGobRegId int16
+
+func (r ImplementationDepInfo) GetTypeId() int16 {
+ return ImplementationDepInfoGobRegId
+}
diff --git a/cc/linker.go b/cc/linker.go
index f85493726..e138203a4 100644
--- a/cc/linker.go
+++ b/cc/linker.go
@@ -69,9 +69,6 @@ type BaseLinkerProperties struct {
// don't link in libclang_rt.builtins-*.a
No_libcrt *bool `android:"arch_variant"`
- // Use clang lld instead of gnu ld.
- Use_clang_lld *bool `android:"arch_variant"`
-
// -l arguments to pass to linker for host-provided shared libraries
Host_ldlibs []string `android:"arch_variant"`
@@ -445,13 +442,6 @@ func (linker *baseLinker) linkerDeps(ctx DepsContext, deps Deps) Deps {
return deps
}
-func (linker *baseLinker) useClangLld(ctx ModuleContext) bool {
- if linker.Properties.Use_clang_lld != nil {
- return Bool(linker.Properties.Use_clang_lld)
- }
- return true
-}
-
// Check whether the SDK version is not older than the specific one
func CheckSdkVersionAtLeast(ctx ModuleContext, SdkVersion android.ApiLevel) bool {
if ctx.minSdkVersion() == "current" {
@@ -471,8 +461,7 @@ func CheckSdkVersionAtLeast(ctx ModuleContext, SdkVersion android.ApiLevel) bool
// ModuleContext extends BaseModuleContext
// BaseModuleContext should know if LLD is used?
-func CommonLinkerFlags(ctx android.ModuleContext, flags Flags, useClangLld bool,
- toolchain config.Toolchain, allow_undefined_symbols bool) Flags {
+func CommonLinkerFlags(ctx android.ModuleContext, flags Flags, toolchain config.Toolchain, allow_undefined_symbols bool) Flags {
hod := "Host"
if ctx.Os().Class == android.Device {
hod = "Device"
@@ -483,11 +472,7 @@ func CommonLinkerFlags(ctx android.ModuleContext, flags Flags, useClangLld bool,
ctx.ModuleErrorf("trying to add CommonLinkerFlags to non-LinkableInterface module.")
return flags
}
- if useClangLld {
- flags.Global.LdFlags = append(flags.Global.LdFlags, fmt.Sprintf("${config.%sGlobalLldflags}", hod))
- } else {
- flags.Global.LdFlags = append(flags.Global.LdFlags, fmt.Sprintf("${config.%sGlobalLdflags}", hod))
- }
+ flags.Global.LdFlags = append(flags.Global.LdFlags, fmt.Sprintf("${config.%sGlobalLdflags}", hod))
if allow_undefined_symbols {
if ctx.Darwin() {
@@ -498,11 +483,7 @@ func CommonLinkerFlags(ctx android.ModuleContext, flags Flags, useClangLld bool,
flags.Global.LdFlags = append(flags.Global.LdFlags, "-Wl,--no-undefined")
}
- if useClangLld {
- flags.Global.LdFlags = append(flags.Global.LdFlags, toolchain.Lldflags())
- } else {
- flags.Global.LdFlags = append(flags.Global.LdFlags, toolchain.Ldflags())
- }
+ flags.Global.LdFlags = append(flags.Global.LdFlags, toolchain.Ldflags())
if !toolchain.Bionic() && ctx.Os() != android.LinuxMusl {
if !ctx.Windows() {
@@ -531,8 +512,7 @@ func (linker *baseLinker) linkerFlags(ctx ModuleContext, flags Flags) Flags {
toolchain := ctx.toolchain()
allow_undefined_symbols := Bool(linker.Properties.Allow_undefined_symbols)
- flags = CommonLinkerFlags(ctx, flags, linker.useClangLld(ctx), toolchain,
- allow_undefined_symbols)
+ flags = CommonLinkerFlags(ctx, flags, toolchain, allow_undefined_symbols)
if !toolchain.Bionic() && ctx.Os() != android.LinuxMusl {
CheckBadHostLdlibs(ctx, "host_ldlibs", linker.Properties.Host_ldlibs)
@@ -541,23 +521,21 @@ func (linker *baseLinker) linkerFlags(ctx ModuleContext, flags Flags) Flags {
CheckBadLinkerFlags(ctx, "ldflags", linker.Properties.Ldflags)
- if linker.useClangLld(ctx) {
- if !BoolDefault(linker.Properties.Pack_relocations, packRelocationsDefault) {
- flags.Global.LdFlags = append(flags.Global.LdFlags, "-Wl,--pack-dyn-relocs=none")
- } else if ctx.Device() {
- // SHT_RELR relocations are only supported at API level >= 30.
- // ANDROID_RELR relocations were supported at API level >= 28.
- // Relocation packer was supported at API level >= 23.
- // Do the best we can...
- if (!ctx.useSdk() && ctx.minSdkVersion() == "") || CheckSdkVersionAtLeast(ctx, android.FirstShtRelrVersion) {
- flags.Global.LdFlags = append(flags.Global.LdFlags, "-Wl,--pack-dyn-relocs=android+relr")
- } else if CheckSdkVersionAtLeast(ctx, android.FirstAndroidRelrVersion) {
- flags.Global.LdFlags = append(flags.Global.LdFlags,
- "-Wl,--pack-dyn-relocs=android+relr",
- "-Wl,--use-android-relr-tags")
- } else if CheckSdkVersionAtLeast(ctx, android.FirstPackedRelocationsVersion) {
- flags.Global.LdFlags = append(flags.Global.LdFlags, "-Wl,--pack-dyn-relocs=android")
- }
+ if !BoolDefault(linker.Properties.Pack_relocations, packRelocationsDefault) {
+ flags.Global.LdFlags = append(flags.Global.LdFlags, "-Wl,--pack-dyn-relocs=none")
+ } else if ctx.Device() {
+ // SHT_RELR relocations are only supported at API level >= 30.
+ // ANDROID_RELR relocations were supported at API level >= 28.
+ // Relocation packer was supported at API level >= 23.
+ // Do the best we can...
+ if (!ctx.useSdk() && ctx.minSdkVersion() == "") || CheckSdkVersionAtLeast(ctx, android.FirstShtRelrVersion) {
+ flags.Global.LdFlags = append(flags.Global.LdFlags, "-Wl,--pack-dyn-relocs=android+relr")
+ } else if CheckSdkVersionAtLeast(ctx, android.FirstAndroidRelrVersion) {
+ flags.Global.LdFlags = append(flags.Global.LdFlags,
+ "-Wl,--pack-dyn-relocs=android+relr",
+ "-Wl,--use-android-relr-tags")
+ } else if CheckSdkVersionAtLeast(ctx, android.FirstPackedRelocationsVersion) {
+ flags.Global.LdFlags = append(flags.Global.LdFlags, "-Wl,--pack-dyn-relocs=android")
}
}
diff --git a/cc/llvm_coverage_tools_zip.go b/cc/llvm_coverage_tools_zip.go
new file mode 100644
index 000000000..0b0b0b649
--- /dev/null
+++ b/cc/llvm_coverage_tools_zip.go
@@ -0,0 +1,55 @@
+// Copyright 2025 Google Inc. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package cc
+
+import (
+ "android/soong/android"
+ "android/soong/cc/config"
+)
+
+func init() {
+ android.RegisterParallelSingletonType("llvm_coverage_tools_zip", llvmCoverageToolsZipFactory)
+}
+
+func llvmCoverageToolsZipFactory() android.Singleton {
+ return &llvmCoverageToolsZipSingleton{}
+}
+
+type llvmCoverageToolsZipSingleton struct{}
+
+// GenerateBuildActions implements android.Singleton.
+func (l *llvmCoverageToolsZipSingleton) GenerateBuildActions(ctx android.SingletonContext) {
+ if !ctx.DeviceConfig().ClangCoverageEnabled() {
+ return
+ }
+
+ clangBase := config.ClangPath(ctx, "")
+ llvmProfdata := config.ClangPath(ctx, "bin/llvm-profdata")
+ llvmCov := config.ClangPath(ctx, "bin/llvm-cov")
+ libCxx := config.ClangPath(ctx, "lib/x86_64-unknown-linux-gnu/libc++.so")
+ llvmCoverageToolsZip := android.PathForOutput(ctx, "llvm-profdata.zip")
+
+ builder := android.NewRuleBuilder(pctx, ctx)
+ builder.Command().BuiltTool("soong_zip").
+ Flag("-d").
+ FlagWithOutput("-o ", llvmCoverageToolsZip).
+ FlagWithArg("-C ", clangBase.String()).
+ FlagWithInput("-f ", llvmProfdata).
+ FlagWithInput("-f ", libCxx).
+ FlagWithInput("-f ", llvmCov)
+ builder.Build("llvm_coverage_tools_zip", "llvm coverage tools zip")
+
+ ctx.DistForGoals([]string{"droidcore-unbundled", "apps_only"}, llvmCoverageToolsZip)
+}
diff --git a/cc/lto_test.go b/cc/lto_test.go
index 3fb1f3c06..7cfbba9e1 100644
--- a/cc/lto_test.go
+++ b/cc/lto_test.go
@@ -19,24 +19,12 @@ import (
"testing"
"android/soong/android"
-
- "github.com/google/blueprint"
)
var LTOPreparer = android.GroupFixturePreparers(
prepareForCcTest,
)
-func hasDep(result *android.TestResult, m android.Module, wantDep android.Module) bool {
- var found bool
- result.VisitDirectDeps(m, func(dep blueprint.Module) {
- if dep == wantDep {
- found = true
- }
- })
- return found
-}
-
func TestThinLtoDeps(t *testing.T) {
t.Parallel()
bp := `
@@ -73,22 +61,22 @@ func TestThinLtoDeps(t *testing.T) {
libLto := result.ModuleForTests(t, "lto_enabled", "android_arm64_armv8-a_shared").Module()
libFoo := result.ModuleForTests(t, "foo", "android_arm64_armv8-a_static").Module()
- if !hasDep(result, libLto, libFoo) {
+ if !android.HasDirectDep(result, libLto, libFoo) {
t.Errorf("'lto_enabled' missing dependency on the default variant of 'foo'")
}
libBaz := result.ModuleForTests(t, "baz", "android_arm64_armv8-a_static").Module()
- if !hasDep(result, libFoo, libBaz) {
+ if !android.HasDirectDep(result, libFoo, libBaz) {
t.Errorf("'foo' missing dependency on the default variant of transitive dep 'baz'")
}
libNeverLto := result.ModuleForTests(t, "lib_never_lto", "android_arm64_armv8-a_static").Module()
- if !hasDep(result, libLto, libNeverLto) {
+ if !android.HasDirectDep(result, libLto, libNeverLto) {
t.Errorf("'lto_enabled' missing dependency on the default variant of 'lib_never_lto'")
}
libBar := result.ModuleForTests(t, "bar", "android_arm64_armv8-a_shared").Module()
- if !hasDep(result, libLto, libBar) {
+ if !android.HasDirectDep(result, libLto, libBar) {
t.Errorf("'lto_enabled' missing dependency on the default variant of 'bar'")
}
@@ -142,12 +130,12 @@ func TestThinLtoOnlyOnStaticDep(t *testing.T) {
libRootLtoNever := result.ModuleForTests(t, "root_no_lto", "android_arm64_armv8-a_shared").Module()
libFoo := result.ModuleForTests(t, "foo", "android_arm64_armv8-a_static")
- if !hasDep(result, libRoot, libFoo.Module()) {
+ if !android.HasDirectDep(result, libRoot, libFoo.Module()) {
t.Errorf("'root' missing dependency on the default variant of 'foo'")
}
libFooNoLto := result.ModuleForTests(t, "foo", "android_arm64_armv8-a_static_lto-none")
- if !hasDep(result, libRootLtoNever, libFooNoLto.Module()) {
+ if !android.HasDirectDep(result, libRootLtoNever, libFooNoLto.Module()) {
t.Errorf("'root_no_lto' missing dependency on the lto_none variant of 'foo'")
}
@@ -157,7 +145,7 @@ func TestThinLtoOnlyOnStaticDep(t *testing.T) {
}
libBaz := result.ModuleForTests(t, "baz", "android_arm64_armv8-a_static")
- if !hasDep(result, libFoo.Module(), libBaz.Module()) {
+ if !android.HasDirectDep(result, libFoo.Module(), libBaz.Module()) {
t.Errorf("'foo' missing dependency on the default variant of transitive dep 'baz'")
}
diff --git a/cc/makevars.go b/cc/makevars.go
index 9358755cc..624f7482f 100644
--- a/cc/makevars.go
+++ b/cc/makevars.go
@@ -100,11 +100,11 @@ func makeVarsProvider(ctx android.MakeVarsContext) {
// Filter vendor_public_library that are exported to make
var exportedVendorPublicLibraries []string
- ctx.VisitAllModules(func(module android.Module) {
- if ccModule, ok := module.(*Module); ok {
- baseName := ccModule.BaseModuleName()
- if ccModule.IsVendorPublicLibrary() && module.ExportedToMake() {
- exportedVendorPublicLibraries = append(exportedVendorPublicLibraries, baseName)
+ ctx.VisitAllModuleProxies(func(module android.ModuleProxy) {
+ if ccInfo, ok := android.OtherModuleProvider(ctx, module, CcInfoProvider); ok {
+ commonInfo := android.OtherModuleProviderOrDefault(ctx, module, android.CommonModuleInfoProvider)
+ if ccInfo.IsVendorPublicLibrary && commonInfo.ExportedToMake {
+ exportedVendorPublicLibraries = append(exportedVendorPublicLibraries, commonInfo.BaseModuleName)
}
}
})
@@ -247,12 +247,6 @@ func makeVarsToolchain(ctx android.MakeVarsContext, secondPrefix string,
toolchain.ToolchainLdflags(),
productExtraLdflags,
}, " "))
- ctx.Strict(clangPrefix+"GLOBAL_LLDFLAGS", strings.Join([]string{
- fmt.Sprintf("${config.%sGlobalLldflags}", hod),
- toolchain.Lldflags(),
- toolchain.ToolchainLdflags(),
- productExtraLdflags,
- }, " "))
if target.Os.Class == android.Device {
for variable, value := range sanitizerVariables {
diff --git a/cc/misc_disted_files.go b/cc/misc_disted_files.go
index 4bdffaa03..ef0b4eb45 100644
--- a/cc/misc_disted_files.go
+++ b/cc/misc_disted_files.go
@@ -15,8 +15,9 @@
package cc
import (
- "android/soong/android"
"strings"
+
+ "android/soong/android"
)
func init() {
@@ -36,7 +37,7 @@ func (s *ccMiscDistedFilesSingleton) GenerateBuildActions(ctx android.SingletonC
var warningsAllowed []string
var usingWnoErrors []string
var missingProfiles []string
- ctx.VisitAllModules(func(module android.Module) {
+ ctx.VisitAllModuleProxies(func(module android.ModuleProxy) {
if v, ok := android.OtherModuleProvider(ctx, module, CcMakeVarsInfoProvider); ok {
warningsAllowed = android.AppendIfNotZero(warningsAllowed, v.WarningsAllowed)
usingWnoErrors = android.AppendIfNotZero(usingWnoErrors, v.UsingWnoError)
diff --git a/cc/ndk_library.go b/cc/ndk_library.go
index c21fe564b..69092b79c 100644
--- a/cc/ndk_library.go
+++ b/cc/ndk_library.go
@@ -298,17 +298,17 @@ func CompileStubLibrary(ctx android.ModuleContext, flags Flags, src android.Path
func (this *stubDecorator) findImplementationLibrary(ctx ModuleContext) android.Path {
dep := ctx.GetDirectDepProxyWithTag(strings.TrimSuffix(ctx.ModuleName(), ndkLibrarySuffix),
stubImplementation)
- if dep == nil {
+ if dep.IsNil() {
ctx.ModuleErrorf("Could not find implementation for stub: ")
return nil
}
- if _, ok := android.OtherModuleProvider(ctx, *dep, CcInfoProvider); !ok {
+ if _, ok := android.OtherModuleProvider(ctx, dep, CcInfoProvider); !ok {
ctx.ModuleErrorf("Implementation for stub is not correct module type")
return nil
}
- output := android.OtherModuleProviderOrDefault(ctx, *dep, LinkableInfoProvider).UnstrippedOutputFile
+ output := android.OtherModuleProviderOrDefault(ctx, dep, LinkableInfoProvider).UnstrippedOutputFile
if output == nil {
- ctx.ModuleErrorf("implementation module (%s) has no output", *dep)
+ ctx.ModuleErrorf("implementation module (%s) has no output", dep)
return nil
}
diff --git a/cc/ndk_test.go b/cc/ndk_test.go
index 8574bf148..e9804024c 100644
--- a/cc/ndk_test.go
+++ b/cc/ndk_test.go
@@ -17,15 +17,13 @@ package cc
import (
"testing"
- "github.com/google/blueprint"
-
"android/soong/android"
)
func TestNdkHeaderDependency(t *testing.T) {
isDep := func(ctx *android.TestResult, from, toExpected android.Module) bool {
foundDep := false
- ctx.VisitDirectDeps(from, func(toActual blueprint.Module) {
+ ctx.VisitDirectDeps(from, func(toActual android.Module) {
if toExpected.Name() == toActual.Name() {
foundDep = true
}
diff --git a/cc/ndk_translation_package.go b/cc/ndk_translation_package.go
new file mode 100644
index 000000000..7d18576b4
--- /dev/null
+++ b/cc/ndk_translation_package.go
@@ -0,0 +1,270 @@
+// Copyright 2025 Google Inc. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package cc
+
+import (
+ "fmt"
+
+ "android/soong/android"
+ "path/filepath"
+ "strings"
+
+ "github.com/google/blueprint"
+ "github.com/google/blueprint/proptools"
+)
+
+func init() {
+ android.RegisterModuleType("ndk_translation_package", NdkTranslationPackageFactory)
+}
+
+func NdkTranslationPackageFactory() android.Module {
+ module := &ndkTranslationPackage{}
+ module.AddProperties(&module.properties)
+ android.InitAndroidMultiTargetsArchModule(module, android.DeviceSupported, android.MultilibCommon)
+ return module
+}
+
+type ndkTranslationPackage struct {
+ android.ModuleBase
+ properties ndkTranslationPackageProperties
+
+ output android.Path
+}
+
+type ndkTranslationPackageProperties struct {
+ // Dependencies with native bridge variants that should be packaged.
+ // (e.g. arm and arm64 on an x86_64 device)
+ Native_bridge_deps proptools.Configurable[[]string]
+ // Non-native bridge variants that should be packaged.
+ // (e.g. x86 and x86_64 on an x86_64 device)
+ Device_both_deps []string
+ // Non-native bridge variants with lib64 that should be packaged.
+ // (e.g. x86_64 on an x86_64 device)
+ Device_64_deps []string
+ // Non-native bridge variants with lib32 that should be packaged.
+ // (e.g. x86 on an x86_64 device)
+ Device_32_deps []string
+ // Non-native bridge variants whose first variant should be packaged.
+ Device_first_deps []string
+ // Non-native bridge variants whose first variant should be packaged,
+ // but always into lib/, bin/ directories.
+ Device_first_to_32_deps []string
+ // Non-native bridge variants that should _not_ be packaged, but
+ // used as inputs to generate Android.mk and product.mk
+ Device_both_extra_allowed_deps []string
+ Device_32_extra_allowed_deps []string
+
+ // Version to use in generating the new sysprops
+ Version *string
+
+ // Path to Android.bp generator
+ Android_bp_gen_path *string
+
+ // Path to product.mk generator
+ Product_mk_gen_path *string
+
+ // Whether generate build files for the ndk_translation_packages, default is true.
+ Generate_build_files *bool
+}
+
+type ndkTranslationPackageDepTag struct {
+ blueprint.DependencyTag
+ name string
+}
+
+func (_ ndkTranslationPackageDepTag) ExcludeFromVisibilityEnforcement() {}
+
+// Some dependencies do not support native bridge variants for riscv
+func (_ ndkTranslationPackageDepTag) AllowDisabledModuleDependency(target android.Module) bool {
+ return target.Target().NativeBridge == android.NativeBridgeEnabled &&
+ target.Target().Arch.ArchType == android.Riscv64
+}
+
+func (_ ndkTranslationPackageDepTag) AllowDisabledModuleDependencyProxy(ctx android.OtherModuleProviderContext, mod android.ModuleProxy) bool {
+ commonInfo := android.OtherModulePointerProviderOrDefault(ctx, mod, android.CommonModuleInfoProvider)
+ return commonInfo.Target.NativeBridge == android.NativeBridgeEnabled &&
+ commonInfo.Target.Arch.ArchType == android.Riscv64
+
+}
+
+var (
+ ndkTranslationPackageTag = ndkTranslationPackageDepTag{name: "dep"}
+ ndkTranslationPackageFirstTo32SrcsTag = ndkTranslationPackageDepTag{name: "first_to_32"}
+ ndkTranslationExtraAllowedDepsTag = ndkTranslationPackageDepTag{name: "extra_allowed_deps"}
+)
+
+func (n *ndkTranslationPackage) DepsMutator(ctx android.BottomUpMutatorContext) {
+ for index, t := range ctx.MultiTargets() {
+ if t.NativeBridge == android.NativeBridgeEnabled {
+ ctx.AddFarVariationDependencies(t.Variations(), ndkTranslationPackageTag, n.properties.Native_bridge_deps.GetOrDefault(ctx, nil)...)
+ } else if t.Arch.ArchType == android.X86_64 {
+ ctx.AddFarVariationDependencies(t.Variations(), ndkTranslationPackageTag, n.properties.Device_64_deps...)
+ ctx.AddFarVariationDependencies(t.Variations(), ndkTranslationPackageTag, n.properties.Device_both_deps...)
+ ctx.AddFarVariationDependencies(t.Variations(), ndkTranslationExtraAllowedDepsTag, n.properties.Device_both_extra_allowed_deps...)
+ } else if t.Arch.ArchType == android.X86 {
+ ctx.AddFarVariationDependencies(t.Variations(), ndkTranslationPackageTag, n.properties.Device_32_deps...)
+ ctx.AddFarVariationDependencies(t.Variations(), ndkTranslationPackageTag, n.properties.Device_both_deps...)
+ ctx.AddFarVariationDependencies(t.Variations(), ndkTranslationExtraAllowedDepsTag, n.properties.Device_both_extra_allowed_deps...)
+ ctx.AddFarVariationDependencies(t.Variations(), ndkTranslationExtraAllowedDepsTag, n.properties.Device_32_extra_allowed_deps...)
+ }
+ if index == 0 { // Primary arch
+ ctx.AddFarVariationDependencies(t.Variations(), ndkTranslationPackageTag, n.properties.Device_first_deps...)
+ ctx.AddFarVariationDependencies(t.Variations(), ndkTranslationPackageFirstTo32SrcsTag, n.properties.Device_first_to_32_deps...)
+ }
+ }
+}
+
+func (n *ndkTranslationPackage) GenerateAndroidBuildActions(ctx android.ModuleContext) {
+ var files []android.PackagingSpec // both arches
+ var files64 []android.PackagingSpec // 64 only
+ var extraFiles []android.PackagingSpec
+ var extraFiles64 []android.PackagingSpec
+
+ ctx.VisitDirectDepsProxy(func(child android.ModuleProxy) {
+ tag := ctx.OtherModuleDependencyTag(child)
+ info := android.OtherModuleProviderOrDefault(ctx, child, android.InstallFilesProvider)
+ commonInfo := android.OtherModulePointerProviderOrDefault(ctx, child, android.CommonModuleInfoProvider)
+ if tag == ndkTranslationExtraAllowedDepsTag {
+ extraFiles = append(extraFiles, info.PackagingSpecs...)
+ if commonInfo.Target.Arch.ArchType == android.X86_64 || commonInfo.Target.Arch.ArchType == android.Arm64 {
+ extraFiles64 = append(extraFiles64, info.PackagingSpecs...)
+ }
+ return
+ }
+ files = append(files, info.PackagingSpecs...)
+ if (commonInfo.Target.Arch.ArchType == android.X86_64 || commonInfo.Target.Arch.ArchType == android.Arm64) && tag != ndkTranslationPackageFirstTo32SrcsTag {
+ files64 = append(files64, info.PackagingSpecs...)
+ }
+ })
+
+ outZip := android.PathForModuleOut(ctx, ctx.ModuleName()+".zip")
+ builder := android.NewRuleBuilder(pctx, ctx)
+ cmd := builder.Command().
+ BuiltTool("soong_zip").
+ FlagWithOutput("-o ", outZip)
+
+ if proptools.BoolDefault(n.properties.Generate_build_files, true) {
+ outBp := n.genAndroidBp(ctx, files)
+ outArm64ArmMk, outArm64Mk := n.genProductMk(ctx, files, files64, extraFiles, extraFiles64)
+ for _, buildFile := range []android.Path{outBp, outArm64ArmMk, outArm64Mk} {
+ cmd.
+ FlagWithArg("-C ", filepath.Dir(buildFile.String())).
+ FlagWithInput("-f ", buildFile)
+ }
+ }
+
+ for _, file := range files {
+ // Copy to relative path inside the zip
+ cmd.
+ FlagWithArg("-e ", "system/"+file.RelPathInPackage()).
+ FlagWithInput("-f ", file.SrcPath())
+ }
+
+ builder.Build("ndk_translation_package.zip", fmt.Sprintf("Build ndk_translation_package for %s", ctx.ModuleName()))
+
+ ctx.CheckbuildFile(outZip)
+ n.output = outZip
+
+ ctx.DistForGoal(ctx.ModuleName(), outZip)
+}
+
+// Creates a build rule to generate Android.bp and returns path of the generated file.
+func (n *ndkTranslationPackage) genAndroidBp(ctx android.ModuleContext, files []android.PackagingSpec) android.Path {
+ genDir := android.PathForModuleOut(ctx, "android_bp_dir")
+ generator := android.PathForModuleSrc(ctx, proptools.String(n.properties.Android_bp_gen_path))
+ builder := android.NewRuleBuilder(pctx, ctx).Sbox(
+ genDir,
+ android.PathForModuleOut(ctx, "Android.bp.sbox.textproto"),
+ )
+ outBp := genDir.Join(ctx, "Android.bp")
+ builder.Command().
+ Input(generator).
+ Implicits(specsToSrcPaths(files)).
+ Flag(strings.Join(filesRelativeToInstallDir(ctx, files), " ")).
+ FlagWithOutput("> ", outBp)
+ builder.Build("ndk_translation_package.Android.bp", "Build ndk_translation_package Android.bp")
+
+ return outBp
+}
+
+// Creates a build rule to generate product.mk and returns path of the generated files
+func (n *ndkTranslationPackage) genProductMk(ctx android.ModuleContext, files, files64, extraFiles, extraFiles64 []android.PackagingSpec) (android.Path, android.Path) {
+ genDir := android.PathForModuleOut(ctx, "product_arm64_arm_dir")
+ generator := android.PathForModuleSrc(ctx, proptools.String(n.properties.Product_mk_gen_path))
+ // Both arches
+ builder := android.NewRuleBuilder(pctx, ctx).Sbox(
+ genDir,
+ android.PathForModuleOut(ctx, "product_arm64_arm.mk.textproto"),
+ )
+ outArm64ArmMk := genDir.Join(ctx, "product_arm64_arm.mk")
+ builder.Command().
+ Input(generator).
+ Implicits(specsToSrcPaths(files)).
+ FlagWithArg("--version=", proptools.String(n.properties.Version)).
+ Flag("--arm64 --arm").
+ FlagForEachArg("--extra_allowed_artifact ", filesRelativeToInstallDir(ctx, extraFiles)).
+ Flag(strings.Join(filesRelativeToInstallDir(ctx, files), " ")).
+ FlagWithOutput("> ", outArm64ArmMk)
+ builder.Build("ndk_translation_package.product_arm64_arm.mk", "Build ndk_translation_package product_arm64_arm.mk")
+
+ // Arm64 only
+ genDir = android.PathForModuleOut(ctx, "product_arm64_dir")
+ builder = android.NewRuleBuilder(pctx, ctx).Sbox(
+ genDir,
+ android.PathForModuleOut(ctx, "product_arm64.mk.textproto"),
+ )
+ outArm64Mk := genDir.Join(ctx, "product_arm64.mk")
+ builder.Command().
+ Input(generator).
+ Implicits(specsToSrcPaths(files64)).
+ FlagWithArg("--version=", proptools.String(n.properties.Version)).
+ Flag("--arm64").
+ FlagForEachArg("--extra_allowed_artifact ", filesRelativeToInstallDir(ctx, extraFiles64)).
+ Flag(strings.Join(filesRelativeToInstallDir(ctx, files64), " ")).
+ FlagWithOutput("> ", outArm64Mk)
+ builder.Build("ndk_translation_package.product_arm_64.mk", "Build ndk_translation_package product_arm64.mk")
+
+ return outArm64ArmMk, outArm64Mk
+}
+
+func filesRelativeToInstallDir(ctx android.ModuleContext, files []android.PackagingSpec) []string {
+ var ret []string
+ for _, file := range files {
+ ret = append(ret, "system/"+file.RelPathInPackage())
+ }
+ return ret
+}
+
+func specsToSrcPaths(specs []android.PackagingSpec) android.Paths {
+ var ret android.Paths
+ for _, spec := range specs {
+ ret = append(ret, spec.SrcPath())
+ }
+ return ret
+}
+
+// The only purpose of this method is to make sure we can build the module directly without dist.
+func (n *ndkTranslationPackage) AndroidMkEntries() []android.AndroidMkEntries {
+ return []android.AndroidMkEntries{
+ android.AndroidMkEntries{
+ Class: "ETC",
+ OutputFile: android.OptionalPathForPath(n.output),
+ ExtraEntries: []android.AndroidMkExtraEntriesFunc{
+ func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
+ entries.SetBool("LOCAL_UNINSTALLABLE_MODULE", true)
+ }},
+ },
+ }
+}
diff --git a/cc/object.go b/cc/object.go
index ea3ed6151..95a8beb52 100644
--- a/cc/object.go
+++ b/cc/object.go
@@ -250,7 +250,3 @@ func (object *objectLinker) moduleInfoJSON(ctx ModuleContext, moduleInfoJSON *an
object.baseLinker.moduleInfoJSON(ctx, moduleInfoJSON)
moduleInfoJSON.Class = []string{"STATIC_LIBRARIES"}
}
-
-func (object *objectLinker) testSuiteInfo(ctx ModuleContext) {
- // not a test
-}
diff --git a/cc/orderfile_test.go b/cc/orderfile_test.go
index 41253adc6..b5709ae0a 100644
--- a/cc/orderfile_test.go
+++ b/cc/orderfile_test.go
@@ -207,11 +207,11 @@ func TestOrderfileProfilePropagateStaticDeps(t *testing.T) {
}
// Check dependency edge from orderfile-enabled module to orderfile variant static libraries
- if !hasDirectDep(result, libTest.Module(), libFooOfVariant.Module()) {
+ if !android.HasDirectDep(result, libTest.Module(), libFooOfVariant.Module()) {
t.Errorf("libTest missing dependency on orderfile variant of libFoo")
}
- if !hasDirectDep(result, libFooOfVariant.Module(), libBarOfVariant.Module()) {
+ if !android.HasDirectDep(result, libFooOfVariant.Module(), libBarOfVariant.Module()) {
t.Errorf("libTest missing dependency on orderfile variant of libBar")
}
@@ -230,11 +230,11 @@ func TestOrderfileProfilePropagateStaticDeps(t *testing.T) {
}
// Check no dependency edge from orderfile-enabled module to non-orderfile variant static libraries
- if hasDirectDep(result, libTest.Module(), libFoo.Module()) {
+ if android.HasDirectDep(result, libTest.Module(), libFoo.Module()) {
t.Errorf("libTest has dependency on non-orderfile variant of libFoo")
}
- if !hasDirectDep(result, libFoo.Module(), libBar.Module()) {
+ if !android.HasDirectDep(result, libFoo.Module(), libBar.Module()) {
t.Errorf("libTest has dependency on non-orderfile variant of libBar")
}
}
@@ -285,11 +285,11 @@ func TestOrderfileLoadPropagateStaticDeps(t *testing.T) {
libBar := result.ModuleForTests(t, "libBar", "android_arm64_armv8-a_static")
// Check dependency edge from orderfile-enabled module to non-orderfile variant static libraries
- if !hasDirectDep(result, libTest.Module(), libFoo.Module()) {
+ if !android.HasDirectDep(result, libTest.Module(), libFoo.Module()) {
t.Errorf("libTest missing dependency on non-orderfile variant of libFoo")
}
- if !hasDirectDep(result, libFoo.Module(), libBar.Module()) {
+ if !android.HasDirectDep(result, libFoo.Module(), libBar.Module()) {
t.Errorf("libTest missing dependency on non-orderfile variant of libBar")
}
@@ -365,11 +365,11 @@ func TestOrderfileProfilePropagateSharedDeps(t *testing.T) {
}
// Check dependency edge from orderfile-enabled module to non-orderfile variant static libraries
- if !hasDirectDep(result, libTest.Module(), libFoo.Module()) {
+ if !android.HasDirectDep(result, libTest.Module(), libFoo.Module()) {
t.Errorf("libTest missing dependency on non-orderfile variant of libFoo")
}
- if !hasDirectDep(result, libFoo.Module(), libBar.Module()) {
+ if !android.HasDirectDep(result, libFoo.Module(), libBar.Module()) {
t.Errorf("libTest missing dependency on non-orderfile variant of libBar")
}
@@ -445,11 +445,11 @@ func TestOrderfileProfileStaticLibrary(t *testing.T) {
}
// Check dependency edge from orderfile-enabled module to non-orderfile variant libraries
- if !hasDirectDep(result, libTest.Module(), libFoo.Module()) {
+ if !android.HasDirectDep(result, libTest.Module(), libFoo.Module()) {
t.Errorf("libTest missing dependency on non-orderfile variant of libFoo")
}
- if !hasDirectDep(result, libFoo.Module(), libBar.Module()) {
+ if !android.HasDirectDep(result, libFoo.Module(), libBar.Module()) {
t.Errorf("libTest missing dependency on non-orderfile variant of libBar")
}
diff --git a/cc/prebuilt_test.go b/cc/prebuilt_test.go
index af68ca6bf..cade677ee 100644
--- a/cc/prebuilt_test.go
+++ b/cc/prebuilt_test.go
@@ -20,7 +20,6 @@ import (
"testing"
"android/soong/android"
- "github.com/google/blueprint"
)
var prepareForPrebuiltTest = android.GroupFixturePreparers(
@@ -132,42 +131,31 @@ func TestPrebuilt(t *testing.T) {
prebuiltLibfShared := ctx.ModuleForTests(t, "prebuilt_libf", "android_arm64_armv8-a_shared").Module()
prebuiltCrtx := ctx.ModuleForTests(t, "prebuilt_crtx", "android_arm64_armv8-a").Module()
- hasDep := func(m android.Module, wantDep android.Module) bool {
- t.Helper()
- var found bool
- ctx.VisitDirectDeps(m, func(dep blueprint.Module) {
- if dep == wantDep {
- found = true
- }
- })
- return found
- }
-
- if !hasDep(liba, prebuiltLiba) {
+ if !android.HasDirectDep(ctx, liba, prebuiltLiba) {
t.Errorf("liba missing dependency on prebuilt_liba")
}
- if !hasDep(libb, prebuiltLibb) {
+ if !android.HasDirectDep(ctx, libb, prebuiltLibb) {
t.Errorf("libb missing dependency on prebuilt_libb")
}
- if !hasDep(libd, prebuiltLibd) {
+ if !android.HasDirectDep(ctx, libd, prebuiltLibd) {
t.Errorf("libd missing dependency on prebuilt_libd")
}
- if !hasDep(libe, prebuiltLibe) {
+ if !android.HasDirectDep(ctx, libe, prebuiltLibe) {
t.Errorf("libe missing dependency on prebuilt_libe")
}
- if !hasDep(libfStatic, prebuiltLibfStatic) {
+ if !android.HasDirectDep(ctx, libfStatic, prebuiltLibfStatic) {
t.Errorf("libf static missing dependency on prebuilt_libf")
}
- if !hasDep(libfShared, prebuiltLibfShared) {
+ if !android.HasDirectDep(ctx, libfShared, prebuiltLibfShared) {
t.Errorf("libf shared missing dependency on prebuilt_libf")
}
- if !hasDep(crtx, prebuiltCrtx) {
+ if !android.HasDirectDep(ctx, crtx, prebuiltCrtx) {
t.Errorf("crtx missing dependency on prebuilt_crtx")
}
@@ -440,17 +428,6 @@ func TestMultiplePrebuilts(t *testing.T) {
}
all_apex_contributions {name: "all_apex_contributions"}
`
- hasDep := func(ctx *android.TestContext, m android.Module, wantDep android.Module) bool {
- t.Helper()
- var found bool
- ctx.VisitDirectDeps(m, func(dep blueprint.Module) {
- if dep == wantDep {
- found = true
- }
- })
- return found
- }
-
testCases := []struct {
desc string
selectedDependencyName string
@@ -486,7 +463,7 @@ func TestMultiplePrebuilts(t *testing.T) {
}, preparer)
libfoo := ctx.ModuleForTests(t, "libfoo", "android_arm64_armv8-a_shared").Module()
expectedDependency := ctx.ModuleForTests(t, tc.expectedDependencyName, "android_arm64_armv8-a_shared").Module()
- android.AssertBoolEquals(t, fmt.Sprintf("expected dependency from %s to %s\n", libfoo.Name(), tc.expectedDependencyName), true, hasDep(ctx, libfoo, expectedDependency))
+ android.AssertBoolEquals(t, fmt.Sprintf("expected dependency from %s to %s\n", libfoo.Name(), tc.expectedDependencyName), true, android.HasDirectDep(ctx, libfoo, expectedDependency))
// check that LOCAL_SHARED_LIBRARIES contains libbar and not libbar.v<N>
entries := android.AndroidMkInfoForTest(t, ctx, libfoo).PrimaryInfo
android.AssertStringListContains(t, "Version should not be present in LOCAL_SHARED_LIBRARIES", entries.EntryMap["LOCAL_SHARED_LIBRARIES"], "libbar")
@@ -539,16 +516,6 @@ func TestMultiplePrebuiltsPreferredUsingLegacyFlags(t *testing.T) {
}
all_apex_contributions {name: "all_apex_contributions"}
`
- hasDep := func(ctx *android.TestContext, m android.Module, wantDep android.Module) bool {
- t.Helper()
- var found bool
- ctx.VisitDirectDeps(m, func(dep blueprint.Module) {
- if dep == wantDep {
- found = true
- }
- })
- return found
- }
testCases := []struct {
desc string
@@ -587,7 +554,8 @@ func TestMultiplePrebuiltsPreferredUsingLegacyFlags(t *testing.T) {
}
libfoo := ctx.ModuleForTests(t, "libfoo", "android_arm64_armv8-a_shared").Module()
expectedDependency := ctx.ModuleForTests(t, tc.expectedDependencyName, "android_arm64_armv8-a_shared").Module()
- android.AssertBoolEquals(t, fmt.Sprintf("expected dependency from %s to %s\n", libfoo.Name(), tc.expectedDependencyName), true, hasDep(ctx, libfoo, expectedDependency))
+ android.AssertBoolEquals(t, fmt.Sprintf("expected dependency from %s to %s\n", libfoo.Name(), tc.expectedDependencyName),
+ true, android.HasDirectDep(ctx, libfoo, expectedDependency))
}
}
@@ -617,16 +585,6 @@ func TestMissingVariantInModuleSdk(t *testing.T) {
}
all_apex_contributions {name: "all_apex_contributions"}
`
- hasDep := func(ctx *android.TestContext, m android.Module, wantDep android.Module) bool {
- t.Helper()
- var found bool
- ctx.VisitDirectDeps(m, func(dep blueprint.Module) {
- if dep == wantDep {
- found = true
- }
- })
- return found
- }
preparer := android.GroupFixturePreparers(
android.FixtureRegisterWithContext(func(ctx android.RegistrationContext) {
@@ -642,5 +600,6 @@ func TestMissingVariantInModuleSdk(t *testing.T) {
sourceLibBar := ctx.ModuleForTests(t, "libbar", "android_arm64_armv8-a_static").Module()
// Even though the prebuilt is listed in apex_contributions, the prebuilt does not have a static variant.
// Therefore source of libbar should be used.
- android.AssertBoolEquals(t, fmt.Sprintf("expected dependency from libfoo to source libbar"), true, hasDep(ctx, libfoo, sourceLibBar))
+ android.AssertBoolEquals(t, fmt.Sprintf("expected dependency from libfoo to source libbar"), true,
+ android.HasDirectDep(ctx, libfoo, sourceLibBar))
}
diff --git a/cc/sanitize.go b/cc/sanitize.go
index f0b0308ae..1678bc482 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -28,6 +28,8 @@ import (
"android/soong/etc"
)
+//go:generate go run ../../blueprint/gobtools/codegen/gob_gen.go
+
var (
// Any C flags added by sanitizer which libTooling tools may not
// understand also need to be added to ClangLibToolingUnknownCflags in
@@ -231,6 +233,7 @@ func (t SanitizerType) incompatibleWithCfi() bool {
return t == Asan || t == Fuzzer || t == Hwasan
}
+// @auto-generate: gob
type SanitizeUserProps struct {
// Prevent use of any sanitizers on this module
Never *bool `android:"arch_variant"`
@@ -1856,30 +1859,34 @@ func (txt *sanitizerLibrariesTxtModule) DepsMutator(actx android.BottomUpMutator
func (txt *sanitizerLibrariesTxtModule) getSanitizerLibs(ctx android.ModuleContext) string {
var sanitizerLibStems []string
- ctx.VisitDirectDepsIf(func(m android.Module) bool {
- if !m.Enabled(ctx) {
- return false
+ ctx.VisitDirectDepsProxy(func(m android.ModuleProxy) {
+ info := android.OtherModuleProviderOrDefault(ctx, m, android.CommonModuleInfoProvider)
+ if !info.Enabled {
+ return
}
- ccModule, _ := m.(*Module)
- if ccModule == nil || ccModule.library == nil || !ccModule.library.shared() {
- return false
+ if _, ok := android.OtherModuleProvider(ctx, m, SharedLibraryInfoProvider); !ok {
+ return
}
targets := ctx.Config().Targets[android.Android]
+ var targetMatches bool
for _, target := range targets {
- if m.Target().Os == target.Os && m.Target().Arch.ArchType == target.Arch.ArchType {
- return true
+ if info.Target.Os == target.Os && info.Target.Arch.ArchType == target.Arch.ArchType {
+ targetMatches = true
}
}
- return false
- }, func(m android.Module) {
- ccModule, _ := m.(*Module)
- outputFile := ccModule.outputFile
- if outputFile.Valid() {
- sanitizerLibStems = append(sanitizerLibStems, outputFile.Path().Base())
+ if !targetMatches {
+ return
+ }
+
+ outputFiles := android.OutputFilesForModule(ctx, m, "")
+ if len(outputFiles) == 1 {
+ sanitizerLibStems = append(sanitizerLibStems, outputFiles[0].Base())
+ } else if len(outputFiles) > 1 {
+ panic(fmt.Errorf("multiple output files for %s: %s", m, outputFiles.Strings()))
}
})
diff --git a/cc/sanitize_gob_enc.go b/cc/sanitize_gob_enc.go
new file mode 100644
index 000000000..a2b68a3e0
--- /dev/null
+++ b/cc/sanitize_gob_enc.go
@@ -0,0 +1,631 @@
+// Code generated by go run gob_gen.go; DO NOT EDIT.
+
+package cc
+
+import (
+ "bytes"
+ "github.com/google/blueprint/gobtools"
+)
+
+func init() {
+ SanitizeUserPropsGobRegId = gobtools.RegisterType(func() gobtools.CustomDec { return new(SanitizeUserProps) })
+}
+
+func (r SanitizeUserProps) Encode(buf *bytes.Buffer) error {
+ var err error
+
+ val1 := r.Never == nil
+ if err = gobtools.EncodeSimple(buf, val1); err != nil {
+ return err
+ }
+ if !val1 {
+ if err = gobtools.EncodeSimple(buf, (*r.Never)); err != nil {
+ return err
+ }
+ }
+
+ val2 := r.Address == nil
+ if err = gobtools.EncodeSimple(buf, val2); err != nil {
+ return err
+ }
+ if !val2 {
+ if err = gobtools.EncodeSimple(buf, (*r.Address)); err != nil {
+ return err
+ }
+ }
+
+ val3 := r.Thread == nil
+ if err = gobtools.EncodeSimple(buf, val3); err != nil {
+ return err
+ }
+ if !val3 {
+ if err = gobtools.EncodeSimple(buf, (*r.Thread)); err != nil {
+ return err
+ }
+ }
+
+ val4 := r.Hwaddress == nil
+ if err = gobtools.EncodeSimple(buf, val4); err != nil {
+ return err
+ }
+ if !val4 {
+ if err = gobtools.EncodeSimple(buf, (*r.Hwaddress)); err != nil {
+ return err
+ }
+ }
+
+ val5 := r.All_undefined == nil
+ if err = gobtools.EncodeSimple(buf, val5); err != nil {
+ return err
+ }
+ if !val5 {
+ if err = gobtools.EncodeSimple(buf, (*r.All_undefined)); err != nil {
+ return err
+ }
+ }
+
+ val6 := r.Undefined == nil
+ if err = gobtools.EncodeSimple(buf, val6); err != nil {
+ return err
+ }
+ if !val6 {
+ if err = gobtools.EncodeSimple(buf, (*r.Undefined)); err != nil {
+ return err
+ }
+ }
+
+ if err = gobtools.EncodeSimple(buf, int32(len(r.Misc_undefined))); err != nil {
+ return err
+ }
+ for val7 := 0; val7 < len(r.Misc_undefined); val7++ {
+ if err = gobtools.EncodeString(buf, r.Misc_undefined[val7]); err != nil {
+ return err
+ }
+ }
+
+ val8 := r.Fuzzer == nil
+ if err = gobtools.EncodeSimple(buf, val8); err != nil {
+ return err
+ }
+ if !val8 {
+ if err = gobtools.EncodeSimple(buf, (*r.Fuzzer)); err != nil {
+ return err
+ }
+ }
+
+ val9 := r.Safestack == nil
+ if err = gobtools.EncodeSimple(buf, val9); err != nil {
+ return err
+ }
+ if !val9 {
+ if err = gobtools.EncodeSimple(buf, (*r.Safestack)); err != nil {
+ return err
+ }
+ }
+
+ val10 := r.Cfi == nil
+ if err = gobtools.EncodeSimple(buf, val10); err != nil {
+ return err
+ }
+ if !val10 {
+ if err = gobtools.EncodeSimple(buf, (*r.Cfi)); err != nil {
+ return err
+ }
+ }
+
+ val11 := r.Integer_overflow == nil
+ if err = gobtools.EncodeSimple(buf, val11); err != nil {
+ return err
+ }
+ if !val11 {
+ if err = gobtools.EncodeSimple(buf, (*r.Integer_overflow)); err != nil {
+ return err
+ }
+ }
+
+ val12 := r.Scudo == nil
+ if err = gobtools.EncodeSimple(buf, val12); err != nil {
+ return err
+ }
+ if !val12 {
+ if err = gobtools.EncodeSimple(buf, (*r.Scudo)); err != nil {
+ return err
+ }
+ }
+
+ val13 := r.Scs == nil
+ if err = gobtools.EncodeSimple(buf, val13); err != nil {
+ return err
+ }
+ if !val13 {
+ if err = gobtools.EncodeSimple(buf, (*r.Scs)); err != nil {
+ return err
+ }
+ }
+
+ val14 := r.Memtag_heap == nil
+ if err = gobtools.EncodeSimple(buf, val14); err != nil {
+ return err
+ }
+ if !val14 {
+ if err = gobtools.EncodeSimple(buf, (*r.Memtag_heap)); err != nil {
+ return err
+ }
+ }
+
+ val15 := r.Memtag_stack == nil
+ if err = gobtools.EncodeSimple(buf, val15); err != nil {
+ return err
+ }
+ if !val15 {
+ if err = gobtools.EncodeSimple(buf, (*r.Memtag_stack)); err != nil {
+ return err
+ }
+ }
+
+ val16 := r.Memtag_globals == nil
+ if err = gobtools.EncodeSimple(buf, val16); err != nil {
+ return err
+ }
+ if !val16 {
+ if err = gobtools.EncodeSimple(buf, (*r.Memtag_globals)); err != nil {
+ return err
+ }
+ }
+
+ val17 := r.Writeonly == nil
+ if err = gobtools.EncodeSimple(buf, val17); err != nil {
+ return err
+ }
+ if !val17 {
+ if err = gobtools.EncodeSimple(buf, (*r.Writeonly)); err != nil {
+ return err
+ }
+ }
+
+ val18 := r.Diag.Undefined == nil
+ if err = gobtools.EncodeSimple(buf, val18); err != nil {
+ return err
+ }
+ if !val18 {
+ if err = gobtools.EncodeSimple(buf, (*r.Diag.Undefined)); err != nil {
+ return err
+ }
+ }
+
+ val19 := r.Diag.Cfi == nil
+ if err = gobtools.EncodeSimple(buf, val19); err != nil {
+ return err
+ }
+ if !val19 {
+ if err = gobtools.EncodeSimple(buf, (*r.Diag.Cfi)); err != nil {
+ return err
+ }
+ }
+
+ val20 := r.Diag.Integer_overflow == nil
+ if err = gobtools.EncodeSimple(buf, val20); err != nil {
+ return err
+ }
+ if !val20 {
+ if err = gobtools.EncodeSimple(buf, (*r.Diag.Integer_overflow)); err != nil {
+ return err
+ }
+ }
+
+ val21 := r.Diag.Memtag_heap == nil
+ if err = gobtools.EncodeSimple(buf, val21); err != nil {
+ return err
+ }
+ if !val21 {
+ if err = gobtools.EncodeSimple(buf, (*r.Diag.Memtag_heap)); err != nil {
+ return err
+ }
+ }
+
+ if err = gobtools.EncodeSimple(buf, int32(len(r.Diag.Misc_undefined))); err != nil {
+ return err
+ }
+ for val22 := 0; val22 < len(r.Diag.Misc_undefined); val22++ {
+ if err = gobtools.EncodeString(buf, r.Diag.Misc_undefined[val22]); err != nil {
+ return err
+ }
+ }
+
+ if err = gobtools.EncodeSimple(buf, int32(len(r.Diag.No_recover))); err != nil {
+ return err
+ }
+ for val23 := 0; val23 < len(r.Diag.No_recover); val23++ {
+ if err = gobtools.EncodeString(buf, r.Diag.No_recover[val23]); err != nil {
+ return err
+ }
+ }
+
+ val24 := r.Config.Cfi_assembly_support == nil
+ if err = gobtools.EncodeSimple(buf, val24); err != nil {
+ return err
+ }
+ if !val24 {
+ if err = gobtools.EncodeSimple(buf, (*r.Config.Cfi_assembly_support)); err != nil {
+ return err
+ }
+ }
+
+ if err = gobtools.EncodeSimple(buf, int32(len(r.Recover))); err != nil {
+ return err
+ }
+ for val25 := 0; val25 < len(r.Recover); val25++ {
+ if err = gobtools.EncodeString(buf, r.Recover[val25]); err != nil {
+ return err
+ }
+ }
+
+ val26 := r.Blocklist == nil
+ if err = gobtools.EncodeSimple(buf, val26); err != nil {
+ return err
+ }
+ if !val26 {
+ if err = gobtools.EncodeString(buf, (*r.Blocklist)); err != nil {
+ return err
+ }
+ }
+ return err
+}
+
+func (r *SanitizeUserProps) Decode(buf *bytes.Reader) error {
+ var err error
+
+ var val2 bool
+ if err = gobtools.DecodeSimple(buf, &val2); err != nil {
+ return err
+ }
+ if !val2 {
+ var val1 bool
+ err = gobtools.DecodeSimple[bool](buf, &val1)
+ if err != nil {
+ return err
+ }
+ r.Never = &val1
+ }
+
+ var val5 bool
+ if err = gobtools.DecodeSimple(buf, &val5); err != nil {
+ return err
+ }
+ if !val5 {
+ var val4 bool
+ err = gobtools.DecodeSimple[bool](buf, &val4)
+ if err != nil {
+ return err
+ }
+ r.Address = &val4
+ }
+
+ var val8 bool
+ if err = gobtools.DecodeSimple(buf, &val8); err != nil {
+ return err
+ }
+ if !val8 {
+ var val7 bool
+ err = gobtools.DecodeSimple[bool](buf, &val7)
+ if err != nil {
+ return err
+ }
+ r.Thread = &val7
+ }
+
+ var val11 bool
+ if err = gobtools.DecodeSimple(buf, &val11); err != nil {
+ return err
+ }
+ if !val11 {
+ var val10 bool
+ err = gobtools.DecodeSimple[bool](buf, &val10)
+ if err != nil {
+ return err
+ }
+ r.Hwaddress = &val10
+ }
+
+ var val14 bool
+ if err = gobtools.DecodeSimple(buf, &val14); err != nil {
+ return err
+ }
+ if !val14 {
+ var val13 bool
+ err = gobtools.DecodeSimple[bool](buf, &val13)
+ if err != nil {
+ return err
+ }
+ r.All_undefined = &val13
+ }
+
+ var val17 bool
+ if err = gobtools.DecodeSimple(buf, &val17); err != nil {
+ return err
+ }
+ if !val17 {
+ var val16 bool
+ err = gobtools.DecodeSimple[bool](buf, &val16)
+ if err != nil {
+ return err
+ }
+ r.Undefined = &val16
+ }
+
+ var val20 int32
+ err = gobtools.DecodeSimple[int32](buf, &val20)
+ if err != nil {
+ return err
+ }
+ if val20 > 0 {
+ r.Misc_undefined = make([]string, val20)
+ for val21 := 0; val21 < int(val20); val21++ {
+ err = gobtools.DecodeString(buf, &r.Misc_undefined[val21])
+ if err != nil {
+ return err
+ }
+ }
+ }
+
+ var val24 bool
+ if err = gobtools.DecodeSimple(buf, &val24); err != nil {
+ return err
+ }
+ if !val24 {
+ var val23 bool
+ err = gobtools.DecodeSimple[bool](buf, &val23)
+ if err != nil {
+ return err
+ }
+ r.Fuzzer = &val23
+ }
+
+ var val27 bool
+ if err = gobtools.DecodeSimple(buf, &val27); err != nil {
+ return err
+ }
+ if !val27 {
+ var val26 bool
+ err = gobtools.DecodeSimple[bool](buf, &val26)
+ if err != nil {
+ return err
+ }
+ r.Safestack = &val26
+ }
+
+ var val30 bool
+ if err = gobtools.DecodeSimple(buf, &val30); err != nil {
+ return err
+ }
+ if !val30 {
+ var val29 bool
+ err = gobtools.DecodeSimple[bool](buf, &val29)
+ if err != nil {
+ return err
+ }
+ r.Cfi = &val29
+ }
+
+ var val33 bool
+ if err = gobtools.DecodeSimple(buf, &val33); err != nil {
+ return err
+ }
+ if !val33 {
+ var val32 bool
+ err = gobtools.DecodeSimple[bool](buf, &val32)
+ if err != nil {
+ return err
+ }
+ r.Integer_overflow = &val32
+ }
+
+ var val36 bool
+ if err = gobtools.DecodeSimple(buf, &val36); err != nil {
+ return err
+ }
+ if !val36 {
+ var val35 bool
+ err = gobtools.DecodeSimple[bool](buf, &val35)
+ if err != nil {
+ return err
+ }
+ r.Scudo = &val35
+ }
+
+ var val39 bool
+ if err = gobtools.DecodeSimple(buf, &val39); err != nil {
+ return err
+ }
+ if !val39 {
+ var val38 bool
+ err = gobtools.DecodeSimple[bool](buf, &val38)
+ if err != nil {
+ return err
+ }
+ r.Scs = &val38
+ }
+
+ var val42 bool
+ if err = gobtools.DecodeSimple(buf, &val42); err != nil {
+ return err
+ }
+ if !val42 {
+ var val41 bool
+ err = gobtools.DecodeSimple[bool](buf, &val41)
+ if err != nil {
+ return err
+ }
+ r.Memtag_heap = &val41
+ }
+
+ var val45 bool
+ if err = gobtools.DecodeSimple(buf, &val45); err != nil {
+ return err
+ }
+ if !val45 {
+ var val44 bool
+ err = gobtools.DecodeSimple[bool](buf, &val44)
+ if err != nil {
+ return err
+ }
+ r.Memtag_stack = &val44
+ }
+
+ var val48 bool
+ if err = gobtools.DecodeSimple(buf, &val48); err != nil {
+ return err
+ }
+ if !val48 {
+ var val47 bool
+ err = gobtools.DecodeSimple[bool](buf, &val47)
+ if err != nil {
+ return err
+ }
+ r.Memtag_globals = &val47
+ }
+
+ var val51 bool
+ if err = gobtools.DecodeSimple(buf, &val51); err != nil {
+ return err
+ }
+ if !val51 {
+ var val50 bool
+ err = gobtools.DecodeSimple[bool](buf, &val50)
+ if err != nil {
+ return err
+ }
+ r.Writeonly = &val50
+ }
+
+ var val55 bool
+ if err = gobtools.DecodeSimple(buf, &val55); err != nil {
+ return err
+ }
+ if !val55 {
+ var val54 bool
+ err = gobtools.DecodeSimple[bool](buf, &val54)
+ if err != nil {
+ return err
+ }
+ r.Diag.Undefined = &val54
+ }
+
+ var val58 bool
+ if err = gobtools.DecodeSimple(buf, &val58); err != nil {
+ return err
+ }
+ if !val58 {
+ var val57 bool
+ err = gobtools.DecodeSimple[bool](buf, &val57)
+ if err != nil {
+ return err
+ }
+ r.Diag.Cfi = &val57
+ }
+
+ var val61 bool
+ if err = gobtools.DecodeSimple(buf, &val61); err != nil {
+ return err
+ }
+ if !val61 {
+ var val60 bool
+ err = gobtools.DecodeSimple[bool](buf, &val60)
+ if err != nil {
+ return err
+ }
+ r.Diag.Integer_overflow = &val60
+ }
+
+ var val64 bool
+ if err = gobtools.DecodeSimple(buf, &val64); err != nil {
+ return err
+ }
+ if !val64 {
+ var val63 bool
+ err = gobtools.DecodeSimple[bool](buf, &val63)
+ if err != nil {
+ return err
+ }
+ r.Diag.Memtag_heap = &val63
+ }
+
+ var val67 int32
+ err = gobtools.DecodeSimple[int32](buf, &val67)
+ if err != nil {
+ return err
+ }
+ if val67 > 0 {
+ r.Diag.Misc_undefined = make([]string, val67)
+ for val68 := 0; val68 < int(val67); val68++ {
+ err = gobtools.DecodeString(buf, &r.Diag.Misc_undefined[val68])
+ if err != nil {
+ return err
+ }
+ }
+ }
+
+ var val71 int32
+ err = gobtools.DecodeSimple[int32](buf, &val71)
+ if err != nil {
+ return err
+ }
+ if val71 > 0 {
+ r.Diag.No_recover = make([]string, val71)
+ for val72 := 0; val72 < int(val71); val72++ {
+ err = gobtools.DecodeString(buf, &r.Diag.No_recover[val72])
+ if err != nil {
+ return err
+ }
+ }
+ }
+
+ var val76 bool
+ if err = gobtools.DecodeSimple(buf, &val76); err != nil {
+ return err
+ }
+ if !val76 {
+ var val75 bool
+ err = gobtools.DecodeSimple[bool](buf, &val75)
+ if err != nil {
+ return err
+ }
+ r.Config.Cfi_assembly_support = &val75
+ }
+
+ var val79 int32
+ err = gobtools.DecodeSimple[int32](buf, &val79)
+ if err != nil {
+ return err
+ }
+ if val79 > 0 {
+ r.Recover = make([]string, val79)
+ for val80 := 0; val80 < int(val79); val80++ {
+ err = gobtools.DecodeString(buf, &r.Recover[val80])
+ if err != nil {
+ return err
+ }
+ }
+ }
+
+ var val83 bool
+ if err = gobtools.DecodeSimple(buf, &val83); err != nil {
+ return err
+ }
+ if !val83 {
+ var val82 string
+ err = gobtools.DecodeString(buf, &val82)
+ if err != nil {
+ return err
+ }
+ r.Blocklist = &val82
+ }
+
+ return err
+}
+
+var SanitizeUserPropsGobRegId int16
+
+func (r SanitizeUserProps) GetTypeId() int16 {
+ return SanitizeUserPropsGobRegId
+}
diff --git a/cc/sdk.go b/cc/sdk.go
index 5dd44d8b8..f375ce828 100644
--- a/cc/sdk.go
+++ b/cc/sdk.go
@@ -57,6 +57,9 @@ func (sdkTransitionMutator) Split(ctx android.BaseModuleContext) []string {
}
func (sdkTransitionMutator) OutgoingTransition(ctx android.OutgoingTransitionContext, sourceVariation string) string {
+ if _, ok := ctx.DepTag().(android.UsesUnbundledVariantDepTag); ok {
+ return "sdk"
+ }
return sourceVariation
}
@@ -78,8 +81,15 @@ func (sdkTransitionMutator) IncomingTransition(ctx android.IncomingTransitionCon
}
}
}
-
- if ctx.IsAddingDependency() {
+ _, usesUnbundledVariantDepTag := ctx.DepTag().(android.UsesUnbundledVariantDepTag)
+ // If we've reached this point, the module doesn't have an sdk variant. If we're adding
+ // a dependency, we want to pass the sdk variant through to cause a missing dependency error,
+ // so that sdk modules can't depend on non-sdk modules and smuggle the use of private apis.
+ // However, when the unbundled_builder depends on modules, it wants to prefer the sdk variant
+ // but fall back to non-sdk if it doesn't exist. It's ok in this case because the
+ // unbundled_builder is just a module for disting other modules, it doesn't have any code of its
+ // own.
+ if ctx.IsAddingDependency() && !usesUnbundledVariantDepTag {
return incomingVariation
} else {
return ""
@@ -114,7 +124,7 @@ func (sdkTransitionMutator) Mutate(ctx android.BottomUpMutatorContext, variation
ccModule.Properties.PreventInstall = true
}
- if ctx.Config().UnbundledBuildApps() {
+ if ctx.Config().HasUnbundledBuildApps() {
if variation == "" {
// For an unbundled apps build, hide the platform variant from Make
// so that other Make modules don't link against it, but against the
diff --git a/cc/test.go b/cc/test.go
index 9c276b81a..a20592892 100644
--- a/cc/test.go
+++ b/cc/test.go
@@ -274,12 +274,6 @@ func (test *testDecorator) moduleInfoJSON(ctx android.ModuleContext, moduleInfoJ
}
}
-func (test *testDecorator) testSuiteInfo(ctx ModuleContext) {
- android.SetProvider(ctx, android.TestSuiteInfoProvider, android.TestSuiteInfo{
- TestSuites: test.InstallerProperties.Test_suites,
- })
-}
-
func NewTestInstaller() *baseInstaller {
return NewBaseInstaller("nativetest", "nativetest64", InstallInData)
}
@@ -348,10 +342,6 @@ func (test *testBinary) moduleInfoJSON(ctx ModuleContext, moduleInfoJSON *androi
}
-func (test *testBinary) testSuiteInfo(ctx ModuleContext) {
- test.testDecorator.testSuiteInfo(ctx)
-}
-
func (test *testBinary) installerProps() []interface{} {
return append(test.baseInstaller.installerProps(), test.testDecorator.installerProps()...)
}
@@ -422,44 +412,36 @@ func (test *testBinary) install(ctx ModuleContext, file android.Path) {
test.Properties.Test_options.Unit_test = proptools.BoolPtr(true)
}
- if !ctx.Config().KatiEnabled() { // TODO(spandandas): Remove the special case for kati
- // Install the test config in testcases/ directory for atest.
- c, ok := ctx.Module().(*Module)
- if !ok {
- ctx.ModuleErrorf("Not a cc_test module")
- }
- // Install configs in the root of $PRODUCT_OUT/testcases/$module
- testCases := android.PathForModuleInPartitionInstall(ctx, "testcases", ctx.ModuleName()+c.SubName())
- if ctx.PrimaryArch() {
- if test.testConfig != nil {
- ctx.InstallFile(testCases, ctx.ModuleName()+".config", test.testConfig)
- }
- dynamicConfig := android.ExistentPathForSource(ctx, ctx.ModuleDir(), "DynamicConfig.xml")
- if dynamicConfig.Valid() {
- ctx.InstallFile(testCases, ctx.ModuleName()+".dynamic", dynamicConfig.Path())
- }
- for _, extraTestConfig := range test.extraTestConfigs {
- ctx.InstallFile(testCases, extraTestConfig.Base(), extraTestConfig)
- }
- }
- // Install tests and data in arch specific subdir $PRODUCT_OUT/testcases/$module/$arch
- testCases = testCases.Join(ctx, ctx.Target().Arch.ArchType.String())
- ctx.InstallTestData(testCases, test.data)
- ctx.InstallFile(testCases, file.Base(), file)
+ // Install the test config in testcases/ directory for atest.
+ c, ok := ctx.Module().(*Module)
+ if !ok {
+ ctx.ModuleErrorf("Not a cc_test module")
}
+ ctx.SetTestSuiteInfo(android.TestSuiteInfo{
+ NameSuffix: c.SubName(),
+ TestSuites: test.InstallerProperties.Test_suites,
+ MainFile: file,
+ MainFileStem: file.Base(),
+ ConfigFile: test.testConfig,
+ ExtraConfigs: test.extraTestConfigs,
+ Data: test.data,
+ NeedsArchFolder: true,
+ PerTestcaseDirectory: Bool(test.Properties.Per_testcase_directory),
+ })
+
test.binaryDecorator.baseInstaller.installTestData(ctx, test.data)
test.binaryDecorator.baseInstaller.install(ctx, file)
if Bool(test.Properties.Standalone_test) {
packagingSpecsBuilder := depset.NewBuilder[android.PackagingSpec](depset.TOPOLOGICAL)
- ctx.VisitDirectDeps(func(dep android.Module) {
+ ctx.VisitDirectDepsProxy(func(dep android.ModuleProxy) {
deps := android.OtherModuleProviderOrDefault(ctx, dep, android.InstallFilesProvider)
packagingSpecsBuilder.Transitive(deps.TransitivePackagingSpecs)
})
for _, standaloneTestDep := range packagingSpecsBuilder.Build().ToList() {
- if standaloneTestDep.ToGob().SrcPath == nil {
+ if standaloneTestDep.SrcPath() == nil {
continue
}
if standaloneTestDep.SkipInstall() {
@@ -588,8 +570,24 @@ func (test *testLibrary) moduleInfoJSON(ctx ModuleContext, moduleInfoJSON *andro
test.testDecorator.moduleInfoJSON(ctx, moduleInfoJSON)
}
-func (test *testLibrary) testSuiteInfo(ctx ModuleContext) {
- test.testDecorator.testSuiteInfo(ctx)
+func (test *testLibrary) install(ctx ModuleContext, file android.Path) {
+ test.libraryDecorator.install(ctx, file)
+
+ c, ok := ctx.Module().(*Module)
+ if !ok {
+ ctx.ModuleErrorf("Expected a cc module")
+ }
+ // host tests are not installed to testcases/ as per:
+ // https://cs.android.com/android/platform/superproject/main/+/main:build/make/core/base_rules.mk;l=251;drc=45efec6797cbf812df34dac9d05e43a9fe7217e0
+ if test.shared() {
+ ctx.SetTestSuiteInfo(android.TestSuiteInfo{
+ NameSuffix: c.SubName(),
+ TestSuites: test.InstallerProperties.Test_suites,
+ NeedsArchFolder: true,
+ MainFile: file,
+ MainFileStem: file.Base(),
+ })
+ }
}
func (test *testLibrary) installerProps() []interface{} {
@@ -684,6 +682,21 @@ func (benchmark *benchmarkDecorator) install(ctx ModuleContext, file android.Pat
benchmark.binaryDecorator.baseInstaller.dir64 = filepath.Join("benchmarktest64", ctx.ModuleName())
benchmark.binaryDecorator.baseInstaller.installTestData(ctx, benchmark.data)
benchmark.binaryDecorator.baseInstaller.install(ctx, file)
+
+ c, ok := ctx.Module().(*Module)
+ if !ok {
+ ctx.ModuleErrorf("Not a cc module")
+ }
+
+ ctx.SetTestSuiteInfo(android.TestSuiteInfo{
+ NameSuffix: c.SubName(),
+ TestSuites: benchmark.Properties.Test_suites,
+ MainFile: file,
+ MainFileStem: file.Base(),
+ ConfigFile: benchmark.testConfig,
+ Data: benchmark.data,
+ NeedsArchFolder: true,
+ })
}
func (benchmark *benchmarkDecorator) moduleInfoJSON(ctx ModuleContext, moduleInfoJSON *android.ModuleInfoJSON) {
@@ -709,12 +722,6 @@ func (benchmark *benchmarkDecorator) moduleInfoJSON(ctx ModuleContext, moduleInf
}
}
-func (benchmark *benchmarkDecorator) testSuiteInfo(ctx ModuleContext) {
- android.SetProvider(ctx, android.TestSuiteInfoProvider, android.TestSuiteInfo{
- TestSuites: benchmark.Properties.Test_suites,
- })
-}
-
func NewBenchmark(hod android.HostOrDeviceSupported) *Module {
module, binary := newBinary(hod)
module.multilib = android.MultilibBoth
diff --git a/cc/testing.go b/cc/testing.go
index 69ae11dfd..7cfcac8c5 100644
--- a/cc/testing.go
+++ b/cc/testing.go
@@ -104,6 +104,7 @@ func commonDefaultModules() string {
name: "libclang_rt.hwasan",
defaults: ["toolchain_libs_defaults"],
srcs: [""],
+ double_loadable: true,
}
cc_prebuilt_library_static {
@@ -130,6 +131,7 @@ func commonDefaultModules() string {
cc_prebuilt_library_shared {
name: "libclang_rt.ubsan_standalone",
defaults: ["toolchain_libs_defaults"],
+ double_loadable: true,
srcs: [""],
}