Merge changes I980677f3,If2d0d04f,I3bc7a0d5,I1e956ab5,Ic5b62063, ...

* changes:
  gn2bp: collect sources for each architecture
  gn2bp: add code that collects common sources
  gn2bp: get arch from toolchain
  gn2bp: remove toolchain label from dependencies
  gn2bp: add arch to Target
  gn2bp: use name without toolchain for Targets
  gn2bp: remove unused third_party deps handling
  gn2bp: pass gn_target_name into get_proto_target_type
  gn2bp: pass gn_desc to parse_gn_desc
  gn2bp: separate parsing gn desc from retrieving Target object
  gn2bp: use discard instead of remove
  gn2bp: do not build root_store_tool
  gn2bp: link libprotobuf statically
diff --git a/tools/gn2bp/Android.bp.swp b/tools/gn2bp/Android.bp.swp
index 376b8f1..9e183fe 100644
--- a/tools/gn2bp/Android.bp.swp
+++ b/tools/gn2bp/Android.bp.swp
@@ -139,13 +139,20 @@
         "-DANDROID_NDK_VERSION_ROLL=r23_1",
         "-DCR_CLANG_REVISION=\"llvmorg-16-init-8697-g60809cd2-1\"",
         "-DCR_LIBCXX_REVISION=47b31179d10646029c260702650a25d24f555acc",
+        "-DCR_SYSROOT_KEY=20220331T153654Z-0",
         "-DDCHECK_ALWAYS_ON=1",
         "-DDYNAMIC_ANNOTATIONS_ENABLED=1",
         "-DHAVE_SYS_UIO_H",
         "-DIS_PARTITION_ALLOC_IMPL",
         "-DPA_PCSCAN_STACK_SUPPORTED",
+        "-DUSE_AURA=1",
+        "-DUSE_OZONE=1",
+        "-DUSE_UDEV",
         "-D_DEBUG",
+        "-D_FILE_OFFSET_BITS=64",
         "-D_GNU_SOURCE",
+        "-D_LARGEFILE64_SOURCE",
+        "-D_LARGEFILE_SOURCE",
         "-D_LIBCPP_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED=1",
         "-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
         "-D_LIBCPP_ENABLE_ASSERTIONS_DEFAULT=1",
@@ -159,6 +166,8 @@
         "buildtools/third_party/libc++/trunk/include",
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/android_ndk/sources/android/cpufeatures/",
+        "build/linux/debian_bullseye_amd64-sysroot/usr/include/x86_64-linux-gnu",
+        "build/linux/debian_bullseye_amd64-sysroot/usr/include",
         "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
     ],
     cpp_std: "c++20",
@@ -182,12 +191,9 @@
                 "base/allocator/partition_allocator/partition_alloc_base/check.cc",
                 "base/allocator/partition_allocator/partition_alloc_base/cpu.cc",
                 "base/allocator/partition_allocator/partition_alloc_base/debug/alias.cc",
-                "base/allocator/partition_allocator/partition_alloc_base/files/file_path.cc",
                 "base/allocator/partition_allocator/partition_alloc_base/files/file_util_posix.cc",
                 "base/allocator/partition_allocator/partition_alloc_base/logging.cc",
                 "base/allocator/partition_allocator/partition_alloc_base/memory/ref_counted.cc",
-                "base/allocator/partition_allocator/partition_alloc_base/native_library.cc",
-                "base/allocator/partition_allocator/partition_alloc_base/native_library_posix.cc",
                 "base/allocator/partition_allocator/partition_alloc_base/pkey.cc",
                 "base/allocator/partition_allocator/partition_alloc_base/posix/safe_strerror.cc",
                 "base/allocator/partition_allocator/partition_alloc_base/rand_util.cc",
@@ -196,7 +202,6 @@
                 "base/allocator/partition_allocator/partition_alloc_base/threading/platform_thread.cc",
                 "base/allocator/partition_allocator/partition_alloc_base/threading/platform_thread_posix.cc",
                 "base/allocator/partition_allocator/partition_alloc_base/time/time.cc",
-                "base/allocator/partition_allocator/partition_alloc_base/time/time_android.cc",
                 "base/allocator/partition_allocator/partition_alloc_base/time/time_conversion_posix.cc",
                 "base/allocator/partition_allocator/partition_alloc_base/time/time_now_posix.cc",
                 "base/allocator/partition_allocator/partition_alloc_base/time/time_override.cc",
@@ -241,12 +246,9 @@
                 "base/allocator/partition_allocator/partition_alloc_base/check.cc",
                 "base/allocator/partition_allocator/partition_alloc_base/cpu.cc",
                 "base/allocator/partition_allocator/partition_alloc_base/debug/alias.cc",
-                "base/allocator/partition_allocator/partition_alloc_base/files/file_path.cc",
                 "base/allocator/partition_allocator/partition_alloc_base/files/file_util_posix.cc",
                 "base/allocator/partition_allocator/partition_alloc_base/logging.cc",
                 "base/allocator/partition_allocator/partition_alloc_base/memory/ref_counted.cc",
-                "base/allocator/partition_allocator/partition_alloc_base/native_library.cc",
-                "base/allocator/partition_allocator/partition_alloc_base/native_library_posix.cc",
                 "base/allocator/partition_allocator/partition_alloc_base/pkey.cc",
                 "base/allocator/partition_allocator/partition_alloc_base/posix/safe_strerror.cc",
                 "base/allocator/partition_allocator/partition_alloc_base/rand_util.cc",
@@ -255,7 +257,6 @@
                 "base/allocator/partition_allocator/partition_alloc_base/threading/platform_thread.cc",
                 "base/allocator/partition_allocator/partition_alloc_base/threading/platform_thread_posix.cc",
                 "base/allocator/partition_allocator/partition_alloc_base/time/time.cc",
-                "base/allocator/partition_allocator/partition_alloc_base/time/time_android.cc",
                 "base/allocator/partition_allocator/partition_alloc_base/time/time_conversion_posix.cc",
                 "base/allocator/partition_allocator/partition_alloc_base/time/time_now_posix.cc",
                 "base/allocator/partition_allocator/partition_alloc_base/time/time_override.cc",
