diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-06-14 19:28:47 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-06-14 19:28:47 +0000 |
commit | 57080bfbebcf8809b6bc1a6311a1700823aaed2b (patch) | |
tree | 03e55463d906429ac01747918091680639bc935f | |
parent | 27e0e43722e6bf5dc33815d3542ddf234f9fae11 (diff) | |
parent | fab96d98127b722c4be452dfc24a1ff629d36f79 (diff) | |
download | linux-x86-snap-temp-L84200000962437416.tar.gz |
Snap for 10321980 from fab96d98127b722c4be452dfc24a1ff629d36f79 to ndk-r26-releasendk-r26-beta1snap-temp-L84200000962437416
Change-Id: Ib2e12df680c393f8b2c8c4a3f0464b8fbaf6a501
-rw-r--r-- | cc_toolchain_config.bzl | 4 | ||||
-rw-r--r-- | cc_toolchain_features.bzl | 98 | ||||
l--------- | clang-r487747c/bin/llvm-dlltool | 1 | ||||
-rw-r--r-- | kleaf/BUILD.bazel | 12 | ||||
-rw-r--r-- | kleaf/clang_config.bzl | 1 | ||||
-rw-r--r-- | kleaf/clang_toolchain.bzl | 24 | ||||
-rw-r--r-- | kleaf/register.bzl | 2 | ||||
-rw-r--r-- | profiles/pgo-r498229.tar.bz2 (renamed from profiles/pgo-r487747.tar.bz2) | bin | 46539848 -> 48199789 bytes |
8 files changed, 126 insertions, 16 deletions
diff --git a/cc_toolchain_config.bzl b/cc_toolchain_config.bzl index 5347087b5..8f4eacde9 100644 --- a/cc_toolchain_config.bzl +++ b/cc_toolchain_config.bzl @@ -26,6 +26,7 @@ load( "get_features", "int_overflow_ignorelist_filename", "int_overflow_ignorelist_path", + "sanitizer_blocklist_dict", ) load("//build/bazel/platforms/arch/variants:constants.bzl", _arch_constants = "constants") @@ -516,6 +517,9 @@ def android_cc_toolchain( "%s_compiler_binaries" % name, "%s_compiler_clang_includes" % name, "@//%s:%s" % (int_overflow_ignorelist_path, int_overflow_ignorelist_filename), + ] + [ + "@//%s:%s" % (blocklist[0], blocklist[1]) + for blocklist in sanitizer_blocklist_dict.items() ], ) diff --git a/cc_toolchain_features.bzl b/cc_toolchain_features.bzl index 902992e73..9c5a1bf4d 100644 --- a/cc_toolchain_features.bzl +++ b/cc_toolchain_features.bzl @@ -1821,6 +1821,80 @@ def _exclude_ubsan_rt_feature(path): int_overflow_ignorelist_path = "build/soong/cc/config" int_overflow_ignorelist_filename = "integer_overflow_blocklist.txt" +def _get_unsupported_integer_check_with_feature_sets(feature_check): + integer_sanitizers = [ + "implicit-unsigned-integer-truncation", + "implicit-signed-integer-truncation", + "implicit-integer-sign-change", + "integer-divide-by-zero", + "signed-integer-overflow", + "unsigned-integer-overflow", + "implicit-integer-truncation", + "implicit-integer-arithmetic-value-change", + "integer", + "integer_overflow", + ] + if feature_check in integer_sanitizers: + integer_sanitizers.remove(feature_check) + + return [ + with_feature_set( + features = ["ubsan_" + integer_sanitizer], + not_features = ["ubsan_" + feature_check], + ) + for integer_sanitizer in integer_sanitizers + ] + +# The key of this dict is the package path to the blocklist, while the value is +# its filename. +# TODO: b/286872909 - When the blocking bug is complete, put these in their +# respective packages +sanitizer_blocklist_dict = { + "external/libavc": "libavc_blocklist.txt", + "external/libaom": "libaom_blocklist.txt", + "external/libvpx": "libvpx_blocklist.txt", + "frameworks/base/libs/androidfw": "libandroidfw_blocklist.txt", + "external/libhevc": "libhevc_blocklist.txt", + "external/libexif": "libexif_blocklist.txt", + "external/libopus": "libopus_blocklist.txt", + "external/libmpeg2": "libmpeg2dec_blocklist.txt", + "external/expat": "libexpat_blocklist.txt", + "external/flac/src/libFLAC": "libFLAC_blocklist.txt", + "system/extras/toolchain-extras": "libprofile_clang_extras_blocklist.txt", +} + +def _get_ubsan_blocklist_features(): + features = [] + for blocklist in sanitizer_blocklist_dict.items(): + # Format the blocklist name to be used in a feature name + blocklist_feature_name_suffix = blocklist[1].lower().replace(".", "_") + features.append( + feature( + name = "ubsan_blocklist_" + blocklist_feature_name_suffix, + enabled = False, + requires = [ + feature_set(features = ["ubsan_enabled"]), + ], + flag_sets = [ + flag_set( + actions = _actions.c_and_cpp_compile, + flag_groups = [ + flag_group( + flags = [ + "%s%s/%s" % ( + _generated_sanitizer_constants.SanitizeIgnorelistPrefix, + blocklist[0], + blocklist[1], + ), + ], + ), + ], + ), + ], + ), + ) + return features + def _get_ubsan_features(target_os, libclang_rt_ubsan_minimal): if target_os in [_oses.Windows, _oses.Darwin]: return [] @@ -2031,14 +2105,9 @@ def _get_ubsan_features(target_os, libclang_rt_ubsan_minimal): ], ), ], - with_features = [ - with_feature_set( - features = ["ubsan_integer"], - not_features = [ - "ubsan_implicit-integer-sign-change", - ], - ), - ], + with_features = _get_unsupported_integer_check_with_feature_sets( + "implicit-integer-sign-change", + ), ), # TODO(b/171275751): If this bug is fixed, this shouldn't be # needed anymore @@ -2051,19 +2120,16 @@ def _get_ubsan_features(target_os, libclang_rt_ubsan_minimal): ], ), ], - with_features = [ - with_feature_set( - features = ["ubsan_integer"], - not_features = [ - "ubsan_unsigned-shift-base", - ], - ), - ], + with_features = _get_unsupported_integer_check_with_feature_sets( + "unsigned-shift-base", + ), ), ], ), ) + ubsan_features.extend(_get_ubsan_blocklist_features()) + return ubsan_features def _manual_binder_interface_feature(): diff --git a/clang-r487747c/bin/llvm-dlltool b/clang-r487747c/bin/llvm-dlltool new file mode 120000 index 000000000..3b94d1a60 --- /dev/null +++ b/clang-r487747c/bin/llvm-dlltool @@ -0,0 +1 @@ +llvm-ar
\ No newline at end of file diff --git a/kleaf/BUILD.bazel b/kleaf/BUILD.bazel index 445453053..28b96cc77 100644 --- a/kleaf/BUILD.bazel +++ b/kleaf/BUILD.bazel @@ -20,6 +20,7 @@ load( load( ":clang_toolchain.bzl", "android_arm64_clang_toolchain", + "android_arm_clang_toolchain", "android_riscv64_clang_toolchain", "android_x86_64_clang_toolchain", "linux_x86_64_clang_toolchain", @@ -51,6 +52,11 @@ android_arm64_clang_toolchain( clang_version = VARS["CLANG_VERSION"], ) +android_arm_clang_toolchain( + name = "android_arm_clang_toolchain", + clang_version = VARS["CLANG_VERSION"], +) + android_x86_64_clang_toolchain( name = "android_x86_64_clang_toolchain", clang_version = VARS["CLANG_VERSION"], @@ -83,6 +89,12 @@ constraint_setting(name = "clang_version") extra_compatible_with = [version], ) for version in VERSIONS] +[android_arm_clang_toolchain( + name = version + "_android_arm_clang_toolchain", + clang_version = version, + extra_compatible_with = [version], +) for version in VERSIONS] + [android_x86_64_clang_toolchain( name = version + "_android_x86_64_clang_toolchain", clang_version = version, diff --git a/kleaf/clang_config.bzl b/kleaf/clang_config.bzl index 1fc3bb370..ac3afeaa6 100644 --- a/kleaf/clang_config.bzl +++ b/kleaf/clang_config.bzl @@ -51,6 +51,7 @@ clang_config = rule( attrs = { "target_cpu": attr.string(mandatory = True, values = [ "arm64", + "arm", "riscv64", "x86_64", ]), diff --git a/kleaf/clang_toolchain.bzl b/kleaf/clang_toolchain.bzl index 56e39223a..a47b2306f 100644 --- a/kleaf/clang_toolchain.bzl +++ b/kleaf/clang_toolchain.bzl @@ -207,6 +207,30 @@ def android_arm64_clang_toolchain( extra_compatible_with = extra_compatible_with, ) +def android_arm_clang_toolchain( + name, + clang_version, + extra_compatible_with = None): + """Declare an android_arm (32-bit) toolchain. + + Args: + name: name prefix + clang_version: `CLANG_VERSION` + extra_compatible_with: extra `exec_compatible_with` and `target_compatible_with` + """ + clang_toolchain( + name = name, + clang_version = clang_version, + ndk_triple = VARS.get("ARM_NDK_TRIPLE"), + # From _setup_env.sh: when NDK triple is set, + # --sysroot=${NDK_DIR}/toolchains/llvm/prebuilt/linux-x86_64/sysroot + sysroot_label = "@prebuilt_ndk//:sysroot" if "ARM_NDK_TRIPLE" in VARS else None, + sysroot_path = "external/prebuilt_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot" if "AARCH64_NDK_TRIPLE" in VARS else None, + target_cpu = "arm", + target_os = "android", + extra_compatible_with = extra_compatible_with, + ) + def android_x86_64_clang_toolchain( name, clang_version, diff --git a/kleaf/register.bzl b/kleaf/register.bzl index a1d01fcfa..264568b74 100644 --- a/kleaf/register.bzl +++ b/kleaf/register.bzl @@ -22,6 +22,7 @@ def register_clang_toolchains(): for version in VERSIONS: native.register_toolchains( "//prebuilts/clang/host/linux-x86/kleaf:{}_android_arm64_clang_toolchain".format(version), + "//prebuilts/clang/host/linux-x86/kleaf:{}_android_arm_clang_toolchain".format(version), "//prebuilts/clang/host/linux-x86/kleaf:{}_android_x86_64_clang_toolchain".format(version), "//prebuilts/clang/host/linux-x86/kleaf:{}_android_riscv64_clang_toolchain".format(version), "//prebuilts/clang/host/linux-x86/kleaf:{}_linux_x86_64_clang_toolchain".format(version), @@ -29,6 +30,7 @@ def register_clang_toolchains(): native.register_toolchains( "//prebuilts/clang/host/linux-x86/kleaf:android_arm64_clang_toolchain", + "//prebuilts/clang/host/linux-x86/kleaf:android_arm_clang_toolchain", "//prebuilts/clang/host/linux-x86/kleaf:android_x86_64_clang_toolchain", "//prebuilts/clang/host/linux-x86/kleaf:android_riscv64_clang_toolchain", "//prebuilts/clang/host/linux-x86/kleaf:linux_x86_64_clang_toolchain", diff --git a/profiles/pgo-r487747.tar.bz2 b/profiles/pgo-r498229.tar.bz2 Binary files differindex a11982729..5eec1c6bc 100644 --- a/profiles/pgo-r487747.tar.bz2 +++ b/profiles/pgo-r498229.tar.bz2 |