gn2bp: Convert `source_set` with rtti to static_libraries

* `source_set` were converted to cc_defaults and this would pose a huge problem if those cc_defaults had rtti on since it affected all of the dependencies of the source target.
* The solution here would be to compile the `source_set` independently as a static/shared library with rtti on then link it.

Test: m cronet_aml_components_cronet_android_cronet
Change-Id: I28bbe0947d0dc87c2d602514a2759a3171b68aa2
diff --git a/tools/gn2bp/Android.bp.swp b/tools/gn2bp/Android.bp.swp
index 24e09cc..d42cd50 100644
--- a/tools/gn2bp/Android.bp.swp
+++ b/tools/gn2bp/Android.bp.swp
@@ -3592,247 +3592,261 @@
 }
 
 // GN: //buildtools/third_party/libc++:libc++
-cc_defaults {
+cc_library_static {
     name: "cronet_aml_buildtools_third_party_libc___libc__",
+    srcs: [
+        "buildtools/third_party/libc++/trunk/src/algorithm.cpp",
+        "buildtools/third_party/libc++/trunk/src/any.cpp",
+        "buildtools/third_party/libc++/trunk/src/atomic.cpp",
+        "buildtools/third_party/libc++/trunk/src/barrier.cpp",
+        "buildtools/third_party/libc++/trunk/src/bind.cpp",
+        "buildtools/third_party/libc++/trunk/src/charconv.cpp",
+        "buildtools/third_party/libc++/trunk/src/chrono.cpp",
+        "buildtools/third_party/libc++/trunk/src/condition_variable.cpp",
+        "buildtools/third_party/libc++/trunk/src/condition_variable_destructor.cpp",
+        "buildtools/third_party/libc++/trunk/src/exception.cpp",
+        "buildtools/third_party/libc++/trunk/src/format.cpp",
+        "buildtools/third_party/libc++/trunk/src/functional.cpp",
+        "buildtools/third_party/libc++/trunk/src/future.cpp",
+        "buildtools/third_party/libc++/trunk/src/hash.cpp",
+        "buildtools/third_party/libc++/trunk/src/ios.cpp",
+        "buildtools/third_party/libc++/trunk/src/ios.instantiations.cpp",
+        "buildtools/third_party/libc++/trunk/src/iostream.cpp",
+        "buildtools/third_party/libc++/trunk/src/legacy_pointer_safety.cpp",
+        "buildtools/third_party/libc++/trunk/src/locale.cpp",
+        "buildtools/third_party/libc++/trunk/src/memory.cpp",
+        "buildtools/third_party/libc++/trunk/src/mutex.cpp",
+        "buildtools/third_party/libc++/trunk/src/mutex_destructor.cpp",
+        "buildtools/third_party/libc++/trunk/src/new.cpp",
+        "buildtools/third_party/libc++/trunk/src/optional.cpp",
+        "buildtools/third_party/libc++/trunk/src/random.cpp",
+        "buildtools/third_party/libc++/trunk/src/random_shuffle.cpp",
+        "buildtools/third_party/libc++/trunk/src/regex.cpp",
+        "buildtools/third_party/libc++/trunk/src/ryu/d2fixed.cpp",
+        "buildtools/third_party/libc++/trunk/src/ryu/d2s.cpp",
+        "buildtools/third_party/libc++/trunk/src/ryu/f2s.cpp",
+        "buildtools/third_party/libc++/trunk/src/shared_mutex.cpp",
+        "buildtools/third_party/libc++/trunk/src/stdexcept.cpp",
+        "buildtools/third_party/libc++/trunk/src/string.cpp",
+        "buildtools/third_party/libc++/trunk/src/strstream.cpp",
+        "buildtools/third_party/libc++/trunk/src/system_error.cpp",
+        "buildtools/third_party/libc++/trunk/src/thread.cpp",
+        "buildtools/third_party/libc++/trunk/src/typeinfo.cpp",
+        "buildtools/third_party/libc++/trunk/src/utility.cpp",
+        "buildtools/third_party/libc++/trunk/src/valarray.cpp",
+        "buildtools/third_party/libc++/trunk/src/variant.cpp",
+        "buildtools/third_party/libc++/trunk/src/vector.cpp",
+        "buildtools/third_party/libc++/trunk/src/verbose_abort.cpp",
+    ],
+    static_libs: [
+        "cronet_aml_buildtools_third_party_libc__abi_libc__abi",
+    ],
+    host_supported: true,
+    defaults: [
+        "cronet_aml_defaults",
+    ],
+    cflags: [
+        "-DCR_CLANG_REVISION=\"llvmorg-16-init-8697-g60809cd2-1\"",
+        "-DCR_LIBCXX_REVISION=47b31179d10646029c260702650a25d24f555acc",
+        "-DDCHECK_ALWAYS_ON=1",
+        "-DDYNAMIC_ANNOTATIONS_ENABLED=1",
+        "-DLIBCXX_BUILDING_LIBCXXABI",
+        "-D_DEBUG",
+        "-D_GNU_SOURCE",
+        "-D_LIBCPP_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED=1",
+        "-D_LIBCPP_BUILDING_LIBRARY",
+        "-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
+        "-D_LIBCPP_ENABLE_ASSERTIONS_DEFAULT=1",
+        "-D_LIBCPP_OVERRIDABLE_FUNC_VIS=__attribute__((__visibility__(\"default\")))",
+        "-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+    ],
+    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",
+    ],
+    cpp_std: "c++20",
+    cppflags: [
+        "-fexceptions",
+    ],
+    rtti: true,
     target: {
         android_x86: {
-            srcs: [
-                "buildtools/third_party/libc++/trunk/src/algorithm.cpp",
-                "buildtools/third_party/libc++/trunk/src/any.cpp",
-                "buildtools/third_party/libc++/trunk/src/atomic.cpp",
-                "buildtools/third_party/libc++/trunk/src/barrier.cpp",
-                "buildtools/third_party/libc++/trunk/src/bind.cpp",
-                "buildtools/third_party/libc++/trunk/src/charconv.cpp",
-                "buildtools/third_party/libc++/trunk/src/chrono.cpp",
-                "buildtools/third_party/libc++/trunk/src/condition_variable.cpp",
-                "buildtools/third_party/libc++/trunk/src/condition_variable_destructor.cpp",
-                "buildtools/third_party/libc++/trunk/src/exception.cpp",
-                "buildtools/third_party/libc++/trunk/src/format.cpp",
-                "buildtools/third_party/libc++/trunk/src/functional.cpp",
-                "buildtools/third_party/libc++/trunk/src/future.cpp",
-                "buildtools/third_party/libc++/trunk/src/hash.cpp",
-                "buildtools/third_party/libc++/trunk/src/ios.cpp",
-                "buildtools/third_party/libc++/trunk/src/ios.instantiations.cpp",
-                "buildtools/third_party/libc++/trunk/src/iostream.cpp",
-                "buildtools/third_party/libc++/trunk/src/legacy_pointer_safety.cpp",
-                "buildtools/third_party/libc++/trunk/src/locale.cpp",
-                "buildtools/third_party/libc++/trunk/src/memory.cpp",
-                "buildtools/third_party/libc++/trunk/src/mutex.cpp",
-                "buildtools/third_party/libc++/trunk/src/mutex_destructor.cpp",
-                "buildtools/third_party/libc++/trunk/src/new.cpp",
-                "buildtools/third_party/libc++/trunk/src/optional.cpp",
-                "buildtools/third_party/libc++/trunk/src/random.cpp",
-                "buildtools/third_party/libc++/trunk/src/random_shuffle.cpp",
-                "buildtools/third_party/libc++/trunk/src/regex.cpp",
-                "buildtools/third_party/libc++/trunk/src/ryu/d2fixed.cpp",
-                "buildtools/third_party/libc++/trunk/src/ryu/d2s.cpp",
-                "buildtools/third_party/libc++/trunk/src/ryu/f2s.cpp",
-                "buildtools/third_party/libc++/trunk/src/shared_mutex.cpp",
-                "buildtools/third_party/libc++/trunk/src/stdexcept.cpp",
-                "buildtools/third_party/libc++/trunk/src/string.cpp",
-                "buildtools/third_party/libc++/trunk/src/strstream.cpp",
-                "buildtools/third_party/libc++/trunk/src/system_error.cpp",
-                "buildtools/third_party/libc++/trunk/src/thread.cpp",
-                "buildtools/third_party/libc++/trunk/src/typeinfo.cpp",
-                "buildtools/third_party/libc++/trunk/src/utility.cpp",
-                "buildtools/third_party/libc++/trunk/src/valarray.cpp",
-                "buildtools/third_party/libc++/trunk/src/variant.cpp",
-                "buildtools/third_party/libc++/trunk/src/vector.cpp",
-                "buildtools/third_party/libc++/trunk/src/verbose_abort.cpp",
+            static_libs: [
+                "cronet_aml_buildtools_third_party_libunwind_libunwind",
+            ],
+            cflags: [
+                "-DANDROID",
+                "-DANDROID_NDK_VERSION_ROLL=r23_1",
+                "-DHAVE_SYS_UIO_H",
             ],
         },
         android_x86_64: {
-            srcs: [
-                "buildtools/third_party/libc++/trunk/src/algorithm.cpp",
-                "buildtools/third_party/libc++/trunk/src/any.cpp",
-                "buildtools/third_party/libc++/trunk/src/atomic.cpp",
-                "buildtools/third_party/libc++/trunk/src/barrier.cpp",
-                "buildtools/third_party/libc++/trunk/src/bind.cpp",
-                "buildtools/third_party/libc++/trunk/src/charconv.cpp",
-                "buildtools/third_party/libc++/trunk/src/chrono.cpp",
-                "buildtools/third_party/libc++/trunk/src/condition_variable.cpp",
-                "buildtools/third_party/libc++/trunk/src/condition_variable_destructor.cpp",
-                "buildtools/third_party/libc++/trunk/src/exception.cpp",
-                "buildtools/third_party/libc++/trunk/src/format.cpp",
-                "buildtools/third_party/libc++/trunk/src/functional.cpp",
-                "buildtools/third_party/libc++/trunk/src/future.cpp",
-                "buildtools/third_party/libc++/trunk/src/hash.cpp",
-                "buildtools/third_party/libc++/trunk/src/ios.cpp",
-                "buildtools/third_party/libc++/trunk/src/ios.instantiations.cpp",
-                "buildtools/third_party/libc++/trunk/src/iostream.cpp",
-                "buildtools/third_party/libc++/trunk/src/legacy_pointer_safety.cpp",
-                "buildtools/third_party/libc++/trunk/src/locale.cpp",
-                "buildtools/third_party/libc++/trunk/src/memory.cpp",
-                "buildtools/third_party/libc++/trunk/src/mutex.cpp",
-                "buildtools/third_party/libc++/trunk/src/mutex_destructor.cpp",
-                "buildtools/third_party/libc++/trunk/src/new.cpp",
-                "buildtools/third_party/libc++/trunk/src/optional.cpp",
-                "buildtools/third_party/libc++/trunk/src/random.cpp",
-                "buildtools/third_party/libc++/trunk/src/random_shuffle.cpp",
-                "buildtools/third_party/libc++/trunk/src/regex.cpp",
-                "buildtools/third_party/libc++/trunk/src/ryu/d2fixed.cpp",
-                "buildtools/third_party/libc++/trunk/src/ryu/d2s.cpp",
-                "buildtools/third_party/libc++/trunk/src/ryu/f2s.cpp",
-                "buildtools/third_party/libc++/trunk/src/shared_mutex.cpp",
-                "buildtools/third_party/libc++/trunk/src/stdexcept.cpp",
-                "buildtools/third_party/libc++/trunk/src/string.cpp",
-                "buildtools/third_party/libc++/trunk/src/strstream.cpp",
-                "buildtools/third_party/libc++/trunk/src/system_error.cpp",
-                "buildtools/third_party/libc++/trunk/src/thread.cpp",
-                "buildtools/third_party/libc++/trunk/src/typeinfo.cpp",
-                "buildtools/third_party/libc++/trunk/src/utility.cpp",
-                "buildtools/third_party/libc++/trunk/src/valarray.cpp",
-                "buildtools/third_party/libc++/trunk/src/variant.cpp",
-                "buildtools/third_party/libc++/trunk/src/vector.cpp",
-                "buildtools/third_party/libc++/trunk/src/verbose_abort.cpp",
+            static_libs: [
+                "cronet_aml_buildtools_third_party_libunwind_libunwind",
+            ],
+            cflags: [
+                "-DANDROID",
+                "-DANDROID_NDK_VERSION_ROLL=r23_1",
+                "-DHAVE_SYS_UIO_H",
             ],
         },
         host: {
-            srcs: [
-                "buildtools/third_party/libc++/trunk/src/algorithm.cpp",
-                "buildtools/third_party/libc++/trunk/src/any.cpp",
-                "buildtools/third_party/libc++/trunk/src/atomic.cpp",
-                "buildtools/third_party/libc++/trunk/src/barrier.cpp",
-                "buildtools/third_party/libc++/trunk/src/bind.cpp",
-                "buildtools/third_party/libc++/trunk/src/charconv.cpp",
-                "buildtools/third_party/libc++/trunk/src/chrono.cpp",
-                "buildtools/third_party/libc++/trunk/src/condition_variable.cpp",
-                "buildtools/third_party/libc++/trunk/src/condition_variable_destructor.cpp",
-                "buildtools/third_party/libc++/trunk/src/exception.cpp",
-                "buildtools/third_party/libc++/trunk/src/format.cpp",
-                "buildtools/third_party/libc++/trunk/src/functional.cpp",
-                "buildtools/third_party/libc++/trunk/src/future.cpp",
-                "buildtools/third_party/libc++/trunk/src/hash.cpp",
-                "buildtools/third_party/libc++/trunk/src/ios.cpp",
-                "buildtools/third_party/libc++/trunk/src/ios.instantiations.cpp",
-                "buildtools/third_party/libc++/trunk/src/iostream.cpp",
-                "buildtools/third_party/libc++/trunk/src/legacy_pointer_safety.cpp",
-                "buildtools/third_party/libc++/trunk/src/locale.cpp",
-                "buildtools/third_party/libc++/trunk/src/memory.cpp",
-                "buildtools/third_party/libc++/trunk/src/mutex.cpp",
-                "buildtools/third_party/libc++/trunk/src/mutex_destructor.cpp",
-                "buildtools/third_party/libc++/trunk/src/new.cpp",
-                "buildtools/third_party/libc++/trunk/src/optional.cpp",
-                "buildtools/third_party/libc++/trunk/src/random.cpp",
-                "buildtools/third_party/libc++/trunk/src/random_shuffle.cpp",
-                "buildtools/third_party/libc++/trunk/src/regex.cpp",
-                "buildtools/third_party/libc++/trunk/src/ryu/d2fixed.cpp",
-                "buildtools/third_party/libc++/trunk/src/ryu/d2s.cpp",
-                "buildtools/third_party/libc++/trunk/src/ryu/f2s.cpp",
-                "buildtools/third_party/libc++/trunk/src/shared_mutex.cpp",
-                "buildtools/third_party/libc++/trunk/src/stdexcept.cpp",
-                "buildtools/third_party/libc++/trunk/src/string.cpp",
-                "buildtools/third_party/libc++/trunk/src/strstream.cpp",
-                "buildtools/third_party/libc++/trunk/src/system_error.cpp",
-                "buildtools/third_party/libc++/trunk/src/thread.cpp",
-                "buildtools/third_party/libc++/trunk/src/typeinfo.cpp",
-                "buildtools/third_party/libc++/trunk/src/utility.cpp",
-                "buildtools/third_party/libc++/trunk/src/valarray.cpp",
-                "buildtools/third_party/libc++/trunk/src/variant.cpp",
-                "buildtools/third_party/libc++/trunk/src/vector.cpp",
-                "buildtools/third_party/libc++/trunk/src/verbose_abort.cpp",
+            cflags: [
+                "-DCR_SYSROOT_KEY=20220331T153654Z-0",
+                "-DUSE_AURA=1",
+                "-DUSE_OZONE=1",
+                "-DUSE_UDEV",
+                "-D_FILE_OFFSET_BITS=64",
+                "-D_LARGEFILE64_SOURCE",
+                "-D_LARGEFILE_SOURCE",
             ],
         },
     },
 }
 
 // GN: //buildtools/third_party/libc++abi:libc++abi
-cc_defaults {
+cc_library_static {
     name: "cronet_aml_buildtools_third_party_libc__abi_libc__abi",
+    srcs: [
+        "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",
+        "buildtools/third_party/libc++abi/trunk/src/cxa_exception.cpp",
+        "buildtools/third_party/libc++abi/trunk/src/cxa_exception_storage.cpp",
+        "buildtools/third_party/libc++abi/trunk/src/cxa_guard.cpp",
+        "buildtools/third_party/libc++abi/trunk/src/cxa_handlers.cpp",
+        "buildtools/third_party/libc++abi/trunk/src/cxa_personality.cpp",
+        "buildtools/third_party/libc++abi/trunk/src/cxa_thread_atexit.cpp",
+        "buildtools/third_party/libc++abi/trunk/src/cxa_vector.cpp",
+        "buildtools/third_party/libc++abi/trunk/src/cxa_virtual.cpp",
+        "buildtools/third_party/libc++abi/trunk/src/fallback_malloc.cpp",
+        "buildtools/third_party/libc++abi/trunk/src/private_typeinfo.cpp",
+        "buildtools/third_party/libc++abi/trunk/src/stdlib_exception.cpp",
+        "buildtools/third_party/libc++abi/trunk/src/stdlib_stdexcept.cpp",
+        "buildtools/third_party/libc++abi/trunk/src/stdlib_typeinfo.cpp",
+    ],
+    host_supported: true,
+    defaults: [
+        "cronet_aml_defaults",
+    ],
+    cflags: [
+        "-DCR_CLANG_REVISION=\"llvmorg-16-init-8697-g60809cd2-1\"",
+        "-DCR_LIBCXX_REVISION=47b31179d10646029c260702650a25d24f555acc",
+        "-DDCHECK_ALWAYS_ON=1",
+        "-DDYNAMIC_ANNOTATIONS_ENABLED=1",
+        "-DLIBCXXABI_SILENT_TERMINATE",
+        "-D_DEBUG",
+        "-D_GNU_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_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+    ],
+    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",
+    ],
+    cpp_std: "c++20",
+    cppflags: [
+        "-fexceptions",
+    ],
+    rtti: true,
     target: {
         android_x86: {
             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",
-                "buildtools/third_party/libc++abi/trunk/src/cxa_exception.cpp",
-                "buildtools/third_party/libc++abi/trunk/src/cxa_exception_storage.cpp",
-                "buildtools/third_party/libc++abi/trunk/src/cxa_guard.cpp",
-                "buildtools/third_party/libc++abi/trunk/src/cxa_handlers.cpp",
-                "buildtools/third_party/libc++abi/trunk/src/cxa_personality.cpp",
-                "buildtools/third_party/libc++abi/trunk/src/cxa_thread_atexit.cpp",
-                "buildtools/third_party/libc++abi/trunk/src/cxa_vector.cpp",
-                "buildtools/third_party/libc++abi/trunk/src/cxa_virtual.cpp",
-                "buildtools/third_party/libc++abi/trunk/src/fallback_malloc.cpp",
-                "buildtools/third_party/libc++abi/trunk/src/private_typeinfo.cpp",
-                "buildtools/third_party/libc++abi/trunk/src/stdlib_exception.cpp",
-                "buildtools/third_party/libc++abi/trunk/src/stdlib_stdexcept.cpp",
-                "buildtools/third_party/libc++abi/trunk/src/stdlib_typeinfo.cpp",
+            ],
+            static_libs: [
+                "cronet_aml_buildtools_third_party_libunwind_libunwind",
+            ],
+            cflags: [
+                "-DANDROID",
+                "-DANDROID_NDK_VERSION_ROLL=r23_1",
+                "-DHAVE_SYS_UIO_H",
             ],
         },
         android_x86_64: {
             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",
-                "buildtools/third_party/libc++abi/trunk/src/cxa_exception.cpp",
-                "buildtools/third_party/libc++abi/trunk/src/cxa_exception_storage.cpp",
-                "buildtools/third_party/libc++abi/trunk/src/cxa_guard.cpp",
-                "buildtools/third_party/libc++abi/trunk/src/cxa_handlers.cpp",
-                "buildtools/third_party/libc++abi/trunk/src/cxa_personality.cpp",
-                "buildtools/third_party/libc++abi/trunk/src/cxa_thread_atexit.cpp",
-                "buildtools/third_party/libc++abi/trunk/src/cxa_vector.cpp",
-                "buildtools/third_party/libc++abi/trunk/src/cxa_virtual.cpp",
-                "buildtools/third_party/libc++abi/trunk/src/fallback_malloc.cpp",
-                "buildtools/third_party/libc++abi/trunk/src/private_typeinfo.cpp",
-                "buildtools/third_party/libc++abi/trunk/src/stdlib_exception.cpp",
-                "buildtools/third_party/libc++abi/trunk/src/stdlib_stdexcept.cpp",
-                "buildtools/third_party/libc++abi/trunk/src/stdlib_typeinfo.cpp",
+            ],
+            static_libs: [
+                "cronet_aml_buildtools_third_party_libunwind_libunwind",
+            ],
+            cflags: [
+                "-DANDROID",
+                "-DANDROID_NDK_VERSION_ROLL=r23_1",
+                "-DHAVE_SYS_UIO_H",
             ],
         },
         host: {
             srcs: [
-                "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",
                 "buildtools/third_party/libc++abi/trunk/src/cxa_demangle.cpp",
-                "buildtools/third_party/libc++abi/trunk/src/cxa_exception.cpp",
-                "buildtools/third_party/libc++abi/trunk/src/cxa_exception_storage.cpp",
-                "buildtools/third_party/libc++abi/trunk/src/cxa_guard.cpp",
-                "buildtools/third_party/libc++abi/trunk/src/cxa_handlers.cpp",
-                "buildtools/third_party/libc++abi/trunk/src/cxa_personality.cpp",
-                "buildtools/third_party/libc++abi/trunk/src/cxa_thread_atexit.cpp",
-                "buildtools/third_party/libc++abi/trunk/src/cxa_vector.cpp",
-                "buildtools/third_party/libc++abi/trunk/src/cxa_virtual.cpp",
-                "buildtools/third_party/libc++abi/trunk/src/fallback_malloc.cpp",
-                "buildtools/third_party/libc++abi/trunk/src/private_typeinfo.cpp",
-                "buildtools/third_party/libc++abi/trunk/src/stdlib_exception.cpp",
-                "buildtools/third_party/libc++abi/trunk/src/stdlib_stdexcept.cpp",
-                "buildtools/third_party/libc++abi/trunk/src/stdlib_typeinfo.cpp",
+            ],
+            cflags: [
+                "-DCR_SYSROOT_KEY=20220331T153654Z-0",
+                "-DUSE_AURA=1",
+                "-DUSE_OZONE=1",
+                "-DUSE_UDEV",
+                "-D_FILE_OFFSET_BITS=64",
+                "-D_LARGEFILE64_SOURCE",
+                "-D_LARGEFILE_SOURCE",
             ],
         },
     },
 }
 
 // GN: //buildtools/third_party/libunwind:libunwind
-cc_defaults {
+cc_library_static {
     name: "cronet_aml_buildtools_third_party_libunwind_libunwind",
-    target: {
-        android_x86: {
-            srcs: [
-                "buildtools/third_party/libunwind/trunk/src/Unwind-EHABI.cpp",
-                "buildtools/third_party/libunwind/trunk/src/Unwind-sjlj.c",
-                "buildtools/third_party/libunwind/trunk/src/UnwindLevel1-gcc-ext.c",
-                "buildtools/third_party/libunwind/trunk/src/UnwindLevel1.c",
-                "buildtools/third_party/libunwind/trunk/src/UnwindRegistersRestore.S",
-                "buildtools/third_party/libunwind/trunk/src/UnwindRegistersSave.S",
-                "buildtools/third_party/libunwind/trunk/src/libunwind.cpp",
-            ],
-        },
-        android_x86_64: {
-            srcs: [
-                "buildtools/third_party/libunwind/trunk/src/Unwind-EHABI.cpp",
-                "buildtools/third_party/libunwind/trunk/src/Unwind-sjlj.c",
-                "buildtools/third_party/libunwind/trunk/src/UnwindLevel1-gcc-ext.c",
-                "buildtools/third_party/libunwind/trunk/src/UnwindLevel1.c",
-                "buildtools/third_party/libunwind/trunk/src/UnwindRegistersRestore.S",
-                "buildtools/third_party/libunwind/trunk/src/UnwindRegistersSave.S",
-                "buildtools/third_party/libunwind/trunk/src/libunwind.cpp",
-            ],
-        },
-    },
+    srcs: [
+        "buildtools/third_party/libunwind/trunk/src/Unwind-EHABI.cpp",
+        "buildtools/third_party/libunwind/trunk/src/Unwind-sjlj.c",
+        "buildtools/third_party/libunwind/trunk/src/UnwindLevel1-gcc-ext.c",
+        "buildtools/third_party/libunwind/trunk/src/UnwindLevel1.c",
+        "buildtools/third_party/libunwind/trunk/src/UnwindRegistersRestore.S",
+        "buildtools/third_party/libunwind/trunk/src/UnwindRegistersSave.S",
+        "buildtools/third_party/libunwind/trunk/src/libunwind.cpp",
+    ],
+    defaults: [
+        "cronet_aml_defaults",
+    ],
+    cflags: [
+        "-DANDROID",
+        "-DANDROID_NDK_VERSION_ROLL=r23_1",
+        "-DCR_CLANG_REVISION=\"llvmorg-16-init-8697-g60809cd2-1\"",
+        "-DCR_LIBCXX_REVISION=47b31179d10646029c260702650a25d24f555acc",
+        "-DDCHECK_ALWAYS_ON=1",
+        "-DDYNAMIC_ANNOTATIONS_ENABLED=1",
+        "-DHAVE_SYS_UIO_H",
+        "-D_DEBUG",
+        "-D_GNU_SOURCE",
+        "-D_LIBCPP_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED=1",
+        "-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
+        "-D_LIBCPP_ENABLE_ASSERTIONS_DEFAULT=1",
+        "-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+        "-D_LIBUNWIND_DISABLE_VISIBILITY_ANNOTATIONS",
+        "-D_LIBUNWIND_IS_NATIVE_ONLY",
+    ],
+    local_include_dirs: [
+        "./",
+        "buildtools/third_party/libc++/",
+        "buildtools/third_party/libc++/trunk/include",
+        "buildtools/third_party/libc++abi/trunk/include",
+        "buildtools/third_party/libunwind/trunk/include/",
+    ],
+    cpp_std: "c++20",
+    cppflags: [
+        "-fexceptions",
+    ],
+    rtti: true,
 }
 
 // GN: //components/cronet/android:buildflags__android_x86
@@ -3892,6 +3906,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_buildtools_third_party_libc___libc__",
+        "cronet_aml_buildtools_third_party_libc__abi_libc__abi",
+        "cronet_aml_buildtools_third_party_libunwind_libunwind",
         "cronet_aml_components_prefs_prefs",
         "cronet_aml_crypto_crypto",
         "cronet_aml_net_net",
@@ -3916,9 +3933,6 @@
         "cronet_aml_third_party_metrics_proto_metrics_proto_gen_headers",
     ],
     defaults: [
-        "cronet_aml_buildtools_third_party_libc___libc__",
-        "cronet_aml_buildtools_third_party_libc__abi_libc__abi",
-        "cronet_aml_buildtools_third_party_libunwind_libunwind",
         "cronet_aml_components_cronet_android_cronet_static",
         "cronet_aml_components_cronet_cronet_common",
         "cronet_aml_components_cronet_cronet_version_header",
@@ -3942,19 +3956,12 @@
         "-DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER",
         "-DHAVE_PTHREAD",
         "-DHAVE_SYS_UIO_H",
-        "-DLIBCXXABI_SILENT_TERMINATE",
-        "-DLIBCXX_BUILDING_LIBCXXABI",
         "-D_DEBUG",
         "-D_GNU_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_LIBUNWIND_DISABLE_VISIBILITY_ANNOTATIONS",
-        "-D_LIBUNWIND_IS_NATIVE_ONLY",
         "-D__STDC_CONSTANT_MACROS",
         "-D__STDC_FORMAT_MACROS",
     ],
@@ -3962,9 +3969,7 @@
         "./",
         "buildtools/third_party/libc++/",
         "buildtools/third_party/libc++/trunk/include",
-        "buildtools/third_party/libc++/trunk/src/",
         "buildtools/third_party/libc++abi/trunk/include",
-        "buildtools/third_party/libunwind/trunk/include/",
         "components/cronet/native/generated/",
         "components/cronet/native/include/",
         "components/grpc_support/include/",
@@ -3980,10 +3985,6 @@
     linker_scripts: [
         "base/android/library_loader/anchor_functions.lds",
     ],
-    cppflags: [
-        "-fexceptions",
-    ],
-    rtti: true,
     target: {
         android_x86: {
             generated_headers: [
@@ -6491,7 +6492,6 @@
         "third_party/zlib/",
     ],
     cpp_std: "c++20",
-    rtti: true,
     target: {
         android_x86: {
             srcs: [
@@ -10734,6 +10734,8 @@
         "third_party/protobuf/src/google/protobuf/compiler/main.cc",
     ],
     static_libs: [
+        "cronet_aml_buildtools_third_party_libc___libc__",
+        "cronet_aml_buildtools_third_party_libc__abi_libc__abi",
         "cronet_aml_third_party_protobuf_protobuf_full",
         "cronet_aml_third_party_protobuf_protoc_lib",
         "cronet_aml_third_party_zlib_zlib",
@@ -10741,9 +10743,6 @@
     host_supported: true,
     device_supported: false,
     defaults: [
-        "cronet_aml_buildtools_third_party_libc___libc__",
-        "cronet_aml_buildtools_third_party_libc__abi_libc__abi",
-        "cronet_aml_buildtools_third_party_libunwind_libunwind",
         "cronet_aml_defaults",
     ],
     cflags: [
@@ -10756,8 +10755,6 @@
         "-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",
@@ -10767,26 +10764,18 @@
         "-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",
     ],
     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/protobuf/src/",
     ],
     cpp_std: "c++20",
-    cppflags: [
-        "-fexceptions",
-    ],
-    rtti: true,
 }
 
 // GN: //third_party/protobuf:protoc_lib
diff --git a/tools/gn2bp/gen_android_bp b/tools/gn2bp/gen_android_bp
index 3d98ce6..70e4466 100755
--- a/tools/gn2bp/gen_android_bp
+++ b/tools/gn2bp/gen_android_bp
@@ -127,9 +127,6 @@
             'cronet_aml_net_third_party_quiche_quiche',
             'cronet_aml_crypto_crypto',
         }),
-        # When a code is compiled under rtti(cronet) that depends on another code(net)
-        # that doesn't depend on rtti. undefined symbol: typeinfo 'class' errors appears.
-        ('rtti', True), # go/undefined-symbol-typeinfo
     ],
 }
 
@@ -967,8 +964,6 @@
   for flag in cflags:
     if '-std=' in flag:
       module.cpp_std = flag[len('-std='):]
-    if '-frtti' in flag:
-      module.rtti = True
     if '-fexceptions' in flag:
       module.cppflags.add('-fexceptions')
 
@@ -1072,6 +1067,8 @@
       for src in arch.sources
       if is_supported_source_file(src) and not src.startswith("//out/test"))
 
+  module.rtti = target.rtti
+
   if target.type in gn_utils.LINKER_UNIT_TYPES:
     set_module_flags(module, target.cflags, target.defines)
     set_module_include_dirs(module, target.cflags, target.include_dirs)
diff --git a/tools/gn2bp/gn_utils.py b/tools/gn2bp/gn_utils.py
index 2df1c6d..f02d33f 100644
--- a/tools/gn2bp/gn_utils.py
+++ b/tools/gn2bp/gn_utils.py
@@ -144,6 +144,7 @@
       self.source_set_deps = set()  # Transitive set of source_set deps.
       self.proto_deps = set()
       self.transitive_proto_deps = set()
+      self.rtti = False
 
       # TODO: come up with a better way to only run this once.
       # is_finalized tracks whether finalize() was called on this target.
@@ -346,7 +347,10 @@
     target.ldflags.update(desc.get('ldflags', []))
     target.arch[arch].defines.update(desc.get('defines', []))
     target.arch[arch].include_dirs.update(desc.get('include_dirs', []))
-
+    if "-frtti" in target.arch[arch].cflags:
+      target.rtti = True
+      if target.type == "source_set":
+        target.type = "static_library"
     # Recurse in dependencies.
     for gn_dep_name in desc.get('deps', []):
       dep = self.parse_gn_desc(gn_desc, gn_dep_name)
@@ -357,6 +361,9 @@
         target.transitive_proto_deps.update(dep.transitive_proto_deps)
       elif dep.type == 'source_set':
         target.source_set_deps.add(dep.name)
+        if "-frtti" in target.arch[arch].cflags:
+          # This must not be propagated upward as it effects all of the dependencies
+          target.arch[arch].cflags -= {"-frtti"}
         target.update(dep, arch)  # Bubble up source set's cflags/ldflags etc.
       elif dep.type == 'group':
         target.update(dep, arch)  # Bubble up groups's cflags/ldflags etc.