@@ -287,7 +288,7 @@
 // GN: //base/allocator/partition_allocator:partition_alloc_buildflags
 genrule {
     name: "cronet_aml_base_allocator_partition_allocator_partition_alloc_buildflags",
-    cmd: "echo '--flags ENABLE_PARTITION_ALLOC_AS_MALLOC_SUPPORT=\"true\" ENABLE_BACKUP_REF_PTR_SUPPORT=\"true\" ENABLE_BACKUP_REF_PTR_SLOW_CHECKS=\"false\" ENABLE_DANGLING_RAW_PTR_CHECKS=\"false\" PUT_REF_COUNT_IN_PREVIOUS_SLOT=\"true\" ENABLE_GWP_ASAN_SUPPORT=\"true\" ENABLE_MTE_CHECKED_PTR_SUPPORT=\"false\" RECORD_ALLOC_INFO=\"false\" USE_FREESLOT_BITMAP=\"false\" GLUE_CORE_POOLS=\"false\" ENABLE_SHADOW_METADATA_FOR_64_BITS_POINTERS=\"false\" STARSCAN=\"true\" PA_USE_BASE_TRACING=\"true\" ENABLE_PKEYS=\"false\"' | " +
+    cmd: "echo '--flags ENABLE_PARTITION_ALLOC_AS_MALLOC_SUPPORT=\"true\" ENABLE_BACKUP_REF_PTR_SUPPORT=\"true\" ENABLE_BACKUP_REF_PTR_SLOW_CHECKS=\"false\" ENABLE_DANGLING_RAW_PTR_CHECKS=\"false\" PUT_REF_COUNT_IN_PREVIOUS_SLOT=\"true\" ENABLE_GWP_ASAN_SUPPORT=\"true\" ENABLE_MTE_CHECKED_PTR_SUPPORT=\"false\" RECORD_ALLOC_INFO=\"false\" USE_FREESLOT_BITMAP=\"false\" GLUE_CORE_POOLS=\"false\" ENABLE_SHADOW_METADATA_FOR_64_BITS_POINTERS=\"false\" STARSCAN=\"true\" PA_USE_BASE_TRACING=\"true\" ENABLE_PKEYS=\"true\"' | " +
          "$(location build/write_buildflag_header.py) --output " +
          "$(out) " +
          "--rulename " +
@@ -307,7 +308,7 @@
 // GN: //base:anchor_functions_buildflags
 genrule {
     name: "cronet_aml_base_anchor_functions_buildflags",
-    cmd: "echo '--flags USE_LLD=\"true\" SUPPORTS_CODE_ORDERING=\"true\"' | " +
+    cmd: "echo '--flags USE_LLD=\"true\" SUPPORTS_CODE_ORDERING=\"false\"' | " +
          "$(location build/write_buildflag_header.py) --output " +
          "$(out) " +
          "--rulename " +
@@ -485,69 +486,11 @@
         "base/allocator/dispatcher/internal/dispatch_data.cc",
         "base/allocator/dispatcher/reentry_guard.cc",
         "base/allocator/partition_allocator/shim/allocator_shim.cc",
-        "base/allocator/partition_allocator/shim/allocator_shim_default_dispatch_to_linker_wrapped_symbols.cc",
-        "base/android/android_hardware_buffer_compat.cc",
-        "base/android/android_image_reader_compat.cc",
-        "base/android/apk_assets.cc",
-        "base/android/application_status_listener.cc",
-        "base/android/base_feature_list.cc",
-        "base/android/base_features.cc",
-        "base/android/base_jni_onload.cc",
-        "base/android/build_info.cc",
-        "base/android/bundle_utils.cc",
-        "base/android/callback_android.cc",
-        "base/android/child_process_service.cc",
-        "base/android/command_line_android.cc",
-        "base/android/content_uri_utils.cc",
-        "base/android/cpu_features.cc",
-        "base/android/early_trace_event_binding.cc",
-        "base/android/event_log.cc",
-        "base/android/feature_list_jni.cc",
-        "base/android/features_jni.cc",
-        "base/android/field_trial_list.cc",
-        "base/android/important_file_writer_android.cc",
-        "base/android/int_string_callback.cc",
-        "base/android/jank_metric_uma_recorder.cc",
-        "base/android/java_exception_reporter.cc",
-        "base/android/java_handler_thread.cc",
-        "base/android/java_heap_dump_generator.cc",
-        "base/android/java_runtime.cc",
-        "base/android/jni_android.cc",
-        "base/android/jni_array.cc",
-        "base/android/jni_registrar.cc",
-        "base/android/jni_string.cc",
-        "base/android/jni_utils.cc",
-        "base/android/jni_weak_ref.cc",
-        "base/android/library_loader/anchor_functions.cc",
-        "base/android/library_loader/library_loader_hooks.cc",
-        "base/android/library_loader/library_prefetcher.cc",
-        "base/android/library_loader/library_prefetcher_hooks.cc",
-        "base/android/locale_utils.cc",
-        "base/android/memory_pressure_listener_android.cc",
-        "base/android/native_uma_recorder.cc",
-        "base/android/path_service_android.cc",
-        "base/android/path_utils.cc",
-        "base/android/radio_utils.cc",
-        "base/android/reached_addresses_bitset.cc",
-        "base/android/reached_code_profiler_stub.cc",
-        "base/android/remove_stale_data.cc",
-        "base/android/scoped_hardware_buffer_fence_sync.cc",
-        "base/android/scoped_hardware_buffer_handle.cc",
-        "base/android/scoped_java_ref.cc",
-        "base/android/statistics_recorder_android.cc",
-        "base/android/sys_utils.cc",
-        "base/android/task_scheduler/post_task_android.cc",
-        "base/android/task_scheduler/task_runner_android.cc",
-        "base/android/thread_instruction_count.cc",
-        "base/android/timezone_utils.cc",
-        "base/android/trace_event_binding.cc",
-        "base/android/unguessable_token_android.cc",
         "base/at_exit.cc",
         "base/barrier_closure.cc",
         "base/base64.cc",
         "base/base64url.cc",
         "base/base_paths.cc",
-        "base/base_paths_android.cc",
         "base/big_endian.cc",
         "base/build_time.cc",
         "base/callback_list.cc",
@@ -574,7 +517,6 @@
         "base/debug/proc_maps_linux.cc",
         "base/debug/profiler.cc",
         "base/debug/stack_trace.cc",
-        "base/debug/stack_trace_android.cc",
         "base/debug/task_trace.cc",
         "base/environment.cc",
         "base/feature_list.cc",
@@ -592,7 +534,6 @@
         "base/files/file_proxy.cc",
         "base/files/file_tracing.cc",
         "base/files/file_util.cc",
-        "base/files/file_util_android.cc",
         "base/files/file_util_posix.cc",
         "base/files/important_file_writer.cc",
         "base/files/important_file_writer_cleaner.cc",
@@ -600,7 +541,6 @@
         "base/files/memory_mapped_file_posix.cc",
         "base/files/safe_base_name.cc",
         "base/files/scoped_file.cc",
-        "base/files/scoped_file_android.cc",
         "base/files/scoped_temp_dir.cc",
         "base/functional/callback_helpers.cc",
         "base/functional/callback_internal.cc",
@@ -632,9 +572,7 @@
         "base/memory/nonscannable_memory.cc",
         "base/memory/page_size_posix.cc",
         "base/memory/platform_shared_memory_handle.cc",
-        "base/memory/platform_shared_memory_mapper_android.cc",
         "base/memory/platform_shared_memory_region.cc",
-        "base/memory/platform_shared_memory_region_android.cc",
         "base/memory/raw_ptr.cc",
         "base/memory/raw_ptr_asan_bound_arg_tracker.cc",
         "base/memory/raw_ptr_asan_service.cc",
@@ -650,7 +588,6 @@
         "base/memory/weak_ptr.cc",
         "base/memory/writable_shared_memory_region.cc",
         "base/message_loop/message_pump.cc",
-        "base/message_loop/message_pump_android.cc",
         "base/message_loop/message_pump_default.cc",
         "base/message_loop/message_pump_epoll.cc",
         "base/message_loop/message_pump_libevent.cc",
@@ -686,7 +623,6 @@
         "base/observer_list_threadsafe.cc",
         "base/observer_list_types.cc",
         "base/one_shot_event.cc",
-        "base/os_compat_android.cc",
         "base/path_service.cc",
         "base/pending_task.cc",
         "base/pickle.cc",
@@ -700,7 +636,6 @@
         "base/power_monitor/moving_average.cc",
         "base/power_monitor/power_monitor.cc",
         "base/power_monitor/power_monitor_device_source.cc",
-        "base/power_monitor/power_monitor_device_source_android.cc",
         "base/power_monitor/power_monitor_features.cc",
         "base/power_monitor/power_monitor_source.cc",
         "base/power_monitor/sampling_event_source.cc",
@@ -713,7 +648,6 @@
         "base/process/launch_posix.cc",
         "base/process/memory.cc",
         "base/process/memory_linux.cc",
-        "base/process/process_android.cc",
         "base/process/process_handle.cc",
         "base/process/process_handle_linux.cc",
         "base/process/process_handle_posix.cc",
@@ -736,7 +670,6 @@
         "base/profiler/stack_copier_signal.cc",
         "base/profiler/stack_copier_suspend.cc",
         "base/profiler/stack_sampler.cc",
-        "base/profiler/stack_sampler_android.cc",
         "base/profiler/stack_sampler_impl.cc",
         "base/profiler/stack_sampling_profiler.cc",
         "base/profiler/thread_delegate_posix.cc",
@@ -783,7 +716,6 @@
         "base/synchronization/waitable_event_watcher_posix.cc",
         "base/syslog_logging.cc",
         "base/system/sys_info.cc",
-        "base/system/sys_info_android.cc",
         "base/system/sys_info_linux.cc",
         "base/system/sys_info_posix.cc",
         "base/system/system_monitor.cc",
@@ -862,7 +794,6 @@
         "base/third_party/superfasthash/superfasthash.c",
         "base/threading/hang_watcher.cc",
         "base/threading/platform_thread.cc",
-        "base/threading/platform_thread_android.cc",
         "base/threading/platform_thread_internal_posix.cc",
         "base/threading/platform_thread_posix.cc",
         "base/threading/platform_thread_ref.cc",
@@ -889,7 +820,6 @@
         "base/time/default_tick_clock.cc",
         "base/time/tick_clock.cc",
         "base/time/time.cc",
-        "base/time/time_android.cc",
         "base/time/time_conversion_posix.cc",
         "base/time/time_delta_from_string.cc",
         "base/time/time_exploded_icu.cc",
@@ -923,6 +853,9 @@
         "cronet_aml_base_base_static",
         "cronet_aml_base_third_party_double_conversion_double_conversion",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
+        "cronet_aml_base_third_party_symbolize_symbolize",
+        "cronet_aml_base_third_party_xdg_mime_xdg_mime",
+        "cronet_aml_base_third_party_xdg_user_dirs_xdg_user_dirs",
         "cronet_aml_third_party_boringssl_boringssl",
         "cronet_aml_third_party_icu_icui18n",
         "cronet_aml_third_party_icu_icuuc_private",
@@ -999,18 +932,27 @@
         "-DBASE_IMPLEMENTATION",
         "-DCR_CLANG_REVISION=\"llvmorg-16-init-8697-g60809cd2-1\"",
         "-DCR_LIBCXX_REVISION=47b31179d10646029c260702650a25d24f555acc",
+        "-DCR_SYSROOT_KEY=20220331T153654Z-0",
         "-DDCHECK_ALWAYS_ON=1",
         "-DDYNAMIC_ANNOTATIONS_ENABLED=1",
+        "-DGLOG_EXPORT=",
         "-DHAVE_SYS_UIO_H",
         "-DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE",
+        "-DUSE_AURA=1",
         "-DUSE_CHROMIUM_ICU=1",
+        "-DUSE_OZONE=1",
+        "-DUSE_SYMBOLIZE",
+        "-DUSE_UDEV",
         "-DU_ENABLE_DYLOAD=0",
         "-DU_ENABLE_RESOURCE_TRACING=0",
         "-DU_ENABLE_TRACING=1",
         "-DU_STATIC_IMPLEMENTATION",
         "-DU_USING_ICU_NAMESPACE=0",
         "-D_DEBUG",
+        "-D_FILE_OFFSET_BITS=64",
         "-D_GNU_SOURCE",
+        "-D_LARGEFILE64_SOURCE",
+        "-D_LARGEFILE_SOURCE",
         "-D_LIBCPP_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED=1",
         "-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
         "-D_LIBCPP_ENABLE_ASSERTIONS_DEFAULT=1",
@@ -1028,6 +970,8 @@
         "third_party/boringssl/src/include/",
         "third_party/icu/source/common/",
         "third_party/icu/source/i18n/",
+        "build/linux/debian_bullseye_amd64-sysroot/usr/include/x86_64-linux-gnu",
+        "build/linux/debian_bullseye_amd64-sysroot/usr/include",
         "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
     ],
     header_libs: [
@@ -1321,11 +1265,18 @@
         "-DANDROID_NDK_VERSION_ROLL=r23_1",
         "-DCR_CLANG_REVISION=\"llvmorg-16-init-8697-g60809cd2-1\"",
         "-DCR_LIBCXX_REVISION=47b31179d10646029c260702650a25d24f555acc",
+        "-DCR_SYSROOT_KEY=20220331T153654Z-0",
         "-DDCHECK_ALWAYS_ON=1",
         "-DDYNAMIC_ANNOTATIONS_ENABLED=1",
         "-DHAVE_SYS_UIO_H",
+        "-DUSE_AURA=1",
+        "-DUSE_OZONE=1",
+        "-DUSE_UDEV",
         "-D_DEBUG",
+        "-D_FILE_OFFSET_BITS=64",
         "-D_GNU_SOURCE",
+        "-D_LARGEFILE64_SOURCE",
+        "-D_LARGEFILE_SOURCE",
         "-D_LIBCPP_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED=1",
         "-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
         "-D_LIBCPP_ENABLE_ASSERTIONS_DEFAULT=1",
@@ -1338,6 +1289,8 @@
         "buildtools/third_party/libc++/",
         "buildtools/third_party/libc++/trunk/include",
         "buildtools/third_party/libc++abi/trunk/include",
+        "build/linux/debian_bullseye_amd64-sysroot/usr/include/x86_64-linux-gnu",
+        "build/linux/debian_bullseye_amd64-sysroot/usr/include",
         "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
     ],
     cpp_std: "c++20",
@@ -1399,7 +1352,7 @@
 // GN: //base:debugging_buildflags
 genrule {
     name: "cronet_aml_base_debugging_buildflags",
-    cmd: "echo '--flags DCHECK_IS_CONFIGURABLE=\"false\" ENABLE_LOCATION_SOURCE=\"true\" ENABLE_PROFILING=\"false\" CAN_UNWIND_WITH_FRAME_POINTERS=\"false\" UNSAFE_DEVELOPER_BUILD=\"true\" CAN_UNWIND_WITH_CFI_TABLE=\"false\" EXCLUDE_UNWIND_TABLES=\"false\" ENABLE_GDBINIT_WARNING=\"true\" ENABLE_LLDBINIT_WARNING=\"false\" EXPENSIVE_DCHECKS_ARE_ON=\"true\" ENABLE_STACK_TRACE_LINE_NUMBERS=\"false\"' | " +
+    cmd: "echo '--flags DCHECK_IS_CONFIGURABLE=\"false\" ENABLE_LOCATION_SOURCE=\"true\" ENABLE_PROFILING=\"false\" CAN_UNWIND_WITH_FRAME_POINTERS=\"true\" UNSAFE_DEVELOPER_BUILD=\"true\" CAN_UNWIND_WITH_CFI_TABLE=\"false\" EXCLUDE_UNWIND_TABLES=\"false\" ENABLE_GDBINIT_WARNING=\"true\" ENABLE_LLDBINIT_WARNING=\"false\" EXPENSIVE_DCHECKS_ARE_ON=\"true\" ENABLE_STACK_TRACE_LINE_NUMBERS=\"false\"' | " +
          "$(location build/write_buildflag_header.py) --output " +
          "$(out) " +
          "--rulename " +
@@ -1642,11 +1595,18 @@
         "-DANDROID_NDK_VERSION_ROLL=r23_1",
         "-DCR_CLANG_REVISION=\"llvmorg-16-init-8697-g60809cd2-1\"",
         "-DCR_LIBCXX_REVISION=47b31179d10646029c260702650a25d24f555acc",
+        "-DCR_SYSROOT_KEY=20220331T153654Z-0",
         "-DDCHECK_ALWAYS_ON=1",
         "-DDYNAMIC_ANNOTATIONS_ENABLED=1",
         "-DHAVE_SYS_UIO_H",
+        "-DUSE_AURA=1",
+        "-DUSE_OZONE=1",
+        "-DUSE_UDEV",
         "-D_DEBUG",
+        "-D_FILE_OFFSET_BITS=64",
         "-D_GNU_SOURCE",
+        "-D_LARGEFILE64_SOURCE",
+        "-D_LARGEFILE_SOURCE",
         "-D_LIBCPP_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED=1",
         "-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
         "-D_LIBCPP_ENABLE_ASSERTIONS_DEFAULT=1",
@@ -1659,6 +1619,8 @@
         "buildtools/third_party/libc++/",
         "buildtools/third_party/libc++/trunk/include",
         "buildtools/third_party/libc++abi/trunk/include",
+        "build/linux/debian_bullseye_amd64-sysroot/usr/include/x86_64-linux-gnu",
+        "build/linux/debian_bullseye_amd64-sysroot/usr/include",
         "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
     ],
     cpp_std: "c++20",
@@ -1678,11 +1640,18 @@
         "-DANDROID_NDK_VERSION_ROLL=r23_1",
         "-DCR_CLANG_REVISION=\"llvmorg-16-init-8697-g60809cd2-1\"",
         "-DCR_LIBCXX_REVISION=47b31179d10646029c260702650a25d24f555acc",
+        "-DCR_SYSROOT_KEY=20220331T153654Z-0",
         "-DDCHECK_ALWAYS_ON=1",
         "-DDYNAMIC_ANNOTATIONS_ENABLED=1",
         "-DHAVE_SYS_UIO_H",
+        "-DUSE_AURA=1",
+        "-DUSE_OZONE=1",
+        "-DUSE_UDEV",
         "-D_DEBUG",
+        "-D_FILE_OFFSET_BITS=64",
         "-D_GNU_SOURCE",
+        "-D_LARGEFILE64_SOURCE",
+        "-D_LARGEFILE_SOURCE",
         "-D_LIBCPP_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED=1",
         "-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
         "-D_LIBCPP_ENABLE_ASSERTIONS_DEFAULT=1",
@@ -1693,6 +1662,8 @@
         "buildtools/third_party/libc++/",
         "buildtools/third_party/libc++/trunk/include",
         "buildtools/third_party/libc++abi/trunk/include",
+        "build/linux/debian_bullseye_amd64-sysroot/usr/include/x86_64-linux-gnu",
+        "build/linux/debian_bullseye_amd64-sysroot/usr/include",
         "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
     ],
     cpp_std: "c++20",
