Merge "Remove PRODUCT_INSTALL_EXTRA_FLATTENED_APEXES"
diff --git a/android/allowlists/allowlists.go b/android/allowlists/allowlists.go
index af97325..34a6860 100644
--- a/android/allowlists/allowlists.go
+++ b/android/allowlists/allowlists.go
@@ -1486,6 +1486,7 @@
"tradefed",
"permissive_mte_test",
"ICU4CTestRunner",
+ "DeviceLongPollingStubTest",
"HelloWorldHostTest", // TODO(b/280452825): Convert HelloWorldHostTest to b test
diff --git a/bp2build/cc_binary_conversion_test.go b/bp2build/cc_binary_conversion_test.go
index f89d42c..ab6e4a5 100644
--- a/bp2build/cc_binary_conversion_test.go
+++ b/bp2build/cc_binary_conversion_test.go
@@ -1126,6 +1126,26 @@
})
}
+func TestCcBinaryExplicitlyDisablesCfiWhenFalse(t *testing.T) {
+ runCcBinaryTestCase(t, ccBinaryBp2buildTestCase{
+ description: "cc_binary disables cfi when explciitly set to false in the bp",
+ blueprint: `
+{rule_name} {
+ name: "foo",
+ sanitize: {
+ cfi: false,
+ },
+}
+`,
+ targets: []testBazelTarget{
+ {"cc_binary", "foo", AttrNameToString{
+ "features": `["-android_cfi"]`,
+ "local_includes": `["."]`,
+ }},
+ },
+ })
+}
+
func TestCcBinaryStem(t *testing.T) {
runCcBinaryTestCase(t, ccBinaryBp2buildTestCase{
description: "cc_binary with stem property",
diff --git a/bp2build/cc_library_conversion_test.go b/bp2build/cc_library_conversion_test.go
index 24e91f5..1e3d72e 100644
--- a/bp2build/cc_library_conversion_test.go
+++ b/bp2build/cc_library_conversion_test.go
@@ -4839,6 +4839,32 @@
})
}
+func TestCcLibraryExplicitlyDisablesCfiWhenFalse(t *testing.T) {
+ runCcLibraryTestCase(t, Bp2buildTestCase{
+ Description: "cc_library disables cfi when explciitly set to false in the bp",
+ ModuleTypeUnderTest: "cc_library",
+ ModuleTypeUnderTestFactory: cc.LibraryFactory,
+ Blueprint: `
+cc_library {
+ name: "foo",
+ sanitize: {
+ cfi: false,
+ },
+}
+`,
+ ExpectedBazelTargets: []string{
+ MakeBazelTarget("cc_library_static", "foo_bp2build_cc_library_static", AttrNameToString{
+ "features": `["-android_cfi"]`,
+ "local_includes": `["."]`,
+ }),
+ MakeBazelTarget("cc_library_shared", "foo", AttrNameToString{
+ "features": `["-android_cfi"]`,
+ "local_includes": `["."]`,
+ }),
+ },
+ })
+}
+
func TestCcLibraryWithStem(t *testing.T) {
runCcLibraryTestCase(t, Bp2buildTestCase{
Description: "cc_library with stem property",
diff --git a/bp2build/cc_library_shared_conversion_test.go b/bp2build/cc_library_shared_conversion_test.go
index a828855..a16cfb3 100644
--- a/bp2build/cc_library_shared_conversion_test.go
+++ b/bp2build/cc_library_shared_conversion_test.go
@@ -1535,3 +1535,23 @@
},
})
}
+
+func TestCcLibrarySharedExplicitlyDisablesCfiWhenFalse(t *testing.T) {
+ runCcLibrarySharedTestCase(t, Bp2buildTestCase{
+ Description: "cc_library_shared disables cfi when explciitly set to false in the bp",
+ Blueprint: `
+cc_library_shared {
+ name: "foo",
+ sanitize: {
+ cfi: false,
+ },
+}
+`,
+ ExpectedBazelTargets: []string{
+ MakeBazelTarget("cc_library_shared", "foo", AttrNameToString{
+ "features": `["-android_cfi"]`,
+ "local_includes": `["."]`,
+ }),
+ },
+ })
+}
diff --git a/bp2build/cc_library_static_conversion_test.go b/bp2build/cc_library_static_conversion_test.go
index afe76e5..b473f27 100644
--- a/bp2build/cc_library_static_conversion_test.go
+++ b/bp2build/cc_library_static_conversion_test.go
@@ -2165,3 +2165,23 @@
},
})
}
+
+func TestCcLibraryStaticExplicitlyDisablesCfiWhenFalse(t *testing.T) {
+ runCcLibraryStaticTestCase(t, Bp2buildTestCase{
+ Description: "cc_library_static disables cfi when explciitly set to false in the bp",
+ Blueprint: `
+cc_library_static {
+ name: "foo",
+ sanitize: {
+ cfi: false,
+ },
+}
+`,
+ ExpectedBazelTargets: []string{
+ MakeBazelTarget("cc_library_static", "foo", AttrNameToString{
+ "features": `["-android_cfi"]`,
+ "local_includes": `["."]`,
+ }),
+ },
+ })
+}
diff --git a/cc/bp2build.go b/cc/bp2build.go
index eb91898..d09cdcd 100644
--- a/cc/bp2build.go
+++ b/cc/bp2build.go
@@ -1787,7 +1787,9 @@
blocklistFeatureSuffix := strings.Replace(strings.ToLower(*blocklist), ".", "_", -1)
features = append(features, "ubsan_blocklist_"+blocklistFeatureSuffix)
}
- if proptools.Bool(sanitizerProps.Sanitize.Cfi) {
+ if sanitizerProps.Sanitize.Cfi != nil && !proptools.Bool(sanitizerProps.Sanitize.Cfi) {
+ features = append(features, "-android_cfi")
+ } else if proptools.Bool(sanitizerProps.Sanitize.Cfi) {
features = append(features, "android_cfi")
if proptools.Bool(sanitizerProps.Sanitize.Config.Cfi_assembly_support) {
features = append(features, "android_cfi_assembly_support")
diff --git a/cc/cc_test.go b/cc/cc_test.go
index 701c3bb..859059e 100644
--- a/cc/cc_test.go
+++ b/cc/cc_test.go
@@ -4981,7 +4981,7 @@
cppOnly := []string{"-fPIC", "${config.CommonGlobalCppflags}", "${config.DeviceGlobalCppflags}", "${config.ArmCppflags}"}
cflags := []string{"-Werror", "-std=candcpp"}
- cstd := []string{"-std=gnu11", "-std=conly"}
+ cstd := []string{"-std=gnu17", "-std=conly"}
cppstd := []string{"-std=gnu++17", "-std=cpp", "-fno-rtti"}
lastIncludes := []string{
diff --git a/cc/config/global.go b/cc/config/global.go
index d63e324..8ff5f55 100644
--- a/cc/config/global.go
+++ b/cc/config/global.go
@@ -298,9 +298,9 @@
"-w",
}
- CStdVersion = "gnu11"
+ CStdVersion = "gnu17"
CppStdVersion = "gnu++17"
- ExperimentalCStdVersion = "gnu17"
+ ExperimentalCStdVersion = "gnu2x"
ExperimentalCppStdVersion = "gnu++2a"
// prebuilts/clang default settings.
diff --git a/genrule/genrule.go b/genrule/genrule.go
index a7264cc..b29e2c9 100644
--- a/genrule/genrule.go
+++ b/genrule/genrule.go
@@ -1012,6 +1012,17 @@
break
}
}
+ bazelName := m.Name()
+ for _, out := range outs {
+ if out == bazelName {
+ // This is a workaround to circumvent a Bazel warning where a genrule's
+ // out may not have the same name as the target itself. This makes no
+ // difference for reverse dependencies, because they may depend on the
+ // out file by name.
+ bazelName = bazelName + "-gen"
+ break
+ }
+ }
attrs := &bazelGenruleAttributes{
Srcs: srcs,
Outs: outs,
@@ -1022,7 +1033,7 @@
Rule_class: "genrule",
}
ctx.CreateBazelTargetModule(props, android.CommonAttributes{
- Name: m.Name(),
+ Name: bazelName,
Tags: tags,
}, attrs)
}