From 11a11259724b7bd4b252427f8025efaf560fb188 Mon Sep 17 00:00:00 2001 From: Ryan Macnak Date: Mon, 2 Dec 2024 19:43:53 +0000 Subject: [PATCH] Switch boringssl to the pre-generated GN source list. With no generation step remaining on our end, stop using the boringssl_gen repository. This makes updating boringssl simple enough for an autoroller. Change-Id: Ice7a5cd6b8a2414405146011b7cf3f24dd92d0db Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/397985 Reviewed-by: Alexander Aprelev Commit-Queue: Ryan Macnak Reviewed-by: Siva Annamalai --- DEPS | 3 -- third_party/boringssl/BUILD.gn | 91 ++++++++++++++++++++++++++++++++++ third_party/boringssl/OWNERS | 1 + tools/gn.py | 2 - 4 files changed, 92 insertions(+), 5 deletions(-) create mode 100644 third_party/boringssl/BUILD.gn create mode 100644 third_party/boringssl/OWNERS diff --git a/DEPS b/DEPS index 488eabfbfea0..edc85ec4f415 100644 --- a/DEPS +++ b/DEPS @@ -98,7 +98,6 @@ vars = { # Prefer to use hashes of binaryen that have been reviewed & rolled into g3. "binaryen_rev" : "93883fde36ac158fd415dcd6dbd387dcfd928d3c", - "boringssl_gen_rev": "b67a5fe651e1618baa311e452e3c188d96db2021", "boringssl_rev": "cd95210465496ac2337b313cf49f607762abe286", "browser-compat-data_tag": "ac8cae697014da1ff7124fba33b0b4245cc6cd1b", # v1.0.22 "cpu_features_rev": "936b9ab5515dead115606559502e3864958f7f6e", @@ -304,8 +303,6 @@ deps = { Var("dart_root") + "/third_party/libcxxabi": Var("llvm_git") + "/llvm-project/libcxxabi" + "@" + Var("libcxxabi_rev"), - Var("dart_root") + "/third_party/boringssl": - Var("dart_git") + "boringssl_gen.git" + "@" + Var("boringssl_gen_rev"), Var("dart_root") + "/third_party/boringssl/src": "https://boringssl.googlesource.com/boringssl.git" + "@" + Var("boringssl_rev"), diff --git a/third_party/boringssl/BUILD.gn b/third_party/boringssl/BUILD.gn new file mode 100644 index 000000000000..3c8b0667a552 --- /dev/null +++ b/third_party/boringssl/BUILD.gn @@ -0,0 +1,91 @@ +# Copyright 2014 The Chromium Authors +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//build/config/android/config.gni") +import("//build/config/arm.gni") +import("//build/config/compiler/compiler.gni") +import("//build/config/sanitizers/sanitizers.gni") +import("//build_overrides/build.gni") +import("src/gen/sources.gni") + +# Config for us and everybody else depending on BoringSSL. +config("external_config") { + include_dirs = [ "src/include" ] + if (is_component_build) { + defines = [ "BORINGSSL_SHARED_LIBRARY" ] + } +} + +# The config used by the :boringssl component itself, and the fuzzer copies. +config("component_config") { + visibility = [ ":*" ] + configs = [ ":internal_config" ] + defines = [ "BORINGSSL_IMPLEMENTATION" ] +} + +# This config is used by anything that consumes internal headers. Tests consume +# this rather than :component_config. +config("internal_config") { + visibility = [ ":*" ] + defines = [ + "OPENSSL_SMALL", + "OPENSSL_STATIC_ARMCAP", + ] + if (is_posix) { + defines += [ "_XOPEN_SOURCE=700" ] + } +} + +config("no_asm_config") { + visibility = [ ":*" ] + defines = [ "OPENSSL_NO_ASM" ] +} + +# TODO(crbug.com/42290535): Move Chromium's use of libpki to the public API and +# unexport pki_internal_headers. +all_sources = bcm_internal_headers + bcm_sources + crypto_internal_headers + + crypto_sources + ssl_internal_headers + ssl_sources + pki_sources +all_headers = crypto_headers + ssl_headers + pki_headers + pki_internal_headers + +if (is_msan) { + # MSan instrumentation is incompatible with assembly optimizations. + # BoringSSL's GAS-compatible assembly knows how to detect MSan, but the NASM + # assembly does not, so we check for MSan explicitly. + source_set("boringssl_asm") { + visibility = [ ":*" ] + public_configs = [ ":no_asm_config" ] + } +} else if (is_win && (current_cpu == "x86" || current_cpu == "x64")) { + # Windows' x86 and x86_64 assembly is built with NASM. + source_set("boringssl_asm") { + visibility = [ ":*" ] + public_configs = [ ":no_asm_config" ] + } +} else { + # All other targets use GAS-compatible assembler. BoringSSL's assembly files + # are all wrapped in processor checks for the corresponding target, so there + # is no need to add target conditions in the build. + source_set("boringssl_asm") { + visibility = [ ":*" ] + sources = rebase_path(bcm_sources_asm + crypto_sources_asm, ".", "src") + include_dirs = [ "src/include" ] + } +} + +source_set("boringssl") { + sources = rebase_path(all_sources, ".", "src") + public = rebase_path(all_headers, ".", "src") + + if (is_win) { + configs += [ ":no_asm_config" ] + } else { + deps = [ ":boringssl_asm" ] + } + + public_configs = [ ":external_config" ] + configs += [ ":component_config" ] + + configs -= [ "//build/config/compiler:chromium_code" ] + configs += [ "//build/config/compiler:no_chromium_code" ] +} diff --git a/third_party/boringssl/OWNERS b/third_party/boringssl/OWNERS new file mode 100644 index 000000000000..dc3a1d027539 --- /dev/null +++ b/third_party/boringssl/OWNERS @@ -0,0 +1 @@ +file:/tools/OWNERS_VM diff --git a/tools/gn.py b/tools/gn.py index 1a7c5cfb6700..905c82baec2d 100755 --- a/tools/gn.py +++ b/tools/gn.py @@ -227,8 +227,6 @@ def ToGnArgs(args, mode, arch, target_os, sanitizer, verify_sdk_hash, if gn_args['target_os'] in ['linux', 'win']: gn_args['dart_use_fallback_root_certificates'] = True - gn_args['bssl_use_clang_integrated_as'] = True - if gn_args['target_os'] == 'linux': if gn_args['target_cpu'] == 'arm': # Default to -mfloat-abi=hard and -mfpu=neon for arm on Linux as we're