@@ -1832,7 +1803,7 @@
 // GN: //base:tracing_buildflags
 genrule {
     name: "cronet_aml_base_tracing_buildflags",
-    cmd: "echo '--flags ENABLE_BASE_TRACING=\"false\" USE_PERFETTO_CLIENT_LIBRARY=\"false\" OPTIONAL_TRACE_EVENTS_ENABLED=\"false\"' | " +
+    cmd: "echo '--flags ENABLE_BASE_TRACING=\"false\" USE_PERFETTO_CLIENT_LIBRARY=\"false\" OPTIONAL_TRACE_EVENTS_ENABLED=\"true\"' | " +
          "$(location build/write_buildflag_header.py) --output " +
          "$(out) " +
          "--rulename " +
@@ -1917,7 +1888,7 @@
 // GN: //build/config/compiler:compiler_buildflags
 genrule {
     name: "cronet_aml_build_config_compiler_compiler_buildflags",
-    cmd: "echo '--flags CLANG_PGO=\"0\" SYMBOL_LEVEL=\"1\"' | " +
+    cmd: "echo '--flags CLANG_PGO=\"0\" SYMBOL_LEVEL=\"2\"' | " +
          "$(location build/write_buildflag_header.py) --output " +
          "$(out) " +
          "--rulename " +
@@ -1987,7 +1958,6 @@
 filegroup {
     name: "cronet_aml_buildtools_third_party_libc__abi_libc__abi",
     srcs: [
-        "buildtools/third_party/libc++abi/cxa_demangle_stub.cc",
         "buildtools/third_party/libc++abi/trunk/src/abort_message.cpp",
         "buildtools/third_party/libc++abi/trunk/src/cxa_aux_runtime.cpp",
         "buildtools/third_party/libc++abi/trunk/src/cxa_default_handlers.cpp",
@@ -2407,6 +2377,26 @@
     ],
 }
 
+// GN: //components/nacl/common:buildflags
+genrule {
+    name: "cronet_aml_components_nacl_common_buildflags",
+    cmd: "echo '--flags ENABLE_NACL=\"true\" IS_MINIMAL_TOOLCHAIN=\"false\"' | " +
+         "$(location build/write_buildflag_header.py) --output " +
+         "$(out) " +
+         "--rulename " +
+         "//components/nacl/common:buildflags " +
+         "--gen-dir " +
+         ". " +
+         "--definitions " +
+         "/dev/stdin",
+    out: [
+        "components/nacl/common/buildflags.h",
+    ],
+    tool_files: [
+        "build/write_buildflag_header.py",
+    ],
+}
+
 // GN: //components/prefs/android:jni_headers
 genrule {
     name: "cronet_aml_components_prefs_android_jni_headers",
@@ -2531,7 +2521,7 @@
 // GN: //crypto:buildflags
 genrule {
     name: "cronet_aml_crypto_buildflags",
-    cmd: "echo '--flags USE_NSS_CERTS=\"false\"' | " +
+    cmd: "echo '--flags USE_NSS_CERTS=\"true\"' | " +
          "$(location build/write_buildflag_header.py) --output " +
          "$(out) " +
          "--rulename " +
@@ -2582,6 +2572,9 @@
         "cronet_aml_base_base_static",
         "cronet_aml_base_third_party_double_conversion_double_conversion",
         "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
+        "cronet_aml_base_third_party_symbolize_symbolize",
+        "cronet_aml_base_third_party_xdg_mime_xdg_mime",
+        "cronet_aml_base_third_party_xdg_user_dirs_xdg_user_dirs",
         "cronet_aml_third_party_boringssl_boringssl",
         "cronet_aml_third_party_icu_icui18n",
         "cronet_aml_third_party_icu_icuuc_private",
@@ -2589,9 +2582,13 @@
         "cronet_aml_third_party_modp_b64_modp_b64",
     ],
     generated_headers: [
+        "cronet_aml_build_chromeos_buildflags",
+        "cronet_aml_components_nacl_common_buildflags",
         "cronet_aml_crypto_buildflags",
     ],
     export_generated_headers: [
+        "cronet_aml_build_chromeos_buildflags",
+        "cronet_aml_components_nacl_common_buildflags",
         "cronet_aml_crypto_buildflags",
     ],
     defaults: [
@@ -2603,11 +2600,18 @@
         "-DCRYPTO_IMPLEMENTATION",
         "-DCR_CLANG_REVISION=\"llvmorg-16-init-8697-g60809cd2-1\"",
         "-DCR_LIBCXX_REVISION=47b31179d10646029c260702650a25d24f555acc",
+        "-DCR_SYSROOT_KEY=20220331T153654Z-0",
         "-DDCHECK_ALWAYS_ON=1",
         "-DDYNAMIC_ANNOTATIONS_ENABLED=1",
         "-DHAVE_SYS_UIO_H",
+        "-DUSE_AURA=1",
+        "-DUSE_OZONE=1",
+        "-DUSE_UDEV",
         "-D_DEBUG",
+        "-D_FILE_OFFSET_BITS=64",
         "-D_GNU_SOURCE",
+        "-D_LARGEFILE64_SOURCE",
+        "-D_LARGEFILE_SOURCE",
         "-D_LIBCPP_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED=1",
         "-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
         "-D_LIBCPP_ENABLE_ASSERTIONS_DEFAULT=1",
@@ -2617,11 +2621,15 @@
     ],
     local_include_dirs: [
         "./",
+        "build/linux/debian_bullseye_amd64-sysroot/usr/include/nspr",
+        "build/linux/debian_bullseye_amd64-sysroot/usr/include/nss",
         "buildtools/third_party/libc++/",
         "buildtools/third_party/libc++/trunk/include",
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/abseil-cpp/",
         "third_party/boringssl/src/include/",
+        "build/linux/debian_bullseye_amd64-sysroot/usr/include/x86_64-linux-gnu",
+        "build/linux/debian_bullseye_amd64-sysroot/usr/include",
         "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
     ],
     cpp_std: "c++20",
@@ -2752,41 +2760,6 @@
     ],
 }
 
-// GN: //net/cert:root_store_proto_full
-genrule {
-    name: "cronet_aml_net_cert_root_store_proto_full_gen",
-    srcs: [
-        "net/cert/root_store.proto",
-    ],
-    tools: [
-        "aprotoc",
-    ],
-    cmd: "$(location aprotoc) --proto_path=external/chromium_org/net/cert --cpp_out=lite=true:$(genDir)/external/chromium_org/net/cert/ $(in)",
-    out: [
-        "external/chromium_org/net/cert/root_store.pb.cc",
-    ],
-}
-
-// GN: //net/cert:root_store_proto_full
-genrule {
-    name: "cronet_aml_net_cert_root_store_proto_full_gen_headers",
-    srcs: [
-        "net/cert/root_store.proto",
-    ],
-    tools: [
-        "aprotoc",
-    ],
-    cmd: "$(location aprotoc) --proto_path=external/chromium_org/net/cert --cpp_out=lite=true:$(genDir)/external/chromium_org/net/cert/ $(in)",
-    out: [
-        "external/chromium_org/net/cert/root_store.pb.h",
-    ],
-    export_include_dirs: [
-        ".",
-        "net/cert",
-        "protos",
-    ],
-}
-
 // GN: //net:constants
 filegroup {
     name: "cronet_aml_net_constants",
@@ -3487,6 +3460,7 @@
         "cronet_aml_third_party_modp_b64_modp_b64",
         "cronet_aml_third_party_zlib_zlib",
         "cronet_aml_url_url",
+        "libprotobuf-cpp-lite",
     ],
     generated_headers: [
         "cronet_aml_base_debugging_buildflags",
@@ -4267,6 +4241,7 @@
         "cronet_aml_third_party_modp_b64_modp_b64",
         "cronet_aml_third_party_zlib_zlib",
         "cronet_aml_url_url",
+        "libprotobuf-cpp-lite",
     ],
     generated_headers: [
         "cronet_aml_build_chromeos_buildflags",
@@ -4318,90 +4293,6 @@
     cpp_std: "c++20",
 }
 
-// GN: //net/tools/root_store_tool:root_store_tool
-cc_binary {
-    name: "cronet_aml_net_tools_root_store_tool_root_store_tool",
-    srcs: [
-        ":cronet_aml_buildtools_third_party_libc___libc__",
-        ":cronet_aml_buildtools_third_party_libc__abi_libc__abi",
-        ":cronet_aml_net_cert_root_store_proto_full_gen",
-        "net/tools/root_store_tool/root_store_tool.cc",
-    ],
-    shared_libs: [
-        "libprotobuf-cpp-lite",
-    ],
-    static_libs: [
-        "cronet_aml_base_allocator_partition_allocator_partition_alloc",
-        "cronet_aml_base_base",
-        "cronet_aml_base_base_static",
-        "cronet_aml_base_third_party_double_conversion_double_conversion",
-        "cronet_aml_base_third_party_dynamic_annotations_dynamic_annotations",
-        "cronet_aml_base_third_party_symbolize_symbolize",
-        "cronet_aml_base_third_party_xdg_mime_xdg_mime",
-        "cronet_aml_base_third_party_xdg_user_dirs_xdg_user_dirs",
-        "cronet_aml_crypto_crypto",
-        "cronet_aml_third_party_boringssl_boringssl",
-        "cronet_aml_third_party_icu_icui18n",
-        "cronet_aml_third_party_icu_icuuc_private",
-        "cronet_aml_third_party_libevent_libevent",
-        "cronet_aml_third_party_modp_b64_modp_b64",
-        "cronet_aml_third_party_zlib_zlib",
-    ],
-    generated_headers: [
-        "cronet_aml_net_cert_root_store_proto_full_gen_headers",
-    ],
-    defaults: [
-        "cronet_aml_defaults",
-    ],
-    cflags: [
-        "-DCR_CLANG_REVISION=\"llvmorg-16-init-8697-g60809cd2-1\"",
-        "-DCR_LIBCXX_REVISION=47b31179d10646029c260702650a25d24f555acc",
-        "-DCR_SYSROOT_KEY=20220331T153654Z-0",
-        "-DDCHECK_ALWAYS_ON=1",
-        "-DDYNAMIC_ANNOTATIONS_ENABLED=1",
-        "-DGOOGLE_PROTOBUF_INTERNAL_DONATE_STEAL_INLINE=0",
-        "-DGOOGLE_PROTOBUF_NO_RTTI",
-        "-DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER",
-        "-DHAVE_PTHREAD",
-        "-DLIBCXXABI_SILENT_TERMINATE",
-        "-DLIBCXX_BUILDING_LIBCXXABI",
-        "-DUSE_AURA=1",
-        "-DUSE_OZONE=1",
-        "-DUSE_UDEV",
-        "-D_DEBUG",
-        "-D_FILE_OFFSET_BITS=64",
-        "-D_GNU_SOURCE",
-        "-D_LARGEFILE64_SOURCE",
-        "-D_LARGEFILE_SOURCE",
-        "-D_LIBCPP_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED=1",
-        "-D_LIBCPP_BUILDING_LIBRARY",
-        "-D_LIBCPP_CONSTINIT=constinit",
-        "-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
-        "-D_LIBCPP_ENABLE_ASSERTIONS_DEFAULT=1",
-        "-D_LIBCPP_OVERRIDABLE_FUNC_VIS=__attribute__((__visibility__(\"default\")))",
-        "-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
-        "-D__STDC_CONSTANT_MACROS",
-        "-D__STDC_FORMAT_MACROS",
-        "-UANDROID",
-    ],
-    local_include_dirs: [
-        "./",
-        "buildtools/third_party/libc++/",
-        "buildtools/third_party/libc++/trunk/include",
-        "buildtools/third_party/libc++/trunk/src/",
-        "buildtools/third_party/libc++abi/trunk/include",
-        "third_party/abseil-cpp/",
-        "third_party/boringssl/src/include/",
-        "build/linux/debian_bullseye_amd64-sysroot/usr/include/x86_64-linux-gnu",
-        "build/linux/debian_bullseye_amd64-sysroot/usr/include",
-    ],
-    cpp_std: "c++20",
-    cppflags: [
-        "-fexceptions",
-    ],
-    rtti: true,
-}
-
 // GN: //net/traffic_annotation:traffic_annotation
 filegroup {
     name: "cronet_aml_net_traffic_annotation_traffic_annotation",
@@ -5246,12 +5137,19 @@
         "-DBORINGSSL_NO_STATIC_INITIALIZER",
         "-DCR_CLANG_REVISION=\"llvmorg-16-init-8697-g60809cd2-1\"",
         "-DCR_LIBCXX_REVISION=47b31179d10646029c260702650a25d24f555acc",
+        "-DCR_SYSROOT_KEY=20220331T153654Z-0",
         "-DDCHECK_ALWAYS_ON=1",
         "-DDYNAMIC_ANNOTATIONS_ENABLED=1",
         "-DHAVE_SYS_UIO_H",
         "-DOPENSSL_SMALL",
+        "-DUSE_AURA=1",
+        "-DUSE_OZONE=1",
+        "-DUSE_UDEV",
         "-D_DEBUG",
+        "-D_FILE_OFFSET_BITS=64",
         "-D_GNU_SOURCE",
+        "-D_LARGEFILE64_SOURCE",
+        "-D_LARGEFILE_SOURCE",
         "-D_LIBCPP_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED=1",
         "-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
         "-D_LIBCPP_ENABLE_ASSERTIONS_DEFAULT=1",
@@ -5265,6 +5163,8 @@
         "buildtools/third_party/libc++/trunk/include",
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/boringssl/src/include/",
+        "build/linux/debian_bullseye_amd64-sysroot/usr/include/x86_64-linux-gnu",
+        "build/linux/debian_bullseye_amd64-sysroot/usr/include",
         "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
     ],
     cpp_std: "c++20",
@@ -5847,19 +5747,26 @@
 filegroup {
     name: "cronet_aml_third_party_boringssl_boringssl_asm_x86",
     srcs: [
-        "third_party/boringssl/linux-x86/crypto/chacha/chacha-x86.S",
-        "third_party/boringssl/linux-x86/crypto/fipsmodule/aesni-x86.S",
-        "third_party/boringssl/linux-x86/crypto/fipsmodule/bn-586.S",
-        "third_party/boringssl/linux-x86/crypto/fipsmodule/co-586.S",
-        "third_party/boringssl/linux-x86/crypto/fipsmodule/ghash-ssse3-x86.S",
-        "third_party/boringssl/linux-x86/crypto/fipsmodule/ghash-x86.S",
-        "third_party/boringssl/linux-x86/crypto/fipsmodule/md5-586.S",
-        "third_party/boringssl/linux-x86/crypto/fipsmodule/sha1-586.S",
-        "third_party/boringssl/linux-x86/crypto/fipsmodule/sha256-586.S",
-        "third_party/boringssl/linux-x86/crypto/fipsmodule/sha512-586.S",
-        "third_party/boringssl/linux-x86/crypto/fipsmodule/vpaes-x86.S",
-        "third_party/boringssl/linux-x86/crypto/fipsmodule/x86-mont.S",
-        "third_party/boringssl/linux-x86/crypto/test/trampoline-x86.S",
+        "third_party/boringssl/linux-x86_64/crypto/chacha/chacha-x86_64.S",
+        "third_party/boringssl/linux-x86_64/crypto/cipher_extra/aes128gcmsiv-x86_64.S",
+        "third_party/boringssl/linux-x86_64/crypto/cipher_extra/chacha20_poly1305_x86_64.S",
+        "third_party/boringssl/linux-x86_64/crypto/fipsmodule/aesni-gcm-x86_64.S",
+        "third_party/boringssl/linux-x86_64/crypto/fipsmodule/aesni-x86_64.S",
+        "third_party/boringssl/linux-x86_64/crypto/fipsmodule/ghash-ssse3-x86_64.S",
+        "third_party/boringssl/linux-x86_64/crypto/fipsmodule/ghash-x86_64.S",
+        "third_party/boringssl/linux-x86_64/crypto/fipsmodule/md5-x86_64.S",
+        "third_party/boringssl/linux-x86_64/crypto/fipsmodule/p256-x86_64-asm.S",
+        "third_party/boringssl/linux-x86_64/crypto/fipsmodule/p256_beeu-x86_64-asm.S",
+        "third_party/boringssl/linux-x86_64/crypto/fipsmodule/rdrand-x86_64.S",
+        "third_party/boringssl/linux-x86_64/crypto/fipsmodule/rsaz-avx2.S",
+        "third_party/boringssl/linux-x86_64/crypto/fipsmodule/sha1-x86_64.S",
+        "third_party/boringssl/linux-x86_64/crypto/fipsmodule/sha256-x86_64.S",
+        "third_party/boringssl/linux-x86_64/crypto/fipsmodule/sha512-x86_64.S",
+        "third_party/boringssl/linux-x86_64/crypto/fipsmodule/vpaes-x86_64.S",
+        "third_party/boringssl/linux-x86_64/crypto/fipsmodule/x86_64-mont.S",
+        "third_party/boringssl/linux-x86_64/crypto/fipsmodule/x86_64-mont5.S",
+        "third_party/boringssl/linux-x86_64/crypto/test/trampoline-x86_64.S",
+        "third_party/boringssl/src/crypto/hrss/asm/poly_rq_mul.S",
     ],
 }
 
@@ -6216,6 +6123,7 @@
         "-DANDROID_NDK_VERSION_ROLL=r23_1",
         "-DCR_CLANG_REVISION=\"llvmorg-16-init-8697-g60809cd2-1\"",
         "-DCR_LIBCXX_REVISION=47b31179d10646029c260702650a25d24f555acc",
+        "-DCR_SYSROOT_KEY=20220331T153654Z-0",
         "-DDCHECK_ALWAYS_ON=1",
         "-DDYNAMIC_ANNOTATIONS_ENABLED=1",
         "-DHAVE_DLOPEN=0",
@@ -6223,7 +6131,10 @@
         "-DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE",
         "-DUCONFIG_ONLY_HTML_CONVERSION=1",
         "-DUCONFIG_USE_WINDOWS_LCID_MAPPING_API=0",
+        "-DUSE_AURA=1",
         "-DUSE_CHROMIUM_ICU=1",
+        "-DUSE_OZONE=1",
+        "-DUSE_UDEV",
         "-DU_CHARSET_IS_UTF8=1",
         "-DU_ENABLE_DYLOAD=0",
         "-DU_ENABLE_RESOURCE_TRACING=0",
@@ -6232,7 +6143,10 @@
         "-DU_STATIC_IMPLEMENTATION",
         "-DU_USING_ICU_NAMESPACE=0",
         "-D_DEBUG",
+        "-D_FILE_OFFSET_BITS=64",
         "-D_GNU_SOURCE",
+        "-D_LARGEFILE64_SOURCE",
+        "-D_LARGEFILE_SOURCE",
         "-D_LIBCPP_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED=1",
         "-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
         "-D_LIBCPP_ENABLE_ASSERTIONS_DEFAULT=1",
@@ -6245,6 +6159,8 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/icu/source/common/",
         "third_party/icu/source/i18n/",
+        "build/linux/debian_bullseye_amd64-sysroot/usr/include/x86_64-linux-gnu",
+        "build/linux/debian_bullseye_amd64-sysroot/usr/include",
         "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
     ],
     cpp_std: "c++20",
