summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--android/arch_list.go3
-rw-r--r--android/config.go62
-rw-r--r--android/module.go5
-rw-r--r--android/paths.go20
-rw-r--r--android/variable.go93
-rw-r--r--apex/apex.go7
-rw-r--r--apex/apex_test.go34
-rw-r--r--cc/androidmk.go25
-rw-r--r--cc/builder.go49
-rw-r--r--cc/cc.go63
-rw-r--r--cc/cc_test.go36
-rw-r--r--cc/compiler.go26
-rw-r--r--cc/config/global.go178
-rw-r--r--cc/config/vndk.go1
-rw-r--r--cc/config/x86_linux_host.go1
-rw-r--r--cc/genrule.go15
-rw-r--r--cc/image.go28
-rw-r--r--cc/library.go24
-rw-r--r--cc/linkable.go13
-rw-r--r--cc/linker.go15
-rw-r--r--cc/lto.go10
-rw-r--r--cc/makevars.go30
-rw-r--r--cc/sabi.go10
-rw-r--r--cc/sanitize.go36
-rw-r--r--cc/snapshot_prebuilt.go203
-rw-r--r--cc/snapshot_utils.go10
-rw-r--r--cc/testing.go26
-rw-r--r--cc/util.go1
-rw-r--r--cc/vendor_snapshot.go60
-rwxr-xr-xjava/app.go64
-rw-r--r--java/dexpreopt.go5
-rw-r--r--java/dexpreopt_bootjars.go6
-rw-r--r--java/java.go7
-rw-r--r--java/rro.go19
-rw-r--r--java/rro_test.go56
-rw-r--r--java/sdk_library.go16
-rw-r--r--rust/rust.go9
-rw-r--r--rust/snapshot_utils.go10
-rw-r--r--scripts/check_boot_jars/package_allowed_list.txt8
-rw-r--r--ui/build/paths/config.go78
-rw-r--r--ui/build/sandbox_linux.go4
-rw-r--r--ui/build/soong.go11
42 files changed, 1260 insertions, 117 deletions
diff --git a/android/arch_list.go b/android/arch_list.go
index d68a0d1d1..0a895437a 100644
--- a/android/arch_list.go
+++ b/android/arch_list.go
@@ -35,6 +35,7 @@ var archVariants = map[ArchType][]string{
"cortex-a76",
"krait",
"kryo",
+ "kryo300",
"kryo385",
"exynos-m1",
"exynos-m2",
@@ -51,7 +52,9 @@ var archVariants = map[ArchType][]string{
"cortex-a75",
"cortex-a76",
"kryo",
+ "kryo300",
"kryo385",
+ "kryo785",
"exynos-m1",
"exynos-m2",
},
diff --git a/android/config.go b/android/config.go
index 24fc522df..b562f926b 100644
--- a/android/config.go
+++ b/android/config.go
@@ -792,6 +792,12 @@ func (c *config) UnbundledBuildApps() bool {
return Bool(c.productVariables.Unbundled_build_apps)
}
+// Returns true if building image that aren't bundled with the platform.
+// UnbundledBuild() is always true when this is true.
+func (c *config) UnbundledBuildImage() bool {
+ return Bool(c.productVariables.Unbundled_build_image)
+}
+
// Returns true if building modules against prebuilt SDKs.
func (c *config) AlwaysUsePrebuiltSdks() bool {
return Bool(c.productVariables.Always_use_prebuilt_sdks)
@@ -1063,6 +1069,10 @@ func (c *deviceConfig) RecoverySnapshotVersion() string {
return String(c.config.productVariables.RecoverySnapshotVersion)
}
+func (c *deviceConfig) RamdiskSnapshotVersion() string {
+ return String(c.config.productVariables.RamdiskSnapshotVersion)
+}
+
func (c *deviceConfig) CurrentApiLevelForVendorModules() string {
return StringDefault(c.config.productVariables.DeviceCurrentApiLevelForVendorModules, "current")
}
@@ -1248,6 +1258,27 @@ func (c *config) IntegerOverflowDisabledForPath(path string) bool {
return HasAnyPrefix(path, c.productVariables.IntegerOverflowExcludePaths)
}
+func (c *config) IntegerOverflowEnabledForPath(path string) bool {
+ if c.productVariables.IntegerOverflowIncludePaths == nil {
+ return false
+ }
+ return HasAnyPrefix(path, c.productVariables.IntegerOverflowIncludePaths)
+}
+
+func (c *config) BoundSanitizerEnabledForPath(path string) bool {
+ if c.productVariables.BoundSanitizerIncludePaths == nil {
+ return false
+ }
+ return HasAnyPrefix(path, c.productVariables.BoundSanitizerIncludePaths)
+}
+
+func (c *config) BoundSanitizerDisabledForPath(path string) bool {
+ if c.productVariables.BoundSanitizerExcludePaths == nil {
+ return false
+ }
+ return HasAnyPrefix(path, c.productVariables.BoundSanitizerExcludePaths)
+}
+
func (c *config) CFIDisabledForPath(path string) bool {
if len(c.productVariables.CFIExcludePaths) == 0 {
return false
@@ -1379,6 +1410,10 @@ func (c *deviceConfig) BoardUsesRecoveryAsBoot() bool {
return Bool(c.config.productVariables.BoardUsesRecoveryAsBoot)
}
+func (c *deviceConfig) BoardUsesRamdiskAsBoot() bool {
+ return Bool(c.config.productVariables.BoardUsesRamdiskAsBoot)
+}
+
func (c *deviceConfig) BoardKernelBinaries() []string {
return c.config.productVariables.BoardKernelBinaries
}
@@ -1391,6 +1426,10 @@ func (c *deviceConfig) BoardMoveRecoveryResourcesToVendorBoot() bool {
return Bool(c.config.productVariables.BoardMoveRecoveryResourcesToVendorBoot)
}
+func (c *deviceConfig) BoardMoveRamdiskResourcesToVendorBoot() bool {
+ return Bool(c.config.productVariables.BoardMoveRamdiskResourcesToVendorBoot)
+}
+
func (c *deviceConfig) PlatformSepolicyVersion() string {
return String(c.config.productVariables.PlatformSepolicyVersion)
}
@@ -1422,6 +1461,14 @@ func (c *deviceConfig) RecoverySnapshotModules() map[string]bool {
return c.config.productVariables.RecoverySnapshotModules
}
+func (c *deviceConfig) DirectedRamdiskSnapshot() bool {
+ return c.config.productVariables.DirectedRamdiskSnapshot
+}
+
+func (c *deviceConfig) RamdiskSnapshotModules() map[string]bool {
+ return c.config.productVariables.RamdiskSnapshotModules
+}
+
func createDirsMap(previous map[string]bool, dirs []string) (map[string]bool, error) {
var ret = make(map[string]bool)
for _, dir := range dirs {
@@ -1478,6 +1525,21 @@ func (c *deviceConfig) RecoverySnapshotDirsIncludedMap() map[string]bool {
c.config.productVariables.RecoverySnapshotDirsIncluded)
}
+var ramdiskSnapshotDirsExcludedKey = NewOnceKey("RamdiskSnapshotDirsExcludedMap")
+
+func (c *deviceConfig) RamdiskSnapshotDirsExcludedMap() map[string]bool {
+ return c.createDirsMapOnce(ramdiskSnapshotDirsExcludedKey, nil,
+ c.config.productVariables.RamdiskSnapshotDirsExcluded)
+}
+
+var ramdiskSnapshotDirsIncludedKey = NewOnceKey("RamdiskSnapshotDirsIncludedMap")
+
+func (c *deviceConfig) RamdiskSnapshotDirsIncludedMap() map[string]bool {
+ excludedMap := c.RamdiskSnapshotDirsExcludedMap()
+ return c.createDirsMapOnce(ramdiskSnapshotDirsIncludedKey, excludedMap,
+ c.config.productVariables.RamdiskSnapshotDirsIncluded)
+}
+
func (c *deviceConfig) ShippingApiLevel() ApiLevel {
if c.config.productVariables.ShippingApiLevel == nil {
return NoneApiLevel
diff --git a/android/module.go b/android/module.go
index f745a4ab4..ce7fd0ca0 100644
--- a/android/module.go
+++ b/android/module.go
@@ -473,6 +473,7 @@ type Module interface {
InitRc() Paths
VintfFragments() Paths
NoticeFiles() Paths
+ EffectiveLicenseFiles() Paths
AddProperties(props ...interface{})
GetProperties() []interface{}
@@ -1501,6 +1502,10 @@ func (m *ModuleBase) ExportedToMake() bool {
return m.commonProperties.NamespaceExportedToMake
}
+func (m *ModuleBase) EffectiveLicenseFiles() Paths {
+ return m.commonProperties.Effective_license_text
+}
+
// computeInstallDeps finds the installed paths of all dependencies that have a dependency
// tag that is annotated as needing installation via the IsInstallDepNeeded method.
func (m *ModuleBase) computeInstallDeps(ctx ModuleContext) ([]*installPathsDepSet, []*packagingSpecsDepSet) {
diff --git a/android/paths.go b/android/paths.go
index fb751175e..8a2eea6da 100644
--- a/android/paths.go
+++ b/android/paths.go
@@ -1591,6 +1591,18 @@ func (p InstallPath) ToMakePath() InstallPath {
// PathForModuleInstall returns a Path representing the install path for the
// module appended with paths...
func PathForModuleInstall(ctx ModuleInstallPathContext, pathComponents ...string) InstallPath {
+ os, arch := osAndArch(ctx)
+ partition := modulePartition(ctx, os)
+ return makePathForInstall(ctx, os, arch, partition, ctx.Debug(), pathComponents...)
+}
+
+// PathForModuleInPartitionInstall is similar to PathForModuleInstall but partition is provided by the caller
+func PathForModuleInPartitionInstall(ctx ModuleInstallPathContext, partition string, pathComponents ...string) InstallPath {
+ os, arch := osAndArch(ctx)
+ return makePathForInstall(ctx, os, arch, partition, ctx.Debug(), pathComponents...)
+}
+
+func osAndArch(ctx ModuleInstallPathContext) (OsType, ArchType) {
os := ctx.Os()
arch := ctx.Arch().ArchType
forceOS, forceArch := ctx.InstallForceOS()
@@ -1600,14 +1612,14 @@ func PathForModuleInstall(ctx ModuleInstallPathContext, pathComponents ...string
if forceArch != nil {
arch = *forceArch
}
- partition := modulePartition(ctx, os)
-
- ret := pathForInstall(ctx, os, arch, partition, ctx.Debug(), pathComponents...)
+ return os, arch
+}
+func makePathForInstall(ctx ModuleInstallPathContext, os OsType, arch ArchType, partition string, debug bool, pathComponents ...string) InstallPath {
+ ret := pathForInstall(ctx, os, arch, partition, debug, pathComponents...)
if ctx.InstallBypassMake() && ctx.Config().KatiEnabled() {
ret = ret.ToMakePath()
}
-
return ret
}
diff --git a/android/variable.go b/android/variable.go
index 0dc5262c7..f152ad206 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -147,6 +147,34 @@ type variableProperties struct {
Srcs []string `android:"arch_variant"`
Exclude_srcs []string `android:"arch_variant"`
} `android:"arch_variant"`
+
+ Real_hal struct {
+ Cflags []string
+ Exclude_srcs []string
+ Include_dirs []string
+ Shared_libs []string
+ Static_libs []string
+ Srcs []string
+ }
+
+ Qmaa_hal struct {
+ Cflags []string
+ Exclude_srcs []string
+ Include_dirs []string
+ Shared_libs []string
+ Static_libs []string
+ Srcs []string
+ }
+
+ Device_support_hwfde struct {
+ Cflags []string
+ Header_libs []string
+ Shared_libs []string
+ }
+
+ Device_support_hwfde_perf struct {
+ Cflags []string
+ }
} `android:"arch_variant"`
}
@@ -181,6 +209,7 @@ type productVariables struct {
DeviceSystemSdkVersions []string `json:",omitempty"`
RecoverySnapshotVersion *string `json:",omitempty"`
+ RamdiskSnapshotVersion *string `json:",omitempty"`
DeviceSecondaryArch *string `json:",omitempty"`
DeviceSecondaryArchVariant *string `json:",omitempty"`
@@ -220,29 +249,36 @@ type productVariables struct {
AppsDefaultVersionName *string `json:",omitempty"`
- Allow_missing_dependencies *bool `json:",omitempty"`
- Unbundled_build *bool `json:",omitempty"`
- Unbundled_build_apps *bool `json:",omitempty"`
- Always_use_prebuilt_sdks *bool `json:",omitempty"`
- Skip_boot_jars_check *bool `json:",omitempty"`
- Malloc_not_svelte *bool `json:",omitempty"`
- Malloc_zero_contents *bool `json:",omitempty"`
- Malloc_pattern_fill_contents *bool `json:",omitempty"`
- Safestack *bool `json:",omitempty"`
- HostStaticBinaries *bool `json:",omitempty"`
- Binder32bit *bool `json:",omitempty"`
- UseGoma *bool `json:",omitempty"`
- UseRBE *bool `json:",omitempty"`
- UseRBEJAVAC *bool `json:",omitempty"`
- UseRBER8 *bool `json:",omitempty"`
- UseRBED8 *bool `json:",omitempty"`
- Debuggable *bool `json:",omitempty"`
- Eng *bool `json:",omitempty"`
- Treble_linker_namespaces *bool `json:",omitempty"`
- Enforce_vintf_manifest *bool `json:",omitempty"`
- Uml *bool `json:",omitempty"`
- Arc *bool `json:",omitempty"`
- MinimizeJavaDebugInfo *bool `json:",omitempty"`
+ Real_hal *bool `json:",omitempty"`
+ Qmaa_hal *bool `json:",omitempty"`
+ Device_support_hwfde *bool `json:",omitempty"`
+ Device_support_hwfde_perf *bool `json:",omitempty"`
+ Allow_missing_dependencies *bool `json:",omitempty"`
+ Unbundled_build *bool `json:",omitempty"`
+ Unbundled_build_apps *bool `json:",omitempty"`
+ Unbundled_build_image *bool `json:",omitempty"`
+ Unbundled_build_sdks_from_source *bool `json:",omitempty"`
+ Always_use_prebuilt_sdks *bool `json:",omitempty"`
+ Skip_boot_jars_check *bool `json:",omitempty"`
+ Malloc_not_svelte *bool `json:",omitempty"`
+ Malloc_zero_contents *bool `json:",omitempty"`
+ Malloc_pattern_fill_contents *bool `json:",omitempty"`
+ Safestack *bool `json:",omitempty"`
+ HostStaticBinaries *bool `json:",omitempty"`
+ Binder32bit *bool `json:",omitempty"`
+ UseGoma *bool `json:",omitempty"`
+ UseRBE *bool `json:",omitempty"`
+ UseRBEJAVAC *bool `json:",omitempty"`
+ UseRBER8 *bool `json:",omitempty"`
+ UseRBED8 *bool `json:",omitempty"`
+ Debuggable *bool `json:",omitempty"`
+ Eng *bool `json:",omitempty"`
+ Treble_linker_namespaces *bool `json:",omitempty"`
+ Enforce_vintf_manifest *bool `json:",omitempty"`
+ Pdk *bool `json:",omitempty"`
+ Uml *bool `json:",omitempty"`
+ Arc *bool `json:",omitempty"`
+ MinimizeJavaDebugInfo *bool `json:",omitempty"`
Check_elf_files *bool `json:",omitempty"`
@@ -253,6 +289,10 @@ type productVariables struct {
UpdatableBootJars ConfiguredJarList `json:",omitempty"`
IntegerOverflowExcludePaths []string `json:",omitempty"`
+ IntegerOverflowIncludePaths []string `json:",omitempty"`
+
+ BoundSanitizerExcludePaths []string `json:",omitempty"`
+ BoundSanitizerIncludePaths []string `json:",omitempty"`
EnableCFI *bool `json:",omitempty"`
CFIExcludePaths []string `json:",omitempty"`
@@ -315,10 +355,15 @@ type productVariables struct {
DirectedRecoverySnapshot bool `json:",omitempty"`
RecoverySnapshotModules map[string]bool `json:",omitempty"`
+ DirectedRamdiskSnapshot bool `json:",omitempty"`
+ RamdiskSnapshotModules map[string]bool `json:",omitempty"`
+
VendorSnapshotDirsIncluded []string `json:",omitempty"`
VendorSnapshotDirsExcluded []string `json:",omitempty"`
RecoverySnapshotDirsExcluded []string `json:",omitempty"`
RecoverySnapshotDirsIncluded []string `json:",omitempty"`
+ RamdiskSnapshotDirsExcluded []string `json:",omitempty"`
+ RamdiskSnapshotDirsIncluded []string `json:",omitempty"`
BoardVendorSepolicyDirs []string `json:",omitempty"`
BoardOdmSepolicyDirs []string `json:",omitempty"`
@@ -371,11 +416,13 @@ type productVariables struct {
InstallExtraFlattenedApexes *bool `json:",omitempty"`
BoardUsesRecoveryAsBoot *bool `json:",omitempty"`
+ BoardUsesRamdiskAsBoot *bool `json:",omitempty"`
BoardKernelBinaries []string `json:",omitempty"`
BoardKernelModuleInterfaceVersions []string `json:",omitempty"`
BoardMoveRecoveryResourcesToVendorBoot *bool `json:",omitempty"`
+ BoardMoveRamdiskResourcesToVendorBoot *bool `json:",omitempty"`
PrebuiltHiddenApiDir *string `json:",omitempty"`
diff --git a/apex/apex.go b/apex/apex.go
index 77854074b..097053f2a 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -2953,6 +2953,13 @@ func makeApexAvailableBaseline() map[string][]string {
"android.hidl.manager-V1.0-java",
"android.hidl.manager-V1.1-java",
"android.hidl.manager-V1.2-java",
+ "vendor.qti.hardware.wifi.hostapd-V1.0-java",
+ "vendor.qti.hardware.wifi.hostapd-V1.1-java",
+ "vendor.qti.hardware.wifi.hostapd-V1.2-java",
+ "vendor.qti.hardware.wifi.supplicant-V2.0-java",
+ "vendor.qti.hardware.wifi.supplicant-V2.1-java",
+ "vendor.qti.hardware.wifi.supplicant-V2.2-java",
+ "vendor.qti.hardware.fstman-V1.0-java",
"bouncycastle-unbundled",
"dnsresolver_aidl_interface-V2-java",
"error_prone_annotations",
diff --git a/apex/apex_test.go b/apex/apex_test.go
index 7b01b9481..360c9fe3f 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -4282,16 +4282,26 @@ func TestPrebuiltExportDexImplementationJars(t *testing.T) {
p := ctx.ModuleForTests(name, "android_common_myapex").Module().(java.UsesLibraryDependency)
dexJarBuildPath := p.DexJarBuildPath()
stem := android.RemoveOptionalPrebuiltPrefix(name)
- if expected, actual := ".intermediates/myapex.deapexer/android_common/deapexer/javalib/"+stem+".jar", android.NormalizePathForTesting(dexJarBuildPath); actual != expected {
- t.Errorf("Incorrect DexJarBuildPath value '%s', expected '%s'", actual, expected)
- }
+ android.AssertStringEquals(t, "DexJarBuildPath should be apex-related path.",
+ ".intermediates/myapex.deapexer/android_common/deapexer/javalib/"+stem+".jar",
+ android.NormalizePathForTesting(dexJarBuildPath))
+ }
+
+ checkDexJarInstallPath := func(t *testing.T, ctx *android.TestContext, name string) {
+ // Make sure the import has been given the correct path to the dex jar.
+ p := ctx.ModuleForTests(name, "android_common_myapex").Module().(java.UsesLibraryDependency)
+ dexJarBuildPath := p.DexJarInstallPath()
+ stem := android.RemoveOptionalPrebuiltPrefix(name)
+ android.AssertStringEquals(t, "DexJarInstallPath should be apex-related path.",
+ "target/product/test_device/apex/myapex/javalib/"+stem+".jar",
+ android.NormalizePathForTesting(dexJarBuildPath))
}
ensureNoSourceVariant := func(t *testing.T, ctx *android.TestContext, name string) {
// Make sure that an apex variant is not created for the source module.
- if expected, actual := []string{"android_common"}, ctx.ModuleVariantsForTests(name); !reflect.DeepEqual(expected, actual) {
- t.Errorf("invalid set of variants for %q: expected %q, found %q", "libfoo", expected, actual)
- }
+ android.AssertArrayString(t, "Check if there is no source variant",
+ []string{"android_common"},
+ ctx.ModuleVariantsForTests(name))
}
t.Run("prebuilt only", func(t *testing.T) {
@@ -4340,8 +4350,10 @@ func TestPrebuiltExportDexImplementationJars(t *testing.T) {
}
checkDexJarBuildPath(t, ctx, "libfoo")
+ checkDexJarInstallPath(t, ctx, "libfoo")
checkDexJarBuildPath(t, ctx, "libbar")
+ checkDexJarInstallPath(t, ctx, "libbar")
})
t.Run("prebuilt with source preferred", func(t *testing.T) {
@@ -4387,9 +4399,11 @@ func TestPrebuiltExportDexImplementationJars(t *testing.T) {
ctx := testDexpreoptWithApexes(t, bp, "", transform)
checkDexJarBuildPath(t, ctx, "prebuilt_libfoo")
+ checkDexJarInstallPath(t, ctx, "prebuilt_libfoo")
ensureNoSourceVariant(t, ctx, "libfoo")
checkDexJarBuildPath(t, ctx, "prebuilt_libbar")
+ checkDexJarInstallPath(t, ctx, "prebuilt_libbar")
ensureNoSourceVariant(t, ctx, "libbar")
})
@@ -4437,9 +4451,11 @@ func TestPrebuiltExportDexImplementationJars(t *testing.T) {
ctx := testDexpreoptWithApexes(t, bp, "", transform)
checkDexJarBuildPath(t, ctx, "prebuilt_libfoo")
+ checkDexJarInstallPath(t, ctx, "prebuilt_libfoo")
ensureNoSourceVariant(t, ctx, "libfoo")
checkDexJarBuildPath(t, ctx, "prebuilt_libbar")
+ checkDexJarInstallPath(t, ctx, "prebuilt_libbar")
ensureNoSourceVariant(t, ctx, "libbar")
})
}
@@ -4628,6 +4644,12 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) {
// find the dex boot jar in it. We either need to disable the source libfoo
// or make the prebuilt libfoo preferred.
testDexpreoptWithApexes(t, bp, "module libfoo does not provide a dex boot jar", preparer, fragment)
+ // dexbootjar check is skipped if AllowMissingDependencies is true
+ preparerAllowMissingDeps := android.GroupFixturePreparers(
+ preparer,
+ android.PrepareForTestWithAllowMissingDependencies,
+ )
+ testDexpreoptWithApexes(t, bp, "", preparerAllowMissingDeps, fragment)
})
t.Run("prebuilt library preferred with source", func(t *testing.T) {
diff --git a/cc/androidmk.go b/cc/androidmk.go
index e58d166a3..e8763df31 100644
--- a/cc/androidmk.go
+++ b/cc/androidmk.go
@@ -106,6 +106,9 @@ func (c *Module) AndroidMkEntries() []android.AndroidMkEntries {
if len(c.Properties.AndroidMkHeaderLibs) > 0 {
entries.AddStrings("LOCAL_HEADER_LIBRARIES", c.Properties.AndroidMkHeaderLibs...)
}
+ if lib, ok := c.compiler.(*libraryDecorator); ok {
+ entries.AddStrings("LOCAL_SRC_FILES", lib.baseCompiler.srcsBeforeGen.Strings()...)
+ }
entries.SetString("LOCAL_SOONG_LINK_TYPE", c.makeLinkType)
if c.UseVndk() {
entries.SetBool("LOCAL_USE_VNDK", true)
@@ -222,15 +225,29 @@ func (library *libraryDecorator) androidMkWriteExportedFlags(entries *android.An
}
func (library *libraryDecorator) androidMkEntriesWriteAdditionalDependenciesForSourceAbiDiff(entries *android.AndroidMkEntries) {
- if library.sAbiDiff.Valid() && !library.static() {
- entries.AddStrings("LOCAL_ADDITIONAL_DEPENDENCIES", library.sAbiDiff.String())
+ if library.sAbiOutputFile.Valid() {
+ entries.SetString("LOCAL_ADDITIONAL_DEPENDENCIES",
+ "$(LOCAL_ADDITIONAL_DEPENDENCIES) "+library.sAbiOutputFile.String())
+ if library.sAbiDiff.Valid() && !library.static() {
+ entries.SetString("LOCAL_ADDITIONAL_DEPENDENCIES",
+ "$(LOCAL_ADDITIONAL_DEPENDENCIES) "+library.sAbiDiff.String())
+ entries.SetString("HEADER_ABI_DIFFS",
+ "$(HEADER_ABI_DIFFS) "+library.sAbiDiff.String())
+ }
}
}
// TODO(ccross): remove this once apex/androidmk.go is converted to AndroidMkEntries
func (library *libraryDecorator) androidMkWriteAdditionalDependenciesForSourceAbiDiff(w io.Writer) {
- if library.sAbiDiff.Valid() && !library.static() {
- fmt.Fprintln(w, "LOCAL_ADDITIONAL_DEPENDENCIES +=", library.sAbiDiff.String())
+ if library.sAbiOutputFile.Valid() {
+ fmt.Fprintln(w, "LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_ADDITIONAL_DEPENDENCIES) ",
+ library.sAbiOutputFile.String())
+ if library.sAbiDiff.Valid() && !library.static() {
+ fmt.Fprintln(w, "LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_ADDITIONAL_DEPENDENCIES) ",
+ library.sAbiDiff.String())
+ fmt.Fprintln(w, "HEADER_ABI_DIFFS := $(HEADER_ABI_DIFFS) ",
+ library.sAbiDiff.String())
+ }
}
}
diff --git a/cc/builder.go b/cc/builder.go
index 51c8a0bdf..667d766a8 100644
--- a/cc/builder.go
+++ b/cc/builder.go
@@ -375,6 +375,7 @@ type builderFlags struct {
toolchain config.Toolchain
// True if these extra features are enabled.
+ sdclang bool
tidy bool
gcovCoverage bool
sAbiDump bool
@@ -585,7 +586,13 @@ func transformSourceToObj(ctx android.ModuleContext, subdir string, srcFiles and
ccDesc := ccCmd
- ccCmd = "${config.ClangBin}/" + ccCmd
+ var extraFlags string
+ if flags.sdclang {
+ ccCmd = "${config.SDClangBin}/" + ccCmd
+ extraFlags = " ${config.SDClangFlags}"
+ } else {
+ ccCmd = "${config.ClangBin}/" + ccCmd
+ }
var implicitOutputs android.WritablePaths
if coverage {
@@ -603,7 +610,7 @@ func transformSourceToObj(ctx android.ModuleContext, subdir string, srcFiles and
Implicits: cFlagsDeps,
OrderOnly: pathDeps,
Args: map[string]string{
- "cFlags": moduleFlags,
+ "cFlags": moduleFlags + extraFlags,
"ccCmd": ccCmd,
},
})
@@ -691,6 +698,9 @@ func transformObjToStaticLib(ctx android.ModuleContext,
flags builderFlags, outputFile android.ModuleOutPath, deps android.Paths) {
arCmd := "${config.ClangBin}/llvm-ar"
+ if flags.sdclang {
+ arCmd = "${config.SDClangBin}/llvm-ar"
+ }
arFlags := ""
if !ctx.Darwin() {
arFlags += " -format=gnu"
@@ -733,7 +743,14 @@ func transformObjToDynamicBinary(ctx android.ModuleContext,
objFiles, sharedLibs, staticLibs, lateStaticLibs, wholeStaticLibs, deps android.Paths,
crtBegin, crtEnd android.OptionalPath, groupLate bool, flags builderFlags, outputFile android.WritablePath, implicitOutputs android.WritablePaths) {
- ldCmd := "${config.ClangBin}/clang++"
+ var ldCmd string
+ var extraFlags string
+ if flags.sdclang {
+ ldCmd = "${config.SDClangBin}/clang++"
+ extraFlags = " ${config.SDClangFlags}"
+ } else {
+ ldCmd = "${config.ClangBin}/clang++"
+ }
var libFlagsList []string
@@ -788,7 +805,7 @@ func transformObjToDynamicBinary(ctx android.ModuleContext,
"crtBegin": crtBegin.String(),
"libFlags": strings.Join(libFlagsList, " "),
"extraLibFlags": flags.extraLibFlags,
- "ldFlags": flags.globalLdFlags + " " + flags.localLdFlags,
+ "ldFlags": flags.globalLdFlags + " " + flags.localLdFlags + " " + extraFlags,
"crtEnd": crtEnd.String(),
}
if ctx.Config().UseRBE() && ctx.Config().IsEnvTrue("RBE_CXX_LINKS") {
@@ -903,6 +920,19 @@ func sourceAbiDiff(ctx android.ModuleContext, inputDump android.Path, referenceD
if isVndkExt {
extraFlags = append(extraFlags, "-allow-extensions")
}
+ var sdclangAbiCheckIgnoreList = []string{
+ "libbinder",
+ "libhwbinder",
+ "libprotobuf-cpp-lite",
+ "libprotobuf-cpp-full",
+ "libunwindstack",
+ "libvixl-arm64",
+ "libvixl-arm",
+ }
+ if config.SDClang && !inList("-advice-only", extraFlags) &&
+ inList(ctx.ModuleName(), sdclangAbiCheckIgnoreList) {
+ extraFlags = append(extraFlags, "-advice-only")
+ }
ctx.Build(pctx, android.BuildParams{
Rule: sAbiDiff,
@@ -950,12 +980,19 @@ func transformSharedObjectToToc(ctx android.ModuleContext, inputFile android.Pat
func transformObjsToObj(ctx android.ModuleContext, objFiles android.Paths,
flags builderFlags, outputFile android.WritablePath, deps android.Paths) {
- ldCmd := "${config.ClangBin}/clang++"
+ var ldCmd string
+ var extraFlags string
+ if flags.sdclang {
+ ldCmd = "${config.SDClangBin}/clang++"
+ extraFlags = " ${config.SDClangFlags}"
+ } else {
+ ldCmd = "${config.ClangBin}/clang++"
+ }
rule := partialLd
args := map[string]string{
"ldCmd": ldCmd,
- "ldFlags": flags.globalLdFlags + " " + flags.localLdFlags,
+ "ldFlags": flags.globalLdFlags + " " + flags.localLdFlags + " " + extraFlags,
}
if ctx.Config().UseRBE() && ctx.Config().IsEnvTrue("RBE_CXX_LINKS") {
rule = partialLdRE
diff --git a/cc/cc.go b/cc/cc.go
index c62fd6c8f..e346bd941 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -221,6 +221,7 @@ type Flags struct {
SystemIncludeFlags []string
Toolchain config.Toolchain
+ Sdclang bool
Tidy bool // True if clang-tidy is enabled.
GcovCoverage bool // True if coverage files should be generated.
SAbiDump bool // True if header abi dumps should be generated.
@@ -252,6 +253,9 @@ type BaseProperties struct {
// Deprecated. true is the default, false is invalid.
Clang *bool `android:"arch_variant"`
+ // compile module with SDLLVM instead of AOSP LLVM
+ Sdclang *bool `android:"arch_variant"`
+
// The API level that this module is built against. The APIs of this API level will be
// visible at build time, but use of any APIs newer than min_sdk_version will render the
// module unloadable on older devices. In the future it will be possible to weakly-link new
@@ -299,10 +303,6 @@ type BaseProperties struct {
Logtags []string
// Make this module available when building for ramdisk.
- // On device without a dedicated recovery partition, the module is only
- // available after switching root into
- // /first_stage_ramdisk. To expose the module before switching root, install
- // the recovery variant instead.
Ramdisk_available *bool
// Make this module available when building for vendor ramdisk.
@@ -332,6 +332,7 @@ type BaseProperties struct {
// Used by vendor snapshot to record dependencies from snapshot modules.
SnapshotSharedLibs []string `blueprint:"mutated"`
+ SnapshotStaticLibs []string `blueprint:"mutated"`
SnapshotRuntimeLibs []string `blueprint:"mutated"`
Installable *bool
@@ -360,6 +361,13 @@ type BaseProperties struct {
// framework module from the recovery snapshot.
Exclude_from_recovery_snapshot *bool
+ // Normally Soong uses the directory structure to decide which modules
+ // should be included (framework) or excluded (non-framework) from the
+ // different snapshots (vendor, recovery, etc.), but this property
+ // allows a partner to exclude a module normally thought of as a
+ // framework module from the ramdisk snapshot.
+ Exclude_from_ramdisk_snapshot *bool
+
// List of APEXes that this module has private access to for testing purpose. The module
// can depend on libraries that are not exported by the APEXes and use private symbols
// from the exported libraries.
@@ -1282,6 +1290,10 @@ func (c *Module) ExcludeFromRecoverySnapshot() bool {
return Bool(c.Properties.Exclude_from_recovery_snapshot)
}
+func (c *Module) ExcludeFromRamdiskSnapshot() bool {
+ return Bool(c.Properties.Exclude_from_ramdisk_snapshot)
+}
+
func isBionic(name string) bool {
switch name {
case "libc", "libm", "libdl", "libdl_android", "linker", "linkerconfig":
@@ -1698,6 +1710,7 @@ func (c *Module) GenerateAndroidBuildActions(actx android.ModuleContext) {
flags := Flags{
Toolchain: c.toolchain(ctx),
EmitXrefs: ctx.Config().EmitXrefRules(),
+ Sdclang: c.sdclang(ctx),
}
if c.compiler != nil {
flags = c.compiler.compilerFlags(ctx, flags, deps)
@@ -1788,7 +1801,7 @@ func (c *Module) GenerateAndroidBuildActions(actx android.ModuleContext) {
}
// glob exported headers for snapshot, if BOARD_VNDK_VERSION is current or
- // RECOVERY_SNAPSHOT_VERSION is current.
+ // RECOVERY_SNAPSHOT_VERSION is current or RAMDISK_SNAPSHOT_VERSION is current.
if i, ok := c.linker.(snapshotLibraryInterface); ok {
if ShouldCollectHeadersForSnapshot(ctx, c, apexInfo) {
i.collectHeadersForSnapshot(ctx)
@@ -2022,9 +2035,9 @@ func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) {
var snapshotInfo *SnapshotInfo
getSnapshot := func() SnapshotInfo {
- // Only modules with BOARD_VNDK_VERSION uses snapshot. Others use the zero value of
+ // Only device modules with BOARD_VNDK_VERSION uses snapshot. Others use the zero value of
// SnapshotInfo, which provides no mappings.
- if snapshotInfo == nil {
+ if snapshotInfo == nil && c.Device() {
// Only retrieve the snapshot on demand in order to avoid circular dependencies
// between the modules in the snapshot and the snapshot itself.
var snapshotModule []blueprint.Module
@@ -2032,17 +2045,19 @@ func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) {
snapshotModule = ctx.AddVariationDependencies(nil, nil, "vendor_snapshot")
} else if recoverySnapshotVersion := actx.DeviceConfig().RecoverySnapshotVersion(); recoverySnapshotVersion != "current" && recoverySnapshotVersion != "" && c.InRecovery() {
snapshotModule = ctx.AddVariationDependencies(nil, nil, "recovery_snapshot")
+ } else if ramdiskSnapshotVersion := actx.DeviceConfig().RamdiskSnapshotVersion(); ramdiskSnapshotVersion != "current" && ramdiskSnapshotVersion != "" && c.InRamdisk() {
+ snapshotModule = ctx.AddVariationDependencies(nil, nil, "ramdisk_snapshot")
}
- if len(snapshotModule) > 0 {
+ if len(snapshotModule) > 0 && snapshotModule[0] != nil {
snapshot := ctx.OtherModuleProvider(snapshotModule[0], SnapshotInfoProvider).(SnapshotInfo)
snapshotInfo = &snapshot
// republish the snapshot for use in later mutators on this module
ctx.SetProvider(SnapshotInfoProvider, snapshot)
- } else {
- snapshotInfo = &SnapshotInfo{}
}
}
-
+ if snapshotInfo == nil {
+ snapshotInfo = &SnapshotInfo{}
+ }
return *snapshotInfo
}
@@ -2080,6 +2095,8 @@ func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) {
name, _ := StubsLibNameAndVersion(entry)
if c.InRecovery() {
nonvariantLibs = append(nonvariantLibs, rewriteSnapshotLib(entry, getSnapshot().SharedLibs))
+ } else if c.InRamdisk() {
+ nonvariantLibs = append(nonvariantLibs, rewriteSnapshotLib(entry, getSnapshot().SharedLibs))
} else if ctx.useSdk() && inList(name, *getNDKKnownLibs(ctx.Config())) {
variantLibs = append(variantLibs, name+ndkLibrarySuffix)
} else if ctx.useVndk() {
@@ -2477,6 +2494,21 @@ func checkDoubleLoadableLibraries(ctx android.TopDownMutatorContext) {
}
}
+func (c *Module) sdclang(ctx BaseModuleContext) bool {
+ sdclang := Bool(c.Properties.Sdclang)
+
+ // SDLLVM is not for host build
+ if ctx.Host() || config.ForceSDClangOff {
+ return false
+ }
+
+ if c.Properties.Sdclang == nil && config.SDClang {
+ return true
+ }
+
+ return sdclang
+}
+
// Convert dependencies to paths. Returns a PathDeps containing paths
func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
var depPaths PathDeps
@@ -2850,6 +2882,8 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
c.Properties.AndroidMkStaticLibs = append(
c.Properties.AndroidMkStaticLibs, makeLibName)
}
+ // Record BaseLibName for snapshots.
+ c.Properties.SnapshotStaticLibs = append(c.Properties.SnapshotStaticLibs, baseLibName(depName))
}
} else if !c.IsStubs() {
// Stubs lib doesn't link to the runtime lib, object, crt, etc. dependencies.
@@ -3079,6 +3113,13 @@ func (c *Module) Binary() bool {
return false
}
+func (c *Module) StaticExecutable() bool {
+ if b, ok := c.linker.(*binaryDecorator); ok {
+ return b.static()
+ }
+ return false
+}
+
func (c *Module) Object() bool {
if o, ok := c.linker.(interface {
object() bool
diff --git a/cc/cc_test.go b/cc/cc_test.go
index 5acafbe2a..9c5cbf0d0 100644
--- a/cc/cc_test.go
+++ b/cc/cc_test.go
@@ -141,6 +141,7 @@ const (
vendorVariant = "android_vendor.29_arm64_armv8-a_shared"
productVariant = "android_product.29_arm64_armv8-a_shared"
recoveryVariant = "android_recovery_arm64_armv8-a_shared"
+ ramdiskVariant = "android_ramdisk_arm64_armv8-a_shared"
)
// Test that the PrepareForTestWithCcDefaultModules provides all the files that it uses by
@@ -3187,6 +3188,41 @@ func TestRecovery(t *testing.T) {
}
}
+func TestRamdisk(t *testing.T) {
+ ctx := testCc(t, `
+ cc_library_shared {
+ name: "libramdisk",
+ ramdisk: true,
+ }
+ cc_library_shared {
+ name: "libramdisk32",
+ ramdisk: true,
+ compile_multilib:"32",
+ }
+ cc_library_shared {
+ name: "libHalInRamdisk",
+ ramdisk_available: true,
+ vendor: true,
+ }
+ `)
+
+ variants := ctx.ModuleVariantsForTests("libramdisk")
+ const arm64 = "android_ramdisk_arm64_armv8-a_shared"
+ if len(variants) != 1 || !android.InList(arm64, variants) {
+ t.Errorf("variants of libramdisk must be \"%s\" only, but was %#v", arm64, variants)
+ }
+
+ variants = ctx.ModuleVariantsForTests("libramdisk32")
+ if android.InList(arm64, variants) {
+ t.Errorf("multilib was set to 32 for libramdisk32, but its variants has %s.", arm64)
+ }
+
+ ramdiskModule := ctx.ModuleForTests("libHalInRamdisk", ramdiskVariant).Module().(*Module)
+ if !ramdiskModule.Platform() {
+ t.Errorf("ramdisk variant of libHalInRamdisk must not specific to device, soc, or product")
+ }
+}
+
func TestDataLibsPrebuiltSharedTestLibrary(t *testing.T) {
bp := `
cc_prebuilt_test_library_shared {
diff --git a/cc/compiler.go b/cc/compiler.go
index 78a5a5da3..7f13719e6 100644
--- a/cc/compiler.go
+++ b/cc/compiler.go
@@ -180,6 +180,23 @@ type BaseCompilerProperties struct {
// build the recovery variant of the C/C++ module.
Exclude_generated_sources []string
}
+ Ramdisk struct {
+ // list of source files that should only be used in the
+ // ramdisk variant of the C/C++ module.
+ Srcs []string `android:"path"`
+
+ // list of source files that should not be used to
+ // build the ramdisk variant of the C/C++ module.
+ Exclude_srcs []string `android:"path"`
+
+ // List of additional cflags that should be used to build the ramdisk
+ // variant of the C/C++ module.
+ Cflags []string
+
+ // list of generated sources that should not be used to
+ // build the ramdisk variant of the C/C++ module.
+ Exclude_generated_sources []string
+ }
Vendor_ramdisk struct {
// list of source files that should not be used to
// build the vendor ramdisk variant of the C/C++ module.
@@ -309,6 +326,7 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps
CheckBadCompilerFlags(ctx, "vendor.cflags", compiler.Properties.Target.Vendor.Cflags)
CheckBadCompilerFlags(ctx, "product.cflags", compiler.Properties.Target.Product.Cflags)
CheckBadCompilerFlags(ctx, "recovery.cflags", compiler.Properties.Target.Recovery.Cflags)
+ CheckBadCompilerFlags(ctx, "ramdisk.cflags", compiler.Properties.Target.Ramdisk.Cflags)
CheckBadCompilerFlags(ctx, "vendor_ramdisk.cflags", compiler.Properties.Target.Vendor_ramdisk.Cflags)
esc := proptools.NinjaAndShellEscapeList
@@ -371,6 +389,10 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps
flags.Global.CommonFlags = append(flags.Global.CommonFlags, "-D__ANDROID_RECOVERY__")
}
+ if ctx.inRamdisk() {
+ flags.Global.CommonFlags = append(flags.Global.CommonFlags, "-D__ANDROID_RAMDISK__")
+ }
+
if ctx.apexVariationName() != "" {
flags.Global.CommonFlags = append(flags.Global.CommonFlags, "-D__ANDROID_APEX__")
if compiler.useApexNameMacro() {
@@ -499,6 +521,10 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps
flags.Local.CFlags = append(flags.Local.CFlags, esc(compiler.Properties.Target.Recovery.Cflags)...)
}
+ if ctx.inRamdisk() {
+ flags.Local.CFlags = append(flags.Local.CFlags, esc(compiler.Properties.Target.Ramdisk.Cflags)...)
+ }
+
if ctx.inVendorRamdisk() {
flags.Local.CFlags = append(flags.Local.CFlags, esc(compiler.Properties.Target.Vendor_ramdisk.Cflags)...)
}
diff --git a/cc/config/global.go b/cc/config/global.go
index ae731b203..214587914 100644
--- a/cc/config/global.go
+++ b/cc/config/global.go
@@ -15,12 +15,26 @@
package config
import (
+ "encoding/json"
+ "encoding/xml"
+ "fmt"
+ "io/ioutil"
+ "os"
+
+ //"path"
+ //"path/filepath"
+ "strconv"
"strings"
"android/soong/android"
"android/soong/remoteexec"
)
+type QiifaAbiLibs struct {
+ XMLName xml.Name `xml:"abilibs"`
+ Library []string `xml:"library"`
+}
+
var (
// Flags used by lots of devices. Putting them in package static variables
// will save bytes in build.ninja so they aren't repeated for every file
@@ -131,7 +145,9 @@ var (
"-Wno-void-pointer-to-int-cast",
// http://b/161386391 for -Wno-pointer-to-int-cast
"-Wno-pointer-to-int-cast",
- "-Werror=fortify-source",
+ // SDClang does not support -Werror=fortify-source.
+ // TODO: b/142476859
+ // "-Werror=fortify-source",
}
IllegalFlags = []string{
@@ -143,6 +159,10 @@ var (
ExperimentalCStdVersion = "gnu11"
ExperimentalCppStdVersion = "gnu++2a"
+ SDClang = false
+ SDClangPath = ""
+ ForceSDClangOff = false
+
// prebuilts/clang default settings.
ClangDefaultBase = "prebuilts/clang/host"
ClangDefaultVersion = "clang-r416183b1"
@@ -156,6 +176,7 @@ var (
// Directories with warnings from Android.mk files.
WarningAllowedOldProjects = []string{}
+ QiifaAbiLibraryList = []string{}
)
var pctx = android.NewPackageContext("android/soong/cc/config")
@@ -164,6 +185,16 @@ func init() {
if android.BuildOs == android.Linux {
commonGlobalCflags = append(commonGlobalCflags, "-fdebug-prefix-map=/proc/self/cwd=")
}
+ qiifaBuildConfig := os.Getenv("QIIFA_BUILD_CONFIG")
+ if _, err := os.Stat(qiifaBuildConfig); !os.IsNotExist(err) {
+ data, _ := ioutil.ReadFile(qiifaBuildConfig)
+ var qiifalibs QiifaAbiLibs
+ _ = xml.Unmarshal([]byte(data), &qiifalibs)
+ for i := 0; i < len(qiifalibs.Library); i++ {
+ QiifaAbiLibraryList = append(QiifaAbiLibraryList, qiifalibs.Library[i])
+
+ }
+ }
staticVariableExportedToBazel("CommonGlobalConlyflags", commonGlobalConlyflags)
staticVariableExportedToBazel("DeviceGlobalCppflags", deviceGlobalCppflags)
@@ -238,6 +269,8 @@ func init() {
"frameworks/av/include",
})
+ setSdclangVars()
+
pctx.SourcePathVariable("ClangDefaultBase", ClangDefaultBase)
pctx.VariableFunc("ClangBase", func(ctx android.PackageVarContext) string {
if override := ctx.Config().Getenv("LLVM_PREBUILTS_BASE"); override != "" {
@@ -292,6 +325,149 @@ func init() {
pctx.StaticVariableWithEnvOverride("REAbiLinkerExecStrategy", "RBE_ABI_LINKER_EXEC_STRATEGY", remoteexec.LocalExecStrategy)
}
+func setSdclangVars() {
+ sdclangPath := ""
+ sdclangAEFlag := ""
+ sdclangFlags := ""
+
+ product := os.Getenv("TARGET_BOARD_PLATFORM")
+ aeConfigPath := os.Getenv("SDCLANG_AE_CONFIG")
+ sdclangConfigPath := os.Getenv("SDCLANG_CONFIG")
+ sdclangSA := os.Getenv("SDCLANG_SA_ENABLED")
+
+ type sdclangAEConfig struct {
+ SDCLANG_AE_FLAG string
+ }
+
+ // Load AE config file and set AE flag
+ if file, err := os.Open(aeConfigPath); err == nil {
+ decoder := json.NewDecoder(file)
+ aeConfig := sdclangAEConfig{}
+ if err := decoder.Decode(&aeConfig); err == nil {
+ sdclangAEFlag = aeConfig.SDCLANG_AE_FLAG
+ } else {
+ panic(err)
+ }
+ }
+
+ // Load SD Clang config file and set SD Clang variables
+ var sdclangConfig interface{}
+ if file, err := os.Open(sdclangConfigPath); err == nil {
+ decoder := json.NewDecoder(file)
+ // Parse the config file
+ if err := decoder.Decode(&sdclangConfig); err == nil {
+ config := sdclangConfig.(map[string]interface{})
+ // Retrieve the default block
+ if dev, ok := config["default"]; ok {
+ devConfig := dev.(map[string]interface{})
+ // FORCE_SDCLANG_OFF is required in the default block
+ if _, ok := devConfig["FORCE_SDCLANG_OFF"]; ok {
+ ForceSDClangOff = devConfig["FORCE_SDCLANG_OFF"].(bool)
+ }
+ // SDCLANG is optional in the default block
+ if _, ok := devConfig["SDCLANG"]; ok {
+ SDClang = devConfig["SDCLANG"].(bool)
+ }
+ // SDCLANG_PATH is required in the default block
+ if _, ok := devConfig["SDCLANG_PATH"]; ok {
+ sdclangPath = devConfig["SDCLANG_PATH"].(string)
+ } else {
+ panic("SDCLANG_PATH is required in the default block")
+ }
+ // SDCLANG_FLAGS is optional in the default block
+ if _, ok := devConfig["SDCLANG_FLAGS"]; ok {
+ sdclangFlags = devConfig["SDCLANG_FLAGS"].(string)
+ }
+ } else {
+ panic("Default block is required in the SD Clang config file")
+ }
+ // Retrieve the device specific block if it exists in the config file
+ if dev, ok := config[product]; ok {
+ devConfig := dev.(map[string]interface{})
+ // SDCLANG is optional in the device specific block
+ if _, ok := devConfig["SDCLANG"]; ok {
+ SDClang = devConfig["SDCLANG"].(bool)
+ }
+ // SDCLANG_PATH is optional in the device specific block
+ if _, ok := devConfig["SDCLANG_PATH"]; ok {
+ sdclangPath = devConfig["SDCLANG_PATH"].(string)
+ }
+ // SDCLANG_FLAGS is optional in the device specific block
+ if _, ok := devConfig["SDCLANG_FLAGS"]; ok {
+ sdclangFlags = devConfig["SDCLANG_FLAGS"].(string)
+ }
+ }
+ b, _ := strconv.ParseBool(sdclangSA)
+ if b {
+ llvmsa_loc := "llvmsa"
+ s := []string{sdclangFlags, "--compile-and-analyze", llvmsa_loc}
+ sdclangFlags = strings.Join(s, " ")
+ fmt.Println("Clang SA is enabled: ", sdclangFlags)
+ } else {
+ fmt.Println("Clang SA is not enabled")
+ }
+ } else {
+ panic(err)
+ }
+ } else {
+ fmt.Println(err)
+ }
+
+ // Override SDCLANG if the varialbe is set in the environment
+ if sdclang := os.Getenv("SDCLANG"); sdclang != "" {
+ if override, err := strconv.ParseBool(sdclang); err == nil {
+ SDClang = override
+ }
+ }
+
+ // Sanity check SDCLANG_PATH
+ if envPath := os.Getenv("SDCLANG_PATH"); sdclangPath == "" && envPath == "" {
+ panic("SDCLANG_PATH can not be empty")
+ }
+
+ // Override SDCLANG_PATH if the variable is set in the environment
+ pctx.VariableFunc("SDClangBin", func(ctx android.PackageVarContext) string {
+ if override := ctx.Config().Getenv("SDCLANG_PATH"); override != "" {
+ return override
+ }
+ return sdclangPath
+ })
+
+ // Override SDCLANG_COMMON_FLAGS if the variable is set in the environment
+ pctx.VariableFunc("SDClangFlags", func(ctx android.PackageVarContext) string {
+ if override := ctx.Config().Getenv("SDCLANG_COMMON_FLAGS"); override != "" {
+ return override
+ }
+ return sdclangAEFlag + " " + sdclangFlags
+ })
+
+ SDClangPath = sdclangPath
+ // Find the path to SDLLVM's ASan libraries
+ // TODO (b/117846004): Disable setting SDClangAsanLibDir due to unit test path issues
+ //absPath := sdclangPath
+ //if envPath := android.SdclangEnv["SDCLANG_PATH"]; envPath != "" {
+ // absPath = envPath
+ //}
+ //if !filepath.IsAbs(absPath) {
+ // absPath = path.Join(androidRoot, absPath)
+ //}
+ //
+ //libDirPrefix := "../lib/clang"
+ //libDir, err := ioutil.ReadDir(path.Join(absPath, libDirPrefix))
+ //if err != nil {
+ // libDirPrefix = "../lib64/clang"
+ // libDir, err = ioutil.ReadDir(path.Join(absPath, libDirPrefix))
+ //}
+ //if err != nil {
+ // panic(err)
+ //}
+ //if len(libDir) != 1 || !libDir[0].IsDir() {
+ // panic("Failed to find sanitizer libraries")
+ //}
+ //
+ //pctx.StaticVariable("SDClangAsanLibDir", path.Join(absPath, libDirPrefix, libDir[0].Name(), "lib/linux"))
+}
+
var HostPrebuiltTag = pctx.VariableConfigMethod("HostPrebuiltTag", android.Config.PrebuiltOS)
func envOverrideFunc(envVar, defaultVal string) func(ctx android.PackageVarContext) string {
diff --git a/cc/config/vndk.go b/cc/config/vndk.go
index 2894f897a..31cccf4a2 100644
--- a/cc/config/vndk.go
+++ b/cc/config/vndk.go
@@ -90,4 +90,5 @@ var VndkMustUseVendorVariantList = []string{
"libstagefright_xmlparser",
"libui",
"libxml2",
+ "libmedia_helper",//Remove it from the list once the workaround patch is cleared in S
}
diff --git a/cc/config/x86_linux_host.go b/cc/config/x86_linux_host.go
index 13b55112a..7e306c5cb 100644
--- a/cc/config/x86_linux_host.go
+++ b/cc/config/x86_linux_host.go
@@ -107,6 +107,7 @@ var (
"resolv",
"rt",
"util",
+ "supc++",
}, "-l")
)
diff --git a/cc/genrule.go b/cc/genrule.go
index 82d7205da..2d9dd9458 100644
--- a/cc/genrule.go
+++ b/cc/genrule.go
@@ -67,9 +67,6 @@ func (g *GenruleExtraProperties) CoreVariantNeeded(ctx android.BaseModuleContext
return !(ctx.SocSpecific() || ctx.DeviceSpecific())
}
-func (g *GenruleExtraProperties) RamdiskVariantNeeded(ctx android.BaseModuleContext) bool {
- return Bool(g.Ramdisk_available)
-}
func (g *GenruleExtraProperties) VendorRamdiskVariantNeeded(ctx android.BaseModuleContext) bool {
return Bool(g.Vendor_ramdisk_available)
@@ -91,6 +88,18 @@ func (g *GenruleExtraProperties) RecoveryVariantNeeded(ctx android.BaseModuleCon
}
}
+func (g *GenruleExtraProperties) RamdiskVariantNeeded(ctx android.BaseModuleContext) bool {
+ // If the build is using a snapshot, the ramdisk variant under AOSP directories
+ // is not needed.
+ ramdiskSnapshotVersion := ctx.DeviceConfig().RamdiskSnapshotVersion()
+ if ramdiskSnapshotVersion != "current" && ramdiskSnapshotVersion != "" &&
+ !isRamdiskProprietaryModule(ctx) {
+ return false
+ } else {
+ return Bool(g.Ramdisk_available)
+ }
+}
+
func (g *GenruleExtraProperties) ExtraImageVariations(ctx android.BaseModuleContext) []string {
if ctx.DeviceConfig().VndkVersion() == "" {
return nil
diff --git a/cc/image.go b/cc/image.go
index 47a424bc2..ac155e316 100644
--- a/cc/image.go
+++ b/cc/image.go
@@ -430,6 +430,9 @@ func MutateImage(mctx android.BaseModuleContext, m ImageMutatableModule) {
recoverySnapshotVersion := mctx.DeviceConfig().RecoverySnapshotVersion()
usingRecoverySnapshot := recoverySnapshotVersion != "current" &&
recoverySnapshotVersion != ""
+ ramdiskSnapshotVersion := mctx.DeviceConfig().RamdiskSnapshotVersion()
+ usingRamdiskSnapshot := ramdiskSnapshotVersion != "current" &&
+ ramdiskSnapshotVersion != ""
needVndkVersionVendorVariantForLlndk := false
if boardVndkVersion != "" {
boardVndkApiLevel, err := android.ApiLevelFromUser(mctx, boardVndkVersion)
@@ -484,6 +487,8 @@ func MutateImage(mctx android.BaseModuleContext, m ImageMutatableModule) {
// PRODUCT_EXTRA_VNDK_VERSIONS.
if m.InstallInRecovery() {
recoveryVariantNeeded = true
+ } else if m.InstallInRamdisk() {
+ ramdiskVariantNeeded = true
} else {
vendorVariants = append(vendorVariants, m.SnapshotVersion(mctx))
}
@@ -579,13 +584,20 @@ func MutateImage(mctx android.BaseModuleContext, m ImageMutatableModule) {
// If using a snapshot, the recovery variant under AOSP directories is not needed,
// except for kernel headers, which needs all variants.
- if m.KernelHeadersDecorator() &&
+ if !m.KernelHeadersDecorator() &&
!m.IsSnapshotPrebuilt() &&
usingRecoverySnapshot &&
!isRecoveryProprietaryModule(mctx) {
recoveryVariantNeeded = false
}
+ if !m.KernelHeadersDecorator() &&
+ !m.IsSnapshotPrebuilt() &&
+ usingRamdiskSnapshot &&
+ !isRamdiskProprietaryModule(mctx) {
+ ramdiskVariantNeeded = false
+ }
+
for _, variant := range android.FirstUniqueStrings(vendorVariants) {
m.AppendExtraVariant(VendorVariationPrefix + variant)
}
@@ -671,6 +683,19 @@ func squashRecoverySrcs(m *Module) {
}
}
+func squashRamdiskSrcs(m *Module) {
+ if lib, ok := m.compiler.(*libraryDecorator); ok {
+ lib.baseCompiler.Properties.Srcs = append(lib.baseCompiler.Properties.Srcs,
+ lib.baseCompiler.Properties.Target.Ramdisk.Srcs...)
+
+ lib.baseCompiler.Properties.Exclude_srcs = append(lib.baseCompiler.Properties.Exclude_srcs,
+ lib.baseCompiler.Properties.Target.Ramdisk.Exclude_srcs...)
+
+ lib.baseCompiler.Properties.Exclude_generated_sources = append(lib.baseCompiler.Properties.Exclude_generated_sources,
+ lib.baseCompiler.Properties.Target.Ramdisk.Exclude_generated_sources...)
+ }
+}
+
func squashVendorRamdiskSrcs(m *Module) {
if lib, ok := m.compiler.(*libraryDecorator); ok {
lib.baseCompiler.Properties.Exclude_srcs = append(lib.baseCompiler.Properties.Exclude_srcs, lib.baseCompiler.Properties.Target.Vendor_ramdisk.Exclude_srcs...)
@@ -681,6 +706,7 @@ func (c *Module) SetImageVariation(ctx android.BaseModuleContext, variant string
m := module.(*Module)
if variant == android.RamdiskVariation {
m.MakeAsPlatform()
+ squashRamdiskSrcs(m)
} else if variant == android.VendorRamdiskVariation {
m.MakeAsPlatform()
squashVendorRamdiskSrcs(m)
diff --git a/cc/library.go b/cc/library.go
index 1ba359758..1edd9f7af 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -522,6 +522,7 @@ type libraryDecorator struct {
*baseInstaller
collectedSnapshotHeaders android.Paths
+ isQiifaLibrary bool
}
type staticLibraryBazelHandler struct {
@@ -798,6 +799,17 @@ func (library *libraryDecorator) compilerFlags(ctx ModuleContext, flags Flags, d
return flags
}
+func loadQiifaLibraryMetadata(library *libraryDecorator,ctx android.BaseModuleContext){
+ m := ctx.Module().(*Module)
+ libName := m.BaseModuleName()
+ for i := 0; i < len(config.QiifaAbiLibraryList); i++ {
+ if(config.QiifaAbiLibraryList[i] == libName ){
+ library.isQiifaLibrary = true
+ break
+ }
+ }
+}
+
func (library *libraryDecorator) headerAbiCheckerEnabled() bool {
return Bool(library.Properties.Header_abi_checker.Enabled)
}
@@ -911,6 +923,8 @@ type libraryInterface interface {
androidMkWriteAdditionalDependenciesForSourceAbiDiff(w io.Writer)
availableFor(string) bool
+ isLibraryQiifaEnabled() bool
+ loadQiifaMetadata(ctx android.BaseModuleContext)
}
type versionedInterface interface {
@@ -1417,7 +1431,7 @@ func (library *libraryDecorator) linkSAbiDumpFiles(ctx ModuleContext, objs Objec
addLsdumpPath(classifySourceAbiDump(ctx) + ":" + library.sAbiOutputFile.String())
refAbiDumpFile := getRefAbiDumpFile(ctx, vndkVersion, fileName)
- if refAbiDumpFile != nil {
+ if refAbiDumpFile != nil && !library.isQiifaLibrary {
library.sAbiDiff = sourceAbiDiff(ctx, library.sAbiOutputFile.Path(),
refAbiDumpFile, fileName, exportedHeaderFlags,
Bool(library.Properties.Header_abi_checker.Check_all_apis),
@@ -1610,6 +1624,14 @@ func (library *libraryDecorator) toc() android.OptionalPath {
return library.tocFile
}
+func (library *libraryDecorator) isLibraryQiifaEnabled() bool {
+ return library.isQiifaLibrary
+}
+
+func (library *libraryDecorator) loadQiifaMetadata(ctx android.BaseModuleContext) {
+ loadQiifaLibraryMetadata(library,ctx)
+}
+
func (library *libraryDecorator) installSymlinkToRuntimeApex(ctx ModuleContext, file android.Path) {
dir := library.baseInstaller.installDir(ctx)
dirOnDevice := android.InstallPathToOnDevicePath(ctx, dir)
diff --git a/cc/linkable.go b/cc/linkable.go
index b583b69e7..2f3632e1f 100644
--- a/cc/linkable.go
+++ b/cc/linkable.go
@@ -85,15 +85,24 @@ type Snapshottable interface {
// ExcludeFromRecoverySnapshot returns true if this module should be otherwise excluded from the recovery snapshot.
ExcludeFromRecoverySnapshot() bool
+ // ExcludeFromRamdiskSnapshot returns true if this module should be otherwise excluded from the ramdisk snapshot.
+ ExcludeFromRamdiskSnapshot() bool
+
// SnapshotLibrary returns true if this module is a snapshot library.
IsSnapshotLibrary() bool
+ // EffectiveLicenseFiles returns the list of License files for this module.
+ EffectiveLicenseFiles() android.Paths
+
// SnapshotRuntimeLibs returns a list of libraries needed by this module at runtime but which aren't build dependencies.
SnapshotRuntimeLibs() []string
// SnapshotSharedLibs returns the list of shared library dependencies for this module.
SnapshotSharedLibs() []string
+ // SnapshotStaticLibs returns the list of static library dependencies for this module.
+ SnapshotStaticLibs() []string
+
// IsSnapshotPrebuilt returns true if this module is a snapshot prebuilt.
IsSnapshotPrebuilt() bool
}
@@ -124,6 +133,7 @@ type LinkableInterface interface {
IsPrebuilt() bool
Toc() android.OptionalPath
+ Device() bool
Host() bool
InRamdisk() bool
@@ -223,6 +233,9 @@ type LinkableInterface interface {
// Header returns true if this is a library headers module.
Header() bool
+ // StaticExecutable returns true if this is a binary module with "static_executable: true".
+ StaticExecutable() bool
+
// EverInstallable returns true if the module is ever installable
EverInstallable() bool
diff --git a/cc/linker.go b/cc/linker.go
index 449b9ad96..a62e24f74 100644
--- a/cc/linker.go
+++ b/cc/linker.go
@@ -145,7 +145,11 @@ type BaseLinkerProperties struct {
Exclude_header_libs []string
}
Ramdisk struct {
- // list of static libs that only should be used to build the recovery
+ // list of shared libs that only should be used to build the ramdisk
+ // variant of the C/C++ module.
+ Shared_libs []string
+
+ // list of static libs that only should be used to build the ramdisk
// variant of the C/C++ module.
Static_libs []string
@@ -156,10 +160,14 @@ type BaseLinkerProperties struct {
// list of static libs that should not be used to build
// the ramdisk variant of the C/C++ module.
Exclude_static_libs []string
+
+ // list of header libs that should not be used to build the ramdisk variant
+ // of the C/C++ module.
+ Exclude_header_libs []string
}
Vendor_ramdisk struct {
// list of shared libs that should not be used to build
- // the recovery variant of the C/C++ module.
+ // the vendor ramdisk variant of the C/C++ module.
Exclude_shared_libs []string
// list of static libs that should not be used to build
@@ -299,10 +307,13 @@ func (linker *baseLinker) linkerDeps(ctx DepsContext, deps Deps) Deps {
}
if ctx.inRamdisk() {
+ deps.SharedLibs = append(deps.SharedLibs, linker.Properties.Target.Ramdisk.Shared_libs...)
deps.SharedLibs = removeListFromList(deps.SharedLibs, linker.Properties.Target.Ramdisk.Exclude_shared_libs)
deps.ReexportSharedLibHeaders = removeListFromList(deps.ReexportSharedLibHeaders, linker.Properties.Target.Ramdisk.Exclude_shared_libs)
deps.StaticLibs = append(deps.StaticLibs, linker.Properties.Target.Ramdisk.Static_libs...)
deps.StaticLibs = removeListFromList(deps.StaticLibs, linker.Properties.Target.Ramdisk.Exclude_static_libs)
+ deps.HeaderLibs = removeListFromList(deps.HeaderLibs, linker.Properties.Target.Ramdisk.Exclude_header_libs)
+ deps.ReexportStaticLibHeaders = removeListFromList(deps.ReexportStaticLibHeaders, linker.Properties.Target.Ramdisk.Exclude_static_libs)
deps.ReexportStaticLibHeaders = removeListFromList(deps.ReexportStaticLibHeaders, linker.Properties.Target.Ramdisk.Exclude_static_libs)
deps.WholeStaticLibs = removeListFromList(deps.WholeStaticLibs, linker.Properties.Target.Ramdisk.Exclude_static_libs)
}
diff --git a/cc/lto.go b/cc/lto.go
index a3b28d9a2..94ed32415 100644
--- a/cc/lto.go
+++ b/cc/lto.go
@@ -16,6 +16,8 @@ package cc
import (
"android/soong/android"
+ "android/soong/cc/config"
+ "strings"
)
// LTO (link-time optimization) allows the compiler to optimize and generate
@@ -101,7 +103,13 @@ func (lto *lto) flags(ctx BaseModuleContext, flags Flags) Flags {
if lto.LTO() {
var ltoFlag string
if lto.ThinLTO() {
- ltoFlag = "-flto=thin -fsplit-lto-unit"
+ // TODO(b/129607781) sdclang does not currently support
+ // the "-fsplit-lto-unit" option
+ if flags.Sdclang && !strings.Contains(config.SDClangPath, "9.0") {
+ ltoFlag = "-flto=thin"
+ } else {
+ ltoFlag = "-flto=thin -fsplit-lto-unit"
+ }
} else {
ltoFlag = "-flto"
}
diff --git a/cc/makevars.go b/cc/makevars.go
index da5f1fde2..6b65c7645 100644
--- a/cc/makevars.go
+++ b/cc/makevars.go
@@ -17,6 +17,7 @@ package cc
import (
"fmt"
"sort"
+ "strconv"
"strings"
"sync"
@@ -71,6 +72,8 @@ func (c *notOnHostContext) Host() bool {
}
func makeVarsProvider(ctx android.MakeVarsContext) {
+ sdclangMakeVars(ctx)
+
ctx.Strict("LLVM_RELEASE_VERSION", "${config.ClangShortVersion}")
ctx.Strict("LLVM_PREBUILTS_VERSION", "${config.ClangVersion}")
ctx.Strict("LLVM_PREBUILTS_BASE", "${config.ClangBase}")
@@ -98,6 +101,7 @@ func makeVarsProvider(ctx android.MakeVarsContext) {
ctx.Strict("BOARD_VNDK_VERSION", ctx.DeviceConfig().VndkVersion())
ctx.Strict("RECOVERY_SNAPSHOT_VERSION", ctx.DeviceConfig().RecoverySnapshotVersion())
+ ctx.Strict("RAMDISK_SNAPSHOT_VERSION", ctx.DeviceConfig().RamdiskSnapshotVersion())
// Filter vendor_public_library that are exported to make
exportedVendorPublicLibraries := []string{}
@@ -178,6 +182,17 @@ func makeVarsProvider(ctx android.MakeVarsContext) {
}
}
+func sdclangMakeVars(ctx android.MakeVarsContext) {
+ if config.ForceSDClangOff {
+ ctx.Strict("FORCE_SDCLANG_OFF", strconv.FormatBool(config.ForceSDClangOff))
+ }
+ if config.SDClang {
+ ctx.Strict("SDCLANG", strconv.FormatBool(config.SDClang))
+ }
+ ctx.Strict("SDCLANG_PATH", "${config.SDClangBin}")
+ ctx.Strict("SDCLANG_COMMON_FLAGS", "${config.SDClangFlags}")
+}
+
func makeVarsToolchain(ctx android.MakeVarsContext, secondPrefix string,
target android.Target) {
var typePrefix string
@@ -278,10 +293,17 @@ func makeVarsToolchain(ctx android.MakeVarsContext, secondPrefix string,
ctx.Strict(makePrefix+"OTOOL", "${config.MacToolPath}/otool")
ctx.Strict(makePrefix+"STRIP", "${config.MacStripPath}")
} else {
- ctx.Strict(makePrefix+"AR", "${config.ClangBin}/llvm-ar")
- ctx.Strict(makePrefix+"READELF", "${config.ClangBin}/llvm-readelf")
- ctx.Strict(makePrefix+"NM", "${config.ClangBin}/llvm-nm")
- ctx.Strict(makePrefix+"STRIP", "${config.ClangBin}/llvm-strip")
+ if config.SDClang {
+ ctx.Strict(makePrefix+"AR", "${config.SDClangBin}/llvm-ar")
+ ctx.Strict(makePrefix+"READELF", "${config.SDClangBin}/llvm-readelf")
+ ctx.Strict(makePrefix+"NM", "${config.SDClangBin}/llvm-nm")
+ ctx.Strict(makePrefix+"STRIP", "${config.SDClangBin}/llvm-strip")
+ } else {
+ ctx.Strict(makePrefix+"AR", "${config.ClangBin}/llvm-ar")
+ ctx.Strict(makePrefix+"READELF", "${config.ClangBin}/llvm-readelf")
+ ctx.Strict(makePrefix+"NM", "${config.ClangBin}/llvm-nm")
+ ctx.Strict(makePrefix+"STRIP", "${config.ClangBin}/llvm-strip")
+ }
}
if target.Os.Class == android.Device {
diff --git a/cc/sabi.go b/cc/sabi.go
index 1f331cb3d..5376c511a 100644
--- a/cc/sabi.go
+++ b/cc/sabi.go
@@ -16,7 +16,6 @@ package cc
import (
"sync"
-
"android/soong/android"
"android/soong/cc/config"
)
@@ -180,8 +179,15 @@ func shouldCreateSourceAbiDumpForLibrary(ctx android.BaseModuleContext) bool {
// Mark the direct and transitive dependencies of libraries that need ABI check, so that ABI dumps
// of their dependencies would be generated.
func sabiDepsMutator(mctx android.TopDownMutatorContext) {
+ isQiifaLibrary := false
+ if m, ok := mctx.Module().(*Module); ok && m.library != nil {
+ m.library.loadQiifaMetadata(mctx)
+ if (m.library.isLibraryQiifaEnabled()){
+ isQiifaLibrary = true
+ }
+ }
// Escape hatch to not check any ABI dump.
- if mctx.Config().IsEnvTrue("SKIP_ABI_CHECKS") {
+ if mctx.Config().IsEnvTrue("SKIP_ABI_CHECKS") && !isQiifaLibrary {
return
}
// Only create ABI dump for native shared libraries and their static library dependencies.
diff --git a/cc/sanitize.go b/cc/sanitize.go
index 941a955e5..ec5ecff00 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -390,6 +390,35 @@ func (sanitize *sanitize) begin(ctx BaseModuleContext) {
}
}
+ if s.Integer_overflow == nil && ctx.Config().IntegerOverflowEnabledForPath(ctx.ModuleDir()) && ctx.Arch().ArchType == android.Arm64 {
+ s.Integer_overflow = boolPtr(true)
+ }
+
+ if ctx.Config().BoundSanitizerEnabledForPath(ctx.ModuleDir()) && ctx.Arch().ArchType == android.Arm64 {
+ s.Misc_undefined = append(s.Misc_undefined, "bounds")
+ }
+
+ if ctx.Config().BoundSanitizerDisabledForPath(ctx.ModuleDir()) && ctx.Arch().ArchType == android.Arm64 {
+ indx := indexList("bounds", s.Misc_undefined)
+ if (indexList("bounds", s.Misc_undefined) != -1) {
+ s.Misc_undefined = append(s.Misc_undefined[0:indx], s.Misc_undefined[indx+1:]...)
+ }
+ }
+
+ // Disable integer-overflow in exclude path
+ if ctx.Config().IntegerOverflowDisabledForPath(ctx.ModuleDir()) && ctx.Arch().ArchType == android.Arm64 {
+ indx := indexList("signed-integer-overflow", s.Misc_undefined)
+ if (indexList("signed-integer-overflow", s.Misc_undefined) != -1) {
+ s.Misc_undefined = append(s.Misc_undefined[0:indx], s.Misc_undefined[indx+1:]...)
+ }
+
+ indx = indexList("unsigned-integer-overflow", s.Misc_undefined)
+ if (indexList("unsigned-integer-overflow", s.Misc_undefined) != -1) {
+ s.Misc_undefined = append(s.Misc_undefined[0:indx], s.Misc_undefined[indx+1:]...)
+ }
+ s.Integer_overflow = nil
+ }
+
// Enable CFI for all components in the include paths (for Aarch64 only)
if s.Cfi == nil && ctx.Config().CFIEnabledForPath(ctx.ModuleDir()) && ctx.Arch().ArchType == android.Arm64 {
s.Cfi = boolPtr(true)
@@ -397,6 +426,13 @@ func (sanitize *sanitize) begin(ctx BaseModuleContext) {
s.Diag.Cfi = boolPtr(true)
}
}
+ // Disable CFI for all component in the exclude path (for Aarch64 only)
+ if ctx.Config().CFIDisabledForPath(ctx.ModuleDir()) && ctx.Arch().ArchType == android.Arm64 {
+ s.Cfi = nil
+ if inList("cfi", ctx.Config().SanitizeDeviceDiag()) {
+ s.Diag.Cfi = nil
+ }
+ }
// Is CFI actually enabled?
if !ctx.Config().EnableCFI() {
diff --git a/cc/snapshot_prebuilt.go b/cc/snapshot_prebuilt.go
index a7351a9ef..e52d74881 100644
--- a/cc/snapshot_prebuilt.go
+++ b/cc/snapshot_prebuilt.go
@@ -13,7 +13,7 @@
// limitations under the License.
package cc
-// This file defines snapshot prebuilt modules, e.g. vendor snapshot and recovery snapshot. Such
+// This file defines snapshot prebuilt modules, e.g. vendor snapshot , ramdisk snapshot and recovery snapshot. Such
// snapshot modules will override original source modules with setting BOARD_VNDK_VERSION, with
// snapshot mutators and snapshot information maps which are also defined in this file.
@@ -82,6 +82,7 @@ type snapshotImage interface {
type vendorSnapshotImage struct{}
type recoverySnapshotImage struct{}
+type ramdiskSnapshotImage struct{}
type directoryMap map[string]bool
@@ -93,6 +94,8 @@ var (
"hardware": true,
"kernel": true,
"vendor": true,
+ // QC specific directories to be ignored
+ "disregard": true,
}
// Modules under following directories are included as they are in AOSP,
@@ -254,12 +257,79 @@ func (recoverySnapshotImage) moduleNameSuffix() string {
return recoverySuffix
}
+func (ramdiskSnapshotImage) init(ctx android.RegistrationContext) {
+ ctx.RegisterSingletonType("ramdisk-snapshot", RamdiskSnapshotSingleton)
+ ctx.RegisterModuleType("ramdisk_snapshot", ramdiskSnapshotFactory)
+ ctx.RegisterModuleType("ramdisk_snapshot_shared", RamdiskSnapshotSharedFactory)
+ ctx.RegisterModuleType("ramdisk_snapshot_static", RamdiskSnapshotStaticFactory)
+ ctx.RegisterModuleType("ramdisk_snapshot_header", RamdiskSnapshotHeaderFactory)
+ ctx.RegisterModuleType("ramdisk_snapshot_binary", RamdiskSnapshotBinaryFactory)
+ ctx.RegisterModuleType("ramdisk_snapshot_object", RamdiskSnapshotObjectFactory)
+}
+
+func (ramdiskSnapshotImage) shouldGenerateSnapshot(ctx android.SingletonContext) bool {
+ // RAMDISK_SNAPSHOT_VERSION must be set to 'current' in order to generate a
+ // snapshot.
+ return ctx.DeviceConfig().RamdiskSnapshotVersion() == "current"
+}
+
+func (ramdiskSnapshotImage) inImage(m LinkableInterface) func() bool {
+ return m.InRamdisk
+}
+
+// ramdisk snapshot does not have private libraries.
+func (ramdiskSnapshotImage) private(m LinkableInterface) bool {
+ return false
+}
+
+func (ramdiskSnapshotImage) isProprietaryPath(dir string, deviceConfig android.DeviceConfig) bool {
+ return isDirectoryExcluded(dir, deviceConfig.RamdiskSnapshotDirsExcludedMap(), deviceConfig.RamdiskSnapshotDirsIncludedMap())
+}
+
+// ramdisk snapshot does NOT treat vndk specially.
+func (ramdiskSnapshotImage) includeVndk() bool {
+ return false
+}
+
+func (ramdiskSnapshotImage) excludeFromSnapshot(m LinkableInterface) bool {
+ return m.ExcludeFromRamdiskSnapshot()
+}
+
+func (ramdiskSnapshotImage) isUsingSnapshot(cfg android.DeviceConfig) bool {
+ ramdiskSnapshotVersion := cfg.RamdiskSnapshotVersion()
+ return ramdiskSnapshotVersion != "current" && ramdiskSnapshotVersion != ""
+}
+
+func (ramdiskSnapshotImage) targetSnapshotVersion(cfg android.DeviceConfig) string {
+ return cfg.RamdiskSnapshotVersion()
+}
+
+func (ramdiskSnapshotImage) excludeFromDirectedSnapshot(cfg android.DeviceConfig, name string) bool {
+ // If we're using full snapshot, not directed snapshot, capture every module
+ if !cfg.DirectedRamdiskSnapshot() {
+ return false
+ }
+ // Else, checks if name is in RAMDSIK_SNAPSHOT_MODULES.
+ return !cfg.RamdiskSnapshotModules()[name]
+}
+
+func (ramdiskSnapshotImage) imageVariantName(cfg android.DeviceConfig) string {
+ return android.RamdiskVariation
+}
+
+func (ramdiskSnapshotImage) moduleNameSuffix() string {
+ return ramdiskSuffix
+}
+
var vendorSnapshotImageSingleton vendorSnapshotImage
var recoverySnapshotImageSingleton recoverySnapshotImage
+var ramdiskSnapshotImageSingleton ramdiskSnapshotImage
func init() {
vendorSnapshotImageSingleton.init(android.InitRegistrationContext)
recoverySnapshotImageSingleton.init(android.InitRegistrationContext)
+ ramdiskSnapshotImageSingleton.init(android.InitRegistrationContext)
+ android.RegisterMakeVarsProvider(pctx, snapshotMakeVarsProvider)
}
const (
@@ -375,6 +445,24 @@ var SnapshotInfoProvider = blueprint.NewMutatorProvider(SnapshotInfo{}, "deps")
var _ android.ImageInterface = (*snapshot)(nil)
+func snapshotMakeVarsProvider(ctx android.MakeVarsContext) {
+ snapshotSet := map[string]struct{}{}
+ ctx.VisitAllModules(func(m android.Module) {
+ if s, ok := m.(*snapshot); ok {
+ if _, ok := snapshotSet[s.Name()]; ok {
+ // arch variant generates duplicated modules
+ // skip this as we only need to know the path of the module.
+ return
+ }
+ snapshotSet[s.Name()] = struct{}{}
+ imageNameVersion := strings.Split(s.image.imageVariantName(ctx.DeviceConfig()), ".")
+ ctx.Strict(
+ strings.Join([]string{strings.ToUpper(imageNameVersion[0]), s.baseSnapshot.version(), "SNAPSHOT_DIR"}, "_"),
+ ctx.ModuleDir(s))
+ }
+ })
+}
+
func vendorSnapshotFactory() android.Module {
return snapshotFactory(vendorSnapshotImageSingleton)
}
@@ -383,6 +471,10 @@ func recoverySnapshotFactory() android.Module {
return snapshotFactory(recoverySnapshotImageSingleton)
}
+func ramdiskSnapshotFactory() android.Module {
+ return snapshotFactory(ramdiskSnapshotImageSingleton)
+}
+
func snapshotFactory(image snapshotImage) android.Module {
snapshot := &snapshot{}
snapshot.image = image
@@ -453,30 +545,49 @@ func (p *baseSnapshotDecorator) snapshotAndroidMkSuffix() string {
return p.baseProperties.Androidmk_suffix
}
-func (p *baseSnapshotDecorator) setSnapshotAndroidMkSuffix(ctx android.ModuleContext) {
- coreVariations := append(ctx.Target().Variations(), blueprint.Variation{
+func (p *baseSnapshotDecorator) setSnapshotAndroidMkSuffix(ctx android.ModuleContext, variant string) {
+ // If there are any 2 or more variations among {core, product, vendor, recovery}
+ // we have to add the androidmk suffix to avoid duplicate modules with the same
+ // name.
+ variations := append(ctx.Target().Variations(), blueprint.Variation{
Mutator: "image",
Variation: android.CoreVariation})
- if ctx.OtherModuleFarDependencyVariantExists(coreVariations, ctx.Module().(*Module).BaseModuleName()) {
+ if ctx.OtherModuleFarDependencyVariantExists(variations, ctx.Module().(*Module).BaseModuleName()) {
p.baseProperties.Androidmk_suffix = p.image.moduleNameSuffix()
return
}
- // If there is no matching core variation, there could still be a
- // product variation, for example if a module is product specific and
- // vendor available. In that case, we also want to add the androidmk
- // suffix.
-
- productVariations := append(ctx.Target().Variations(), blueprint.Variation{
+ variations = append(ctx.Target().Variations(), blueprint.Variation{
Mutator: "image",
Variation: ProductVariationPrefix + ctx.DeviceConfig().PlatformVndkVersion()})
- if ctx.OtherModuleFarDependencyVariantExists(productVariations, ctx.Module().(*Module).BaseModuleName()) {
+ if ctx.OtherModuleFarDependencyVariantExists(variations, ctx.Module().(*Module).BaseModuleName()) {
p.baseProperties.Androidmk_suffix = p.image.moduleNameSuffix()
return
}
+ images := []snapshotImage{vendorSnapshotImageSingleton, recoverySnapshotImageSingleton, ramdiskSnapshotImageSingleton}
+
+ for _, image := range images {
+ if p.image == image {
+ continue
+ }
+ variations = append(ctx.Target().Variations(), blueprint.Variation{
+ Mutator: "image",
+ Variation: image.imageVariantName(ctx.DeviceConfig())})
+
+ if ctx.OtherModuleFarDependencyVariantExists(variations,
+ ctx.Module().(*Module).BaseModuleName()+
+ getSnapshotNameSuffix(
+ image.moduleNameSuffix()+variant,
+ p.version(),
+ ctx.DeviceConfig().Arches()[0].ArchType.String())) {
+ p.baseProperties.Androidmk_suffix = p.image.moduleNameSuffix()
+ return
+ }
+ }
+
p.baseProperties.Androidmk_suffix = ""
}
@@ -566,7 +677,16 @@ func (p *snapshotLibraryDecorator) matchesWithDevice(config android.DeviceConfig
// As snapshots are prebuilts, this just returns the prebuilt binary after doing things which are
// done by normal library decorator, e.g. exporting flags.
func (p *snapshotLibraryDecorator) link(ctx ModuleContext, flags Flags, deps PathDeps, objs Objects) android.Path {
- p.setSnapshotAndroidMkSuffix(ctx)
+ var variant string
+ if p.shared() {
+ variant = snapshotSharedSuffix
+ } else if p.static() {
+ variant = snapshotStaticSuffix
+ } else {
+ variant = snapshotHeaderSuffix
+ }
+
+ p.setSnapshotAndroidMkSuffix(ctx, variant)
if p.header() {
return p.libraryDecorator.link(ctx, flags, deps, objs)
@@ -711,6 +831,16 @@ func RecoverySnapshotSharedFactory() android.Module {
return module.Init()
}
+// ramdisk_snapshot_shared is a special prebuilt shared library which is auto-generated by
+// development/vendor_snapshot/update.py. As a part of ramdisk snapshot, ramdisk_snapshot_shared
+// overrides the ramdisk variant of the cc shared library with the same name, if BOARD_VNDK_VERSION
+// is set.
+func RamdiskSnapshotSharedFactory() android.Module {
+ module, prebuilt := snapshotLibraryFactory(ramdiskSnapshotImageSingleton, snapshotSharedSuffix)
+ prebuilt.libraryDecorator.BuildOnlyShared()
+ return module.Init()
+}
+
// vendor_snapshot_static is a special prebuilt static library which is auto-generated by
// development/vendor_snapshot/update.py. As a part of vendor snapshot, vendor_snapshot_static
// overrides the vendor variant of the cc static library with the same name, if BOARD_VNDK_VERSION
@@ -731,6 +861,16 @@ func RecoverySnapshotStaticFactory() android.Module {
return module.Init()
}
+// ramdisk_snapshot_static is a special prebuilt static library which is auto-generated by
+// development/vendor_snapshot/update.py. As a part of ramdisk snapshot, ramdisk_snapshot_static
+// overrides the ramdisk variant of the cc static library with the same name, if BOARD_VNDK_VERSION
+// is set.
+func RamdiskSnapshotStaticFactory() android.Module {
+ module, prebuilt := snapshotLibraryFactory(ramdiskSnapshotImageSingleton, snapshotStaticSuffix)
+ prebuilt.libraryDecorator.BuildOnlyStatic()
+ return module.Init()
+}
+
// vendor_snapshot_header is a special header library which is auto-generated by
// development/vendor_snapshot/update.py. As a part of vendor snapshot, vendor_snapshot_header
// overrides the vendor variant of the cc header library with the same name, if BOARD_VNDK_VERSION
@@ -751,6 +891,16 @@ func RecoverySnapshotHeaderFactory() android.Module {
return module.Init()
}
+// ramdisk_snapshot_header is a special header library which is auto-generated by
+// development/vendor_snapshot/update.py. As a part of ramdisk snapshot, ramdisk_snapshot_header
+// overrides the ramdisk variant of the cc header library with the same name, if BOARD_VNDK_VERSION
+// is set.
+func RamdiskSnapshotHeaderFactory() android.Module {
+ module, prebuilt := snapshotLibraryFactory(ramdiskSnapshotImageSingleton, snapshotHeaderSuffix)
+ prebuilt.libraryDecorator.HeaderOnly()
+ return module.Init()
+}
+
var _ snapshotSanitizer = (*snapshotLibraryDecorator)(nil)
//
@@ -784,7 +934,7 @@ func (p *snapshotBinaryDecorator) matchesWithDevice(config android.DeviceConfig)
// cc modules' link functions are to link compiled objects into final binaries.
// As snapshots are prebuilts, this just returns the prebuilt binary
func (p *snapshotBinaryDecorator) link(ctx ModuleContext, flags Flags, deps PathDeps, objs Objects) android.Path {
- p.setSnapshotAndroidMkSuffix(ctx)
+ p.setSnapshotAndroidMkSuffix(ctx, snapshotBinarySuffix)
if !p.matchesWithDevice(ctx.DeviceConfig()) {
return nil
@@ -824,6 +974,13 @@ func RecoverySnapshotBinaryFactory() android.Module {
return snapshotBinaryFactory(recoverySnapshotImageSingleton, snapshotBinarySuffix)
}
+// ramdisk_snapshot_binary is a special prebuilt executable binary which is auto-generated by
+// development/vendor_snapshot/update.py. As a part of ramdisk snapshot, ramdisk_snapshot_binary
+// overrides the ramdisk variant of the cc binary with the same name, if BOARD_VNDK_VERSION is set.
+func RamdiskSnapshotBinaryFactory() android.Module {
+ return snapshotBinaryFactory(ramdiskSnapshotImageSingleton, snapshotBinarySuffix)
+}
+
func snapshotBinaryFactory(image snapshotImage, moduleSuffix string) android.Module {
module, binary := NewBinary(android.DeviceSupported)
binary.baseLinker.Properties.No_libcrt = BoolPtr(true)
@@ -879,7 +1036,7 @@ func (p *snapshotObjectLinker) matchesWithDevice(config android.DeviceConfig) bo
// cc modules' link functions are to link compiled objects into final binaries.
// As snapshots are prebuilts, this just returns the prebuilt binary
func (p *snapshotObjectLinker) link(ctx ModuleContext, flags Flags, deps PathDeps, objs Objects) android.Path {
- p.setSnapshotAndroidMkSuffix(ctx)
+ p.setSnapshotAndroidMkSuffix(ctx, snapshotObjectSuffix)
if !p.matchesWithDevice(ctx.DeviceConfig()) {
return nil
@@ -928,6 +1085,24 @@ func RecoverySnapshotObjectFactory() android.Module {
return module.Init()
}
+// ramdisk_snapshot_object is a special prebuilt compiled object file which is auto-generated by
+// development/vendor_snapshot/update.py. As a part of ramdisk snapshot, ramdisk_snapshot_object
+// overrides the ramdisk variant of the cc object with the same name, if BOARD_VNDK_VERSION is set.
+func RamdiskSnapshotObjectFactory() android.Module {
+ module := newObject()
+
+ prebuilt := &snapshotObjectLinker{
+ objectLinker: objectLinker{
+ baseLinker: NewBaseLinker(nil),
+ },
+ }
+ module.linker = prebuilt
+
+ prebuilt.init(module, ramdiskSnapshotImageSingleton, snapshotObjectSuffix)
+ module.AddProperties(&prebuilt.properties)
+ return module.Init()
+}
+
type snapshotInterface interface {
matchesWithDevice(config android.DeviceConfig) bool
isSnapshotPrebuilt() bool
diff --git a/cc/snapshot_utils.go b/cc/snapshot_utils.go
index 8eb616448..a17f11496 100644
--- a/cc/snapshot_utils.go
+++ b/cc/snapshot_utils.go
@@ -53,6 +53,10 @@ func (m *Module) SnapshotSharedLibs() []string {
return m.Properties.SnapshotSharedLibs
}
+func (m *Module) SnapshotStaticLibs() []string {
+ return m.Properties.SnapshotStaticLibs
+}
+
// snapshotLibraryInterface is an interface for libraries captured to VNDK / vendor snapshots.
type snapshotLibraryInterface interface {
libraryInterface
@@ -102,14 +106,16 @@ func (s *snapshotMap) get(name string, arch android.ArchType) (snapshot string,
// If it's true, collectHeadersForSnapshot will be called in GenerateAndroidBuildActions.
func ShouldCollectHeadersForSnapshot(ctx android.ModuleContext, m LinkableInterface, apexInfo android.ApexInfo) bool {
if ctx.DeviceConfig().VndkVersion() != "current" &&
- ctx.DeviceConfig().RecoverySnapshotVersion() != "current" {
+ ctx.DeviceConfig().RecoverySnapshotVersion() != "current" &&
+ ctx.DeviceConfig().RamdiskSnapshotVersion() != "current" {
return false
}
if _, ok := isVndkSnapshotAware(ctx.DeviceConfig(), m, apexInfo); ok {
return ctx.Config().VndkSnapshotBuildArtifacts()
}
- for _, image := range []snapshotImage{vendorSnapshotImageSingleton, recoverySnapshotImageSingleton} {
+ for _, image := range []snapshotImage{vendorSnapshotImageSingleton, recoverySnapshotImageSingleton,
+ ramdiskSnapshotImageSingleton} {
if isSnapshotAware(ctx.DeviceConfig(), m, image.isProprietaryPath(ctx.ModuleDir(), ctx.DeviceConfig()), apexInfo, image) {
return true
}
diff --git a/cc/testing.go b/cc/testing.go
index 15f7ebb0d..dec3caca9 100644
--- a/cc/testing.go
+++ b/cc/testing.go
@@ -67,6 +67,7 @@ func commonDefaultModules() string {
vendor_ramdisk_available: true,
product_available: true,
recovery_available: true,
+ ramdisk_available: true,
src: "",
}
@@ -76,6 +77,7 @@ func commonDefaultModules() string {
vendor_ramdisk_available: true,
product_available: true,
recovery_available: true,
+ ramdisk_available: true,
native_bridge_supported: true,
src: "",
}
@@ -86,6 +88,7 @@ func commonDefaultModules() string {
vendor_ramdisk_available: true,
product_available: true,
recovery_available: true,
+ ramdisk_available: true,
native_bridge_supported: true,
src: "",
}
@@ -96,6 +99,7 @@ func commonDefaultModules() string {
vendor_available: true,
product_available: true,
recovery_available: true,
+ ramdisk_available: true,
system_shared_libs: [],
stl: "none",
srcs: [""],
@@ -111,6 +115,7 @@ func commonDefaultModules() string {
vendor_ramdisk_available: true,
product_available: true,
recovery_available: true,
+ ramdisk_available: true,
native_bridge_supported: true,
src: "",
}
@@ -122,6 +127,7 @@ func commonDefaultModules() string {
vendor_ramdisk_available: true,
product_available: true,
recovery_available: true,
+ ramdisk_available: true,
native_bridge_supported: true,
src: "",
}
@@ -133,6 +139,7 @@ func commonDefaultModules() string {
vendor_ramdisk_available: true,
product_available: true,
recovery_available: true,
+ ramdisk_available: true,
native_bridge_supported: true,
src: "",
}
@@ -142,6 +149,7 @@ func commonDefaultModules() string {
vendor_available: true,
product_available: true,
recovery_available: true,
+ ramdisk_available: true,
src: "",
}
@@ -150,6 +158,7 @@ func commonDefaultModules() string {
vendor_available: true,
product_available: true,
recovery_available: true,
+ ramdisk_available: true,
src: "",
}
@@ -158,6 +167,7 @@ func commonDefaultModules() string {
vendor_available: true,
product_available: true,
recovery_available: true,
+ ramdisk_available: true,
src: "",
}
@@ -167,6 +177,7 @@ func commonDefaultModules() string {
vendor_available: true,
product_available: true,
recovery_available: true,
+ ramdisk_available: true,
src: "",
}
@@ -175,6 +186,7 @@ func commonDefaultModules() string {
vendor_available: true,
product_available: true,
recovery_available: true,
+ ramdisk_available: true,
src: "",
}
@@ -184,6 +196,7 @@ func commonDefaultModules() string {
vendor_available: true,
product_available: true,
recovery_available: true,
+ ramdisk_available: true,
system_shared_libs: [],
srcs: [""],
}
@@ -196,6 +209,7 @@ func commonDefaultModules() string {
stl: "none",
system_shared_libs: [],
recovery_available: true,
+ ramdisk_available: true,
stubs: {
versions: ["27", "28", "29"],
},
@@ -211,6 +225,7 @@ func commonDefaultModules() string {
stl: "none",
system_shared_libs: [],
recovery_available: true,
+ ramdisk_available: true,
stubs: {
versions: ["27", "28", "29"],
},
@@ -230,6 +245,7 @@ func commonDefaultModules() string {
vendor_ramdisk_available: true,
product_available: true,
recovery_available: true,
+ ramdisk_available: true,
native_coverage: false,
system_shared_libs: [],
stl: "none",
@@ -241,6 +257,7 @@ func commonDefaultModules() string {
vendor_ramdisk_available: true,
product_available: true,
recovery_available: true,
+ ramdisk_available: true,
native_coverage: false,
system_shared_libs: [],
stl: "none",
@@ -275,6 +292,7 @@ func commonDefaultModules() string {
stl: "none",
system_shared_libs: [],
recovery_available: true,
+ ramdisk_available: true,
stubs: {
versions: ["27", "28", "29"],
},
@@ -292,6 +310,7 @@ func commonDefaultModules() string {
nocrt: true,
system_shared_libs: [],
recovery_available: true,
+ ramdisk_available: true,
llndk: {
symbol_file: "libft2.map.txt",
private: true,
@@ -307,6 +326,7 @@ func commonDefaultModules() string {
vendor_ramdisk_available: true,
product_available: true,
recovery_available: true,
+ ramdisk_available: true,
host_supported: true,
min_sdk_version: "29",
apex_available: [
@@ -323,6 +343,7 @@ func commonDefaultModules() string {
vendor_available: true,
product_available: true,
recovery_available: true,
+ ramdisk_available: true,
host_supported: true,
min_sdk_version: "29",
vndk: {
@@ -345,6 +366,7 @@ func commonDefaultModules() string {
vendor_ramdisk_available: true,
product_available: true,
recovery_available: true,
+ ramdisk_available: true,
min_sdk_version: "29",
apex_available: [
"//apex_available:platform",
@@ -356,6 +378,7 @@ func commonDefaultModules() string {
name: "crt_defaults",
defaults: ["linux_bionic_supported"],
recovery_available: true,
+ ramdisk_available: true,
vendor_available: true,
vendor_ramdisk_available: true,
product_available: true,
@@ -479,6 +502,7 @@ func withLinuxBionic() string {
name: "linker",
defaults: ["linux_bionic_supported"],
recovery_available: true,
+ ramdisk_available: true,
stl: "none",
nocrt: true,
static_executable: true,
@@ -627,6 +651,7 @@ var PrepareForTestWithCcIncludeVndk = android.GroupFixturePreparers(
android.FixtureRegisterWithContext(func(ctx android.RegistrationContext) {
vendorSnapshotImageSingleton.init(ctx)
recoverySnapshotImageSingleton.init(ctx)
+ ramdiskSnapshotImageSingleton.init(ctx)
ctx.RegisterSingletonType("vndk-snapshot", VndkSnapshotSingleton)
}),
)
@@ -676,6 +701,7 @@ func CreateTestContext(config android.Config) *android.TestContext {
vendorSnapshotImageSingleton.init(ctx)
recoverySnapshotImageSingleton.init(ctx)
+ ramdiskSnapshotImageSingleton.init(ctx)
ctx.RegisterSingletonType("vndk-snapshot", VndkSnapshotSingleton)
RegisterVndkLibraryTxtTypes(ctx)
diff --git a/cc/util.go b/cc/util.go
index 1220d8432..31d8b848e 100644
--- a/cc/util.go
+++ b/cc/util.go
@@ -82,6 +82,7 @@ func flagsToBuilderFlags(in Flags) builderFlags {
tidyFlags: strings.Join(in.TidyFlags, " "),
sAbiFlags: strings.Join(in.SAbiFlags, " "),
toolchain: in.Toolchain,
+ sdclang: in.Sdclang,
gcovCoverage: in.GcovCoverage,
tidy: in.Tidy,
sAbiDump: in.SAbiDump,
diff --git a/cc/vendor_snapshot.go b/cc/vendor_snapshot.go
index 4e59a95f8..c59a0c69f 100644
--- a/cc/vendor_snapshot.go
+++ b/cc/vendor_snapshot.go
@@ -13,8 +13,8 @@
// limitations under the License.
package cc
-// This file contains singletons to capture vendor and recovery snapshot. They consist of prebuilt
-// modules under AOSP so older vendor and recovery can be built with a newer system in a single
+// This file contains singletons to capture vendor, ramdisk and recovery snapshot. They consist of prebuilt
+// modules under AOSP so older vendor, ramdisk and recovery can be built with a newer system in a single
// source tree.
import (
@@ -53,6 +53,15 @@ var recoverySnapshotSingleton = snapshotSingleton{
false, /* fake */
}
+var ramdiskSnapshotSingleton = snapshotSingleton{
+ "ramdisk",
+ "SOONG_RAMDISK_SNAPSHOT_ZIP",
+ android.OptionalPath{},
+ false,
+ ramdiskSnapshotImageSingleton,
+ false, /* fake */
+}
+
func VendorSnapshotSingleton() android.Singleton {
return &vendorSnapshotSingleton
}
@@ -65,6 +74,10 @@ func RecoverySnapshotSingleton() android.Singleton {
return &recoverySnapshotSingleton
}
+func RamdiskSnapshotSingleton() android.Singleton {
+ return &ramdiskSnapshotSingleton
+}
+
type snapshotSingleton struct {
// Name, e.g., "vendor", "recovery", "ramdisk".
name string
@@ -104,6 +117,13 @@ func isRecoveryProprietaryPath(dir string, deviceConfig android.DeviceConfig) bo
return RecoverySnapshotSingleton().(*snapshotSingleton).image.isProprietaryPath(dir, deviceConfig)
}
+// Determine if a dir under source tree is an SoC-owned proprietary directory based
+// on ramdisk snapshot configuration
+// Examples: device/, vendor/
+func isRamdiskProprietaryPath(dir string, deviceConfig android.DeviceConfig) bool {
+ return RamdiskSnapshotSingleton().(*snapshotSingleton).image.isProprietaryPath(dir, deviceConfig)
+}
+
func isVendorProprietaryModule(ctx android.BaseModuleContext) bool {
// Any module in a vendor proprietary path is a vendor proprietary
// module.
@@ -146,6 +166,28 @@ func isRecoveryProprietaryModule(ctx android.BaseModuleContext) bool {
return false
}
+func isRamdiskProprietaryModule(ctx android.BaseModuleContext) bool {
+
+ // Any module in a ramdisk proprietary path is a ramdisk proprietary
+ // module.
+ if isRamdiskProprietaryPath(ctx.ModuleDir(), ctx.DeviceConfig()) {
+ return true
+ }
+
+ // However if the module is not in a ramdisk proprietary path, it may
+ // still be a ramdisk proprietary module. This happens for cc modules
+ // that are excluded from the ramdisk snapshot, and it means that the
+ // ramdisk has assumed control of the framework-provided module.
+
+ if c, ok := ctx.Module().(*Module); ok {
+ if c.ExcludeFromRamdiskSnapshot() {
+ return true
+ }
+ }
+
+ return false
+}
+
// Determines if the module is a candidate for snapshot.
func isSnapshotAware(cfg android.DeviceConfig, m LinkableInterface, inProprietaryPath bool, apexInfo android.ApexInfo, image snapshotImage) bool {
if !m.Enabled() || m.HiddenFromMake() {
@@ -242,10 +284,12 @@ type snapshotJsonFlags struct {
SanitizeUbsanDep bool `json:",omitempty"`
// binary flags
- Symlinks []string `json:",omitempty"`
+ Symlinks []string `json:",omitempty"`
+ StaticExecutable bool `json:",omitempty"`
// dependencies
SharedLibs []string `json:",omitempty"`
+ StaticLibs []string `json:",omitempty"`
RuntimeLibs []string `json:",omitempty"`
Required []string `json:",omitempty"`
@@ -381,6 +425,8 @@ func (c *snapshotSingleton) GenerateBuildActions(ctx android.SingletonContext) {
if m.Shared() {
prop.SharedLibs = m.SnapshotSharedLibs()
}
+ // static libs dependencies are required to collect the NOTICE files.
+ prop.StaticLibs = m.SnapshotStaticLibs()
if sanitizable, ok := m.(PlatformSanitizeable); ok {
if sanitizable.Static() && sanitizable.SanitizePropDefined() {
prop.SanitizeMinimalDep = sanitizable.MinimalRuntimeDep() || sanitizable.MinimalRuntimeNeeded()
@@ -424,8 +470,10 @@ func (c *snapshotSingleton) GenerateBuildActions(ctx android.SingletonContext) {
} else if m.Binary() {
// binary flags
prop.Symlinks = m.Symlinks()
+ prop.StaticExecutable = m.StaticExecutable()
prop.SharedLibs = m.SnapshotSharedLibs()
-
+ // static libs dependencies are required to collect the NOTICE files.
+ prop.StaticLibs = m.SnapshotStaticLibs()
// install bin
binPath := m.OutputFile().Path()
snapshotBinOut := filepath.Join(snapshotArchDir, targetArch, "binary", binPath.Base())
@@ -493,13 +541,13 @@ func (c *snapshotSingleton) GenerateBuildActions(ctx android.SingletonContext) {
headers = append(headers, m.SnapshotHeaders()...)
}
- if len(m.NoticeFiles()) > 0 {
+ if len(m.EffectiveLicenseFiles()) > 0 {
noticeName := ctx.ModuleName(m) + ".txt"
noticeOut := filepath.Join(noticeDir, noticeName)
// skip already copied notice file
if !installedNotices[noticeOut] {
installedNotices[noticeOut] = true
- snapshotOutputs = append(snapshotOutputs, combineNoticesRule(ctx, m.NoticeFiles(), noticeOut))
+ snapshotOutputs = append(snapshotOutputs, combineNoticesRule(ctx, m.EffectiveLicenseFiles(), noticeOut))
}
}
})
diff --git a/java/app.go b/java/app.go
index fc1ace07b..0750c46bb 100755
--- a/java/app.go
+++ b/java/app.go
@@ -18,6 +18,8 @@ package java
// related module types, including their override variants.
import (
+ "fmt"
+ "os"
"path/filepath"
"sort"
"strings"
@@ -721,6 +723,59 @@ func (a *AndroidApp) generateAndroidBuildActions(ctx android.ModuleContext) {
}
a.buildAppDependencyInfo(ctx)
+
+ config := ctx.Config().VendorConfig("vendor_clean_up_java")
+ if ctx.SocSpecific() || ctx.DeviceSpecific() {
+ output := filepath.Join(config.String("output"),
+ os.Getenv("TARGET_PRODUCT"),
+ config.String("file"))
+ split,_ := filepath.Split(output)
+ if config.String("config") == "warning" {
+ os.MkdirAll(split, os.ModePerm)
+ if outputs, err := os.OpenFile(output,
+ os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666); err == nil {
+ defer outputs.Close()
+ fmt.Fprintf(outputs,
+ "Module %s in %s hit the violation because it compile " +
+ "the java in vendor. Only prebuilt for Java Apk and Jar" +
+ " is allowed in vendor. for detail instruction, pls " +
+ "refer to go/JavaCleanUpInVendor \n",
+ ctx.ModuleName(),
+ ctx.ModuleDir())
+ } else {
+ fmt.Println("Err: ",err)
+ }
+ } else if config.String("config") == "enforcing"{
+ config_list := false
+ for _, splitstr:= range strings.Split(config.String("allowlist"), " "){
+ if strings.TrimSpace(splitstr) == ctx.ModuleName() {
+ config_list = true
+ }
+ }
+ if config_list == true {
+ os.MkdirAll(split, os.ModePerm)
+ if outputs_enforce, err := os.OpenFile(output,
+ os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666); err == nil {
+ defer outputs_enforce.Close()
+ fmt.Fprintf(outputs_enforce,
+ "Module %s in %s hit the violation because it compile " +
+ "the java in vendor. Only prebuilt for Java Apk and Jar" +
+ " is allowed in vendor. for detail instruction, pls " +
+ "refer to go/JavaCleanUpInVendor \n",
+ ctx.ModuleName(),
+ ctx.ModuleDir())
+ } else {
+ fmt.Println("Err: ",err)
+ }
+ } else {
+ ctx.PropertyErrorf("ERR", "Module " + ctx.ModuleName() +
+ " in " + ctx.ModuleDir() + " hit the violation because it " +
+ "compile the java in vendor. Only prebuilt for Java Apk and" +
+ " Jar is allowed in vendor. for detail instruction, pls" +
+ " refer to go/JavaCleanUpInVendor")
+ }
+ }
+ }
}
type appDepsInterface interface {
@@ -1213,7 +1268,7 @@ func (u *usesLibrary) addLib(lib string, optional bool) {
}
func (u *usesLibrary) deps(ctx android.BottomUpMutatorContext, hasFrameworkLibs bool) {
- if !ctx.Config().UnbundledBuild() {
+ if !ctx.Config().UnbundledBuild() || ctx.Config().UnbundledBuildImage() {
ctx.AddVariationDependencies(nil, usesLibTag, u.usesLibraryProperties.Uses_libs...)
ctx.AddVariationDependencies(nil, usesLibTag, u.presentOptionalUsesLibs(ctx)...)
// Only add these extra dependencies if the module depends on framework libs. This avoids
@@ -1249,11 +1304,12 @@ func replaceInList(list []string, oldstr, newstr string) {
// to their dex jars on host and on device.
func (u *usesLibrary) classLoaderContextForUsesLibDeps(ctx android.ModuleContext) dexpreopt.ClassLoaderContextMap {
clcMap := make(dexpreopt.ClassLoaderContextMap)
-
- if !ctx.Config().UnbundledBuild() {
+ // Skip when UnbundledBuild() is true, but UnbundledBuildImage() is false.
+ // Added UnbundledBuildImage() condition to generate dexpreopt.config even though unbundled image is built.
+ if !ctx.Config().UnbundledBuild() || ctx.Config().UnbundledBuildImage() {
ctx.VisitDirectDeps(func(m android.Module) {
if tag, ok := ctx.OtherModuleDependencyTag(m).(usesLibraryDependencyTag); ok {
- dep := ctx.OtherModuleName(m)
+ dep := android.RemoveOptionalPrebuiltPrefix(ctx.OtherModuleName(m))
if lib, ok := m.(UsesLibraryDependency); ok {
libName := dep
if ulib, ok := m.(ProvidesUsesLib); ok && ulib.ProvidesUsesLib() != nil {
diff --git a/java/dexpreopt.go b/java/dexpreopt.go
index 2e46d74fa..0faae36ba 100644
--- a/java/dexpreopt.go
+++ b/java/dexpreopt.go
@@ -141,10 +141,9 @@ func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, dexJarFile android.Wr
}
}
- // If it is neither app nor test, make config files regardless of its dexpreopt setting.
+ // If it is test, make config files regardless of its dexpreopt setting.
// The config files are required for apps defined in make which depend on the lib.
- // TODO(b/158843648): The config for apps should be generated as well regardless of setting.
- if (d.isApp || d.isTest) && d.dexpreoptDisabled(ctx) {
+ if d.isTest && d.dexpreoptDisabled(ctx) {
return
}
diff --git a/java/dexpreopt_bootjars.go b/java/dexpreopt_bootjars.go
index 19c65cac7..f50705cc0 100644
--- a/java/dexpreopt_bootjars.go
+++ b/java/dexpreopt_bootjars.go
@@ -489,7 +489,11 @@ func copyBootJarsToPredefinedLocations(ctx android.ModuleContext, srcBootDexJars
dst := dstBootJarsByModule[name]
if src == nil {
- ctx.ModuleErrorf("module %s does not provide a dex boot jar", name)
+ if !ctx.Config().AllowMissingDependencies() {
+ ctx.ModuleErrorf("module %s does not provide a dex boot jar", name)
+ } else {
+ ctx.AddMissingDependencies([]string{name})
+ }
} else if dst == nil {
ctx.ModuleErrorf("module %s is not part of the boot configuration", name)
} else {
diff --git a/java/java.go b/java/java.go
index bbed42def..84a9d9aa4 100644
--- a/java/java.go
+++ b/java/java.go
@@ -1180,7 +1180,8 @@ type Import struct {
properties ImportProperties
// output file containing classes.dex and resources
- dexJarFile android.Path
+ dexJarFile android.Path
+ dexJarInstallFile android.Path
combinedClasspathFile android.Path
classLoaderContexts dexpreopt.ClassLoaderContextMap
@@ -1335,6 +1336,7 @@ func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) {
di := ctx.OtherModuleProvider(deapexerModule, android.DeapexerProvider).(android.DeapexerInfo)
if dexOutputPath := di.PrebuiltExportPath(apexRootRelativePathToJavaLib(j.BaseModuleName())); dexOutputPath != nil {
j.dexJarFile = dexOutputPath
+ j.dexJarInstallFile = android.PathForModuleInPartitionInstall(ctx, "apex", ai.ApexVariationName, apexRootRelativePathToJavaLib(j.BaseModuleName()))
// Initialize the hiddenapi structure.
j.initHiddenAPI(ctx, dexOutputPath, outputFile, nil)
@@ -1375,6 +1377,7 @@ func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) {
dexOutputFile = j.hiddenAPIEncodeDex(ctx, dexOutputFile)
j.dexJarFile = dexOutputFile
+ j.dexJarInstallFile = android.PathForModuleInstall(ctx, "framework", jarName)
}
}
@@ -1416,7 +1419,7 @@ func (j *Import) DexJarBuildPath() android.Path {
}
func (j *Import) DexJarInstallPath() android.Path {
- return nil
+ return j.dexJarInstallFile
}
func (j *Import) ClassLoaderContexts() dexpreopt.ClassLoaderContextMap {
diff --git a/java/rro.go b/java/rro.go
index 2e58c042f..0b4d0916a 100644
--- a/java/rro.go
+++ b/java/rro.go
@@ -90,6 +90,22 @@ type RuntimeResourceOverlayModule interface {
Theme() string
}
+// RRO's partition logic is different from the partition logic of other modules defined in soong/android/paths.go
+// The default partition for RRO is "/product" and not "/system"
+func rroPartition(ctx android.ModuleContext) string {
+ var partition string
+ if ctx.DeviceSpecific() {
+ partition = ctx.DeviceConfig().OdmPath()
+ } else if ctx.SocSpecific() {
+ partition = ctx.DeviceConfig().VendorPath()
+ } else if ctx.SystemExtSpecific() {
+ partition = ctx.DeviceConfig().SystemExtPath()
+ } else {
+ partition = ctx.DeviceConfig().ProductPath()
+ }
+ return partition
+}
+
func (r *RuntimeResourceOverlay) DepsMutator(ctx android.BottomUpMutatorContext) {
sdkDep := decodeSdkDep(ctx, android.SdkContext(r))
if sdkDep.hasFrameworkLibs() {
@@ -137,7 +153,8 @@ func (r *RuntimeResourceOverlay) GenerateAndroidBuildActions(ctx android.ModuleC
r.certificate = certificates[0]
r.outputFile = signed
- r.installDir = android.PathForModuleInstall(ctx, "overlay", String(r.properties.Theme))
+ partition := rroPartition(ctx)
+ r.installDir = android.PathForModuleInPartitionInstall(ctx, partition, "overlay", String(r.properties.Theme))
ctx.InstallFile(r.installDir, r.outputFile.Base(), r.outputFile)
}
diff --git a/java/rro_test.go b/java/rro_test.go
index bad60bc16..27abbe4f3 100644
--- a/java/rro_test.go
+++ b/java/rro_test.go
@@ -177,7 +177,7 @@ func TestRuntimeResourceOverlay_JavaDefaults(t *testing.T) {
// Check device location.
path = android.AndroidMkEntriesForTest(t, ctx, m.Module())[0].EntryMap["LOCAL_MODULE_PATH"]
- expectedPath = []string{shared.JoinPath("out/target/product/test_device/system/overlay")}
+ expectedPath = []string{shared.JoinPath("out/target/product/test_device/product/overlay")}
android.AssertStringPathsRelativeToTopEquals(t, "LOCAL_MODULE_PATH", config, expectedPath, path)
}
@@ -343,3 +343,57 @@ func TestEnforceRRO_propagatesToDependencies(t *testing.T) {
})
}
}
+
+func TestRuntimeResourceOverlayPartition(t *testing.T) {
+ bp := `
+ runtime_resource_overlay {
+ name: "device_specific",
+ device_specific: true,
+ }
+ runtime_resource_overlay {
+ name: "soc_specific",
+ soc_specific: true,
+ }
+ runtime_resource_overlay {
+ name: "system_ext_specific",
+ system_ext_specific: true,
+ }
+ runtime_resource_overlay {
+ name: "product_specific",
+ product_specific: true,
+ }
+ runtime_resource_overlay {
+ name: "default"
+ }
+ `
+ testCases := []struct {
+ name string
+ expectedPath string
+ }{
+ {
+ name: "device_specific",
+ expectedPath: "out/soong/target/product/test_device/odm/overlay",
+ },
+ {
+ name: "soc_specific",
+ expectedPath: "out/soong/target/product/test_device/vendor/overlay",
+ },
+ {
+ name: "system_ext_specific",
+ expectedPath: "out/soong/target/product/test_device/system_ext/overlay",
+ },
+ {
+ name: "product_specific",
+ expectedPath: "out/soong/target/product/test_device/product/overlay",
+ },
+ {
+ name: "default",
+ expectedPath: "out/soong/target/product/test_device/product/overlay",
+ },
+ }
+ for _, testCase := range testCases {
+ ctx, _ := testJava(t, bp)
+ mod := ctx.ModuleForTests(testCase.name, "android_common").Module().(*RuntimeResourceOverlay)
+ android.AssertPathRelativeToTopEquals(t, "Install dir is not correct for "+testCase.name, testCase.expectedPath, mod.installDir)
+ }
+}
diff --git a/java/sdk_library.go b/java/sdk_library.go
index 8c664383d..fe48e6144 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -1923,8 +1923,12 @@ type SdkLibraryImport struct {
// Is nil if the source module does not exist.
xmlPermissionsFileModule *sdkLibraryXml
- // Path to the dex implementation jar obtained from the prebuilt_apex, if any.
+ // Build path to the dex implementation jar obtained from the prebuilt_apex, if any.
dexJarFile android.Path
+
+ // Expected install file path of the source module(sdk_library)
+ // or dex implementation jar obtained from the prebuilt_apex, if any.
+ installFile android.Path
}
var _ SdkLibraryDependency = (*SdkLibraryImport)(nil)
@@ -2142,6 +2146,9 @@ func (module *SdkLibraryImport) GenerateAndroidBuildActions(ctx android.ModuleCo
var deapexerModule android.Module
+ // Assume that source module(sdk_library) is installed in /<sdk_library partition>/framework
+ module.installFile = android.PathForModuleInstall(ctx, "framework", module.Stem()+".jar")
+
// Record the paths to the prebuilt stubs library and stubs source.
ctx.VisitDirectDeps(func(to android.Module) {
tag := ctx.OtherModuleDependencyTag(to)
@@ -2205,6 +2212,7 @@ func (module *SdkLibraryImport) GenerateAndroidBuildActions(ctx android.ModuleCo
di := ctx.OtherModuleProvider(deapexerModule, android.DeapexerProvider).(android.DeapexerInfo)
if dexOutputPath := di.PrebuiltExportPath(apexRootRelativePathToJavaLib(module.BaseModuleName())); dexOutputPath != nil {
module.dexJarFile = dexOutputPath
+ module.installFile = android.PathForModuleInPartitionInstall(ctx, "apex", ai.ApexVariationName, apexRootRelativePathToJavaLib(module.BaseModuleName()))
module.initHiddenAPI(ctx, dexOutputPath, module.findScopePaths(apiScopePublic).stubsImplPath[0], nil)
} else {
// This should never happen as a variant for a prebuilt_apex is only created if the
@@ -2259,11 +2267,7 @@ func (module *SdkLibraryImport) DexJarBuildPath() android.Path {
// to satisfy UsesLibraryDependency interface
func (module *SdkLibraryImport) DexJarInstallPath() android.Path {
- if module.implLibraryModule == nil {
- return nil
- } else {
- return module.implLibraryModule.DexJarInstallPath()
- }
+ return module.installFile
}
// to satisfy UsesLibraryDependency interface
diff --git a/rust/rust.go b/rust/rust.go
index f068b3d7b..37e41dec9 100644
--- a/rust/rust.go
+++ b/rust/rust.go
@@ -33,11 +33,12 @@ var pctx = android.NewPackageContext("android/soong/rust")
func init() {
// Only allow rust modules to be defined for certain projects
- android.AddNeverAllowRules(
+ // Temporarily disable allow list
+ /* android.AddNeverAllowRules(
android.NeverAllow().
NotIn(config.RustAllowedPaths...).
ModuleType(config.RustModuleTypes...))
-
+ */
android.RegisterModuleType("rust_defaults", defaultsFactory)
android.PreDepsMutators(func(ctx android.RegisterMutatorsContext) {
ctx.BottomUp("rust_libraries", LibraryMutator).Parallel()
@@ -242,6 +243,10 @@ func (mod *Module) Binary() bool {
return false
}
+func (mod *Module) StaticExecutable() bool {
+ return false
+}
+
func (mod *Module) Object() bool {
// Rust has no modules which produce only object files.
return false
diff --git a/rust/snapshot_utils.go b/rust/snapshot_utils.go
index 943c79098..1bb3f735d 100644
--- a/rust/snapshot_utils.go
+++ b/rust/snapshot_utils.go
@@ -28,6 +28,11 @@ func (mod *Module) ExcludeFromRecoverySnapshot() bool {
return false
}
+func (mod *Module) ExcludeFromRamdiskSnapshot() bool {
+ // TODO Rust does not yet support snapshotting
+ return false
+}
+
func (mod *Module) IsSnapshotLibrary() bool {
// TODO Rust does not yet support snapshotting
return false
@@ -43,6 +48,11 @@ func (mod *Module) SnapshotSharedLibs() []string {
return []string{}
}
+func (mod *Module) SnapshotStaticLibs() []string {
+ // TODO Rust does not yet support snapshotting
+ return []string{}
+}
+
func (mod *Module) Symlinks() []string {
// TODO update this to return the list of symlinks when Rust supports defining symlinks
return nil
diff --git a/scripts/check_boot_jars/package_allowed_list.txt b/scripts/check_boot_jars/package_allowed_list.txt
index 18ab427b5..3dc984797 100644
--- a/scripts/check_boot_jars/package_allowed_list.txt
+++ b/scripts/check_boot_jars/package_allowed_list.txt
@@ -246,3 +246,11 @@ com\.google\.i18n\.phonenumbers
# Packages used for Android in Chrome OS
org\.chromium\.arc
org\.chromium\.arc\..*
+
+# QC adds
+com.qualcomm.qti
+com.quicinc.tcmiface
+com.qualcomm.wfd
+com.qualcomm.wfd.service
+org.codeaurora.internal
+qcom.fmradio
diff --git a/ui/build/paths/config.go b/ui/build/paths/config.go
index 81c500d2b..5f8e313cb 100644
--- a/ui/build/paths/config.go
+++ b/ui/build/paths/config.go
@@ -74,6 +74,12 @@ func GetConfig(name string) PathConfig {
}
var Configuration = map[string]PathConfig{
+ "aarch64-linux-android-ar": Log,
+ "aarch64-linux-android-gcc": Log,
+ "aarch64-linux-android-ld": Log,
+ "aarch64-linux-android-nm": Log,
+ "aarch64-linux-android-objcopy": Log,
+ "aarch64-linux-android-objdump": Log,
"bash": Allowed,
"dd": Allowed,
"diff": Allowed,
@@ -88,6 +94,8 @@ var Configuration = map[string]PathConfig{
"javap": Allowed,
"lsof": Allowed,
"openssl": Allowed,
+ "perl": Log,
+ "printf": Log,
"pstree": Allowed,
"rsync": Allowed,
"sh": Allowed,
@@ -109,10 +117,72 @@ var Configuration = map[string]PathConfig{
"ld.gold": Forbidden,
"pkg-config": Forbidden,
- // These are toybox tools that only work on Linux.
- "pgrep": LinuxOnlyPrebuilt,
- "pkill": LinuxOnlyPrebuilt,
- "ps": LinuxOnlyPrebuilt,
+ // On Linux we'll use the toybox versions of these instead.
+ "basename": LinuxOnlyPrebuilt,
+ "cat": LinuxOnlyPrebuilt,
+ "chmod": LinuxOnlyPrebuilt,
+ // TODO (b/121282416): switch back to LinuxOnlyPrebuilt when build is hermetic
+ "cmp": Log,
+ // TODO (b/121282416): switch back to LinuxOnlyPrebuilt when build is hermetic
+ "cp": Log,
+ "comm": LinuxOnlyPrebuilt,
+ "cut": LinuxOnlyPrebuilt,
+ "date": LinuxOnlyPrebuilt,
+ // TODO (b/121282416): switch back to LinuxOnlyPrebuilt when build is hermetic
+ "dirname": Log,
+ "du": LinuxOnlyPrebuilt,
+ "echo": LinuxOnlyPrebuilt,
+ "egrep": LinuxOnlyPrebuilt,
+ "env": LinuxOnlyPrebuilt,
+ "getconf": LinuxOnlyPrebuilt,
+ "grep": LinuxOnlyPrebuilt,
+ "head": LinuxOnlyPrebuilt,
+ "hostname": LinuxOnlyPrebuilt,
+ "id": LinuxOnlyPrebuilt,
+ "ln": LinuxOnlyPrebuilt,
+ "ls": LinuxOnlyPrebuilt,
+ "md5sum": LinuxOnlyPrebuilt,
+ // TODO (b/121282416): switch back to LinuxOnlyPrebuilt when build is hermetic
+ "mkdir": Log,
+ "mktemp": LinuxOnlyPrebuilt,
+ "mv": LinuxOnlyPrebuilt,
+ "od": LinuxOnlyPrebuilt,
+ // TODO (b/121282416): switch back to LinuxOnlyPrebuilt when build is hermetic
+ "paste": Log,
+ "pgrep": LinuxOnlyPrebuilt,
+ "pkill": LinuxOnlyPrebuilt,
+ "ps": LinuxOnlyPrebuilt,
+ // TODO (b/121282416): switch back to LinuxOnlyPrebuilt when build is hermetic
+ "pwd": Log,
+ "readlink": LinuxOnlyPrebuilt,
+ "rm": LinuxOnlyPrebuilt,
+ // TODO (b/121282416): switch back to LinuxOnlyPrebuilt when build is hermetic
+ "rmdir": Log,
+ "sed": LinuxOnlyPrebuilt,
+ "seq": LinuxOnlyPrebuilt,
+ "setsid": LinuxOnlyPrebuilt,
+ "sha1sum": LinuxOnlyPrebuilt,
+ "sha256sum": LinuxOnlyPrebuilt,
+ "sha512sum": LinuxOnlyPrebuilt,
+ "sleep": LinuxOnlyPrebuilt,
+ "sort": LinuxOnlyPrebuilt,
+ "stat": LinuxOnlyPrebuilt,
+ // TODO (b/121282416): switch back to LinuxOnlyPrebuilt when build is hermetic
+ "tail": Log,
+ "tar": LinuxOnlyPrebuilt,
+ "tee": LinuxOnlyPrebuilt,
+ "timeout": LinuxOnlyPrebuilt,
+ // TODO (b/121282416): switch back to LinuxOnlyPrebuilt when build is hermetic
+ "touch": Log,
+ "true": LinuxOnlyPrebuilt,
+ "uname": LinuxOnlyPrebuilt,
+ "uniq": LinuxOnlyPrebuilt,
+ "unix2dos": LinuxOnlyPrebuilt,
+ "wc": LinuxOnlyPrebuilt,
+ "whoami": LinuxOnlyPrebuilt,
+ "which": LinuxOnlyPrebuilt,
+ // TODO (b/121282416): switch back to LinuxOnlyPrebuilt when build is hermetic
+ "xxd": Log,
}
func init() {
diff --git a/ui/build/sandbox_linux.go b/ui/build/sandbox_linux.go
index dab0e756b..e813e08b4 100644
--- a/ui/build/sandbox_linux.go
+++ b/ui/build/sandbox_linux.go
@@ -34,14 +34,14 @@ type Sandbox struct {
var (
noSandbox = Sandbox{}
basicSandbox = Sandbox{
- Enabled: true,
+ Enabled: false,
}
dumpvarsSandbox = basicSandbox
katiSandbox = basicSandbox
soongSandbox = basicSandbox
ninjaSandbox = Sandbox{
- Enabled: true,
+ Enabled: false,
DisableWhenUsingGoma: true,
AllowBuildBrokenUsesNetwork: true,
diff --git a/ui/build/soong.go b/ui/build/soong.go
index 87818e386..05fbf1d89 100644
--- a/ui/build/soong.go
+++ b/ui/build/soong.go
@@ -287,6 +287,17 @@ func runSoong(ctx Context, config Config) {
// root of the source tree and the output root
ninjaEnv.Set("TOP", os.Getenv("TOP"))
+ qcEnvVars := []string{
+ "TARGET_BOARD_PLATFORM",
+ "SDCLANG_AE_CONFIG",
+ "SDCLANG_CONFIG",
+ "SDCLANG_SA_ENABLED",
+ "QIIFA_BUILD_CONFIG",
+ }
+ for _, qcVar := range qcEnvVars {
+ ninjaEnv.Set(qcVar, os.Getenv(qcVar))
+ }
+
cmd.Environment = &ninjaEnv
cmd.Sandbox = soongSandbox
cmd.RunAndStreamOrFatal()