Merge "bp2build allowlist expanded"
diff --git a/bp2build/cc_binary_conversion_test.go b/bp2build/cc_binary_conversion_test.go
index 6ec3703..8a83cc0 100644
--- a/bp2build/cc_binary_conversion_test.go
+++ b/bp2build/cc_binary_conversion_test.go
@@ -222,6 +222,7 @@
         "-Wl,--version-script,$(location vs)",
         "-Wl,--dynamic-list,$(location dynamic.list)",
     ]`,
+				"features": `["android_cfi_exports_map"]`,
 			},
 			},
 		},
@@ -249,6 +250,7 @@
         "version_script",
         "dynamic.list",
     ]`,
+				"features": `["android_cfi_exports_map"]`,
 				"linkopts": `[
         "--nospace_flag",
         "-z",
diff --git a/bp2build/cc_library_conversion_test.go b/bp2build/cc_library_conversion_test.go
index 0e8705b..3dd9373 100644
--- a/bp2build/cc_library_conversion_test.go
+++ b/bp2build/cc_library_conversion_test.go
@@ -900,7 +900,8 @@
         "-Wl,--version-script,$(location v.map)",
         "-Wl,--dynamic-list,$(location dynamic.list)",
     ]`,
-			"srcs": `["a.cpp"]`,
+			"srcs":     `["a.cpp"]`,
+			"features": `["android_cfi_exports_map"]`,
 		}),
 	},
 	)
@@ -958,6 +959,11 @@
         "//conditions:default": [],
     })`,
 			"srcs": `["a.cpp"]`,
+			"features": `select({
+        "//build/bazel/platforms/arch:arm": ["android_cfi_exports_map"],
+        "//build/bazel/platforms/arch:arm64": ["android_cfi_exports_map"],
+        "//conditions:default": [],
+    })`,
 		}),
 	},
 	)
@@ -985,12 +991,15 @@
 }
 `,
 		ExpectedBazelTargets: []string{
-			MakeBazelTarget("cc_library_static", "foo_bp2build_cc_library_static", AttrNameToString{}),
+			MakeBazelTarget("cc_library_static", "foo_bp2build_cc_library_static", AttrNameToString{
+				"features": `["android_cfi_exports_map"]`,
+			}),
 			MakeBazelTarget("cc_library_shared", "foo", AttrNameToString{
 				"additional_linker_inputs": `[
         "version_script",
         "dynamic.list",
     ]`,
+				"features": `["android_cfi_exports_map"]`,
 				"linkopts": `[
         "--nospace_flag",
         "-z",
diff --git a/bp2build/cc_library_shared_conversion_test.go b/bp2build/cc_library_shared_conversion_test.go
index 2ee9c99..6c9f9a1 100644
--- a/bp2build/cc_library_shared_conversion_test.go
+++ b/bp2build/cc_library_shared_conversion_test.go
@@ -362,6 +362,7 @@
         "-Wl,--version-script,$(location version_script)",
         "-Wl,--dynamic-list,$(location dynamic.list)",
     ]`,
+				"features": `["android_cfi_exports_map"]`,
 			}),
 		},
 	})
@@ -398,6 +399,7 @@
         "-Wl,--version-script,$(location version_script)",
         "-Wl,--dynamic-list,$(location dynamic.list)",
     ]`,
+				"features": `["android_cfi_exports_map"]`,
 			}),
 		},
 	})
@@ -913,6 +915,7 @@
         "header.h",
     ]`,
 				"linkopts": `["-Wl,--version-script,$(location version_script)"]`,
+				"features": `["android_cfi_exports_map"]`,
 			}),
 		},
 	})
diff --git a/cc/bp2build.go b/cc/bp2build.go
index fa98df4..259ba39 100644
--- a/cc/bp2build.go
+++ b/cc/bp2build.go
@@ -1257,6 +1257,7 @@
 		label := android.BazelLabelForModuleSrcSingle(ctx, *props.Version_script)
 		additionalLinkerInputs.Add(&label)
 		linkerFlags = append(linkerFlags, fmt.Sprintf("-Wl,--version-script,$(location %s)", label.Label))
+		axisFeatures = append(axisFeatures, "android_cfi_exports_map")
 	}
 
 	if props.Dynamic_list != nil {
diff --git a/cc/config/toolchain.go b/cc/config/toolchain.go
index 6a10e14..a0ef575 100644
--- a/cc/config/toolchain.go
+++ b/cc/config/toolchain.go
@@ -20,6 +20,12 @@
 	"android/soong/android"
 )
 
+func init() {
+	exportedVars.ExportStringListStaticVariable("DarwinAvailableLibraries", darwinAvailableLibraries)
+	exportedVars.ExportStringListStaticVariable("LinuxAvailableLibraries", linuxAvailableLibraries)
+	exportedVars.ExportStringListStaticVariable("WindowsAvailableLibraries", windowsAvailableLibraries)
+}
+
 type toolchainFactory func(arch android.Arch) Toolchain
 
 var toolchainFactories = make(map[android.OsType]map[android.ArchType]toolchainFactory)
diff --git a/cc/fuzz.go b/cc/fuzz.go
index dfefc11..0f709c9 100644
--- a/cc/fuzz.go
+++ b/cc/fuzz.go
@@ -398,7 +398,9 @@
 		}
 
 		hostOrTargetString := "target"
-		if ccModule.Host() {
+		if ccModule.Target().HostCross {
+			hostOrTargetString = "host_cross"
+		} else if ccModule.Host() {
 			hostOrTargetString = "host"
 		}
 
diff --git a/cc/sanitize.go b/cc/sanitize.go
index 7fddc1b..6e732b6 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -665,6 +665,21 @@
 		s.Diag.Cfi = nil
 	}
 
+	// TODO(b/280478629): runtimes don't exist for musl arm64 yet.
+	if ctx.toolchain().Musl() && ctx.Arch().ArchType == android.Arm64 {
+		s.Address = nil
+		s.Hwaddress = nil
+		s.Thread = nil
+		s.Scudo = nil
+		s.Fuzzer = nil
+		s.Cfi = nil
+		s.Diag.Cfi = nil
+		s.Misc_undefined = nil
+		s.Undefined = nil
+		s.All_undefined = nil
+		s.Integer_overflow = nil
+	}
+
 	// Also disable CFI for VNDK variants of components
 	if ctx.isVndk() && ctx.useVndk() {
 		s.Cfi = nil
diff --git a/java/fuzz.go b/java/fuzz.go
index 4aa6dbf..e24594a 100644
--- a/java/fuzz.go
+++ b/java/fuzz.go
@@ -150,7 +150,9 @@
 		}
 
 		hostOrTargetString := "target"
-		if javaFuzzModule.Host() {
+		if javaFuzzModule.Target().HostCross {
+			hostOrTargetString = "host_cross"
+		} else if javaFuzzModule.Host() {
 			hostOrTargetString = "host"
 		}