@@ -6464,6 +6380,7 @@
         "-DANDROID_NDK_VERSION_ROLL=r23_1",
         "-DCR_CLANG_REVISION=\"llvmorg-16-init-8697-g60809cd2-1\"",
         "-DCR_LIBCXX_REVISION=47b31179d10646029c260702650a25d24f555acc",
+        "-DCR_SYSROOT_KEY=20220331T153654Z-0",
         "-DDCHECK_ALWAYS_ON=1",
         "-DDYNAMIC_ANNOTATIONS_ENABLED=1",
         "-DHAVE_DLOPEN=0",
@@ -6471,7 +6388,10 @@
         "-DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE",
         "-DUCONFIG_ONLY_HTML_CONVERSION=1",
         "-DUCONFIG_USE_WINDOWS_LCID_MAPPING_API=0",
+        "-DUSE_AURA=1",
         "-DUSE_CHROMIUM_ICU=1",
+        "-DUSE_OZONE=1",
+        "-DUSE_UDEV",
         "-DU_CHARSET_IS_UTF8=1",
         "-DU_COMMON_IMPLEMENTATION",
         "-DU_ENABLE_DYLOAD=0",
@@ -6481,7 +6401,10 @@
         "-DU_STATIC_IMPLEMENTATION",
         "-DU_USING_ICU_NAMESPACE=0",
         "-D_DEBUG",
+        "-D_FILE_OFFSET_BITS=64",
         "-D_GNU_SOURCE",
+        "-D_LARGEFILE64_SOURCE",
+        "-D_LARGEFILE_SOURCE",
         "-D_LIBCPP_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED=1",
         "-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
         "-D_LIBCPP_ENABLE_ASSERTIONS_DEFAULT=1",
@@ -6496,6 +6419,8 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/icu/source/common/",
         "third_party/icu/source/i18n/",
+        "build/linux/debian_bullseye_amd64-sysroot/usr/include/x86_64-linux-gnu",
+        "build/linux/debian_bullseye_amd64-sysroot/usr/include",
         "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
     ],
     cpp_std: "c++20",
@@ -6534,12 +6459,19 @@
         "-DANDROID_NDK_VERSION_ROLL=r23_1",
         "-DCR_CLANG_REVISION=\"llvmorg-16-init-8697-g60809cd2-1\"",
         "-DCR_LIBCXX_REVISION=47b31179d10646029c260702650a25d24f555acc",
+        "-DCR_SYSROOT_KEY=20220331T153654Z-0",
         "-DDCHECK_ALWAYS_ON=1",
         "-DDYNAMIC_ANNOTATIONS_ENABLED=1",
         "-DHAVE_CONFIG_H",
         "-DHAVE_SYS_UIO_H",
+        "-DUSE_AURA=1",
+        "-DUSE_OZONE=1",
+        "-DUSE_UDEV",
         "-D_DEBUG",
+        "-D_FILE_OFFSET_BITS=64",
         "-D_GNU_SOURCE",
+        "-D_LARGEFILE64_SOURCE",
+        "-D_LARGEFILE_SOURCE",
         "-D_LIBCPP_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED=1",
         "-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
         "-D_LIBCPP_ENABLE_ASSERTIONS_DEFAULT=1",
@@ -6551,6 +6483,9 @@
         "buildtools/third_party/libc++/trunk/include",
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/libevent/android/",
+        "third_party/libevent/linux/",
+        "build/linux/debian_bullseye_amd64-sysroot/usr/include/x86_64-linux-gnu",
+        "build/linux/debian_bullseye_amd64-sysroot/usr/include",
         "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
     ],
     cpp_std: "c++20",
@@ -6709,11 +6644,18 @@
         "-DANDROID_NDK_VERSION_ROLL=r23_1",
         "-DCR_CLANG_REVISION=\"llvmorg-16-init-8697-g60809cd2-1\"",
         "-DCR_LIBCXX_REVISION=47b31179d10646029c260702650a25d24f555acc",
+        "-DCR_SYSROOT_KEY=20220331T153654Z-0",
         "-DDCHECK_ALWAYS_ON=1",
         "-DDYNAMIC_ANNOTATIONS_ENABLED=1",
         "-DHAVE_SYS_UIO_H",
+        "-DUSE_AURA=1",
+        "-DUSE_OZONE=1",
+        "-DUSE_UDEV",
         "-D_DEBUG",
+        "-D_FILE_OFFSET_BITS=64",
         "-D_GNU_SOURCE",
+        "-D_LARGEFILE64_SOURCE",
+        "-D_LARGEFILE_SOURCE",
         "-D_LIBCPP_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED=1",
         "-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
         "-D_LIBCPP_ENABLE_ASSERTIONS_DEFAULT=1",
@@ -6726,6 +6668,8 @@
         "buildtools/third_party/libc++/",
         "buildtools/third_party/libc++/trunk/include",
         "buildtools/third_party/libc++abi/trunk/include",
+        "build/linux/debian_bullseye_amd64-sysroot/usr/include/x86_64-linux-gnu",
+        "build/linux/debian_bullseye_amd64-sysroot/usr/include",
         "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
     ],
     cpp_std: "c++20",
@@ -6735,6 +6679,7 @@
 cc_library_static {
     name: "cronet_aml_third_party_zlib_zlib",
     srcs: [
+        ":cronet_aml_third_party_android_ndk_cpu_features",
         ":cronet_aml_third_party_zlib_zlib_adler32_simd",
         ":cronet_aml_third_party_zlib_zlib_common_headers",
         ":cronet_aml_third_party_zlib_zlib_crc32_simd",
@@ -6761,6 +6706,8 @@
     ],
     cflags: [
         "-DADLER32_SIMD_SSSE3",
+        "-DANDROID",
+        "-DANDROID_NDK_VERSION_ROLL=r23_1",
         "-DCRC32_SIMD_SSE42_PCLMUL",
         "-DCR_CLANG_REVISION=\"llvmorg-16-init-8697-g60809cd2-1\"",
         "-DCR_LIBCXX_REVISION=47b31179d10646029c260702650a25d24f555acc",
@@ -6768,6 +6715,7 @@
         "-DDCHECK_ALWAYS_ON=1",
         "-DDEFLATE_SLIDE_HASH_SSE2",
         "-DDYNAMIC_ANNOTATIONS_ENABLED=1",
+        "-DHAVE_SYS_UIO_H",
         "-DINFLATE_CHUNK_READ_64LE",
         "-DINFLATE_CHUNK_SIMD_SSE2",
         "-DUSE_AURA=1",
@@ -6787,16 +6735,17 @@
         "-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
         "-D__STDC_CONSTANT_MACROS",
         "-D__STDC_FORMAT_MACROS",
-        "-UANDROID",
     ],
     local_include_dirs: [
         "./",
         "buildtools/third_party/libc++/",
         "buildtools/third_party/libc++/trunk/include",
         "buildtools/third_party/libc++abi/trunk/include",
+        "third_party/android_ndk/sources/android/cpufeatures/",
         "third_party/zlib/",
         "build/linux/debian_bullseye_amd64-sysroot/usr/include/x86_64-linux-gnu",
         "build/linux/debian_bullseye_amd64-sysroot/usr/include",
+        "third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include",
     ],
     cpp_std: "c++20",
 }
diff --git a/tools/gn2bp/gen_android_bp b/tools/gn2bp/gen_android_bp
index 2644e43..eb44f72 100755
--- a/tools/gn2bp/gen_android_bp
+++ b/tools/gn2bp/gen_android_bp
@@ -138,25 +138,18 @@
 
 
 def enable_protobuf_full(module):
-  if module.type == 'cc_binary_host':
+  if module.type not in ['genrule', 'filegroup']:
     module.static_libs.add('libprotobuf-cpp-full')
-  elif module.host_supported:
-    module.host.static_libs.add('libprotobuf-cpp-full')
-    module.android.shared_libs.add('libprotobuf-cpp-full')
-  elif module.type not in ['genrule', 'filegroup']:
-    module.shared_libs.add('libprotobuf-cpp-full')
 
 
 def enable_protobuf_lite(module):
   if module.type not in ['genrule', 'filegroup']:
-    module.shared_libs.add('libprotobuf-cpp-lite')
+    module.static_libs.add('libprotobuf-cpp-lite')
 
 
 def enable_protoc_lib(module):
-  if module.type == 'cc_binary_host':
+  if module.type not in ['genrule', 'filegroup']:
     module.static_libs.add('libprotoc')
-  elif module.type not in ['genrule', 'filegroup']:
-    module.shared_libs.add('libprotoc')
 
 
 def enable_libunwindstack(module):
@@ -236,10 +229,12 @@
         enable_zlib,
     '//gn:bionic_kernel_uapi_headers':
         enable_uapi_headers,
+    '//net/tools/root_store_tool:root_store_tool':
+        lambda x: None,
     '//src/profiling/memory:bionic_libc_platform_headers_on_android':
         enable_bionic_libc_platform_headers_on_android,
     '//third_party/protobuf:protoc':
-      lambda x: None,
+        lambda x: None,
     '//third_party/protobuf:protobuf_full':
         enable_protobuf_full,
     '//third_party/protobuf:protobuf_lite':
@@ -1242,7 +1237,7 @@
   # need arch condition. So, for now, hardcoding arch condition
   if module.name == "cronet_aml_base_allocator_partition_allocator_partition_alloc":
     x86_srcs = module.srcs.copy()
-    x86_srcs.remove(
+    x86_srcs.discard(
       "base/allocator/partition_allocator/starscan/stack/asm/x64/push_registers_asm.cc")
     x86_srcs.add("base/allocator/partition_allocator/starscan/stack/asm/x86/push_registers_asm.cc")
     module.arch['x86'] = {'srcs': x86_srcs}
@@ -1320,9 +1315,10 @@
   # Currently, multi tool chain is not supported for all targets and create_modules_from_target can
   # not reach to this target by following the dependency.
   # So it's required to specify explicitly.
-  create_modules_from_target(blueprint, gn,
-                             "//third_party/boringssl:boringssl_asm" +
-                             "(//build/toolchain/android:android_clang_x86)")
+  boringssl_gn_target_name = ('//third_party/boringssl:boringssl_asm' +
+                             '(//build/toolchain/android:android_clang_x86)')
+  gn.parse_gn_desc(desc, boringssl_gn_target_name)
+  create_modules_from_target(blueprint, gn, boringssl_gn_target_name)
 
   create_java_module(blueprint, gn)
   update_jni_registration_module(blueprint, gn)
@@ -1385,8 +1381,13 @@
   with open(args.desc) as f:
     desc = json.load(f)
 
-  gn = gn_utils.GnParser(desc)
-  blueprint = create_blueprint_for_targets(gn, desc, args.targets or default_targets)
+  gn = gn_utils.GnParser()
+  targets = args.targets or default_targets
+  for target in targets:
+    # TODO: pass desc to parse_gn_desc() to support parsing multiple desc files
+    # for different target architectures.
+    gn.parse_gn_desc(desc, target)
+  blueprint = create_blueprint_for_targets(gn, desc, targets)
   project_root = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
   tool_name = os.path.relpath(os.path.abspath(__file__), project_root)
 
diff --git a/tools/gn2bp/gn_utils.py b/tools/gn2bp/gn_utils.py
index 118208c..b3cda41 100644
--- a/tools/gn2bp/gn_utils.py
+++ b/tools/gn2bp/gn_utils.py
@@ -94,6 +94,12 @@
         Maked properties are propagated up the dependency chain when a
         source_set dependency is encountered.
         """
+    class Arch():
+      """Architecture-dependent properties
+        """
+      def __init__(self):
+        self.sources = set()
+
 
     def __init__(self, name, type):
       self.name = name  # e.g. //src/ipc:ipc
@@ -144,6 +150,11 @@
       # placeholder target once we hit //gn:protoc or similar.
       self.is_third_party_dep_ = False
 
+      # TODO: come up with a better way to only run this once.
+      # is_finalized tracks whether finalize() was called on this target.
+      self.is_finalized = False
+      self.arch = dict()
+
     def __lt__(self, other):
       if isinstance(other, self.__class__):
         return self.name < other.name
@@ -165,8 +176,24 @@
                   'libs', 'proto_paths'):
         self.__dict__[key].update(other.__dict__.get(key, []))
 
-  def __init__(self, gn_desc):
-    self.gn_desc_ = gn_desc
+    def finalize(self):
+      """Move common properties out of arch-dependent subobjects to Target object.
+
+        TODO: find a better name for this function.
+        """
+      if self.is_finalized:
+        return
+      self.is_finalized = True
+
+      # Target contains the intersection of arch-dependent properties
+      self.sources = set.intersection(*[arch.sources for arch in self.arch.values()])
+
+      # Deduplicate arch-dependent properties
+      for arch in self.arch.keys():
+        self.arch[arch].sources -= self.sources
+
+
+  def __init__(self):
     self.all_targets = {}
     self.linker_units = {}  # Executables, shared or static libraries.
     self.source_sets = {}
@@ -195,39 +222,58 @@
     # TODO: There are some other possible variations we might need to support.
     return target.type == 'group' and re.match('.*_java$', target.name)
 
+  def _get_arch(self, toolchain):
+    if toolchain is None:
+      # TODO: throw an exception instead of defaulting to x86_64.
+      return 'x86_64'
+    elif toolchain == '//build/toolchain/android:android_clang_x86':
+      return 'x86'
+    elif toolchain == '//build/toolchain/android:android_clang_x64':
+      return 'x86_64'
+    elif toolchain == '//build/toolchain/android:android_clang_arm':
+      return 'arm'
+    elif toolchain == '//build/toolchain/android:android_clang_arm64':
+      return 'arm64'
+    else:
+      return 'host'
 
   def get_target(self, gn_target_name):
     """Returns a Target object from the fully qualified GN target name.
 
+      get_target() requires that parse_gn_desc() has already been called.
+      """
+    # Run this every time as parse_gn_desc can be called at any time.
+    for target in self.all_targets.values():
+      target.finalize()
+
+    return self.all_targets[label_without_toolchain(gn_target_name)]
+
+  def parse_gn_desc(self, gn_desc, gn_target_name):
+    """Parses a gn desc tree and resolves all target dependencies.
+
         It bubbles up variables from source_set dependencies as described in the
         class-level comments.
         """
-    target = self.all_targets.get(gn_target_name)
-    if target is not None:
+    # Use name without toolchain for targets to support targets built for
+    # multiple archs.
+    target_name = label_without_toolchain(gn_target_name)
+    target = self.all_targets.get(target_name)
+    desc = gn_desc[gn_target_name]
+    arch = self._get_arch(desc.get('toolchain', None))
+    if target is None:
+      target = GnParser.Target(target_name, desc['type'])
+      self.all_targets[target_name] = target
+
+    if arch not in target.arch:
+      target.arch[arch] = GnParser.Target.Arch()
+    else:
       return target  # Target already processed.
 
-    desc = self.gn_desc_[gn_target_name]
-    target = GnParser.Target(gn_target_name, desc['type'])
     target.testonly = desc.get('testonly', False)
+    # TODO: remove toolchain from Target object
     target.toolchain = desc.get('toolchain', None)
-    self.all_targets[gn_target_name] = target
 
-    # TODO: determine if below comment should apply for cronet builds in Android.
-    # We should never have GN targets directly depend on buidtools. They
-    # should hop via //gn:xxx, so we can give generators an opportunity to
-    # override them.
-    # Specifically allow targets to depend on libc++ and libunwind.
-    if not any(match in gn_target_name for match in ['libc++', 'libunwind']):
-      assert (not gn_target_name.startswith('//buildtools'))
-
-
-    # Don't descend further into third_party targets. Genrators are supposed
-    # to either ignore them or route to other externally-provided targets.
-    if gn_target_name.startswith('//gn'):
-      target.is_third_party_dep_ = True
-      return target
-
-    proto_target_type, proto_desc = self.get_proto_target_type(target)
+    proto_target_type, proto_desc = self.get_proto_target_type(gn_desc, gn_target_name)
     if proto_target_type is not None:
       self.proto_libs[target.name] = target
       target.type = 'proto_library'
@@ -235,18 +281,18 @@
       target.proto_paths.update(self.get_proto_paths(proto_desc))
       target.proto_exports.update(self.get_proto_exports(proto_desc))
       target.proto_in_dir = self.get_proto_in_dir(proto_desc)
-      target.sources.update(proto_desc.get('sources', []))
-      assert (all(x.endswith('.proto') for x in target.sources))
+      target.arch[arch].sources.update(proto_desc.get('sources', []))
+      assert (all(x.endswith('.proto') for x in target.arch[arch].sources))
     elif target.type == 'source_set':
       self.source_sets[gn_target_name] = target
-      target.sources.update(desc.get('sources', []))
+      target.arch[arch].sources.update(desc.get('sources', []))
     elif target.type in LINKER_UNIT_TYPES:
       self.linker_units[gn_target_name] = target
-      target.sources.update(desc.get('sources', []))
+      target.arch[arch].sources.update(desc.get('sources', []))
     elif target.type in ['action', 'action_foreach']:
       self.actions[gn_target_name] = target
       target.inputs.update(desc.get('inputs', []))
-      target.sources.update(desc.get('sources', []))
+      target.arch[arch].sources.update(desc.get('sources', []))
       outs = [re.sub('^//out/.+?/gen/', '', x) for x in desc['outputs']]
       target.outputs.update(outs)
       target.script = desc['script']
@@ -276,8 +322,9 @@
     target.include_dirs.update(desc.get('include_dirs', []))
 
     # Recurse in dependencies.
-    for dep_name in desc.get('deps', []):
-      dep = self.get_target(dep_name)
+    for gn_dep_name in desc.get('deps', []):
+      dep = self.parse_gn_desc(gn_desc, gn_dep_name)
+      dep_name = label_without_toolchain(gn_dep_name)
       if dep.is_third_party_dep_:
         target.deps.add(dep_name)
       elif dep.type == 'proto_library':
@@ -340,7 +387,7 @@
     args = proto_desc.get('args')
     return re.sub('^\.\./\.\./', '', args[args.index('--proto-in-dir') + 1])
 
-  def get_proto_target_type(self, target):
+  def get_proto_target_type(self, gn_desc, gn_target_name):
     """ Checks if the target is a proto library and return the plugin.
 
         Returns:
@@ -350,13 +397,13 @@
             json desc of the target with the .proto sources (_gen target for
             non-descriptor types or the target itself for descriptor type).
         """
-    parts = target.name.split('(', 1)
+    parts = gn_target_name.split('(', 1)
     name = parts[0]
     toolchain = '(' + parts[1] if len(parts) > 1 else ''
 
     # Descriptor targets don't have a _gen target; instead we look for the
     # characteristic flag in the args of the target itself.
-    desc = self.gn_desc_.get(target.name)
+    desc = gn_desc.get(gn_target_name)
     if '--descriptor_set_out' in desc.get('args', []):
       return 'descriptor', desc
 
@@ -368,7 +415,7 @@
 
     # In all other cases, we want to look at the _gen target as that has the
     # important information.
-    gen_desc = self.gn_desc_.get('%s_gen%s' % (name, toolchain))
+    gen_desc = gn_desc.get('%s_gen%s' % (name, toolchain))
     if gen_desc is None or gen_desc['type'] != 'action':
       return None, None
     if gen_desc['script'] != '//tools/protoc_wrapper/protoc_wrapper.py':