Browse Source

remove redundant archival

Signed-off-by: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
Rebecca Chang Swee Fun 1 year ago
parent
commit
eb070d48c5
31 changed files with 0 additions and 7555 deletions
  1. 0 31
      archive/0001-BUILD.gn-disable-printing-unittests.patch
  2. 0 35
      archive/0001-BUILD.gn-remove-libjpeg-turbo.patch
  3. 0 1563
      archive/0001-breakpad-temporarily-disable-it.patch
  4. 0 27
      archive/0001-build-config-make-sure-target_cpu-is-honored-in-tool.patch
  5. 0 26
      archive/0001-build-gn_run_binary.py-do-not-run-binary-from.patch
  6. 0 607
      archive/0001-linux-sysroot-script-to-create-riscv-sysroot-from-De.patch
  7. 0 99
      archive/0001-media-gpu-disable-tests.patch
  8. 0 551
      archive/0001-media-media_options-disable-dav1d-decoder.patch
  9. 0 27
      archive/0001-third_party-widevine-define-WIDEVINE_CDM_VERSION_STR.patch
  10. 0 36
      archive/0001-third_party-zlib-do-not-mangle-zlib.patch
  11. 0 1864
      archive/0002-sandbox-add-riscv-arch-definition-and-define-syscall.patch
  12. 0 26
      archive/0004-skia-add-riscv64.patch
  13. 0 87
      archive/0005-base-allocator-partition_allocator-add-riscv64-suppo.patch
  14. 0 27
      archive/0006-base-process-add-riscv64-arch-definition.patch
  15. 0 81
      archive/0007-remoting-fix-missing-cstring-header.patch
  16. 0 25
      archive/0008-remoting-codec-fix-missing-cmath-header.patch
  17. 0 49
      archive/0009-components-update_client-add-riscv64-arch-definition.patch
  18. 0 26
      archive/0010-build-config-compiler-use_gold-linker-option.patch
  19. 0 66
      archive/0011-build-config-compiler-remove-flags-not-available-in-.patch
  20. 0 25
      archive/0012-build-config-add-atomic-build-flag.patch
  21. 0 30
      archive/0013-build-config-compiler-do-not-use-linker-relaxation.patch
  22. 0 116
      archive/0014-chrome-common-remove-unrar-code.patch
  23. 0 26
      archive/0015-third_party-libaom-add-riscv-target.patch
  24. 0 35
      archive/0016-third_party-libvpx-add-riscv-target.patch
  25. 0 808
      archive/0017-third_party-crashpad-add-support-for-riscv.patch
  26. 0 31
      archive/0018-third_party-lzma_sdk-add-riscv-arch-definition.patch
  27. 0 1104
      archive/0019-build-linux-sysroot-create-a-sysroot-for-riscv.patch
  28. 0 31
      archive/0020-build-config-linux-workaround-for-files-not-found-wi.patch
  29. 0 27
      archive/0021-v8-settings.patch
  30. 0 44
      archive/0022-chrome-installer-add-riscv64-as-one-of-the-target-ar.patch
  31. 0 25
      archive/0023-ui-gl-enable-swiftshader-for-riscv64.patch

+ 0 - 31
archive/0001-BUILD.gn-disable-printing-unittests.patch

@@ -1,31 +0,0 @@
-From 26d3a6cc2b01da7475e79231725caf245f8c65fe Mon Sep 17 00:00:00 2001
-From: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
-Date: Fri, 14 Jan 2022 02:40:23 +0000
-Subject: [PATCH] BUILD.gn: disable printing unittests
-
-Depends on cups-config in sysroot.
-Currently sysroot does not include cups-config.
-
-Signed-off-by: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
----
- BUILD.gn | 4 ----
- 1 file changed, 4 deletions(-)
-
-diff --git a/BUILD.gn b/BUILD.gn
-index 73aefc2325553..f3bb841e5419a 100644
---- a/BUILD.gn
-+++ b/BUILD.gn
-@@ -282,10 +282,6 @@ group("gn_all") {
- 
-   deps += root_extra_deps
- 
--  if (enable_basic_printing) {
--    deps += [ "//printing:printing_unittests" ]
--  }
--
-   if (enable_extensions) {
-     deps += [
-       "//extensions:extensions_browsertests",
--- 
-2.25.1
-

+ 0 - 35
archive/0001-BUILD.gn-remove-libjpeg-turbo.patch

@@ -1,35 +0,0 @@
-From 1b78e8e37881b715f828b52bc61ab0cc725b38a9 Mon Sep 17 00:00:00 2001
-From: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
-Date: Tue, 5 Apr 2022 01:53:24 +0000
-Subject: [PATCH] BUILD.gn: remove libjpeg-turbo
-
-riscv64 is not supported in libjpeg-turbo.
-
-Signed-off-by: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
----
- BUILD.gn | 2 --
- 1 file changed, 2 deletions(-)
-
-diff --git a/BUILD.gn b/BUILD.gn
-index f3bb841e5419a..d480858dff71a 100644
---- a/BUILD.gn
-+++ b/BUILD.gn
-@@ -753,7 +753,6 @@ group("gn_all") {
-       "//third_party/angle:libEGL",
-       "//third_party/angle:libGLESv2",
-       "//third_party/leveldatabase:leveldb_test_targets",
--      "//third_party/libjpeg_turbo:simd",
-       "//third_party/opus:opus_compare",
-       "//third_party/opus:opus_demo",
-       "//third_party/opus:test_opus_api",
-@@ -768,7 +767,6 @@ group("gn_all") {
-       if (!is_android) {
-         deps += [ "//chrome/test:load_library_perf_tests" ]
-       }
--      deps += [ "//third_party/libjpeg_turbo:simd_asm" ]
-     }
-     if ((is_linux || is_chromeos) && current_toolchain == host_toolchain) {
-       deps += [ "//v8:v8_shell" ]
--- 
-2.25.1
-

+ 0 - 1563
archive/0001-breakpad-temporarily-disable-it.patch

@@ -1,1563 +0,0 @@
-From 5a5ea15181d5e18528a2c4486454c9dcf244c87e Mon Sep 17 00:00:00 2001
-From: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
-Date: Tue, 5 Apr 2022 02:25:00 +0000
-Subject: [PATCH] breakpad: temporarily disable it
-
-Signed-off-by: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
----
- BUILD.gn                                   |   38 +-
- chrome/BUILD.gn                            |    5 -
- chrome/test/BUILD.gn                       |    4 -
- components/crash/content/browser/BUILD.gn  |    9 -
- components/crash/core/app/BUILD.gn         |   14 -
- components/crash/core/common/BUILD.gn      |   11 -
- components/nacl/broker/BUILD.gn            |    1 -
- content/shell/BUILD.gn                     |   11 -
- remoting/base/BUILD.gn                     |    1 -
- remoting/host/setup/BUILD.gn               |    1 -
- third_party/breakpad/BUILD.gn              | 1146 --------------------
- tools/perf/chrome_telemetry_build/BUILD.gn |   17 -
- 12 files changed, 1 insertion(+), 1257 deletions(-)
- delete mode 100644 third_party/breakpad/BUILD.gn
-
-diff --git a/BUILD.gn b/BUILD.gn
-index d480858dff71a..e31a9006e2eff 100644
---- a/BUILD.gn
-+++ b/BUILD.gn
-@@ -449,10 +449,6 @@ group("gn_all") {
- 
-   if (is_linux || is_chromeos || is_android) {
-     deps += [
--      "//third_party/breakpad:breakpad_unittests",
--      "//third_party/breakpad:core-2-minidump",
--      "//third_party/breakpad:generate_test_dump",
--      "//third_party/breakpad:minidump-2-core",
-       "//tools/dump_process_memory:dump_process",
-       "//tools/memory/partition_allocator:all",
-     ]
-@@ -618,10 +614,6 @@ group("gn_all") {
-       "//mojo:mojo_perftests",
-       "//services/service_manager/public/cpp",
-       "//testing/gmock:gmock_main",
--      "//third_party/breakpad:dump_syms($host_toolchain)",
--      "//third_party/breakpad:microdump_stackwalk($host_toolchain)",
--      "//third_party/breakpad:minidump_dump($host_toolchain)",
--      "//third_party/breakpad:minidump_stackwalk($host_toolchain)",
-     ]
- 
-     if (!is_android) {
-@@ -647,9 +639,6 @@ group("gn_all") {
- 
-   if (is_mac) {
-     deps += [
--      "//third_party/breakpad:crash_inspector",
--      "//third_party/breakpad:dump_syms",
--
-       # The following are accessibility API tools.
-       "//tools/accessibility/inspect:ax_dump_events",
-       "//tools/accessibility/inspect:ax_dump_tree",
-@@ -693,8 +682,6 @@ group("gn_all") {
-         host_os == "win") {
-       deps += [ "//chrome/test/mini_installer:mini_installer_tests" ]
-     }
--  } else if (!is_android && !is_ios && !is_fuchsia) {
--    deps += [ "//third_party/breakpad:symupload($host_toolchain)" ]
-   }
- 
-   if (is_chromecast) {
-@@ -966,7 +953,6 @@ if (is_win) {
-       "//net:net_unittests",
-       "//printing:printing_unittests",
-       "//sql:sql_unittests",
--      "//third_party/breakpad:symupload($host_toolchain)",
-       "//ui/base:ui_base_unittests",
-       "//ui/gfx:gfx_unittests",
-       "//ui/touch_selection:ui_touch_selection_unittests",
-@@ -993,7 +979,6 @@ if (is_chromeos_ash) {
-       "//ppapi/examples/video_decode",
-       "//sandbox/linux:chrome_sandbox",
-       "//sandbox/linux:sandbox_linux_unittests",
--      "//third_party/breakpad:minidump_stackwalk($host_toolchain)",
-       "//third_party/dawn/src/dawn/tests:dawn_end2end_tests",
-       "//third_party/dawn/src/dawn/tests:dawn_unittests",
- 
-@@ -1138,31 +1123,12 @@ if (!is_ios) {
- 
-     if (is_android) {
-       data_deps += [
--        "//third_party/breakpad:breakpad_unittests",
--        "//third_party/breakpad:dump_syms",
--        "//third_party/breakpad:microdump_stackwalk",
--        "//third_party/breakpad:minidump_dump",
--        "//third_party/breakpad:minidump_stackwalk",
--        "//third_party/breakpad:symupload",
-         "//tools/android/forwarder2",
-       ]
-     } else {
-       data_deps += [ "//content/web_test:web_test_common_mojom_js_data_deps" ]
-     }
- 
--    if (!is_win && !is_android) {
--      data_deps +=
--          [ "//third_party/breakpad:minidump_stackwalk($host_toolchain)" ]
--    }
--
--    if (is_mac) {
--      data_deps += [ "//third_party/breakpad:dump_syms($host_toolchain)" ]
--    }
--
--    if (is_linux || is_chromeos) {
--      data_deps += [ "//third_party/breakpad:dump_syms($host_toolchain)" ]
--    }
--
-     if (is_fuchsia) {
-       data_deps += [
-         "//build/config/fuchsia:deployment_resources",
-@@ -1548,10 +1514,8 @@ group("chromium_builder_perf") {
- 
-     if (is_win) {
-       data_deps += [ "//chrome/installer/mini_installer:mini_installer" ]
--    } else {
--      data_deps +=
--          [ "//third_party/breakpad:minidump_stackwalk($host_toolchain)" ]
-     }
-+
-     if (is_win || is_android) {
-       data_deps += [
-         "//components:components_perftests",
-diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn
-index 6b8f8778d1700..d750cbd7a4402 100644
---- a/chrome/BUILD.gn
-+++ b/chrome/BUILD.gn
-@@ -202,8 +202,6 @@ if (!is_android && !is_mac) {
-         "//sandbox",
-         "//sandbox/policy",
-         "//sandbox/policy/mojom",
--        "//third_party/breakpad:breakpad_handler",
--        "//third_party/breakpad:breakpad_sender",
-         "//third_party/crashpad/crashpad/util",
-         "//ui/gl",
-       ]
-@@ -440,7 +438,6 @@ if (is_win) {
-   tweak_info_plist("chrome_app_plist") {
-     info_plist = "app/app-Info.plist"
-     args = [
--      "--breakpad=0",
-       "--scm=1",
-       "--bundle_id=$chrome_mac_bundle_id",
-     ]
-@@ -668,7 +665,6 @@ if (is_win) {
-   tweak_info_plist("chrome_helper_plist") {
-     info_plist = "app/helper-Info.plist"
-     args = [
--      "--breakpad=0",
-       "--keystone=0",
-       "--scm=0",
-     ]
-@@ -1076,7 +1072,6 @@ if (is_win) {
-   tweak_info_plist("chrome_framework_plist") {
-     info_plist = "app/framework-Info.plist"
-     args = [
--      "--breakpad=0",
-       "--keystone=0",
-       "--scm=1",
-       "--branding",
-diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn
-index acde6777c6bc6..fac0628eb5a17 100644
---- a/chrome/test/BUILD.gn
-+++ b/chrome/test/BUILD.gn
-@@ -404,7 +404,6 @@ static_library("test_support") {
-     ]
-     public_deps += [
-       "//components/crash/core/app",
--      "//third_party/breakpad",
-     ]
-   }
- 
-@@ -9435,9 +9434,6 @@ test("chrome_app_unittests") {
-     "//components/heap_profiling/in_process",
-     "//components/safe_browsing:buildflags",
-   ]
--  if (!is_fuchsia) {
--    deps += [ "//third_party/breakpad:client" ]
--  }
-   if (enable_gwp_asan) {
-     deps += [ "//components/gwp_asan/client" ]
-   }
-diff --git a/components/crash/content/browser/BUILD.gn b/components/crash/content/browser/BUILD.gn
-index b2b08636e4020..96f24166dd17a 100644
---- a/components/crash/content/browser/BUILD.gn
-+++ b/components/crash/content/browser/BUILD.gn
-@@ -35,13 +35,6 @@ source_set("browser") {
-     deps += [ "//third_party/crashpad/crashpad/client" ]
-   }
- 
--  # This is not in the GYP build but this target includes breakpad client
--  # headers, so add the dependency here.
--  if ((is_posix && !is_ios) || is_fuchsia) {
--    configs += [ "//third_party/breakpad:client_config" ]
--    public_configs = [ "//third_party/breakpad:client_config" ]
--  }
--
-   if (is_android) {
-     sources += [
-       "child_exit_observer_android.cc",
-@@ -59,8 +52,6 @@ source_set("browser") {
-       "//components/crash/android:jni_headers",
-       "//mojo/public/cpp/bindings",
-     ]
--  } else {
--    deps += [ "//third_party/breakpad:client" ]
-   }
- }
- 
-diff --git a/components/crash/core/app/BUILD.gn b/components/crash/core/app/BUILD.gn
-index 7a5e5244cfdcc..fe66ed5022c99 100644
---- a/components/crash/core/app/BUILD.gn
-+++ b/components/crash/core/app/BUILD.gn
-@@ -52,15 +52,6 @@ static_library("app") {
-     "crashpad.h",
-   ]
- 
--  if (is_linux || is_chromeos) {
--    sources += [
--      "breakpad_linux.cc",
--      "breakpad_linux.h",
--      "breakpad_linux_impl.h",
--      "crashpad_linux.cc",
--    ]
--  }
--
-   defines = [ "CRASH_IMPLEMENTATION" ]
- 
-   public_deps = [ ":lib" ]
-@@ -96,10 +87,6 @@ static_library("app") {
-     ]
-   }
- 
--  if (is_linux || is_chromeos) {
--    deps += [ "//third_party/breakpad:client" ]
--  }
--
-   if (is_win) {
-     sources += [
-       "crashpad_win.cc",
-@@ -287,7 +274,6 @@ source_set("unit_tests") {
-     ]
-     deps += [
-       ":run_as_crashpad_handler",
--      "//third_party/breakpad:client",
-       "//third_party/crashpad/crashpad/client:client",
-       "//third_party/crashpad/crashpad/snapshot:snapshot",
-       "//third_party/crashpad/crashpad/util",
-diff --git a/components/crash/core/common/BUILD.gn b/components/crash/core/common/BUILD.gn
-index 81460a6cd795b..854828fd627ab 100644
---- a/components/crash/core/common/BUILD.gn
-+++ b/components/crash/core/common/BUILD.gn
-@@ -97,8 +97,6 @@ target(crash_key_target_type, "crash_key_lib") {
-     sources += [ "crash_key_crashpad.cc" ]
-     deps += [ "//third_party/crashpad/crashpad/client" ]
-   } else {
--    include_dirs = [ "//third_party/breakpad/breakpad/src" ]
--
-     if (is_ios) {
-       sources += [ "crash_key_breakpad_ios.mm" ]
-       deps += [
-@@ -107,14 +105,8 @@ target(crash_key_target_type, "crash_key_lib") {
-       ]
- 
-       configs += [ "//build/config/compiler:enable_arc" ]
--    } else {
--      sources += [
--        "crash_key_breakpad.cc",
--        "crash_key_internal.h",
--      ]
-     }
- 
--    deps += [ "//third_party/breakpad:client" ]
-     if (use_combined_annotations) {
-       public_deps += [ "//third_party/crashpad/crashpad/client" ]
-     }
-@@ -190,9 +182,6 @@ source_set("unit_tests") {
-     sources += [ "crash_key_breakpad_ios_unittest.cc" ]
-     deps += [ "//third_party/breakpad:client" ]
-     include_dirs = [ "//third_party/breakpad/breakpad/src/" ]
--  } else if (!is_mac && !is_win && !is_fuchsia && !is_android) {
--    include_dirs = [ "//third_party/breakpad/breakpad/src/" ]
--    sources += [ "crash_key_breakpad_unittest.cc" ]
-   }
- 
-   # TODO(crbug.com/1186718): Enable when crash keys are supported on Fuchsia.
-diff --git a/components/nacl/broker/BUILD.gn b/components/nacl/broker/BUILD.gn
-index 31a7822c7ee9a..7de416b4ec498 100644
---- a/components/nacl/broker/BUILD.gn
-+++ b/components/nacl/broker/BUILD.gn
-@@ -108,7 +108,6 @@ if (current_cpu == "x86") {
-       "//content/public/common:static_switches",
-       "//ppapi/proxy:ipc",
-       "//sandbox",
--      "//third_party/breakpad:breakpad_handler",
-     ]
-   }
- 
-diff --git a/content/shell/BUILD.gn b/content/shell/BUILD.gn
-index 603832550746d..0aacdf8bc6389 100644
---- a/content/shell/BUILD.gn
-+++ b/content/shell/BUILD.gn
-@@ -653,7 +653,6 @@ if (is_mac) {
-     testonly = true
-     info_plist = "app/framework-Info.plist"
-     args = [
--      "--breakpad=0",
-       "--keystone=0",
-       "--scm=1",
-       "--version",
-@@ -727,7 +726,6 @@ if (is_mac) {
-     testonly = true
-     info_plist = "app/helper-Info.plist"
-     args = [
--      "--breakpad=0",
-       "--keystone=0",
-       "--scm=0",
-       "--version",
-@@ -886,19 +884,10 @@ group("content_shell_crash_test") {
-   if (is_win) {
-     data_deps += [ "//build/win:copy_cdb_to_output" ]
-   }
--  if (is_posix) {
--    data_deps += [
--      "//third_party/breakpad:dump_syms",
--      "//third_party/breakpad:minidump_stackwalk",
--    ]
--  }
-   if (is_android) {
-     data_deps += [
-       "//build/android:devil_chromium_py",
-       "//build/android:test_runner_py",
--      "//third_party/breakpad:microdump_stackwalk",
--      "//third_party/breakpad:minidump_dump",
--      "//third_party/breakpad:symupload",
-       "//tools/android/forwarder2",
-     ]
-   }
-diff --git a/remoting/base/BUILD.gn b/remoting/base/BUILD.gn
-index 9e43e4274c873..38deff3d6d751 100644
---- a/remoting/base/BUILD.gn
-+++ b/remoting/base/BUILD.gn
-@@ -256,7 +256,6 @@ static_library("test_support") {
-   public_deps = [
-     ":authorization",
-     ":base",
--    ":breakpad",
-     "//base",
-     "//testing/gmock",
-     "//testing/gtest",
-diff --git a/remoting/host/setup/BUILD.gn b/remoting/host/setup/BUILD.gn
-index 14da0a2b67c96..4abcfd75918d8 100644
---- a/remoting/host/setup/BUILD.gn
-+++ b/remoting/host/setup/BUILD.gn
-@@ -141,7 +141,6 @@ source_set("native_messaging_host_main") {
-     "//net",
-     "//remoting/base",
-     "//remoting/base:authorization",
--    "//remoting/base:breakpad",
-     "//remoting/host",
-     "//remoting/host:common",
-     "//remoting/host/base",
-diff --git a/third_party/breakpad/BUILD.gn b/third_party/breakpad/BUILD.gn
-deleted file mode 100644
-index 48defa6ef092c..0000000000000
---- a/third_party/breakpad/BUILD.gn
-+++ /dev/null
-@@ -1,1146 +0,0 @@
--# Copyright 2014 The Chromium Authors. All rights reserved.
--# Use of this source code is governed by a BSD-style license that can be
--# found in the LICENSE file.
--
--import("//build/config/chromeos/ui_mode.gni")
--import("//build/symlink.gni")
--import("//testing/libfuzzer/fuzzer_test.gni")
--import("//testing/test.gni")
--
--if (is_win) {
--  import("//build/config/win/visual_studio_version.gni")
--}
--
--config("tools_config") {
--  include_dirs = [
--    "breakpad/src",
--    "breakpad/src/third_party",
--  ]
--  if (is_android) {
--    defines = [ "__ANDROID__" ]
--  }
--  if (is_clang) {
--    cflags = [ "-Wno-tautological-constant-out-of-range-compare" ]
--  }
--}
--
--config("internal_config") {
--  include_dirs = [ "breakpad/src" ]
--  defines = []
--  if (is_debug) {
--    # This is needed for GTMLogger to work correctly.
--    defines += [ "DEBUG" ]
--  }
--  if (is_android) {
--    defines += [ "__ANDROID__" ]
--  }
--}
--
--config("client_config") {
--  include_dirs = [ "breakpad/src" ]
--  if (is_android) {
--    include_dirs += [ "breakpad/src/common/android/include" ]
--  }
--  if (is_chromeos_ash) {
--    defines = [ "__CHROMEOS__" ]
--  }
--}
--
--config("handler_config") {
--  include_dirs = [ "breakpad/src" ]
--}
--
--config("sender_config") {
--  include_dirs = [ "breakpad/src" ]
--}
--
--config("breakpad_unittest_config") {
--  # One of the breakpad unit tests test that we can detect the proper build-id.
--  # We must override the build-id for this one target.
--  ldflags = [ "-Wl,--build-id=0x000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f" ]
--}
--
--config("default_logging_severity_config") {
--  defines = [ "BPLOG_MINIMUM_SEVERITY=SEVERITY_ERROR" ]
--}
--
--config("fuzzing_logging_severity_config") {
--  defines = [ "BPLOG_MINIMUM_SEVERITY=SEVERITY_CRITICAL" ]
--}
--
--default_breakpad_configs = [ ":tools_config" ]
--
--if (use_fuzzing_engine) {
--  default_breakpad_configs += [ ":fuzzing_logging_severity_config" ]
--} else {
--  default_breakpad_configs += [ ":default_logging_severity_config" ]
--}
--
--# {micro,mini}dump_stackwalk and minidump_dump are tool-type executables
--# that do not build on Windows.
--if (!is_win) {
--  if (current_toolchain == host_toolchain || target_os == "mac") {
--    # Contains the code shared by both {micro,mini}dump_stackwalk.
--    static_library("stackwalk_common") {
--      sources = [
--        "breakpad/src/common/path_helper.cc",
--        "breakpad/src/common/path_helper.h",
--        "breakpad/src/common/scoped_ptr.h",
--        "breakpad/src/processor/basic_code_module.h",
--        "breakpad/src/processor/basic_code_modules.cc",
--        "breakpad/src/processor/basic_code_modules.h",
--        "breakpad/src/processor/basic_source_line_resolver.cc",
--        "breakpad/src/processor/call_stack.cc",
--        "breakpad/src/processor/cfi_frame_info.cc",
--        "breakpad/src/processor/cfi_frame_info.h",
--        "breakpad/src/processor/convert_old_arm64_context.cc",
--        "breakpad/src/processor/convert_old_arm64_context.h",
--        "breakpad/src/processor/disassembler_x86.cc",
--        "breakpad/src/processor/disassembler_x86.h",
--        "breakpad/src/processor/dump_context.cc",
--        "breakpad/src/processor/dump_object.cc",
--        "breakpad/src/processor/logging.cc",
--        "breakpad/src/processor/logging.h",
--        "breakpad/src/processor/pathname_stripper.cc",
--        "breakpad/src/processor/pathname_stripper.h",
--        "breakpad/src/processor/proc_maps_linux.cc",
--        "breakpad/src/processor/process_state.cc",
--        "breakpad/src/processor/simple_symbol_supplier.cc",
--        "breakpad/src/processor/simple_symbol_supplier.h",
--        "breakpad/src/processor/source_line_resolver_base.cc",
--        "breakpad/src/processor/stack_frame_cpu.cc",
--        "breakpad/src/processor/stack_frame_symbolizer.cc",
--        "breakpad/src/processor/stackwalk_common.cc",
--        "breakpad/src/processor/stackwalker.cc",
--        "breakpad/src/processor/stackwalker_amd64.cc",
--        "breakpad/src/processor/stackwalker_amd64.h",
--        "breakpad/src/processor/stackwalker_arm.cc",
--        "breakpad/src/processor/stackwalker_arm.h",
--        "breakpad/src/processor/stackwalker_arm64.cc",
--        "breakpad/src/processor/stackwalker_arm64.h",
--        "breakpad/src/processor/stackwalker_mips.cc",
--        "breakpad/src/processor/stackwalker_mips.h",
--        "breakpad/src/processor/stackwalker_ppc.cc",
--        "breakpad/src/processor/stackwalker_ppc.h",
--        "breakpad/src/processor/stackwalker_ppc64.cc",
--        "breakpad/src/processor/stackwalker_ppc64.h",
--        "breakpad/src/processor/stackwalker_sparc.cc",
--        "breakpad/src/processor/stackwalker_sparc.h",
--        "breakpad/src/processor/stackwalker_x86.cc",
--        "breakpad/src/processor/stackwalker_x86.h",
--        "breakpad/src/processor/tokenize.cc",
--        "breakpad/src/processor/tokenize.h",
--
--        # libdisasm
--        "breakpad/src/third_party/libdisasm/ia32_implicit.c",
--        "breakpad/src/third_party/libdisasm/ia32_implicit.h",
--        "breakpad/src/third_party/libdisasm/ia32_insn.c",
--        "breakpad/src/third_party/libdisasm/ia32_insn.h",
--        "breakpad/src/third_party/libdisasm/ia32_invariant.c",
--        "breakpad/src/third_party/libdisasm/ia32_invariant.h",
--        "breakpad/src/third_party/libdisasm/ia32_modrm.c",
--        "breakpad/src/third_party/libdisasm/ia32_modrm.h",
--        "breakpad/src/third_party/libdisasm/ia32_opcode_tables.c",
--        "breakpad/src/third_party/libdisasm/ia32_opcode_tables.h",
--        "breakpad/src/third_party/libdisasm/ia32_operand.c",
--        "breakpad/src/third_party/libdisasm/ia32_operand.h",
--        "breakpad/src/third_party/libdisasm/ia32_reg.c",
--        "breakpad/src/third_party/libdisasm/ia32_reg.h",
--        "breakpad/src/third_party/libdisasm/ia32_settings.c",
--        "breakpad/src/third_party/libdisasm/ia32_settings.h",
--        "breakpad/src/third_party/libdisasm/libdis.h",
--        "breakpad/src/third_party/libdisasm/qword.h",
--        "breakpad/src/third_party/libdisasm/x86_disasm.c",
--        "breakpad/src/third_party/libdisasm/x86_format.c",
--        "breakpad/src/third_party/libdisasm/x86_imm.c",
--        "breakpad/src/third_party/libdisasm/x86_imm.h",
--        "breakpad/src/third_party/libdisasm/x86_insn.c",
--        "breakpad/src/third_party/libdisasm/x86_misc.c",
--        "breakpad/src/third_party/libdisasm/x86_operand_list.c",
--        "breakpad/src/third_party/libdisasm/x86_operand_list.h",
--      ]
--
--      configs -= [ "//build/config/compiler:chromium_code" ]
--      configs += [ "//build/config/compiler:no_chromium_code" ]
--      configs += default_breakpad_configs
--    }
--
--    fuzzer_test("minidump_fuzzer") {
--      sources = [
--        "breakpad/src/processor/exploitability.cc",
--        "breakpad/src/processor/minidump.cc",
--        "breakpad/src/processor/minidump_processor.cc",
--        "minidump_fuzzer.cc",
--      ]
--
--      deps = [
--        ":stackwalk_common",
--        "//base",
--      ]
--
--      additional_configs = [ ":fuzzing_logging_severity_config" ]
--      include_dirs = [ "breakpad/src" ]
--
--      libfuzzer_options = [
--        # Suppress stdout from stackwalk_common, as it uses printf() directly.
--        "close_fd_mask=1",
--        "max_len=128000",
--      ]
--
--      sources += [
--        "breakpad/src/processor/exploitability_linux.cc",
--        "breakpad/src/processor/exploitability_linux.h",
--        "breakpad/src/processor/exploitability_win.cc",
--        "breakpad/src/processor/exploitability_win.h",
--        "breakpad/src/processor/symbolic_constants_win.cc",
--        "breakpad/src/processor/symbolic_constants_win.h",
--      ]
--    }
--
--    executable("microdump_stackwalk") {
--      sources = [
--        "breakpad/src/processor/microdump.cc",
--        "breakpad/src/processor/microdump_processor.cc",
--        "breakpad/src/processor/microdump_stackwalk.cc",
--      ]
--
--      deps = [ ":stackwalk_common" ]
--
--      configs -= [ "//build/config/compiler:chromium_code" ]
--      configs += [ "//build/config/compiler:no_chromium_code" ]
--      configs += default_breakpad_configs
--    }
--
--    executable("minidump_stackwalk") {
--      sources = [
--        "breakpad/src/processor/exploitability.cc",
--        "breakpad/src/processor/minidump.cc",
--        "breakpad/src/processor/minidump_processor.cc",
--        "breakpad/src/processor/minidump_stackwalk.cc",
--      ]
--
--      deps = [ ":stackwalk_common" ]
--
--      configs -= [ "//build/config/compiler:chromium_code" ]
--      configs += [ "//build/config/compiler:no_chromium_code" ]
--      configs += default_breakpad_configs
--
--      sources += [
--        "breakpad/src/processor/exploitability_linux.cc",
--        "breakpad/src/processor/exploitability_linux.h",
--        "breakpad/src/processor/exploitability_win.cc",
--        "breakpad/src/processor/exploitability_win.h",
--        "breakpad/src/processor/symbolic_constants_win.cc",
--        "breakpad/src/processor/symbolic_constants_win.h",
--      ]
--    }
--
--    executable("minidump_dump") {
--      sources = [
--        "breakpad/src/common/path_helper.cc",
--        "breakpad/src/common/path_helper.h",
--        "breakpad/src/common/scoped_ptr.h",
--        "breakpad/src/processor/basic_code_module.h",
--        "breakpad/src/processor/basic_code_modules.cc",
--        "breakpad/src/processor/basic_code_modules.h",
--        "breakpad/src/processor/convert_old_arm64_context.cc",
--        "breakpad/src/processor/convert_old_arm64_context.h",
--        "breakpad/src/processor/dump_context.cc",
--        "breakpad/src/processor/dump_object.cc",
--        "breakpad/src/processor/logging.cc",
--        "breakpad/src/processor/logging.h",
--        "breakpad/src/processor/minidump.cc",
--        "breakpad/src/processor/minidump_dump.cc",
--        "breakpad/src/processor/pathname_stripper.cc",
--        "breakpad/src/processor/pathname_stripper.h",
--        "breakpad/src/processor/proc_maps_linux.cc",
--      ]
--
--      configs += [ ":tools_config" ]
--
--      # There are some warnings in this code.
--      configs -= [ "//build/config/compiler:chromium_code" ]
--      configs += [ "//build/config/compiler:no_chromium_code" ]
--    }
--  } else {
--    # Aliases for convenience.
--    binary_symlink("microdump_stackwalk") {
--      binary_label = ":$target_name($host_toolchain)"
--    }
--    binary_symlink("minidump_stackwalk") {
--      binary_label = ":$target_name($host_toolchain)"
--    }
--    binary_symlink("minidump_dump") {
--      binary_label = ":$target_name($host_toolchain)"
--    }
--  }
--}
--
--# Mac --------------------------------------------------------------------------
--
--if (is_mac) {
--  if (current_toolchain == host_toolchain || target_os != "ios") {
--    source_set("common") {
--      sources = [
--        "breakpad/src/common/dwarf/bytereader.cc",
--        "breakpad/src/common/dwarf/dwarf2diehandler.cc",
--        "breakpad/src/common/dwarf/dwarf2reader.cc",
--        "breakpad/src/common/dwarf/elf_reader.cc",
--        "breakpad/src/common/dwarf/elf_reader.h",
--        "breakpad/src/common/dwarf_cfi_to_module.cc",
--        "breakpad/src/common/dwarf_cu_to_module.cc",
--        "breakpad/src/common/dwarf_line_to_module.cc",
--        "breakpad/src/common/dwarf_range_list_handler.cc",
--        "breakpad/src/common/dwarf_range_list_handler.h",
--        "breakpad/src/common/language.cc",
--        "breakpad/src/common/mac/arch_utilities.cc",
--        "breakpad/src/common/mac/arch_utilities.h",
--        "breakpad/src/common/mac/dump_syms.cc",
--        "breakpad/src/common/mac/file_id.cc",
--        "breakpad/src/common/mac/macho_id.cc",
--        "breakpad/src/common/mac/macho_reader.cc",
--        "breakpad/src/common/mac/macho_utilities.cc",
--        "breakpad/src/common/mac/macho_walker.cc",
--        "breakpad/src/common/md5.cc",
--        "breakpad/src/common/memory_range.h",
--        "breakpad/src/common/module.cc",
--        "breakpad/src/common/path_helper.cc",
--        "breakpad/src/common/path_helper.h",
--        "breakpad/src/common/scoped_ptr.h",
--        "breakpad/src/common/stabs_reader.cc",
--        "breakpad/src/common/stabs_to_module.cc",
--      ]
--      include_dirs = [ "breakpad/src/common/mac" ]
--
--      configs += [ ":internal_config" ]
--
--      # The DWARF utilities require -funsigned-char.
--      cflags = [ "-funsigned-char" ]
--
--      # dwarf2reader.cc uses dynamic_cast.
--      configs -= [ "//build/config/compiler:no_rtti" ]
--      configs += [ "//build/config/compiler:rtti" ]
--
--      configs -= [ "//build/config/compiler:chromium_code" ]
--      configs += [ "//build/config/compiler:no_chromium_code" ]
--
--      # For breakpad/src/common/stabs_reader.h.
--      defines = [ "HAVE_MACH_O_NLIST_H" ]
--    }
--
--    executable("dump_syms") {
--      sources = [ "breakpad/src/tools/mac/dump_syms/dump_syms_tool.cc" ]
--      configs -= [ "//build/config/compiler:chromium_code" ]
--      configs += [ "//build/config/compiler:no_chromium_code" ]
--
--      configs += [ ":internal_config" ]
--
--      frameworks = [ "Foundation.framework" ]
--
--      if (!is_debug) {
--        # dump_syms crashes when built at -O1, -O2, and -O3.  It does
--        # not crash at -Os.  To play it safe, dump_syms is always built
--        # at -O0 until this can be sorted out.
--        # https://crbug.com/google-breakpad/329
--        configs -= [ "//build/config/compiler:default_optimization" ]
--        cflags = [ "-O0" ]
--      }
--
--      deps = [ ":common" ]
--    }
--
--    executable("symupload") {
--      sources = [
--        "breakpad/src/common/mac/HTTPGetRequest.m",
--        "breakpad/src/common/mac/HTTPMultipartUpload.m",
--        "breakpad/src/common/mac/HTTPPutRequest.m",
--        "breakpad/src/common/mac/HTTPRequest.m",
--        "breakpad/src/common/mac/HTTPSimplePostRequest.m",
--        "breakpad/src/common/mac/SymbolCollectorClient.m",
--        "breakpad/src/common/mac/encoding_util.m",
--        "breakpad/src/tools/mac/symupload/symupload.mm",
--      ]
--
--      include_dirs = [ "breakpad/src/common/mac" ]
--
--      configs += [ ":internal_config" ]
--
--      frameworks = [ "Foundation.framework" ]
--
--      configs -= [ "//build/config/compiler:chromium_code" ]
--      configs += [ "//build/config/compiler:no_chromium_code" ]
--
--      deps = [ ":common" ]
--    }
--  } else {
--    binary_symlink("dump_syms") {
--      binary_label = ":$target_name($host_toolchain)"
--    }
--    binary_symlink("symupload") {
--      binary_label = ":$target_name($host_toolchain)"
--    }
--  }
--}
--
--if (is_ios) {
--  binary_symlink("dump_syms") {
--    binary_label = ":$target_name($host_toolchain)"
--  }
--  binary_symlink("symupload") {
--    binary_label = ":$target_name($host_toolchain)"
--  }
--}
--
--if (is_mac) {
--  static_library("utilities") {
--    sources = [
--      "breakpad/src/client/mac/crash_generation/ConfigFile.mm",
--      "breakpad/src/client/mac/handler/breakpad_nlist_64.cc",
--      "breakpad/src/client/mac/handler/dynamic_images.cc",
--      "breakpad/src/client/mac/handler/minidump_generator.cc",
--      "breakpad/src/client/minidump_file_writer.cc",
--      "breakpad/src/common/convert_UTF.cc",
--      "breakpad/src/common/mac/MachIPC.mm",
--      "breakpad/src/common/mac/arch_utilities.cc",
--      "breakpad/src/common/mac/arch_utilities.h",
--      "breakpad/src/common/mac/bootstrap_compat.cc",
--      "breakpad/src/common/mac/file_id.cc",
--      "breakpad/src/common/mac/launch_reporter.cc",
--      "breakpad/src/common/mac/macho_id.cc",
--      "breakpad/src/common/mac/macho_utilities.cc",
--      "breakpad/src/common/mac/macho_walker.cc",
--      "breakpad/src/common/mac/string_utilities.cc",
--      "breakpad/src/common/md5.cc",
--      "breakpad/src/common/scoped_ptr.h",
--      "breakpad/src/common/simple_string_dictionary.cc",
--      "breakpad/src/common/string_conversion.cc",
--    ]
--
--    configs += [ ":internal_config" ]
--
--    # There are some warnings in this code.
--    configs -= [ "//build/config/compiler:chromium_code" ]
--    configs += [ "//build/config/compiler:no_chromium_code" ]
--  }
--
--  executable("crash_inspector") {
--    sources = [
--      "breakpad/src/client/mac/crash_generation/Inspector.mm",
--      "breakpad/src/client/mac/crash_generation/InspectorMain.mm",
--    ]
--
--    # TODO(GYP): 'mac_real_dsym': 1,
--
--    include_dirs = [
--      "breakpad/src/client/apple/Framework",
--      "breakpad/src/common/mac",
--      "breakpad/src",
--    ]
--    frameworks = [
--      "CoreServices.framework",
--      "Foundation.framework",
--    ]
--
--    deps = [ ":utilities" ]
--  }
--
--  # TODO(GYP) this target has some mac_bundle_resources stuff.
--  # executable("crash_report_sender") {
--  # }
--  group("crash_report_sender") {
--  }
--
--  config("breakpad_config") {
--    include_dirs = [ "breakpad/src/client/apple/Framework" ]
--  }
--
--  static_library("breakpad") {
--    sources = [
--      "breakpad/src/client/mac/Framework/Breakpad.mm",
--      "breakpad/src/client/mac/Framework/OnDemandServer.mm",
--      "breakpad/src/client/mac/crash_generation/crash_generation_client.cc",
--      "breakpad/src/client/mac/crash_generation/crash_generation_client.h",
--      "breakpad/src/client/mac/handler/exception_handler.cc",
--      "breakpad/src/client/mac/handler/protected_memory_allocator.cc",
--    ]
--
--    configs += [ ":internal_config" ]
--    public_configs = [ ":breakpad_config" ]
--
--    defines = [ "USE_PROTECTED_ALLOCATIONS=1" ]
--    include_dirs = [ "breakpad/src/client/apple/Framework" ]
--
--    # TODO(crbug.com/841631): Breakpad uses bootstrap_subset() and
--    # bootstrap_create_server(), both of which are deprecated starting in 10.10.
--    cflags = [ "-Wno-deprecated-declarations" ]
--
--    deps = [
--      ":crash_inspector",
--      ":crash_report_sender",
--      ":utilities",
--    ]
--  }
--
--  group("client") {
--    public_configs = [ ":client_config" ]
--  }
--}
--
--if (is_linux || is_chromeos || is_android) {
--  if (current_toolchain == host_toolchain) {
--    executable("symupload") {
--      sources = [
--        "breakpad/src/common/linux/http_upload.cc",
--        "breakpad/src/common/linux/http_upload.h",
--        "breakpad/src/common/linux/libcurl_wrapper.cc",
--        "breakpad/src/common/linux/libcurl_wrapper.h",
--        "breakpad/src/common/linux/symbol_collector_client.cc",
--        "breakpad/src/common/linux/symbol_collector_client.h",
--        "breakpad/src/common/linux/symbol_upload.cc",
--        "breakpad/src/common/linux/symbol_upload.h",
--        "breakpad/src/common/path_helper.cc",
--        "breakpad/src/common/path_helper.h",
--        "breakpad/src/common/scoped_ptr.h",
--        "breakpad/src/tools/linux/symupload/sym_upload.cc",
--      ]
--
--      include_dirs = [
--        "breakpad/src",
--        "breakpad/src/third_party",
--      ]
--
--      configs += [ ":tools_config" ]
--
--      libs = [ "dl" ]
--    }
--
--    # dump_syms is a host tool, so only compile it for the host system.
--    executable("dump_syms") {
--      sources = [
--        "breakpad/src/common/dwarf/bytereader.cc",
--        "breakpad/src/common/dwarf/dwarf2diehandler.cc",
--        "breakpad/src/common/dwarf/dwarf2reader.cc",
--        "breakpad/src/common/dwarf/elf_reader.cc",
--        "breakpad/src/common/dwarf/elf_reader.h",
--        "breakpad/src/common/dwarf_cfi_to_module.cc",
--        "breakpad/src/common/dwarf_cfi_to_module.h",
--        "breakpad/src/common/dwarf_cu_to_module.cc",
--        "breakpad/src/common/dwarf_cu_to_module.h",
--        "breakpad/src/common/dwarf_line_to_module.cc",
--        "breakpad/src/common/dwarf_line_to_module.h",
--        "breakpad/src/common/dwarf_range_list_handler.cc",
--        "breakpad/src/common/dwarf_range_list_handler.h",
--        "breakpad/src/common/language.cc",
--        "breakpad/src/common/language.h",
--        "breakpad/src/common/linux/crc32.cc",
--        "breakpad/src/common/linux/crc32.h",
--        "breakpad/src/common/linux/dump_symbols.cc",
--        "breakpad/src/common/linux/dump_symbols.h",
--        "breakpad/src/common/linux/elf_symbols_to_module.cc",
--        "breakpad/src/common/linux/elf_symbols_to_module.h",
--        "breakpad/src/common/linux/elfutils.cc",
--        "breakpad/src/common/linux/elfutils.h",
--        "breakpad/src/common/linux/file_id.cc",
--        "breakpad/src/common/linux/file_id.h",
--        "breakpad/src/common/linux/guid_creator.h",
--        "breakpad/src/common/linux/linux_libc_support.cc",
--        "breakpad/src/common/linux/linux_libc_support.h",
--        "breakpad/src/common/linux/memory_mapped_file.cc",
--        "breakpad/src/common/linux/memory_mapped_file.h",
--        "breakpad/src/common/memory_allocator.h",
--        "breakpad/src/common/memory_range.h",
--        "breakpad/src/common/module.cc",
--        "breakpad/src/common/module.h",
--        "breakpad/src/common/path_helper.cc",
--        "breakpad/src/common/path_helper.h",
--        "breakpad/src/common/scoped_ptr.h",
--        "breakpad/src/common/stabs_reader.cc",
--        "breakpad/src/common/stabs_reader.h",
--        "breakpad/src/common/stabs_to_module.cc",
--        "breakpad/src/common/stabs_to_module.h",
--        "breakpad/src/tools/linux/dump_syms/dump_syms.cc",
--      ]
--
--      # There are some warnings in this code.
--      configs -= [ "//build/config/compiler:chromium_code" ]
--      configs += [ "//build/config/compiler:no_chromium_code" ]
--
--      # dwarf2reader.cc uses dynamic_cast. Because we don't typically
--      # don't support RTTI, we enable it for this single target. Since
--      # dump_syms doesn't share any object files with anything else,
--      # this doesn't end up polluting Chrome itself.
--      configs -= [ "//build/config/compiler:no_rtti" ]
--      configs += [ "//build/config/compiler:rtti" ]
--
--      # Breakpad rev 583 introduced this flag.
--      # Using this define, stabs_reader.h will include a.out.h to
--      # build on Linux.
--      defines = [ "HAVE_A_OUT_H" ]
--
--      include_dirs = [ "breakpad/src" ]
--    }
--  } else {
--    # Aliases for convenience.
--    binary_symlink("dump_syms") {
--      binary_label = ":dump_syms($host_toolchain)"
--    }
--    binary_symlink("symupload") {
--      binary_label = ":symupload($host_toolchain)"
--    }
--  }
--
--  static_library("client") {
--    sources = [
--      "breakpad/src/client/linux/crash_generation/crash_generation_client.cc",
--      "breakpad/src/client/linux/crash_generation/crash_generation_client.h",
--      "breakpad/src/client/linux/dump_writer_common/mapping_info.h",
--      "breakpad/src/client/linux/dump_writer_common/thread_info.cc",
--      "breakpad/src/client/linux/dump_writer_common/thread_info.h",
--      "breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc",
--      "breakpad/src/client/linux/dump_writer_common/ucontext_reader.h",
--      "breakpad/src/client/linux/handler/exception_handler.cc",
--      "breakpad/src/client/linux/handler/exception_handler.h",
--      "breakpad/src/client/linux/handler/minidump_descriptor.cc",
--      "breakpad/src/client/linux/handler/minidump_descriptor.h",
--      "breakpad/src/client/linux/log/log.cc",
--      "breakpad/src/client/linux/log/log.h",
--      "breakpad/src/client/linux/microdump_writer/microdump_writer.cc",
--      "breakpad/src/client/linux/microdump_writer/microdump_writer.h",
--      "breakpad/src/client/linux/minidump_writer/cpu_set.h",
--      "breakpad/src/client/linux/minidump_writer/directory_reader.h",
--      "breakpad/src/client/linux/minidump_writer/line_reader.h",
--      "breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc",
--      "breakpad/src/client/linux/minidump_writer/linux_core_dumper.h",
--      "breakpad/src/client/linux/minidump_writer/linux_dumper.cc",
--      "breakpad/src/client/linux/minidump_writer/linux_dumper.h",
--      "breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc",
--      "breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.h",
--      "breakpad/src/client/linux/minidump_writer/minidump_writer.cc",
--      "breakpad/src/client/linux/minidump_writer/minidump_writer.h",
--      "breakpad/src/client/linux/minidump_writer/proc_cpuinfo_reader.h",
--      "breakpad/src/client/minidump_file_writer-inl.h",
--      "breakpad/src/client/minidump_file_writer.cc",
--      "breakpad/src/client/minidump_file_writer.h",
--      "breakpad/src/common/convert_UTF.cc",
--      "breakpad/src/common/convert_UTF.h",
--      "breakpad/src/common/linux/breakpad_getcontext.S",
--      "breakpad/src/common/linux/elf_core_dump.cc",
--      "breakpad/src/common/linux/elf_core_dump.h",
--      "breakpad/src/common/linux/elfutils.cc",
--      "breakpad/src/common/linux/elfutils.h",
--      "breakpad/src/common/linux/file_id.cc",
--      "breakpad/src/common/linux/file_id.h",
--      "breakpad/src/common/linux/google_crashdump_uploader.cc",
--      "breakpad/src/common/linux/google_crashdump_uploader.h",
--      "breakpad/src/common/linux/guid_creator.cc",
--      "breakpad/src/common/linux/guid_creator.h",
--      "breakpad/src/common/linux/libcurl_wrapper.cc",
--      "breakpad/src/common/linux/libcurl_wrapper.h",
--      "breakpad/src/common/linux/linux_libc_support.cc",
--      "breakpad/src/common/linux/linux_libc_support.h",
--      "breakpad/src/common/linux/memory_mapped_file.cc",
--      "breakpad/src/common/linux/memory_mapped_file.h",
--      "breakpad/src/common/linux/safe_readlink.cc",
--      "breakpad/src/common/linux/safe_readlink.h",
--      "breakpad/src/common/memory_allocator.h",
--      "breakpad/src/common/memory_range.h",
--      "breakpad/src/common/scoped_ptr.h",
--      "breakpad/src/common/simple_string_dictionary.cc",
--      "breakpad/src/common/simple_string_dictionary.h",
--      "breakpad/src/common/string_conversion.cc",
--      "breakpad/src/common/string_conversion.h",
--    ]
--
--    configs -= [ "//build/config/compiler:chromium_code" ]
--    configs += [ "//build/config/compiler:no_chromium_code" ]
--    public_configs = [ ":client_config" ]
--
--    if (current_cpu == "arm" && is_chromeos_ash) {
--      # Avoid running out of registers in
--      # linux_syscall_support.h:sys_clone()'s inline assembly.
--      cflags = [ "-marm" ]
--    }
--
--    libs = [ "dl" ]
--
--    include_dirs = [
--      ".",
--      "breakpad/src",
--      "breakpad/src/client",
--      "breakpad/src/third_party/linux/include",
--    ]
--  }
--
--  static_library("processor_support") {
--    sources = [
--      "breakpad/src/common/scoped_ptr.h",
--      "breakpad/src/processor/basic_code_module.h",
--      "breakpad/src/processor/basic_code_modules.cc",
--      "breakpad/src/processor/basic_code_modules.h",
--      "breakpad/src/processor/convert_old_arm64_context.cc",
--      "breakpad/src/processor/convert_old_arm64_context.h",
--      "breakpad/src/processor/dump_context.cc",
--      "breakpad/src/processor/dump_object.cc",
--      "breakpad/src/processor/logging.cc",
--      "breakpad/src/processor/logging.h",
--      "breakpad/src/processor/minidump.cc",
--      "breakpad/src/processor/pathname_stripper.cc",
--      "breakpad/src/processor/pathname_stripper.h",
--      "breakpad/src/processor/proc_maps_linux.cc",
--    ]
--
--    include_dirs = [
--      "breakpad/src",
--      "breakpad/src/client",
--      "breakpad/src/third_party/linux/include",
--      ".",
--    ]
--
--    # There are some warnings in this code.
--    configs -= [ "//build/config/compiler:chromium_code" ]
--    configs += [ "//build/config/compiler:no_chromium_code" ]
--  }
--
--  test("breakpad_unittests") {
--    sources = [
--      "breakpad/src/client/linux/handler/exception_handler_unittest.cc",
--      "breakpad/src/client/linux/minidump_writer/cpu_set_unittest.cc",
--      "breakpad/src/client/linux/minidump_writer/directory_reader_unittest.cc",
--      "breakpad/src/client/linux/minidump_writer/line_reader_unittest.cc",
--      "breakpad/src/client/linux/minidump_writer/linux_core_dumper_unittest.cc",
--      "breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc",
--      "breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc",
--      "breakpad/src/client/linux/minidump_writer/minidump_writer_unittest_utils.cc",
--      "breakpad/src/client/linux/minidump_writer/proc_cpuinfo_reader_unittest.cc",
--      "breakpad/src/common/linux/breakpad_getcontext_unittest.cc",
--      "breakpad/src/common/linux/elf_core_dump_unittest.cc",
--      "breakpad/src/common/linux/file_id_unittest.cc",
--      "breakpad/src/common/linux/linux_libc_support_unittest.cc",
--      "breakpad/src/common/linux/synth_elf.cc",
--      "breakpad/src/common/linux/tests/auto_testfile.h",
--      "breakpad/src/common/linux/tests/crash_generator.cc",
--      "breakpad/src/common/linux/tests/crash_generator.h",
--      "breakpad/src/common/memory_allocator_unittest.cc",
--      "breakpad/src/common/memory_range.h",
--      "breakpad/src/common/simple_string_dictionary_unittest.cc",
--      "breakpad/src/common/test_assembler.cc",
--      "breakpad/src/common/tests/file_utils.cc",
--      "breakpad/src/common/tests/file_utils.h",
--      "breakpad/src/tools/linux/md2core/minidump_memory_range.h",
--      "breakpad/src/tools/linux/md2core/minidump_memory_range_unittest.cc",
--      "linux/breakpad_googletest_includes.h",
--    ]
--
--    deps = [
--      ":client",
--      ":processor_support",
--      "//testing/gmock",
--      "//testing/gtest",
--      "//testing/gtest:gtest_main",
--    ]
--
--    data_deps = [
--      ":linux_dumper_unittest_helper",
--      "//testing/buildbot/filters:breakpad_unittests_filters",
--    ]
--
--    include_dirs = [
--      "linux",  # Use our copy of breakpad_googletest_includes.h
--      ".",
--    ]
--
--    # There are some warnings in this code.
--    configs -= [ "//build/config/compiler:chromium_code" ]
--    configs += [
--      ":client_config",
--      "//build/config/compiler:no_chromium_code",
--    ]
--
--    if (is_clang) {
--      # See https://crbug.com/138571#c18
--      cflags = [ "-Wno-unused-value" ]
--    }
--
--    if (is_android) {
--      use_raw_android_executable = true
--      libs = [ "log" ]
--      extra_dist_files = [ "$root_out_dir/linux_dumper_unittest_helper" ]
--    }
--
--    # Add the breakpad unittest config at the end to override all configs.
--    configs += [ ":breakpad_unittest_config" ]
--  }
--
--  executable("linux_dumper_unittest_helper") {
--    testonly = true
--    sources = [ "breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc" ]
--    deps = [ ":processor_support" ]
--
--    configs += [ ":client_config" ]
--
--    if (is_component_build) {
--      ldflags = [ "-Wl,-rpath,\$ORIGIN" ]
--    }
--  }
--
--  executable("generate_test_dump") {
--    testonly = true
--    sources = [ "linux/generate-test-dump.cc" ]
--
--    # This file has an unused variable warning.
--    configs -= [ "//build/config/compiler:chromium_code" ]
--    configs += [
--      ":client_config",
--      "//build/config/compiler:no_chromium_code",
--    ]
--
--    deps = [ ":client" ]
--
--    if (is_android) {
--      libs = [ "log" ]
--    }
--  }
--
--  executable("minidump-2-core") {
--    sources = [
--      "breakpad/src/common/path_helper.cc",
--      "breakpad/src/common/path_helper.h",
--      "breakpad/src/tools/linux/md2core/minidump-2-core.cc",
--      "breakpad/src/tools/linux/md2core/minidump_memory_range.h",
--    ]
--
--    include_dirs = [ "breakpad/src" ]
--
--    deps = [ ":client" ]
--  }
--
--  executable("core-2-minidump") {
--    sources = [
--      "breakpad/src/common/path_helper.cc",
--      "breakpad/src/common/path_helper.h",
--      "breakpad/src/tools/linux/core2md/core2md.cc",
--    ]
--
--    deps = [ ":client" ]
--
--    include_dirs = [ "breakpad/src" ]
--  }
--}
--
--if (is_win) {
--  # Force a native symupload, since Chrome tries to be "helpful" and not really
--  # differentiate target vs. host for x86/x64 builds.
--  #
--  # Normally, this would just use the (current_toolchain == host_toolchain)
--  # condition, which would cause these targets to only be compiled for the host
--  # CPU (i.e. to only build "native" binaries), but the Chrome Windows build
--  # will "always use the target CPU for host builds for x86/x64":
--  # https://crrev.com/3258ed4d9d755a3564d98bef8707bbdb5f8a7974/config/BUILDCONFIG.gn#199
--  # This means that host_toolchain will be x86 (32-bit) if the target is x86,
--  # even when the host is actually x64 (64-bit), which causes this to create
--  # 32-bit binaries, despite wanting native, 64-bit binaries.
--  #
--  # Adding the second condition enables this block for the "true" host
--  # toolchain as well, which allows creating 64-bit binaries even when the host
--  # toolchain is redefined to a 32-bit target.
--  if (is_clang) {
--    symupload_toolchain = "//build/toolchain/win:win_clang_$host_cpu"
--  } else {
--    symupload_toolchain = "//build/toolchain/win:$host_cpu"
--  }
--  if (current_toolchain == host_toolchain ||
--      current_toolchain == symupload_toolchain) {
--    static_library("common_windows") {
--      include_dirs = [
--        "$visual_studio_path/DIA SDK/include",
--        "breakpad/src",
--      ]
--      sources = [
--        "breakpad/src/common/windows/dia_util.cc",
--        "breakpad/src/common/windows/dia_util.h",
--        "breakpad/src/common/windows/guid_string.cc",
--        "breakpad/src/common/windows/guid_string.h",
--        "breakpad/src/common/windows/http_upload.cc",
--        "breakpad/src/common/windows/http_upload.h",
--        "breakpad/src/common/windows/module_info.h",
--        "breakpad/src/common/windows/omap.cc",
--        "breakpad/src/common/windows/omap.h",
--        "breakpad/src/common/windows/omap_internal.h",
--        "breakpad/src/common/windows/pdb_source_line_writer.cc",
--        "breakpad/src/common/windows/pdb_source_line_writer.h",
--        "breakpad/src/common/windows/pe_source_line_writer.cc",
--        "breakpad/src/common/windows/pe_source_line_writer.h",
--        "breakpad/src/common/windows/pe_util.cc",
--        "breakpad/src/common/windows/pe_util.h",
--        "breakpad/src/common/windows/string_utils-inl.h",
--        "breakpad/src/common/windows/string_utils.cc",
--        "breakpad/src/common/windows/symbol_collector_client.cc",
--        "breakpad/src/common/windows/symbol_collector_client.h",
--      ]
--    }
--
--    static_library("ms_symbol_server_converter") {
--      include_dirs = [
--        "$visual_studio_path/DIA SDK/include",
--        "breakpad/src",
--      ]
--
--      sources = [
--        "breakpad/src/tools/windows/converter/ms_symbol_server_converter.cc",
--      ]
--
--      deps = [ "//third_party/breakpad:common_windows" ]
--
--      libs = [ "Pathcch.lib" ]
--    }
--
--    executable("dump_syms") {
--      # TODO(scottmg) using this with VS2015 may break the crash server.
--      # https://crbug.com/696671
--      include_dirs = [
--        "$visual_studio_path/DIA SDK/include",
--        "breakpad/src",
--      ]
--
--      sources = [ "breakpad/src/tools/windows/dump_syms/dump_syms.cc" ]
--
--      deps = [ "//third_party/breakpad:common_windows" ]
--
--      lib_dirs = []
--      if (current_cpu == "x64") {
--        lib_dirs += [ "$visual_studio_path/DIA SDK/lib/amd64" ]
--      } else {
--        lib_dirs += [ "$visual_studio_path/DIA SDK/lib" ]
--      }
--
--      libs = [
--        "diaguids.lib",
--        "imagehlp.lib",
--      ]
--
--      if (is_clang) {
--        # clang complains about microsoft-specific goto extensions. Instead of
--        # rewriting decade-old, goto-ridden code, disable the warning.
--        cflags = [ "-Wno-microsoft-goto" ]
--      }
--    }
--
--    group("symupload") {
--      deps = [ ":symupload_win($symupload_toolchain)" ]
--    }
--    executable("symupload_win") {
--      include_dirs = [
--        "$visual_studio_path/DIA SDK/include",
--        "breakpad/src",
--      ]
--      output_name = "symupload"
--
--      # Invert the normal logic which puts binaries built with the default
--      # (target) toolchain into the root output directory, and other toolchain
--      # binaries into subdirs. This gives preference to the native symupload,
--      # which is what's wanted in most situations. The cross-compiled binary
--      # can still be created (by building "symupload_win" instead of
--      # "symupload") and found in the corresponding toolchain subdir (e.g.
--      # //out/Release/win_clang_x86/ when cross-compiling to x86).
--      if (current_toolchain == symupload_toolchain) {
--        output_dir = "$root_build_dir"
--      } else {
--        output_name = "symupload_$target_cpu"
--        toolchain_parts =
--            string_split(get_path_info(current_toolchain, "name"), ":")
--        output_dir = "$root_out_dir/" + toolchain_parts[1]
--      }
--
--      sources = [ "breakpad/src/tools/windows/symupload/symupload.cc" ]
--
--      deps = [ "//third_party/breakpad:common_windows" ]
--
--      ldflags = [ "/LARGEADDRESSAWARE" ]
--
--      lib_dirs = []
--      if (current_cpu == "x64") {
--        lib_dirs += [ "$visual_studio_path/DIA SDK/lib/amd64" ]
--      } else {
--        lib_dirs += [ "$visual_studio_path/DIA SDK/lib" ]
--      }
--
--      libs = [
--        "diaguids.lib",
--        "imagehlp.lib",
--      ]
--
--      if (is_clang) {
--        # clang complains about microsoft-specific goto extensions. Instead of
--        # rewriting decade-old, goto-ridden code, disable the warning.
--        cflags = [ "-Wno-microsoft-goto" ]
--      }
--    }
--
--    executable("google_converter") {
--      include_dirs = [
--        "$visual_studio_path/DIA SDK/include",
--        "breakpad/src",
--      ]
--
--      sources = [
--        "breakpad/src/tools/windows/converter_exe/converter.cc",
--        "breakpad/src/tools/windows/converter_exe/escaping.cc",
--        "breakpad/src/tools/windows/converter_exe/escaping.h",
--        "breakpad/src/tools/windows/converter_exe/http_download.cc",
--        "breakpad/src/tools/windows/converter_exe/tokenizer.cc",
--        "breakpad/src/tools/windows/converter_exe/winhttp_client.cc",
--        "breakpad/src/tools/windows/converter_exe/wininet_client.cc",
--      ]
--
--      deps = [
--        "//third_party/breakpad:common_windows",
--        "//third_party/breakpad:ms_symbol_server_converter",
--      ]
--
--      ldflags = [
--        "/DELAYLOAD:dbghelp.dll",
--        "/DELAYLOAD:dwmapi.dll",
--        "/DELAYLOAD:uxtheme.dll",
--      ]
--
--      lib_dirs = []
--      if (current_cpu == "x64") {
--        lib_dirs += [ "$visual_studio_path/DIA SDK/lib/amd64" ]
--      } else {
--        lib_dirs += [ "$visual_studio_path/DIA SDK/lib" ]
--      }
--
--      libs = [
--        "diaguids.lib",
--        "imagehlp.lib",
--      ]
--
--      if (is_clang) {
--        # clang complains about microsoft-specific goto extensions. Instead of
--        # rewriting decade-old, goto-ridden code, disable the warning.
--        cflags = [ "-Wno-microsoft-goto" ]
--      }
--    }
--  } else {
--    # handle dump_syms appropriately for Windows cross build when necessary,
--    # such as symlinking.
--  }
--}
--
--if (is_ios) {
--  static_library("client") {
--    sources = [
--      "breakpad/src/client/ios/Breakpad.h",
--      "breakpad/src/client/ios/Breakpad.mm",
--      "breakpad/src/client/ios/BreakpadController.h",
--      "breakpad/src/client/ios/BreakpadController.mm",
--      "breakpad/src/client/ios/handler/ios_exception_minidump_generator.h",
--      "breakpad/src/client/ios/handler/ios_exception_minidump_generator.mm",
--      "breakpad/src/client/mac/crash_generation/ConfigFile.h",
--      "breakpad/src/client/mac/crash_generation/ConfigFile.mm",
--      "breakpad/src/client/mac/handler/breakpad_nlist_64.cc",
--      "breakpad/src/client/mac/handler/breakpad_nlist_64.h",
--      "breakpad/src/client/mac/handler/dynamic_images.cc",
--      "breakpad/src/client/mac/handler/dynamic_images.h",
--      "breakpad/src/client/mac/handler/exception_handler.cc",
--      "breakpad/src/client/mac/handler/exception_handler.h",
--      "breakpad/src/client/mac/handler/minidump_generator.cc",
--      "breakpad/src/client/mac/handler/minidump_generator.h",
--      "breakpad/src/client/mac/handler/protected_memory_allocator.cc",
--      "breakpad/src/client/mac/handler/protected_memory_allocator.h",
--      "breakpad/src/client/mac/sender/uploader.h",
--      "breakpad/src/client/mac/sender/uploader.mm",
--      "breakpad/src/client/minidump_file_writer-inl.h",
--      "breakpad/src/client/minidump_file_writer.cc",
--      "breakpad/src/client/minidump_file_writer.h",
--      "breakpad/src/common/convert_UTF.cc",
--      "breakpad/src/common/convert_UTF.h",
--      "breakpad/src/common/long_string_dictionary.cc",
--      "breakpad/src/common/mac/HTTPMultipartUpload.m",
--      "breakpad/src/common/mac/HTTPRequest.m",
--      "breakpad/src/common/mac/encoding_util.m",
--      "breakpad/src/common/mac/file_id.cc",
--      "breakpad/src/common/mac/file_id.h",
--      "breakpad/src/common/mac/macho_id.cc",
--      "breakpad/src/common/mac/macho_id.h",
--      "breakpad/src/common/mac/macho_utilities.cc",
--      "breakpad/src/common/mac/macho_utilities.h",
--      "breakpad/src/common/mac/macho_walker.cc",
--      "breakpad/src/common/mac/macho_walker.h",
--      "breakpad/src/common/mac/string_utilities.cc",
--      "breakpad/src/common/mac/string_utilities.h",
--      "breakpad/src/common/md5.cc",
--      "breakpad/src/common/md5.h",
--      "breakpad/src/common/simple_string_dictionary.cc",
--      "breakpad/src/common/simple_string_dictionary.h",
--      "breakpad/src/common/string_conversion.cc",
--      "breakpad/src/common/string_conversion.h",
--      "breakpad/src/google_breakpad/common/minidump_format.h",
--    ]
--
--    include_dirs = [
--      "breakpad/src",
--      "breakpad/src/client/mac/Framework",
--      "breakpad/src/common/mac",
--    ]
--
--    public_configs = [ ":client_config" ]
--
--    if (is_clang) {
--      # See https://crbug.com/google-breakpad/675.
--      cflags = [ "-Wno-deprecated-declarations" ]
--    }
--  }
--}
--
--if (is_win) {
--  group("client") {
--    public_configs = [ ":client_config" ]
--  }
--
--  config("breakpad_handler_warnings") {
--    if (is_clang) {
--      # See https://crbug.com/google-breakpad/658.
--      cflags = [ "-Wno-reorder" ]
--    }
--  }
--
--  static_library("breakpad_handler") {
--    configs += [ ":handler_config" ]
--    if (is_win) {
--      public_configs = [ ":handler_config" ]
--    }
--
--    defines = [ "BREAKPAD_NO_TERMINATE_THREAD" ]
--
--    sources = [
--      "breakpad/src/client/windows/crash_generation/client_info.cc",
--      "breakpad/src/client/windows/crash_generation/client_info.h",
--      "breakpad/src/client/windows/crash_generation/crash_generation_client.cc",
--      "breakpad/src/client/windows/crash_generation/crash_generation_client.h",
--      "breakpad/src/client/windows/crash_generation/crash_generation_server.cc",
--      "breakpad/src/client/windows/crash_generation/crash_generation_server.h",
--      "breakpad/src/client/windows/crash_generation/minidump_generator.cc",
--      "breakpad/src/client/windows/crash_generation/minidump_generator.h",
--      "breakpad/src/client/windows/handler/exception_handler.cc",
--      "breakpad/src/client/windows/handler/exception_handler.h",
--      "breakpad/src/common/windows/guid_string.cc",
--      "breakpad/src/common/windows/guid_string.h",
--      "breakpad/src/common/windows/string_utils-inl.h",
--      "breakpad/src/google_breakpad/common/minidump_format.h",
--    ]
--    configs += [ ":breakpad_handler_warnings" ]
--  }
--
--  source_set("breakpad_sender") {
--    sources = [
--      "breakpad/src/client/windows/sender/crash_report_sender.cc",
--      "breakpad/src/client/windows/sender/crash_report_sender.h",
--      "breakpad/src/common/windows/http_upload.cc",
--      "breakpad/src/common/windows/http_upload.h",
--      "breakpad/src/common/windows/string_utils-inl.h",
--    ]
--    configs += [ ":sender_config" ]
--    public_configs = [ ":sender_config" ]
--  }
--}
-diff --git a/tools/perf/chrome_telemetry_build/BUILD.gn b/tools/perf/chrome_telemetry_build/BUILD.gn
-index 2d6c25ea2d0bb..1aaf0b2ce3d66 100644
---- a/tools/perf/chrome_telemetry_build/BUILD.gn
-+++ b/tools/perf/chrome_telemetry_build/BUILD.gn
-@@ -46,8 +46,6 @@ group("telemetry_chrome_test") {
-   }
- 
-   if (is_linux || is_chromeos) {
--    data_deps += [ "//third_party/breakpad:dump_syms($host_toolchain)" ]
--
-     # CrOS currently has issues with the locally compiled version of
-     # crashpad_database_util, so only include it on traditional Linux
-     # platforms.
-@@ -61,7 +59,6 @@ group("telemetry_chrome_test") {
-     data_deps += [
-       "//chrome:chrome_framework",
-       "//chrome:chrome_helper_app_default",
--      "//third_party/breakpad:dump_syms",
-       "//third_party/crashpad/crashpad/tools:crashpad_database_util",
-     ]
-   }
-@@ -211,20 +208,6 @@ group("telemetry_chrome_test_without_chrome") {
-     "//tools/metrics:metrics_python_tests",
-   ]
- 
--  # Cr-Fuchsia doesn't support breakpad.
--  if (!is_win && !is_fuchsia) {
--    data_deps += [
--      # This is defined for Windows, but is unused by Telemetry on
--      # Windows, and including it can have issues when cross-compiling
--      # for Arm-based Windows.
--      "//third_party/breakpad:dump_syms",
--
--      # These explicitly not defined for Windows builds in Breakpad.
--      "//third_party/breakpad:minidump_dump",
--      "//third_party/breakpad:minidump_stackwalk",
--    ]
--  }
--
-   if (is_mac) {
-     data += [
-       # Required for the hermetic otool binary, which is required for
--- 
-2.25.1
-

+ 0 - 27
archive/0001-build-config-make-sure-target_cpu-is-honored-in-tool.patch

@@ -1,27 +0,0 @@
-From 41a39ad79244bcbd710e496a3bdab94d0309ce85 Mon Sep 17 00:00:00 2001
-From: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
-Date: Fri, 14 Jan 2022 07:30:10 +0000
-Subject: [PATCH] build: config: make sure target_cpu is honored in
- toolchain settings
-
-Signed-off-by: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
----
- build/config/BUILDCONFIG.gn | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn
-index d960648941d8b..51da82f22945d 100644
---- a/build/config/BUILDCONFIG.gn
-+++ b/build/config/BUILDCONFIG.gn
-@@ -195,7 +195,7 @@ if (host_toolchain == "") {
-     if (target_os != "linux") {
-       host_toolchain = "//build/toolchain/linux:clang_$host_cpu"
-     } else if (is_clang) {
--      host_toolchain = "//build/toolchain/linux:clang_$host_cpu"
-+      host_toolchain = "//build/toolchain/linux:clang_$target_cpu"
-     } else {
-       host_toolchain = "//build/toolchain/linux:$host_cpu"
-     }
--- 
-2.25.1
-

+ 0 - 26
archive/0001-build-gn_run_binary.py-do-not-run-binary-from.patch

@@ -1,26 +0,0 @@
-From a2522cb27a828a7cd37ae553eb21d10764acf316 Mon Sep 17 00:00:00 2001
-From: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
-Date: Wed, 19 Jan 2022 05:48:04 +0000
-Subject: [PATCH] build: gn_run_binary.py: do not run binary from ./
-
-Signed-off-by: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
----
- build/gn_run_binary.py | 2 --
- 1 file changed, 2 deletions(-)
-
-diff --git a/build/gn_run_binary.py b/build/gn_run_binary.py
-index d7e2926fa4fba..f071a78d0fd83 100644
---- a/build/gn_run_binary.py
-+++ b/build/gn_run_binary.py
-@@ -18,8 +18,6 @@ import sys
- # may prefix it with "./" to avoid picking up system versions that might
- # also be on the path.
- path = sys.argv[1]
--if not os.path.isabs(path):
--  path = './' + path
- 
- # The rest of the arguments are passed directly to the executable.
- args = [path] + sys.argv[2:]
--- 
-2.25.1
-

+ 0 - 607
archive/0001-linux-sysroot-script-to-create-riscv-sysroot-from-De.patch

@@ -1,607 +0,0 @@
-From ceef9e02d5fd787605d0babc94570ca41d8f7a2e Mon Sep 17 00:00:00 2001
-From: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
-Date: Wed, 18 May 2022 06:00:28 +0000
-Subject: [PATCH 01/21] linux: sysroot: script to create riscv sysroot from
- Debian ports
-
-Signed-off-by: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
----
- .../sysroot_scripts/sysroot-creator-sid.sh    | 416 ++++++++++++++++++
- .../linux/sysroot_scripts/sysroot-creator.sh  |  52 ++-
- 2 files changed, 459 insertions(+), 9 deletions(-)
- create mode 100755 build/linux/sysroot_scripts/sysroot-creator-sid.sh
-
-diff --git a/build/linux/sysroot_scripts/sysroot-creator-sid.sh b/build/linux/sysroot_scripts/sysroot-creator-sid.sh
-new file mode 100755
-index 0000000000000..f8c01b96256d5
---- /dev/null
-+++ b/build/linux/sysroot_scripts/sysroot-creator-sid.sh
-@@ -0,0 +1,416 @@
-+#!/bin/bash
-+# Copyright 2022 The Chromium Authors. All rights reserved.
-+# Use of this source code is governed by a BSD-style license that can be
-+# found in the LICENSE file.
-+
-+SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-+
-+DISTRO=debian
-+DIST=sid
-+
-+ARCHIVE_URL="http://ftp.ports.debian.org/debian-ports/"
-+APT_SOURCES_LIST=(
-+  "${ARCHIVE_URL} experimental main"
-+  "${ARCHIVE_URL} unreleased main"
-+  "${ARCHIVE_URL} unstable main"
-+  "${ARCHIVE_URL} sid main"
-+)
-+
-+# gpg keyring file generated using generate_keyring.sh
-+KEYRING_FILE="/etc/apt/trusted.gpg.d/debian-ports-archive-2022.gpg"
-+
-+HAS_ARCH_RISCV64=1
-+
-+# Sysroot packages: these are the packages needed to build chrome.
-+DEBIAN_PACKAGES="\
-+  comerr-dev
-+  krb5-multidev
-+  libasound2
-+  libasound2-dev
-+  libasyncns0
-+  libatk-bridge2.0-0
-+  libatk-bridge2.0-dev
-+  libatk1.0-0
-+  libatk1.0-dev
-+  libatomic1
-+  libatspi2.0-0
-+  libatspi2.0-dev
-+  libattr1
-+  libaudit1
-+  libavahi-client3
-+  libavahi-common3
-+  libblkid-dev
-+  libblkid1
-+  libbluetooth-dev
-+  libbluetooth3
-+  libbrotli-dev
-+  libbrotli1
-+  libbsd0
-+  libc6
-+  libc6-dev
-+  libcairo-gobject2
-+  libcairo-script-interpreter2
-+  libcairo2
-+  libcairo2-dev
-+  libcap-dev
-+  libcap-ng0
-+  libcap2
-+  libcloudproviders0
-+  libcolord2
-+  libcom-err2
-+  libcups2
-+  libcups2-dev
-+  libcupsimage2
-+  libcupsimage2-dev
-+  libcurl3-gnutls
-+  libcurl4-gnutls-dev
-+  libdatrie-dev
-+  libdatrie1
-+  libdb5.3
-+  libdbus-1-3
-+  libdbus-1-dev
-+  libdbus-glib-1-2
-+  libdbusmenu-glib-dev
-+  libdbusmenu-glib4
-+  libdbusmenu-gtk3-4
-+  libdbusmenu-gtk4
-+  libdeflate-dev
-+  libdeflate0
-+  libdouble-conversion3
-+  libdrm-amdgpu1
-+  libdrm-dev
-+  libdrm-nouveau2
-+  libdrm-radeon1
-+  libdrm2
-+  libegl-dev
-+  libegl1
-+  libegl1-mesa
-+  libegl1-mesa-dev
-+  libelf-dev
-+  libelf1
-+  libepoxy-dev
-+  libepoxy0
-+  libevdev-dev
-+  libevdev2
-+  libevent-2.1-7
-+  libexpat1
-+  libexpat1-dev
-+  libffi-dev
-+  libffi8
-+  libflac-dev
-+  libflac8
-+  libfontconfig-dev
-+  libfontconfig1
-+  libfreetype-dev
-+  libfreetype6
-+  libfribidi-dev
-+  libfribidi0
-+  libgbm-dev
-+  libgbm1
-+  libgcc-10-dev
-+  libgcc-s1
-+  libgcrypt20
-+  libgcrypt20-dev
-+  libgdk-pixbuf-2.0-0
-+  libgdk-pixbuf-2.0-dev
-+  libgl-dev
-+  libgl1
-+  libgl1-mesa-dev
-+  libgl1-mesa-glx
-+  libglapi-mesa
-+  libgles-dev
-+  libgles1
-+  libgles2
-+  libglib2.0-0
-+  libglib2.0-dev
-+  libglvnd-dev
-+  libglvnd0
-+  libglx-dev
-+  libglx0
-+  libgmp10
-+  libgnutls-dane0
-+  libgnutls-openssl27
-+  libgnutls28-dev
-+  libgnutls30
-+  libgnutlsxx30
-+  libgomp1
-+  libgpg-error-dev
-+  libgpg-error0
-+  libgraphene-1.0-0
-+  libgraphene-1.0-dev
-+  libgraphite2-3
-+  libgraphite2-dev
-+  libgssapi-krb5-2
-+  libgssrpc4
-+  libgtk-3-0
-+  libgtk-3-dev
-+  libgtk-4-1
-+  libgtk-4-dev
-+  libgtk2.0-0
-+  libgudev-1.0-0
-+  libharfbuzz-dev
-+  libharfbuzz-gobject0
-+  libharfbuzz-icu0
-+  libharfbuzz0b
-+  libhogweed6
-+  libice6
-+  libicu-le-hb0
-+  libicu71
-+  libidl-2-0
-+  libidn12
-+  libidn2-0
-+  libinput-dev
-+  libinput10
-+  libjbig-dev
-+  libjbig0
-+  libjpeg62-turbo
-+  libjpeg62-turbo-dev
-+  libjson-glib-1.0-0
-+  libjsoncpp-dev
-+  libjsoncpp25
-+  libk5crypto3
-+  libkadm5clnt-mit12
-+  libkadm5srv-mit12
-+  libkdb5-10
-+  libkeyutils1
-+  libkrb5-3
-+  libkrb5-dev
-+  libkrb5support0
-+  liblcms2-2
-+  libldap-2.5-0
-+  libltdl7
-+  liblz4-1
-+  liblzma5
-+  liblzo2-2
-+  libmd0
-+  libmd4c0
-+  libminizip-dev
-+  libminizip1
-+  libmount-dev
-+  libmount1
-+  libmtdev1
-+  libncurses-dev
-+  libncurses6
-+  libncursesw6
-+  libnettle8
-+  libnghttp2-14
-+  libnsl2
-+  libnspr4
-+  libnspr4-dev
-+  libnss-db
-+  libnss3
-+  libnss3-dev
-+  libogg-dev
-+  libogg0
-+  libopengl0
-+  libopus-dev
-+  libopus0
-+  libp11-kit0
-+  libpam0g
-+  libpam0g-dev
-+  libpango-1.0-0
-+  libpango1.0-dev
-+  libpangocairo-1.0-0
-+  libpangoft2-1.0-0
-+  libpangoxft-1.0-0
-+  libpci-dev
-+  libpci3
-+  libpciaccess0
-+  libpcre16-3
-+  libpcre2-16-0
-+  libpcre2-32-0
-+  libpcre2-8-0
-+  libpcre2-dev
-+  libpcre2-posix3
-+  libpcre3
-+  libpcre3-dev
-+  libpcre32-3
-+  libpcrecpp0v5
-+  libpipewire-0.3-0
-+  libpipewire-0.3-dev
-+  libpixman-1-0
-+  libpixman-1-dev
-+  libpng-dev
-+  libpng16-16
-+  libpsl5
-+  libpthread-stubs0-dev
-+  libpulse-dev
-+  libpulse-mainloop-glib0
-+  libpulse0
-+  libqt5concurrent5
-+  libqt5core5a
-+  libqt5dbus5
-+  libqt5gui5
-+  libqt5network5
-+  libqt5printsupport5
-+  libqt5sql5
-+  libqt5test5
-+  libqt5widgets5
-+  libqt5xml5
-+  libre2-9
-+  libre2-dev
-+  librest-0.7-0
-+  librtmp1
-+  libsasl2-2
-+  libselinux1
-+  libselinux1-dev
-+  libsepol2
-+  libsepol-dev
-+  libsm6
-+  libsnappy-dev
-+  libsnappy1v5
-+  libsndfile1
-+  libsoup-gnome2.4-1
-+  libsoup2.4-1
-+  libspa-0.2-dev
-+  libspeechd-dev
-+  libspeechd2
-+  libsqlite3-0
-+  libssh2-1
-+  libssl-dev
-+  libssl1.1
-+  libstdc++-10-dev
-+  libstdc++6
-+  libsystemd0
-+  libtasn1-6
-+  libthai-dev
-+  libthai0
-+  libtiff-dev
-+  libtiff5
-+  libtiffxx5
-+  libtinfo6
-+  libtirpc3
-+  libudev-dev
-+  libudev1
-+  libunbound8
-+  libunistring2
-+  libutempter-dev
-+  libutempter0
-+  libuuid1
-+  libva-dev
-+  libva-drm2
-+  libva-glx2
-+  libva-wayland2
-+  libva-x11-2
-+  libva2
-+  libvorbis0a
-+  libvorbisenc2
-+  libvulkan-dev
-+  libvulkan1
-+  libwacom9
-+  libwayland-client0
-+  libwayland-cursor0
-+  libwayland-dev
-+  libwayland-egl1
-+  libwayland-egl1-mesa
-+  libwayland-server0
-+  libwebp-dev
-+  libwebp7
-+  libwebpdemux2
-+  libwebpmux3
-+  libwrap0
-+  libx11-6
-+  libx11-dev
-+  libx11-xcb-dev
-+  libx11-xcb1
-+  libxau-dev
-+  libxau6
-+  libxcb-dri2-0
-+  libxcb-dri2-0-dev
-+  libxcb-dri3-0
-+  libxcb-dri3-dev
-+  libxcb-glx0
-+  libxcb-glx0-dev
-+  libxcb-icccm4
-+  libxcb-image0
-+  libxcb-keysyms1
-+  libxcb-present-dev
-+  libxcb-present0
-+  libxcb-randr0
-+  libxcb-render-util0
-+  libxcb-render0
-+  libxcb-render0-dev
-+  libxcb-shape0
-+  libxcb-shm0
-+  libxcb-shm0-dev
-+  libxcb-sync1
-+  libxcb-util1
-+  libxcb-xfixes0
-+  libxcb-xinerama0
-+  libxcb-xinput0
-+  libxcb-xkb1
-+  libxcb1
-+  libxcb1-dev
-+  libxcomposite-dev
-+  libxcomposite1
-+  libxcursor-dev
-+  libxcursor1
-+  libxdamage-dev
-+  libxdamage1
-+  libxdmcp-dev
-+  libxdmcp6
-+  libxext-dev
-+  libxext6
-+  libxfixes-dev
-+  libxfixes3
-+  libxft-dev
-+  libxft2
-+  libxi-dev
-+  libxi6
-+  libxinerama-dev
-+  libxinerama1
-+  libxkbcommon-dev
-+  libxkbcommon-x11-0
-+  libxkbcommon0
-+  libxml2
-+  libxml2-dev
-+  libxrandr-dev
-+  libxrandr2
-+  libxrender-dev
-+  libxrender1
-+  libxshmfence-dev
-+  libxshmfence1
-+  libxslt1-dev
-+  libxslt1.1
-+  libxss-dev
-+  libxss1
-+  libxt-dev
-+  libxt6
-+  libxtst-dev
-+  libxtst6
-+  libxxf86vm-dev
-+  libxxf86vm1
-+  libzstd1
-+  linux-libc-dev
-+  mesa-common-dev
-+  qtbase5-dev
-+  qtbase5-dev-tools
-+  shared-mime-info
-+  uuid-dev
-+  wayland-protocols
-+  x11proto-dev
-+  zlib1g
-+  zlib1g-dev
-+"
-+
-+DEBIAN_PACKAGES_RISCV64="
-+  libtsan0
-+  liblsan0
-+  libasan6
-+  libdrm-intel1
-+  libitm1
-+  libquadmath0
-+  libdrm-etnaviv1
-+  libdrm-exynos1
-+  libdrm-freedreno1
-+  libdrm-omap1
-+  libdrm-tegra0
-+  libgmp10
-+  liblsan0
-+  libthai0
-+  libtsan0
-+  libubsan1
-+  valgrind
-+"
-+
-+. "${SCRIPT_DIR}/sysroot-creator.sh"
-diff --git a/build/linux/sysroot_scripts/sysroot-creator.sh b/build/linux/sysroot_scripts/sysroot-creator.sh
-index fb854cbfa4d6b..c46edc8224465 100644
---- a/build/linux/sysroot_scripts/sysroot-creator.sh
-+++ b/build/linux/sysroot_scripts/sysroot-creator.sh
-@@ -51,6 +51,7 @@ readonly HAS_ARCH_ARM64=${HAS_ARCH_ARM64:=0}
- readonly HAS_ARCH_ARMEL=${HAS_ARCH_ARMEL:=0}
- readonly HAS_ARCH_MIPS=${HAS_ARCH_MIPS:=0}
- readonly HAS_ARCH_MIPS64EL=${HAS_ARCH_MIPS64EL:=0}
-+readonly HAS_ARCH_RISCV64=${HAS_ARCH_RISCV64:=0}
- 
- readonly REQUIRED_TOOLS="curl xzcat"
- 
-@@ -69,6 +70,7 @@ readonly DEBIAN_DEP_LIST_ARM64="generated_package_lists/${DIST}.arm64"
- readonly DEBIAN_DEP_LIST_ARMEL="generated_package_lists/${DIST}.armel"
- readonly DEBIAN_DEP_LIST_MIPS="generated_package_lists/${DIST}.mipsel"
- readonly DEBIAN_DEP_LIST_MIPS64EL="generated_package_lists/${DIST}.mips64el"
-+readonly DEBIAN_DEP_LIST_RISCV64="generated_package_lists/${DIST}.riscv64"
- 
- 
- ######################################################################
-@@ -171,6 +173,9 @@ SetEnvironmentVariables() {
-     *ARMEL)
-       ARCH=ARMEL
-       ;;
-+    *Riscv*)
-+      ARCH=RISCV64
-+      ;;
-     *)
-       echo "ERROR: Unable to determine architecture based on: $1"
-       exit 1
-@@ -312,6 +317,10 @@ GeneratePackageListMips64el() {
-   ${DEBIAN_PACKAGES_MIPS64EL:=}"
- }
- 
-+GeneratePackageListRiscv64() {
-+  GeneratePackageListCommon "$1" riscv64 "${DEBIAN_PACKAGES}"
-+}
-+
- StripChecksumsFromPackageList() {
-   local package_file="$1"
-   sed -i 's/ [a-f0-9]\{64\}$//' "$package_file"
-@@ -407,13 +416,11 @@ HacksAndPatchesAmd64() {
-   ReversionGlibc x86_64 linux-gnu
- }
- 
--
- HacksAndPatchesI386() {
-   HacksAndPatchesCommon i386 linux-gnu strip
-   ReversionGlibc i386 linux-gnu
- }
- 
--
- HacksAndPatchesARM() {
-   HacksAndPatchesCommon arm linux-gnueabihf arm-linux-gnueabihf-strip
-   ReversionGlibc arm linux-gnueabihf
-@@ -438,12 +445,15 @@ HacksAndPatchesMips() {
-   ReversionGlibc mipsel linux-gnu
- }
- 
--
- HacksAndPatchesMips64el() {
-   HacksAndPatchesCommon mips64el linux-gnuabi64 mips64el-linux-gnuabi64-strip
-   ReversionGlibc mips64el linux-gnuabi64
- }
- 
-+HacksAndPatchesRiscv64() {
-+  HacksAndPatchesCommon riscv64 linux-gnu true
-+   ReversionGlibc riscv64 linux-gnu
-+}
- 
- InstallIntoSysroot() {
-   Banner "Install Libs And Headers Into Jail"
-@@ -494,7 +504,7 @@ CleanupJailSymlinks() {
-   cd ${INSTALL_ROOT}
-   local libdirs="lib usr/lib"
-   if [ "${ARCH}" != "MIPS" ]; then
--    libdirs="${libdirs} lib64"
-+    libdirs="${libdirs}"
-   fi
- 
-   find $libdirs -type l -printf '%p %l\n' | while read link target; do
-@@ -537,6 +547,7 @@ VerifyLibraryDepsCommon() {
-   local all_libs="$(find ${find_dirs[*]} -printf '%f\n')"
-   # Ignore missing libdbus-1.so.0
-   all_libs+="$(echo -e '\nlibdbus-1.so.0')"
-+  all_libs+="$(echo -e '\nlibicuuc.so.67')"
-   local missing_libs="$(grep -vFxf <(echo "${all_libs}") \
-     <(echo "${needed_libs}"))"
-   if [ ! -z "${missing_libs}" ]; then
-@@ -551,17 +562,14 @@ VerifyLibraryDepsAmd64() {
-   VerifyLibraryDepsCommon x86_64 linux-gnu
- }
- 
--
- VerifyLibraryDepsI386() {
-   VerifyLibraryDepsCommon i386 linux-gnu
- }
- 
--
- VerifyLibraryDepsARM() {
-   VerifyLibraryDepsCommon arm linux-gnueabihf
- }
- 
--
- VerifyLibraryDepsARM64() {
-   VerifyLibraryDepsCommon aarch64 linux-gnu
- }
-@@ -574,11 +582,14 @@ VerifyLibraryDepsMips() {
-   VerifyLibraryDepsCommon mipsel linux-gnu
- }
- 
--
- VerifyLibraryDepsMips64el() {
-   VerifyLibraryDepsCommon mips64el linux-gnuabi64
- }
- 
-+VerifyLibraryDepsRiscv64() {
-+  VerifyLibraryDepsCommon riscv64 linux-gnu
-+}
-+
- 
- #@
- #@ BuildSysrootAmd64
-@@ -720,6 +731,26 @@ BuildSysrootMips64el() {
-   CreateTarBall
- }
- 
-+#@
-+#@ BuildSysrootRiscv64
-+#@
-+#@    Build everything and package it
-+BuildSysrootRiscv64() {
-+  if [ "$HAS_ARCH_RISCV64" = "0" ]; then
-+    return
-+  fi
-+  ClearInstallDir
-+  local package_file="${DEBIAN_DEP_LIST_RISCV64}"
-+  GeneratePackageListRiscv64 "$package_file"
-+  local files_and_sha256sums="$(cat ${package_file})"
-+  StripChecksumsFromPackageList "$package_file"
-+  InstallIntoSysroot ${files_and_sha256sums}
-+  HacksAndPatchesRiscv64
-+  CleanupJailSymlinks
-+  VerifyLibraryDepsRiscv64
-+  CreateTarBall
-+}
-+
- #@
- #@ BuildSysrootAll
- #@
-@@ -895,7 +926,7 @@ GeneratePackageList() {
-   local failed=0
-   for pkg in $@ ; do
-     local pkg_full=$(grep -A 1 " ${pkg}\$" "$input_file" | \
--      egrep "pool/.*" | sed 's/.*Filename: //')
-+      egrep "debian-ports/.*" | sed 's/.*Filename: //')
-     if [ -z "${pkg_full}" ]; then
-       echo "ERROR: missing package: $pkg"
-       local failed=1
-@@ -942,6 +973,9 @@ PrintArchitectures() {
-   if [ "$HAS_ARCH_MIPS64EL" = "1" ]; then
-     echo Mips64el
-   fi
-+  if [ "$HAS_ARCH_RISCV64" = "1" ]; then
-+    echo Riscv64
-+  fi
- }
- 
- #@
--- 
-2.25.1
-

+ 0 - 99
archive/0001-media-gpu-disable-tests.patch

@@ -1,99 +0,0 @@
-From 89d89e36b1fe1505c19e634faedfebf74279c1d0 Mon Sep 17 00:00:00 2001
-From: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
-Date: Fri, 14 Jan 2022 07:16:30 +0000
-Subject: [PATCH] media: gpu: disable tests
-
-Unable to assert "enable_av1_decoder".
-
-Signed-off-by: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
----
- media/gpu/BUILD.gn | 73 ----------------------------------------------
- 1 file changed, 73 deletions(-)
-
-diff --git a/media/gpu/BUILD.gn b/media/gpu/BUILD.gn
-index 9244da3cf636b..ae2461f645ef9 100644
---- a/media/gpu/BUILD.gn
-+++ b/media/gpu/BUILD.gn
-@@ -589,79 +589,6 @@ source_set("unit_tests") {
-   }
- }
- 
--# TODO(crbug.com/1006266): consider using |use_chromeos_video_acceleration|.
--if (use_v4l2_codec || use_vaapi) {
--  test("video_decode_accelerator_tests") {
--    assert(enable_av1_decoder)
--    testonly = true
--    sources = [ "video_decode_accelerator_tests.cc" ]
--    data = [ "//media/test/data/" ]
--    deps = [
--      ":buildflags",
--      "test:frame_file_writer",
--      "test:frame_validator",
--      "test:helpers",
--      "test:test_helpers",
--      "test:video_player",
--      "test:video_player_test_environment",
--      "test:video_player_thumbnail_renderer",
--      "//media:test_support",
--      "//testing/gtest",
--    ]
--  }
--
--  test("video_decode_accelerator_perf_tests") {
--    testonly = true
--    sources = [ "video_decode_accelerator_perf_tests.cc" ]
--    data = [ "//media/test/data/" ]
--    deps = [
--      ":buildflags",
--      "test:helpers",
--      "test:video_player",
--      "test:video_player_test_environment",
--      "//media:test_support",
--      "//sandbox/linux:sandbox_services",
--      "//testing/gtest",
--    ]
--  }
--
--  test("video_encode_accelerator_tests") {
--    testonly = true
--    sources = [ "video_encode_accelerator_tests.cc" ]
--    data = [ "//media/test/data/" ]
--    deps = [
--      ":buildflags",
--      ":common",
--      "test:frame_file_writer",
--      "test:frame_validator",
--      "test:helpers",
--      "test:test_helpers",
--      "test:video_encoder",
--      "test:video_encoder_test_environment",
--      "//media:test_support",
--      "//testing/gtest",
--    ]
--  }
--
--  test("video_encode_accelerator_perf_tests") {
--    testonly = true
--    sources = [ "video_encode_accelerator_perf_tests.cc" ]
--    data = [ "//media/test/data/" ]
--    deps = [
--      ":buildflags",
--      ":common",
--      "test:frame_validator",
--      "test:helpers",
--      "test:test_helpers",
--      "test:video_encoder",
--      "test:video_encoder_test_environment",
--      "test:video_encoder_test_environment",
--      "//media:test_support",
--      "//testing/gtest",
--    ]
--  }
--}
--
- if (enable_platform_hevc_decoding) {
-   fuzzer_test("media_h265_decoder_fuzzer") {
-     sources = [ "h265_decoder_fuzzertest.cc" ]
--- 
-2.25.1
-

+ 0 - 551
archive/0001-media-media_options-disable-dav1d-decoder.patch

@@ -1,551 +0,0 @@
-From 5282570bdd05f688bbc7f31d6a8cd3716f84a48b Mon Sep 17 00:00:00 2001
-From: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
-Date: Fri, 14 Jan 2022 09:07:44 +0000
-Subject: [PATCH] media: media_options: disable dav1d decoder
-
-Signed-off-by: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
----
- media/BUILD.gn                                |   1 -
- media/DEPS                                    |   1 -
- .../clear_key_cdm/cdm_video_decoder.cc        |   4 -
- media/filters/BUILD.gn                        |  12 -
- media/filters/dav1d_video_decoder.cc          |   5 -
- media/filters/dav1d_video_decoder_unittest.cc |   1 -
- media/gpu/video_decode_accelerator_tests.cc   |   4 +-
- media/media_options.gni                       |   2 +-
- media/renderers/default_decoder_factory.cc    |   4 -
- media/test/pipeline_integration_test_base.cc  |   4 -
- media/video/software_video_encoder_test.cc    |   3 -
- third_party/dav1d/BUILD.gn                    | 325 ------------------
- third_party/libavif/BUILD.gn                  |   7 -
- 13 files changed, 2 insertions(+), 371 deletions(-)
- delete mode 100644 third_party/dav1d/BUILD.gn
-
-diff --git a/media/BUILD.gn b/media/BUILD.gn
-index 01e0910666e86..e716c6604f546 100644
---- a/media/BUILD.gn
-+++ b/media/BUILD.gn
-@@ -26,7 +26,6 @@ buildflag_header("media_buildflags") {
-     "ENABLE_CAST_AUDIO_RENDERER=$enable_cast_audio_renderer",
-     "ENABLE_CDM_HOST_VERIFICATION=$enable_cdm_host_verification",
-     "ENABLE_CDM_STORAGE_ID=$enable_cdm_storage_id",
--    "ENABLE_DAV1D_DECODER=$enable_dav1d_decoder",
-     "ENABLE_AV1_DECODER=$enable_av1_decoder",
-     "ENABLE_PLATFORM_DOLBY_VISION=$enable_platform_dolby_vision",
-     "ENABLE_FFMPEG=$media_use_ffmpeg",
-diff --git a/media/DEPS b/media/DEPS
-index 0cd29bc8f5937..1df25ca17aa75 100644
---- a/media/DEPS
-+++ b/media/DEPS
-@@ -15,7 +15,6 @@ include_rules = [
-   "+services/viz/public/cpp/gpu/context_provider_command_buffer.h",
-   "+skia/ext",
-   "+third_party/re2",
--  "+third_party/dav1d",
-   "+third_party/ffmpeg",
-   "+third_party/libaom",
-   "+third_party/libdrm",
-diff --git a/media/cdm/library_cdm/clear_key_cdm/cdm_video_decoder.cc b/media/cdm/library_cdm/clear_key_cdm/cdm_video_decoder.cc
-index 15166819bdb7c..83f614e0720ee 100644
---- a/media/cdm/library_cdm/clear_key_cdm/cdm_video_decoder.cc
-+++ b/media/cdm/library_cdm/clear_key_cdm/cdm_video_decoder.cc
-@@ -35,10 +35,6 @@
- #include "media/filters/vpx_video_decoder.h"
- #endif
- 
--#if BUILDFLAG(ENABLE_DAV1D_DECODER)
--#include "media/filters/dav1d_video_decoder.h"
--#endif
--
- #if BUILDFLAG(ENABLE_FFMPEG_VIDEO_DECODERS)
- #include "media/filters/ffmpeg_video_decoder.h"
- #endif
-diff --git a/media/filters/BUILD.gn b/media/filters/BUILD.gn
-index e9e4fa9b5b5e2..4430d7edf7d65 100644
---- a/media/filters/BUILD.gn
-+++ b/media/filters/BUILD.gn
-@@ -137,14 +137,6 @@ source_set("filters") {
-     deps += [ "//third_party/libvpx" ]
-   }
- 
--  if (enable_dav1d_decoder) {
--    sources += [
--      "dav1d_video_decoder.cc",
--      "dav1d_video_decoder.h",
--    ]
--    deps += [ "//third_party/dav1d" ]
--  }
--
-   if (enable_libgav1_decoder) {
-     sources += [
-       "gav1_video_decoder.cc",
-@@ -371,10 +363,6 @@ source_set("unit_tests") {
-     sources += [ "vpx_video_decoder_unittest.cc" ]
-   }
- 
--  if (enable_dav1d_decoder) {
--    sources += [ "dav1d_video_decoder_unittest.cc" ]
--  }
--
-   if (enable_libgav1_decoder) {
-     sources += [ "gav1_video_decoder_unittest.cc" ]
-   }
-diff --git a/media/filters/dav1d_video_decoder.cc b/media/filters/dav1d_video_decoder.cc
-index 830b6bd4b11e6..2b7a3242b1199 100644
---- a/media/filters/dav1d_video_decoder.cc
-+++ b/media/filters/dav1d_video_decoder.cc
-@@ -2,8 +2,6 @@
- // Use of this source code is governed by a BSD-style license that can be
- // found in the LICENSE file.
- 
--#include "media/filters/dav1d_video_decoder.h"
--
- #include <memory>
- #include <string>
- #include <utility>
-@@ -21,9 +19,6 @@
- #include "media/base/video_aspect_ratio.h"
- #include "media/base/video_util.h"
- 
--extern "C" {
--#include "third_party/dav1d/libdav1d/include/dav1d/dav1d.h"
--}
- 
- namespace media {
- 
-diff --git a/media/filters/dav1d_video_decoder_unittest.cc b/media/filters/dav1d_video_decoder_unittest.cc
-index 676a02b8ad3a0..541b7ffca7f92 100644
---- a/media/filters/dav1d_video_decoder_unittest.cc
-+++ b/media/filters/dav1d_video_decoder_unittest.cc
-@@ -20,7 +20,6 @@
- #include "media/base/test_helpers.h"
- #include "media/base/video_frame.h"
- #include "media/ffmpeg/ffmpeg_common.h"
--#include "media/filters/dav1d_video_decoder.h"
- #include "media/filters/in_memory_url_protocol.h"
- #include "testing/gmock/include/gmock/gmock.h"
- 
-diff --git a/media/gpu/video_decode_accelerator_tests.cc b/media/gpu/video_decode_accelerator_tests.cc
-index a6b95fef61746..636cb8fc38eda 100644
---- a/media/gpu/video_decode_accelerator_tests.cc
-+++ b/media/gpu/video_decode_accelerator_tests.cc
-@@ -29,9 +29,7 @@
- #include "media/media_buildflags.h"
- #include "testing/gtest/include/gtest/gtest.h"
- 
--#if BUILDFLAG(ENABLE_DAV1D_DECODER)
--#include "media/filters/dav1d_video_decoder.h"
--#elif BUILDFLAG(ENABLE_LIBGAV1_DECODER)
-+#if BUILDFLAG(ENABLE_LIBGAV1_DECODER)
- #include "media/filters/gav1_video_decoder.h"
- #endif
- 
-diff --git a/media/media_options.gni b/media/media_options.gni
-index 1b9eec3e63996..5a35f4960dffb 100644
---- a/media/media_options.gni
-+++ b/media/media_options.gni
-@@ -74,7 +74,7 @@ declare_args() {
-   # On Fuchsia, these are logged as VLOGs.
-   enable_logging_override = is_chromecast || is_fuchsia
- 
--  enable_dav1d_decoder = !is_ios
-+  enable_dav1d_decoder = false
- 
-   # Enable browser managed persistent metadata storage for EME persistent
-   # session and persistent usage record session.
-diff --git a/media/renderers/default_decoder_factory.cc b/media/renderers/default_decoder_factory.cc
-index 430ec53038a84..7cfe5d072e759 100644
---- a/media/renderers/default_decoder_factory.cc
-+++ b/media/renderers/default_decoder_factory.cc
-@@ -26,10 +26,6 @@
- #include "media/filters/fuchsia/fuchsia_video_decoder.h"
- #endif
- 
--#if BUILDFLAG(ENABLE_DAV1D_DECODER)
--#include "media/filters/dav1d_video_decoder.h"
--#endif
--
- #if BUILDFLAG(ENABLE_FFMPEG)
- #include "media/filters/ffmpeg_audio_decoder.h"
- #endif
-diff --git a/media/test/pipeline_integration_test_base.cc b/media/test/pipeline_integration_test_base.cc
-index 4afe60de61139..afad5ee5acfbf 100644
---- a/media/test/pipeline_integration_test_base.cc
-+++ b/media/test/pipeline_integration_test_base.cc
-@@ -27,10 +27,6 @@
- #include "media/test/fake_encrypted_media.h"
- #include "media/test/test_media_source.h"
- 
--#if BUILDFLAG(ENABLE_DAV1D_DECODER)
--#include "media/filters/dav1d_video_decoder.h"
--#endif
--
- #if BUILDFLAG(ENABLE_FFMPEG)
- #include "media/filters/ffmpeg_audio_decoder.h"
- #include "media/filters/ffmpeg_demuxer.h"
-diff --git a/media/video/software_video_encoder_test.cc b/media/video/software_video_encoder_test.cc
-index 4c8e81626dd78..e234ef927c33f 100644
---- a/media/video/software_video_encoder_test.cc
-+++ b/media/video/software_video_encoder_test.cc
-@@ -43,9 +43,6 @@
- #include "media/video/av1_video_encoder.h"
- #endif
- 
--#if BUILDFLAG(ENABLE_DAV1D_DECODER)
--#include "media/filters/dav1d_video_decoder.h"
--#endif
- 
- namespace media {
- 
-diff --git a/third_party/dav1d/BUILD.gn b/third_party/dav1d/BUILD.gn
-deleted file mode 100644
-index 933c8f2f566aa..0000000000000
---- a/third_party/dav1d/BUILD.gn
-+++ /dev/null
-@@ -1,325 +0,0 @@
--# Copyright 2019 The Chromium Authors. All rights reserved.
--# Use of this source code is governed by a BSD-style license that can be
--# found in the LICENSE file.
--
--import("dav1d_generated.gni")
--
--import("//build/config/compiler/compiler.gni")
--import("//build/config/sanitizers/sanitizers.gni")
--import("//third_party/nasm/nasm_assemble.gni")
--
--# MemorySanitizer can't handle assembly, https://crbug.com/928357.
--enable_nasm = (current_cpu == "x86" || current_cpu == "x64") && !is_msan
--
--if (is_win) {
--  platform_config_root = "config/win/$current_cpu"
--} else if (is_msan) {
--  assert(current_cpu == "x64" && (is_linux || is_chromeos),
--         "Only Linux X64 MSAN is supported")
--  platform_config_root = "config/linux-noasm/$current_cpu"
--} else {
--  # Linux configuration files seem to work on Mac, so just reuse them.
--  platform_config_root = "config/linux/$current_cpu"
--}
--
--# Clang LTO doesn't respect stack alignment and clang-cl doesn't support setting
--# the stack alignment, so we must use the platform's default alignment in those
--# cases; https://crbug.com/928743.
--if (current_cpu == "x86" || current_cpu == "x64") {
--  if (use_thin_lto || is_win) {
--    needs_stack_alignment = false
--    # The defaults are stack_alignment=4 for x86 and stack_alignment=16 for x64.
--  } else {
--    # The compiler flags, as well as the stack alignment values, all mirror
--    # upstream's meson.build setup:
--    # https://chromium.googlesource.com/external/github.com/videolan/dav1d/+/master/meson.build
--    needs_stack_alignment = true
--    if (current_cpu == "x86") {
--      stack_alignment = 16
--
--      if (!is_clang) {
--        # Values used by GCC.
--        preferred_stack_boundary = 4
--        incoming_stack_boundary = 2
--      }
--    } else if (current_cpu == "x64") {
--      stack_alignment = 32
--
--      if (!is_clang) {
--        # Values used by GCC.
--        preferred_stack_boundary = 5
--        incoming_stack_boundary = 4
--      }
--    }
--
--    if (is_clang) {
--      stackalign_flag = "-mstack-alignment=$stack_alignment"
--      stackrealign_flag = "-mstackrealign"
--    } else {
--      # Assume GCC for now.
--      stackalign_flag = "-mpreferred-stack-boundary=$preferred_stack_boundary"
--      stackrealign_flag = "-mincoming-stack-boundary=$incoming_stack_boundary"
--    }
--  }
--} else {
--  needs_stack_alignment = false
--}
--
--config("public_dav1d_config") {
--  include_dirs = [ "version" ]
--
--  # Disable internal dav1d logs in the official build to save storage.
--  if (is_official_build) {
--    defines = [ "CONFIG_LOG=0" ]
--  } else {
--    defines = [ "CONFIG_LOG=1" ]
--  }
--
--  if (needs_stack_alignment) {
--    defines += [ "STACK_ALIGNMENT=$stack_alignment" ]
--  }
--
--  if (!is_android && !is_win) {
--    defines += [ "HAVE_PTHREAD_GETAFFINITY_NP=1" ]
--  }
--
--  # Don't let dav1d export any symbols. Otherwise the verify_order step on macOS
--  # can fail since these exports end up in the final Chromium binary.
--  defines += [ "DAV1D_API=" ]
--}
--
--config("dav1d_config") {
--  configs = [ ":public_dav1d_config" ]
--  include_dirs = [
--    "libdav1d",
--    "libdav1d/include",
--    "libdav1d/include/dav1d",
--    platform_config_root,
--  ]
--  if (is_win && !is_clang) {
--    include_dirs += [ "libdav1d/include/compat/msvc" ]
--  }
--}
--
--dav1d_copts = [
--  "-D_FILE_OFFSET_BITS=64",
--  "-D_POSIX_C_SOURCE=200112L",
--]
--
--if (is_win) {
--  if (!is_clang) {
--    dav1d_copts += [ "/wd4028" ]
--  }
--} else {
--  dav1d_copts += [ "-std=c99" ]
--  if (needs_stack_alignment) {
--    dav1d_copts += [ stackalign_flag ]
--  }
--  if (is_mac || is_ios) {
--    dav1d_copts += [ "-D_DARWIN_C_SOURCE" ]
--  }
--  if (is_linux || is_chromeos || is_android || current_os == "aix") {
--    if (!is_clang) {
--      dav1d_copts += [ "-D_GNU_SOURCE" ]
--    }
--  }
--}
--
--if (enable_nasm) {
--  nasm_assemble("dav1d_asm") {
--    sources = x86_asm_sources
--
--    inputs = [
--      "libdav1d/src/ext/x86/x86inc.asm",
--      "$platform_config_root/config.asm",
--    ]
--
--    include_dirs = [
--      "libdav1d/src/",
--      platform_config_root,
--    ]
--
--    nasm_flags = [
--      "-P",
--      rebase_path("$platform_config_root/config.asm", root_build_dir),
--    ]
--
--    defines = []
--    if (needs_stack_alignment) {
--      defines += [ "STACK_ALIGNMENT=$stack_alignment" ]
--    }
--
--    # Necessary to ensure macOS symbols end up with a _ prefix.
--    if (is_mac || is_ios) {
--      defines += [ "PREFIX" ]
--    }
--  }
--}
--
--source_set("dav1d_headers") {
--  configs -= [ "//build/config/compiler:chromium_code" ]
--  configs += [
--    "//build/config/compiler:no_chromium_code",
--    ":dav1d_config",
--  ]
--
--  sources = c_headers
--}
--
--static_library("dav1d_entrypoints") {
--  configs -= [ "//build/config/compiler:chromium_code" ]
--  configs += [
--    "//build/config/compiler:no_chromium_code",
--    ":dav1d_config",
--  ]
--
--  sources = entry_point_sources
--  cflags = dav1d_copts
--  if (is_win) {
--    sources += [ "libdav1d/src/win32/thread.c" ]
--  }
--
--  if (needs_stack_alignment) {
--    cflags += [ stackrealign_flag ]
--  }
--
--  deps = [ ":dav1d_headers" ]
--}
--
--static_library("dav1d_8bit") {
--  configs -= [ "//build/config/compiler:chromium_code" ]
--  configs += [
--    "//build/config/compiler:no_chromium_code",
--    ":dav1d_config",
--  ]
--
--  sources = template_sources
--  if (current_cpu == "x86" || current_cpu == "x64") {
--    sources += x86_template_sources
--  } else if (current_cpu == "arm") {
--    sources += arm_template_sources
--  } else if (current_cpu == "arm64") {
--    sources += arm_template_sources
--  }
--
--  cflags = dav1d_copts
--  cflags += [ "-DBITDEPTH=8" ]
--
--  deps = [ ":dav1d_headers" ]
--}
--
--static_library("dav1d_10bit") {
--  configs -= [
--    "//build/config/compiler:chromium_code",
--
--    # Disable coverage for the 10 bit version to avoid confusing the
--    # instrumentation about which version of the library is being run.
--    # dav1d_10 bit was selected for this, as it's less used than dav1d_8bit,
--    # which still has coverage enabled. See crbug.com/1030350.
--    "//build/config/coverage:default_coverage",
--  ]
--  configs += [
--    "//build/config/compiler:no_chromium_code",
--    ":dav1d_config",
--  ]
--
--  sources = template_sources
--  if (current_cpu == "x86" || current_cpu == "x64") {
--    sources += x86_template_sources
--  } else if (current_cpu == "arm") {
--    sources += arm_template_sources
--  } else if (current_cpu == "arm64") {
--    sources += arm_template_sources
--  }
--
--  cflags = dav1d_copts
--  cflags += [ "-DBITDEPTH=16" ]
--
--  deps = [ ":dav1d_headers" ]
--}
--
--if (current_cpu == "x86" || current_cpu == "x64") {
--  static_library("dav1d_x86") {
--    sources = [
--      "libdav1d/src/x86/cpu.c",
--      "libdav1d/src/x86/cpu.h",
--      "libdav1d/src/x86/refmvs_init.c",
--    ]
--
--    # x86/msac.h redefines macros in msac.h if x86/msac.h is included and
--    # HAVE_ASM is 0, so we must exclude msac_init.c if !enable_nasm. Also, it
--    # is only used for x64.
--    if (enable_nasm && current_cpu == "x64") {
--      sources += [ "libdav1d/src/x86/msac_init.c" ]
--    }
--    configs -= [ "//build/config/compiler:chromium_code" ]
--    configs += [
--      "//build/config/compiler:no_chromium_code",
--      ":dav1d_config",
--    ]
--    cflags = dav1d_copts
--
--    deps = [ ":dav1d_headers" ]
--    allow_circular_includes_from = [ ":dav1d_headers" ]
--  }
--} else if (current_cpu == "arm" || current_cpu == "arm64") {
--  static_library("dav1d_arm") {
--    sources = [
--      "libdav1d/src/arm/cpu.c",
--      "libdav1d/src/arm/cpu.h",
--      "libdav1d/src/arm/refmvs_init.c",
--    ]
--
--    # These are not template based so should only be built once.
--    if (current_cpu == "arm") {
--      sources += arm32_asm_sources
--    } else if (current_cpu == "arm64") {
--      sources += arm64_asm_sources
--    }
--
--    configs -= [ "//build/config/compiler:chromium_code" ]
--    configs += [
--      "//build/config/compiler:no_chromium_code",
--      ":dav1d_config",
--    ]
--
--    # Necessary to ensure macOS symbols end up with a _ prefix.
--    if (is_mac || is_ios) {
--      defines = [ "PREFIX" ]
--    }
--
--    cflags = dav1d_copts
--
--    deps = [ ":dav1d_headers" ]
--    allow_circular_includes_from = [ ":dav1d_headers" ]
--  }
--}
--
--static_library("dav1d") {
--  sources = c_sources
--
--  configs -= [ "//build/config/compiler:chromium_code" ]
--  configs += [
--    "//build/config/compiler:no_chromium_code",
--    ":dav1d_config",
--  ]
--  cflags = dav1d_copts
--
--  deps = [
--    ":dav1d_10bit",
--    ":dav1d_8bit",
--    ":dav1d_entrypoints",
--    ":dav1d_headers",
--  ]
--
--  public_configs = [ ":public_dav1d_config" ]
--
--  if (current_cpu == "x86" || current_cpu == "x64") {
--    deps += [ ":dav1d_x86" ]
--    if (enable_nasm) {
--      deps += [ ":dav1d_asm" ]
--    }
--  } else if (current_cpu == "arm" || current_cpu == "arm64") {
--    deps += [ ":dav1d_arm" ]
--  }
--}
-diff --git a/third_party/libavif/BUILD.gn b/third_party/libavif/BUILD.gn
-index deaaaeea66c51..307df49faa3bc 100644
---- a/third_party/libavif/BUILD.gn
-+++ b/third_party/libavif/BUILD.gn
-@@ -31,13 +31,6 @@ source_set("libavif") {
- 
-   deps = [ "//third_party/libyuv" ]
- 
--  if (enable_dav1d_decoder) {
--    sources += [ "src/src/codec_dav1d.c" ]
--    include_dirs += [ "../dav1d/libdav1d/include/" ]
--    defines += [ "AVIF_CODEC_DAV1D" ]
--    deps += [ "//third_party/dav1d" ]
--  }
--
-   if (enable_libgav1_decoder) {
-     sources += [ "src/src/codec_libgav1.c" ]
-     defines += [ "AVIF_CODEC_LIBGAV1" ]
--- 
-2.25.1
-

+ 0 - 27
archive/0001-third_party-widevine-define-WIDEVINE_CDM_VERSION_STR.patch

@@ -1,27 +0,0 @@
-From e10182c0a7811b7db6d77183df3c6befb299b527 Mon Sep 17 00:00:00 2001
-From: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
-Date: Thu, 13 Jan 2022 09:11:17 +0000
-Subject: [PATCH] third_party: widevine: define
- WIDEVINE_CDM_VERSION_STRING
-
-Port over from Fedora's patch list.
-
-Signed-off-by: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
----
- third_party/widevine/cdm/widevine_cdm_version.h | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/third_party/widevine/cdm/widevine_cdm_version.h b/third_party/widevine/cdm/widevine_cdm_version.h
-index dd6efed02646d..d13b8d6aa5bf7 100644
---- a/third_party/widevine/cdm/widevine_cdm_version.h
-+++ b/third_party/widevine/cdm/widevine_cdm_version.h
-@@ -12,4 +12,6 @@
- //  - WIDEVINE_CDM_VERSION_STRING (with the version of the CDM that's available
- //    as a string, e.g., "1.0.123.456").
- 
-+#define WIDEVINE_CDM_VERSION_STRING "unknown"
-+
- #endif  // WIDEVINE_CDM_VERSION_H_
--- 
-2.25.1
-

+ 0 - 36
archive/0001-third_party-zlib-do-not-mangle-zlib.patch

@@ -1,36 +0,0 @@
-From 1960ae0d483def599b1d8372f0514c89842e2843 Mon Sep 17 00:00:00 2001
-From: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
-Date: Thu, 13 Jan 2022 08:51:04 +0000
-Subject: [PATCH] third_party: zlib: do not mangle zlib
-
-Signed-off-by: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
----
- third_party/zlib/zconf.h | 12 ------------
- 1 file changed, 12 deletions(-)
-
-diff --git a/third_party/zlib/zconf.h b/third_party/zlib/zconf.h
-index 2d1d03ff951c9..cf54129aa6bca 100644
---- a/third_party/zlib/zconf.h
-+++ b/third_party/zlib/zconf.h
-@@ -8,18 +8,6 @@
- #ifndef ZCONF_H
- #define ZCONF_H
- 
--/*
-- * This library is also built as a part of AOSP, which does not need to include
-- * chromeconf.h. This config does not want chromeconf.h, so it can set this
-- * macro to opt out. While this works today, there's no guarantee that building
-- * zlib outside of Chromium keeps working in the future.
-- */
--#if !defined(CHROMIUM_ZLIB_NO_CHROMECONF)
--/* This include does prefixing as below, but with an updated set of names.  Also
-- * sets up export macros in component builds. */
--#include "chromeconf.h"
--#endif
--
- /*
-  * If you *really* need a unique prefix for all types and library functions,
-  * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
--- 
-2.25.1
-

+ 0 - 1864
archive/0002-sandbox-add-riscv-arch-definition-and-define-syscall.patch

@@ -1,1864 +0,0 @@
-From dda0b84e776a01b77c87f40af98713dfa303482d Mon Sep 17 00:00:00 2001
-From: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
-Date: Wed, 15 Jun 2022 08:27:45 +0000
-Subject: [PATCH] sandbox: add riscv arch definition and define syscall
-
-Credit to work contributed in Github.
-https://github.com/felixonmars/archriscv-packages/tree/master/chromium
-
-Signed-off-by: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
----
- sandbox/features.gni                          |    3 +-
- sandbox/linux/BUILD.gn                        |    5 +
- sandbox/linux/bpf_dsl/linux_syscall_ranges.h  |    6 +
- sandbox/linux/bpf_dsl/seccomp_macros.h        |   41 +
- .../seccomp-bpf-helpers/baseline_policy.cc    |    9 +-
- .../syscall_parameters_restrictions.cc        |    3 +-
- .../linux/seccomp-bpf-helpers/syscall_sets.cc |   71 +-
- .../linux/seccomp-bpf-helpers/syscall_sets.h  |   14 +-
- sandbox/linux/seccomp-bpf/syscall.cc          |   35 +-
- sandbox/linux/services/credentials.cc         |    2 +-
- sandbox/linux/services/syscall_wrappers.cc    |    2 +-
- .../linux/syscall_broker/broker_process.cc    |   20 +-
- sandbox/linux/system_headers/linux_seccomp.h  |    8 +
- sandbox/linux/system_headers/linux_signal.h   |    2 +-
- sandbox/linux/system_headers/linux_stat.h     |    2 +-
- sandbox/linux/system_headers/linux_syscalls.h |    4 +
- .../system_headers/riscv64_linux_syscalls.h   | 1074 +++++++++++++++++
- .../linux/bpf_cros_amd_gpu_policy_linux.cc    |    2 +-
- sandbox/policy/linux/bpf_gpu_policy_linux.cc  |    2 +-
- 19 files changed, 1251 insertions(+), 54 deletions(-)
- create mode 100644 sandbox/linux/system_headers/riscv64_linux_syscalls.h
-
-diff --git a/sandbox/features.gni b/sandbox/features.gni
-index ad067ada520b..c9f67f81618f 100644
---- a/sandbox/features.gni
-+++ b/sandbox/features.gni
-@@ -9,7 +9,8 @@
- use_seccomp_bpf = (is_linux || is_chromeos || is_android) &&
-                   (current_cpu == "x86" || current_cpu == "x64" ||
-                    current_cpu == "arm" || current_cpu == "arm64" ||
--                   current_cpu == "mipsel" || current_cpu == "mips64el")
-+                   current_cpu == "mipsel" || current_cpu == "mips64el" ||
-+                   current_cpu == "riscv64")
- 
- # SSBD (Speculative Store Bypass Disable) is a mitigation of Spectre Variant 4.
- # As Spectre Variant 4 can be mitigated by site isolation, opt-out SSBD on site
-diff --git a/sandbox/linux/BUILD.gn b/sandbox/linux/BUILD.gn
-index ec24cd81e274..60c60d741bf6 100644
---- a/sandbox/linux/BUILD.gn
-+++ b/sandbox/linux/BUILD.gn
-@@ -292,11 +292,16 @@ if (is_linux || is_chromeos) {
-     cflags = [
-       # For ULLONG_MAX
-       "-std=gnu99",
-+      "-fPIE",
- 
-       # These files have a suspicious comparison.
-       # TODO fix this and re-enable this warning.
-       "-Wno-sign-compare",
-     ]
-+
-+    ldflags = [
-+      "-pie",
-+    ]
-   }
- }
- 
-diff --git a/sandbox/linux/bpf_dsl/linux_syscall_ranges.h b/sandbox/linux/bpf_dsl/linux_syscall_ranges.h
-index 313511f22e95..104dabde1cc0 100644
---- a/sandbox/linux/bpf_dsl/linux_syscall_ranges.h
-+++ b/sandbox/linux/bpf_dsl/linux_syscall_ranges.h
-@@ -56,6 +56,12 @@
- #define MAX_PUBLIC_SYSCALL __NR_syscalls
- #define MAX_SYSCALL MAX_PUBLIC_SYSCALL
- 
-+#elif defined(__riscv) && (__riscv_xlen == 64)
-+
-+#define MIN_SYSCALL 0u
-+#define MAX_PUBLIC_SYSCALL 1024u
-+#define MAX_SYSCALL MAX_PUBLIC_SYSCALL
-+
- #else
- #error "Unsupported architecture"
- #endif
-diff --git a/sandbox/linux/bpf_dsl/seccomp_macros.h b/sandbox/linux/bpf_dsl/seccomp_macros.h
-index 961a8cf7521e..7c9a0c99e8fb 100644
---- a/sandbox/linux/bpf_dsl/seccomp_macros.h
-+++ b/sandbox/linux/bpf_dsl/seccomp_macros.h
-@@ -343,6 +343,47 @@ struct regs_struct {
- #define SECCOMP_PT_PARM4(_regs) (_regs).regs[3]
- #define SECCOMP_PT_PARM5(_regs) (_regs).regs[4]
- #define SECCOMP_PT_PARM6(_regs) (_regs).regs[5]
-+
-+#elif defined(__riscv) && (__riscv_xlen == 64)
-+struct regs_struct {
-+  unsigned long regs[32];
-+};
-+
-+#define SECCOMP_ARCH AUDIT_ARCH_RISCV64
-+
-+#define SECCOMP_REG(_ctx, _reg) ((_ctx)->uc_mcontext.__gregs[_reg])
-+
-+#define SECCOMP_RESULT(_ctx) SECCOMP_REG(_ctx, REG_A0)
-+#define SECCOMP_SYSCALL(_ctx) SECCOMP_REG(_ctx, REG_A0+7)
-+#define SECCOMP_IP(_ctx) (_ctx)->uc_mcontext.__gregs[REG_PC]
-+#define SECCOMP_PARM1(_ctx) SECCOMP_REG(_ctx, REG_A0)
-+#define SECCOMP_PARM2(_ctx) SECCOMP_REG(_ctx, REG_A0+1)
-+#define SECCOMP_PARM3(_ctx) SECCOMP_REG(_ctx, REG_A0+2)
-+#define SECCOMP_PARM4(_ctx) SECCOMP_REG(_ctx, REG_A0+3)
-+#define SECCOMP_PARM5(_ctx) SECCOMP_REG(_ctx, REG_A0+4)
-+#define SECCOMP_PARM6(_ctx) SECCOMP_REG(_ctx, REG_A0+5)
-+
-+#define SECCOMP_NR_IDX (offsetof(struct arch_seccomp_data, nr))
-+#define SECCOMP_ARCH_IDX (offsetof(struct arch_seccomp_data, arch))
-+#define SECCOMP_IP_MSB_IDX \
-+  (offsetof(struct arch_seccomp_data, instruction_pointer) + 4)
-+#define SECCOMP_IP_LSB_IDX \
-+  (offsetof(struct arch_seccomp_data, instruction_pointer) + 0)
-+#define SECCOMP_ARG_MSB_IDX(nr) \
-+  (offsetof(struct arch_seccomp_data, args) + 8 * (nr) + 4)
-+#define SECCOMP_ARG_LSB_IDX(nr) \
-+  (offsetof(struct arch_seccomp_data, args) + 8 * (nr) + 0)
-+
-+#define SECCOMP_PT_RESULT(_regs) (_regs).regs[REG_A0]
-+#define SECCOMP_PT_SYSCALL(_regs) (_regs).regs[REG_A0+7]
-+#define SECCOMP_PT_IP(_regs) (_regs).regs[REG_PC]
-+#define SECCOMP_PT_PARM1(_regs) (_regs).regs[REG_A0]
-+#define SECCOMP_PT_PARM2(_regs) (_regs).regs[REG_A0+1]
-+#define SECCOMP_PT_PARM3(_regs) (_regs).regs[REG_A0+2]
-+#define SECCOMP_PT_PARM4(_regs) (_regs).regs[REG_A0+3]
-+#define SECCOMP_PT_PARM5(_regs) (_regs).regs[REG_A0+4]
-+#define SECCOMP_PT_PARM6(_regs) (_regs).regs[REG_A0+5]
-+
- #else
- #error Unsupported target platform
- 
-diff --git a/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc b/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
-index 30c15cccb5c1..06c6026a26fa 100644
---- a/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
-+++ b/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
-@@ -60,6 +60,9 @@ bool IsBaselinePolicyAllowed(int sysno) {
- #endif
- #if defined(__mips__)
-          SyscallSets::IsMipsPrivate(sysno) ||
-+#endif
-+#if defined(__riscv)
-+         SyscallSets::IsRiscvPrivate(sysno) ||
- #endif
-          SyscallSets::IsAllowedOperationOnFd(sysno);
-   // clang-format on
-@@ -198,7 +201,7 @@ ResultExpr EvaluateSyscallImpl(int fs_denied_errno,
-     return RestrictFcntlCommands();
- #endif
- 
--#if !defined(__aarch64__)
-+#if !defined(__aarch64__) && !defined(__riscv)
-   // fork() is never used as a system call (clone() is used instead), but we
-   // have seen it in fallback code on Android.
-   if (sysno == __NR_fork) {
-@@ -253,7 +256,7 @@ ResultExpr EvaluateSyscallImpl(int fs_denied_errno,
-   }
- 
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
--    defined(__aarch64__)
-+    defined(__aarch64__) || defined(__riscv)
-   if (sysno == __NR_mmap)
-     return RestrictMmapFlags();
- #endif
-@@ -274,7 +277,7 @@ ResultExpr EvaluateSyscallImpl(int fs_denied_errno,
-     return RestrictPrctl();
- 
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
--    defined(__aarch64__)
-+    defined(__aarch64__) || defined(__riscv)
-   if (sysno == __NR_socketpair) {
-     // Only allow AF_UNIX, PF_UNIX. Crash if anything else is seen.
-     static_assert(AF_UNIX == PF_UNIX,
-diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc b/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc
-index 9728d0b52e68..6f6e3984028b 100644
---- a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc
-+++ b/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc
-@@ -37,6 +37,7 @@
- 
- #if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) && \
-     !defined(__arm__) && !defined(__aarch64__) &&             \
-+    !defined(__riscv) &&                                      \
-     !defined(PTRACE_GET_THREAD_AREA)
- // Also include asm/ptrace-abi.h since ptrace.h in older libc (for instance
- // the one in Ubuntu 16.04 LTS) is missing PTRACE_GET_THREAD_AREA.
-@@ -438,7 +439,7 @@ ResultExpr RestrictPtrace() {
- #endif
-   return Switch(request)
-       .CASES((
--#if !defined(__aarch64__)
-+#if !defined(__aarch64__) && !defined(__riscv)
-                  PTRACE_GETREGS, PTRACE_GETFPREGS, PTRACE_GET_THREAD_AREA,
-                  PTRACE_GETREGSET,
- #endif
-diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
-index b3cf6fc7e86f..39dceabf07c3 100644
---- a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
-+++ b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
-@@ -103,7 +103,7 @@ bool SyscallSets::IsUmask(int sysno) {
- // Both EPERM and ENOENT are valid errno unless otherwise noted in comment.
- bool SyscallSets::IsFileSystem(int sysno) {
-   switch (sysno) {
--#if !defined(__aarch64__)
-+#if !defined(__aarch64__) && !defined(__riscv)
-     case __NR_access:  // EPERM not a valid errno.
-     case __NR_chmod:
-     case __NR_chown:
-@@ -136,7 +136,7 @@ bool SyscallSets::IsFileSystem(int sysno) {
-     case __NR_faccessat2:
-     case __NR_fchmodat:
-     case __NR_fchownat:  // Should be called chownat ?
--#if defined(__x86_64__) || defined(__aarch64__)
-+#if defined(__x86_64__) || defined(__aarch64__) && defined(__riscv)
-     case __NR_newfstatat:  // fstatat(). EPERM not a valid errno.
- #elif defined(__i386__) || defined(__arm__) || \
-     (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-@@ -226,7 +226,7 @@ bool SyscallSets::IsAllowedFileSystemAccessViaFd(int sysno) {
-     case __NR_oldfstat:
- #endif
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
--    defined(__aarch64__)
-+    defined(__aarch64__) || defined(__riscv)
-     case __NR_sync_file_range:  // EPERM not a valid errno.
- #elif defined(__arm__)
-     case __NR_arm_sync_file_range:  // EPERM not a valid errno.
-@@ -245,7 +245,7 @@ bool SyscallSets::IsDeniedFileSystemAccessViaFd(int sysno) {
- #if defined(__i386__) || defined(__arm__)
-     case __NR_fchown32:
- #endif
--#if !defined(__aarch64__)
-+#if !defined(__aarch64__) && !defined(__riscv)
-     case __NR_getdents:    // EPERM not a valid errno.
- #endif
-     case __NR_getdents64:  // EPERM not a valid errno.
-@@ -324,7 +324,7 @@ bool SyscallSets::IsProcessPrivilegeChange(int sysno) {
- bool SyscallSets::IsProcessGroupOrSession(int sysno) {
-   switch (sysno) {
-     case __NR_setpgid:
--#if !defined(__aarch64__)
-+#if !defined(__aarch64__) && !defined(__riscv)
-     case __NR_getpgrp:
- #endif
-     case __NR_setsid:
-@@ -358,7 +358,7 @@ bool SyscallSets::IsAllowedSignalHandling(int sysno) {
-     case __NR_rt_sigqueueinfo:
-     case __NR_rt_sigsuspend:
-     case __NR_rt_tgsigqueueinfo:
--#if !defined(__aarch64__)
-+#if !defined(__aarch64__) && !defined(__riscv)
-     case __NR_signalfd:
- #endif
-     case __NR_signalfd4:
-@@ -382,12 +382,12 @@ bool SyscallSets::IsAllowedOperationOnFd(int sysno) {
-   switch (sysno) {
-     case __NR_close:
-     case __NR_dup:
--#if !defined(__aarch64__)
-+#if !defined(__aarch64__) && !defined(__riscv)
-     case __NR_dup2:
- #endif
-     case __NR_dup3:
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
--    defined(__aarch64__)
-+    defined(__aarch64__) || defined(__riscv)
-     case __NR_shutdown:
- #endif
-       return true;
-@@ -426,7 +426,7 @@ bool SyscallSets::IsAllowedProcessStartOrDeath(int sysno) {
-       return true;
-     case __NR_clone:  // Should be parameter-restricted.
-     case __NR_setns:  // Privileged.
--#if !defined(__aarch64__)
-+#if !defined(__aarch64__) && !defined(__riscv)
-     case __NR_fork:
- #endif
- #if defined(__i386__) || defined(__x86_64__)
-@@ -437,7 +437,7 @@ bool SyscallSets::IsAllowedProcessStartOrDeath(int sysno) {
- #endif
-     case __NR_set_tid_address:
-     case __NR_unshare:
--#if !defined(__mips__) && !defined(__aarch64__)
-+#if !defined(__mips__) && !defined(__aarch64__) && !defined(__riscv)
-     case __NR_vfork:
- #endif
-     default:
-@@ -462,7 +462,7 @@ bool SyscallSets::IsAllowedFutex(int sysno) {
- 
- bool SyscallSets::IsAllowedEpoll(int sysno) {
-   switch (sysno) {
--#if !defined(__aarch64__)
-+#if !defined(__aarch64__) && !defined(__riscv)
-     case __NR_epoll_create:
-     case __NR_epoll_wait:
- #endif
-@@ -483,14 +483,14 @@ bool SyscallSets::IsAllowedEpoll(int sysno) {
- 
- bool SyscallSets::IsAllowedGetOrModifySocket(int sysno) {
-   switch (sysno) {
--#if !defined(__aarch64__)
-+#if !defined(__aarch64__) && !defined(__riscv)
-     case __NR_pipe:
- #endif
-     case __NR_pipe2:
-       return true;
-     default:
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
--    defined(__aarch64__)
-+    defined(__aarch64__) || defined(__riscv)
-     case __NR_socketpair:  // We will want to inspect its argument.
- #endif
-       return false;
-@@ -500,7 +500,7 @@ bool SyscallSets::IsAllowedGetOrModifySocket(int sysno) {
- bool SyscallSets::IsDeniedGetOrModifySocket(int sysno) {
-   switch (sysno) {
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
--    defined(__aarch64__)
-+    defined(__aarch64__) || defined(__riscv)
-     case __NR_accept:
-     case __NR_accept4:
-     case __NR_bind:
-@@ -554,7 +554,7 @@ bool SyscallSets::IsAllowedAddressSpaceAccess(int sysno) {
-     case __NR_mincore:
-     case __NR_mlockall:
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
--    defined(__aarch64__)
-+    defined(__aarch64__) || defined(__riscv)
-     case __NR_mmap:
- #endif
- #if defined(__i386__) || defined(__arm__) || \
-@@ -587,7 +587,7 @@ bool SyscallSets::IsAllowedGeneralIo(int sysno) {
-     (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-     case __NR__llseek:
- #endif
--#if !defined(__aarch64__)
-+#if !defined(__aarch64__) && !defined(__riscv)
-     case __NR_poll:
- #endif
-     case __NR_ppoll:
-@@ -608,7 +608,7 @@ bool SyscallSets::IsAllowedGeneralIo(int sysno) {
-     case __NR_recv:
- #endif
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
--    defined(__aarch64__)
-+    defined(__aarch64__) || defined(__riscv)
-     case __NR_recvfrom:  // Could specify source.
-     case __NR_recvmsg:   // Could specify source.
- #endif
-@@ -623,7 +623,7 @@ bool SyscallSets::IsAllowedGeneralIo(int sysno) {
-     case __NR_send:
- #endif
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
--    defined(__aarch64__)
-+    defined(__aarch64__) || defined(__riscv)
-     case __NR_sendmsg:  // Could specify destination.
-     case __NR_sendto:   // Could specify destination.
- #endif
-@@ -672,7 +672,7 @@ bool SyscallSets::IsSeccomp(int sysno) {
- bool SyscallSets::IsAllowedBasicScheduler(int sysno) {
-   switch (sysno) {
-     case __NR_sched_yield:
--#if !defined(__aarch64__)
-+#if !defined(__aarch64__) && !defined(__riscv)
-     case __NR_pause:
- #endif
-     case __NR_nanosleep:
-@@ -756,7 +756,7 @@ bool SyscallSets::IsNuma(int sysno) {
-     case __NR_getcpu:
-     case __NR_mbind:
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
--    defined(__aarch64__)
-+    defined(__aarch64__) || defined(__riscv)
-     case __NR_migrate_pages:
- #endif
-     case __NR_move_pages:
-@@ -791,7 +791,7 @@ bool SyscallSets::IsGlobalProcessEnvironment(int sysno) {
-   switch (sysno) {
-     case __NR_acct:  // Privileged.
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
--    defined(__aarch64__)
-+    defined(__aarch64__) || defined(__riscv)
-     case __NR_getrlimit:
- #endif
- #if defined(__i386__) || defined(__arm__)
-@@ -826,7 +826,7 @@ bool SyscallSets::IsDebug(int sysno) {
- 
- bool SyscallSets::IsGlobalSystemStatus(int sysno) {
-   switch (sysno) {
--#if !defined(__aarch64__)
-+#if !defined(__aarch64__) && !defined(__riscv)
-     case __NR__sysctl:
-     case __NR_sysfs:
- #endif
-@@ -844,7 +844,7 @@ bool SyscallSets::IsGlobalSystemStatus(int sysno) {
- 
- bool SyscallSets::IsEventFd(int sysno) {
-   switch (sysno) {
--#if !defined(__aarch64__)
-+#if !defined(__aarch64__) && !defined(__riscv)
-     case __NR_eventfd:
- #endif
-     case __NR_eventfd2:
-@@ -896,7 +896,7 @@ bool SyscallSets::IsKeyManagement(int sysno) {
- }
- 
- #if defined(__x86_64__) || defined(__arm__) || defined(__aarch64__) || \
--    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_64_BITS))
-+    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_64_BITS)) || defined(__riscv)
- bool SyscallSets::IsSystemVSemaphores(int sysno) {
-   switch (sysno) {
-     case __NR_semctl:
-@@ -915,7 +915,7 @@ bool SyscallSets::IsSystemVSemaphores(int sysno) {
- #endif
- 
- #if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || \
--    defined(__aarch64__) ||                                         \
-+    defined(__aarch64__) || defined(__riscv) ||                     \
-     (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_64_BITS))
- // These give a lot of ambient authority and bypass the setuid sandbox.
- bool SyscallSets::IsSystemVSharedMemory(int sysno) {
-@@ -932,7 +932,8 @@ bool SyscallSets::IsSystemVSharedMemory(int sysno) {
- #endif
- 
- #if defined(__x86_64__) || defined(__arm__) || defined(__aarch64__) || \
--    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_64_BITS))
-+    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_64_BITS)) ||    \
-+    defined(__riscv)
- bool SyscallSets::IsSystemVMessageQueue(int sysno) {
-   switch (sysno) {
-     case __NR_msgctl:
-@@ -963,7 +964,8 @@ bool SyscallSets::IsSystemVIpc(int sysno) {
- 
- bool SyscallSets::IsAnySystemV(int sysno) {
- #if defined(__x86_64__) || defined(__arm__) || defined(__aarch64__) || \
--    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_64_BITS))
-+    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_64_BITS)) ||    \
-+    defined(__riscv)
-   return IsSystemVMessageQueue(sysno) || IsSystemVSemaphores(sysno) ||
-          IsSystemVSharedMemory(sysno);
- #elif defined(__i386__) || \
-@@ -1000,7 +1002,7 @@ bool SyscallSets::IsAdvancedScheduler(int sysno) {
- bool SyscallSets::IsInotify(int sysno) {
-   switch (sysno) {
-     case __NR_inotify_add_watch:
--#if !defined(__aarch64__)
-+#if !defined(__aarch64__) && !defined(__riscv)
-     case __NR_inotify_init:
- #endif
-     case __NR_inotify_init1:
-@@ -1138,7 +1140,7 @@ bool SyscallSets::IsMisc(int sysno) {
- #if defined(__x86_64__)
-     case __NR_tuxcall:
- #endif
--#if !defined(__aarch64__)
-+#if !defined(__aarch64__) && !defined(__riscv)
-     case __NR_vserver:
- #endif
-       return true;
-@@ -1173,6 +1175,17 @@ bool SyscallSets::IsArmPrivate(int sysno) {
- }
- #endif  // defined(__arm__)
- 
-+#if defined(__riscv)
-+bool SyscallSets::IsRiscvPrivate(int sysno) {
-+  switch (sysno) {
-+    case __NR_riscv_flush_icache:
-+      return true;
-+    default:
-+      return false;
-+  }
-+}
-+#endif  // defined(__riscv)
-+
- #if defined(__mips__)
- bool SyscallSets::IsMipsPrivate(int sysno) {
-   switch (sysno) {
-diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h
-index 6403f45dc2f7..7110d3f6999c 100644
---- a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h
-+++ b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h
-@@ -52,7 +52,7 @@ class SANDBOX_EXPORT SyscallSets {
- #endif
- 
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
--    defined(__aarch64__)
-+    defined(__aarch64__) || defined(__riscv)
-   static bool IsNetworkSocketInformation(int sysno);
- #endif
- 
-@@ -79,18 +79,21 @@ class SANDBOX_EXPORT SyscallSets {
-   static bool IsAsyncIo(int sysno);
-   static bool IsKeyManagement(int sysno);
- #if defined(__x86_64__) || defined(__arm__) || defined(__aarch64__) || \
--    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_64_BITS))
-+    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_64_BITS)) ||    \
-+    defined(__riscv)
-   static bool IsSystemVSemaphores(int sysno);
- #endif
- #if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || \
-     defined(__aarch64__) ||                                         \
--    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_64_BITS))
-+    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_64_BITS)) || \
-+    defined(__riscv)
-   // These give a lot of ambient authority and bypass the setuid sandbox.
-   static bool IsSystemVSharedMemory(int sysno);
- #endif
- 
- #if defined(__x86_64__) || defined(__arm__) || defined(__aarch64__) || \
--    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_64_BITS))
-+    (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_64_BITS)) || \
-+    defined(__riscv)
-   static bool IsSystemVMessageQueue(int sysno);
- #endif
- 
-@@ -117,6 +120,9 @@ class SANDBOX_EXPORT SyscallSets {
-   static bool IsMipsPrivate(int sysno);
-   static bool IsMipsMisc(int sysno);
- #endif  // defined(__mips__)
-+#if defined(__riscv)
-+  static bool IsRiscvPrivate(int sysno);
-+#endif
- };
- 
- }  // namespace sandbox.
-diff --git a/sandbox/linux/seccomp-bpf/syscall.cc b/sandbox/linux/seccomp-bpf/syscall.cc
-index 2e0e810383b5..37f60d3333e0 100644
---- a/sandbox/linux/seccomp-bpf/syscall.cc
-+++ b/sandbox/linux/seccomp-bpf/syscall.cc
-@@ -18,7 +18,7 @@ namespace sandbox {
- namespace {
- 
- #if defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARM_FAMILY) || \
--    defined(ARCH_CPU_MIPS_FAMILY)
-+    defined(ARCH_CPU_MIPS_FAMILY) || defined(ARCH_CPU_RISCV_FAMILY)
- // Number that's not currently used by any Linux kernel ABIs.
- const int kInvalidSyscallNumber = 0x351d3;
- #else
-@@ -308,6 +308,28 @@ asm(// We need to be able to tell the kernel exactly where we made a
-     "2:ret\n"
-     ".cfi_endproc\n"
-     ".size SyscallAsm, .-SyscallAsm\n"
-+#elif defined(__riscv)
-+    ".text\n"
-+    ".align 2\n"
-+    ".type SyscallAsm, %function\n"
-+    "SyscallAsm:\n"
-+    ".cfi_startproc\n"
-+    "bgez a0,1f\n"
-+    "la a0,2f\n"
-+    "j 2f\n"
-+    "1:mv a7, a0\n"
-+    "ld a0, (t0)\n"
-+    "ld a1, 8(t0)\n"
-+    "ld a2, 16(t0)\n"
-+    "ld a3, 24(t0)\n"
-+    "ld a4, 32(t0)\n"
-+    "ld a5, 40(t0)\n"
-+    "ld a6, 48(t0)\n"
-+    // Enter the kernel
-+    "scall\n"
-+    "2:ret\n"
-+    ".cfi_endproc\n"
-+    ".size SyscallAsm, .-SyscallAsm\n"
- #endif
-     );  // asm
- 
-@@ -424,6 +446,17 @@ intptr_t Syscall::Call(int nr,
-                  : "memory", "x1", "x2", "x3", "x4", "x5", "x8", "x30");
-     ret = inout;
-   }
-+#elif defined(__riscv)
-+  intptr_t ret;
-+  {
-+    register intptr_t inout __asm__("a0") = nr;
-+    register const intptr_t* data __asm__("t0") = args;
-+    asm volatile("jal SyscallAsm\n"
-+                 : "+r"(inout)
-+		 : "r"(data)
-+		 : "memory", "a1", "a2", "a3", "a4", "a5", "a6");
-+    ret = inout;
-+  }
- 
- #else
- #error "Unimplemented architecture"
-diff --git a/sandbox/linux/services/credentials.cc b/sandbox/linux/services/credentials.cc
-index 00b969ee02a7..7fa1a42ca41c 100644
---- a/sandbox/linux/services/credentials.cc
-+++ b/sandbox/linux/services/credentials.cc
-@@ -80,7 +80,7 @@ bool ChrootToSafeEmptyDir() {
-   pid_t pid = -1;
-   alignas(16) char stack_buf[PTHREAD_STACK_MIN];
- #if defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARM_FAMILY) || \
--    defined(ARCH_CPU_MIPS_FAMILY)
-+    defined(ARCH_CPU_MIPS_FAMILY) || defined(ARCH_CPU_RISCV_FAMILY)
-   // The stack grows downward.
-   void* stack = stack_buf + sizeof(stack_buf);
- #else
-diff --git a/sandbox/linux/services/syscall_wrappers.cc b/sandbox/linux/services/syscall_wrappers.cc
-index f863cd005141..b6d7dac2cab4 100644
---- a/sandbox/linux/services/syscall_wrappers.cc
-+++ b/sandbox/linux/services/syscall_wrappers.cc
-@@ -61,7 +61,7 @@ long sys_clone(unsigned long flags,
- #if defined(ARCH_CPU_X86_64)
-   return syscall(__NR_clone, flags, child_stack, ptid, ctid, tls);
- #elif defined(ARCH_CPU_X86) || defined(ARCH_CPU_ARM_FAMILY) || \
--    defined(ARCH_CPU_MIPS_FAMILY)
-+    defined(ARCH_CPU_MIPS_FAMILY) || defined(ARCH_CPU_RISCV_FAMILY)
-   // CONFIG_CLONE_BACKWARDS defined.
-   return syscall(__NR_clone, flags, child_stack, ptid, tls, ctid);
- #endif
-diff --git a/sandbox/linux/syscall_broker/broker_process.cc b/sandbox/linux/syscall_broker/broker_process.cc
-index 7dd4688011f9..11422693463d 100644
---- a/sandbox/linux/syscall_broker/broker_process.cc
-+++ b/sandbox/linux/syscall_broker/broker_process.cc
-@@ -117,44 +117,46 @@ bool BrokerProcess::IsSyscallBrokerable(int sysno, bool fast_check) const {
-   // and are default disabled in Android. So, we should refuse to broker them
-   // to be consistent with the platform's restrictions.
-   switch (sysno) {
--#if !defined(__aarch64__) && !BUILDFLAG(IS_ANDROID)
-+#if !defined(__aarch64__) && !BUILDFLAG(IS_ANDROID) && !defined(__riscv)
-     case __NR_access:
- #endif
-     case __NR_faccessat:
-     case __NR_faccessat2:
-       return !fast_check || policy_->allowed_command_set.test(COMMAND_ACCESS);
- 
--#if !defined(__aarch64__) && !BUILDFLAG(IS_ANDROID)
-+#if !defined(__aarch64__) && !BUILDFLAG(IS_ANDROID) && !defined(__riscv)
-     case __NR_mkdir:
- #endif
-     case __NR_mkdirat:
-       return !fast_check || policy_->allowed_command_set.test(COMMAND_MKDIR);
- 
--#if !defined(__aarch64__) && !BUILDFLAG(IS_ANDROID)
-+#if !defined(__aarch64__) && !BUILDFLAG(IS_ANDROID) && !defined(__riscv)
-     case __NR_open:
- #endif
-     case __NR_openat:
-       return !fast_check || policy_->allowed_command_set.test(COMMAND_OPEN);
- 
--#if !defined(__aarch64__) && !BUILDFLAG(IS_ANDROID)
-+#if !defined(__aarch64__) && !BUILDFLAG(IS_ANDROID) && !defined(__riscv)
-     case __NR_readlink:
- #endif
-     case __NR_readlinkat:
-       return !fast_check || policy_->allowed_command_set.test(COMMAND_READLINK);
- 
--#if !defined(__aarch64__) && !BUILDFLAG(IS_ANDROID)
-+#if !defined(__aarch64__) && !BUILDFLAG(IS_ANDROID) && !defined(__riscv)
-     case __NR_rename:
- #endif
-+#ifdef __NR_renameat
-     case __NR_renameat:
-+#endif
-     case __NR_renameat2:
-       return !fast_check || policy_->allowed_command_set.test(COMMAND_RENAME);
- 
--#if !defined(__aarch64__) && !BUILDFLAG(IS_ANDROID)
-+#if !defined(__aarch64__) && !BUILDFLAG(IS_ANDROID) && !defined(__riscv)
-     case __NR_rmdir:
-       return !fast_check || policy_->allowed_command_set.test(COMMAND_RMDIR);
- #endif
- 
--#if !defined(__aarch64__) && !BUILDFLAG(IS_ANDROID)
-+#if !defined(__aarch64__) && !BUILDFLAG(IS_ANDROID) && !defined(__riscv)
-     case __NR_stat:
-     case __NR_lstat:
- #endif
-@@ -164,7 +166,7 @@ bool BrokerProcess::IsSyscallBrokerable(int sysno, bool fast_check) const {
- #if defined(__NR_fstatat64)
-     case __NR_fstatat64:
- #endif
--#if defined(__x86_64__) || defined(__aarch64__)
-+#if defined(__x86_64__) || defined(__aarch64__) || defined(__riscv)
-     case __NR_newfstatat:
- #endif
-       return !fast_check || policy_->allowed_command_set.test(COMMAND_STAT);
-@@ -179,7 +181,7 @@ bool BrokerProcess::IsSyscallBrokerable(int sysno, bool fast_check) const {
-       return !fast_check || policy_->allowed_command_set.test(COMMAND_STAT);
- #endif
- 
--#if !defined(__aarch64__) && !BUILDFLAG(IS_ANDROID)
-+#if !defined(__aarch64__) && !BUILDFLAG(IS_ANDROID) && !defined(__riscv)
-     case __NR_unlink:
-       return !fast_check || policy_->allowed_command_set.test(COMMAND_UNLINK);
- #endif
-diff --git a/sandbox/linux/system_headers/linux_seccomp.h b/sandbox/linux/system_headers/linux_seccomp.h
-index 7d898d84631a..0b144fe30c32 100644
---- a/sandbox/linux/system_headers/linux_seccomp.h
-+++ b/sandbox/linux/system_headers/linux_seccomp.h
-@@ -39,6 +39,10 @@
- #define EM_AARCH64 183
- #endif
- 
-+#ifndef EM_RISCV
-+#define EM_RISCV 243
-+#endif
-+
- #ifndef __AUDIT_ARCH_64BIT
- #define __AUDIT_ARCH_64BIT 0x80000000
- #endif
-@@ -71,6 +75,10 @@
- #define AUDIT_ARCH_AARCH64 (EM_AARCH64 | __AUDIT_ARCH_64BIT | __AUDIT_ARCH_LE)
- #endif
- 
-+#ifndef AUDIT_ARCH_RISCV64
-+#define AUDIT_ARCH_RISCV64 (EM_RISCV|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
-+#endif
-+
- // For prctl.h
- #ifndef PR_SET_SECCOMP
- #define PR_SET_SECCOMP               22
-diff --git a/sandbox/linux/system_headers/linux_signal.h b/sandbox/linux/system_headers/linux_signal.h
-index 74bbb8ef8c74..db6159f754ce 100644
---- a/sandbox/linux/system_headers/linux_signal.h
-+++ b/sandbox/linux/system_headers/linux_signal.h
-@@ -13,7 +13,7 @@
- // (not undefined, but defined different values and in different memory
- // layouts). So, fill the gap here.
- #if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || \
--    defined(__aarch64__)
-+    defined(__aarch64__) || defined(__riscv)
- 
- #define LINUX_SIGHUP 1
- #define LINUX_SIGINT 2
-diff --git a/sandbox/linux/system_headers/linux_stat.h b/sandbox/linux/system_headers/linux_stat.h
-index 5f49a958499e..32ab256cfca4 100644
---- a/sandbox/linux/system_headers/linux_stat.h
-+++ b/sandbox/linux/system_headers/linux_stat.h
-@@ -150,7 +150,7 @@ struct kernel_stat {
-   int st_blocks;
-   int st_pad4[14];
- };
--#elif defined(__aarch64__)
-+#elif defined(__aarch64__) || defined(__riscv)
- struct kernel_stat {
-   unsigned long st_dev;
-   unsigned long st_ino;
-diff --git a/sandbox/linux/system_headers/linux_syscalls.h b/sandbox/linux/system_headers/linux_syscalls.h
-index 2b78a0cc3b97..968d6f71b586 100644
---- a/sandbox/linux/system_headers/linux_syscalls.h
-+++ b/sandbox/linux/system_headers/linux_syscalls.h
-@@ -35,5 +35,9 @@
- #include "sandbox/linux/system_headers/arm64_linux_syscalls.h"
- #endif
- 
-+#if defined(__riscv) && __riscv_xlen == 64
-+#include "sandbox/linux/system_headers/riscv64_linux_syscalls.h"
-+#endif
-+
- #endif  // SANDBOX_LINUX_SYSTEM_HEADERS_LINUX_SYSCALLS_H_
- 
-diff --git a/sandbox/linux/system_headers/riscv64_linux_syscalls.h b/sandbox/linux/system_headers/riscv64_linux_syscalls.h
-new file mode 100644
-index 000000000000..f8fcd06bc2f2
---- /dev/null
-+++ b/sandbox/linux/system_headers/riscv64_linux_syscalls.h
-@@ -0,0 +1,1074 @@
-+// Copyright 2014 The Chromium Authors. All rights reserved.
-+// Use of this source code is governed by a BSD-style license that can be
-+// found in the LICENSE file.
-+
-+#ifndef SANDBOX_LINUX_SYSTEM_HEADERS_RISCV64_LINUX_SYSCALLS_H_
-+#define SANDBOX_LINUX_SYSTEM_HEADERS_RISCV64_LINUX_SYSCALLS_H_
-+
-+#include <asm-generic/unistd.h>
-+
-+#if !defined(__NR_io_setup)
-+#define __NR_io_setup 0
-+#endif
-+
-+#if !defined(__NR_io_destroy)
-+#define __NR_io_destroy 1
-+#endif
-+
-+#if !defined(__NR_io_submit)
-+#define __NR_io_submit 2
-+#endif
-+
-+#if !defined(__NR_io_cancel)
-+#define __NR_io_cancel 3
-+#endif
-+
-+#if !defined(__NR_io_getevents)
-+#define __NR_io_getevents 4
-+#endif
-+
-+#if !defined(__NR_setxattr)
-+#define __NR_setxattr 5
-+#endif
-+
-+#if !defined(__NR_lsetxattr)
-+#define __NR_lsetxattr 6
-+#endif
-+
-+#if !defined(__NR_fsetxattr)
-+#define __NR_fsetxattr 7
-+#endif
-+
-+#if !defined(__NR_getxattr)
-+#define __NR_getxattr 8
-+#endif
-+
-+#if !defined(__NR_lgetxattr)
-+#define __NR_lgetxattr 9
-+#endif
-+
-+#if !defined(__NR_fgetxattr)
-+#define __NR_fgetxattr 10
-+#endif
-+
-+#if !defined(__NR_listxattr)
-+#define __NR_listxattr 11
-+#endif
-+
-+#if !defined(__NR_llistxattr)
-+#define __NR_llistxattr 12
-+#endif
-+
-+#if !defined(__NR_flistxattr)
-+#define __NR_flistxattr 13
-+#endif
-+
-+#if !defined(__NR_removexattr)
-+#define __NR_removexattr 14
-+#endif
-+
-+#if !defined(__NR_lremovexattr)
-+#define __NR_lremovexattr 15
-+#endif
-+
-+#if !defined(__NR_fremovexattr)
-+#define __NR_fremovexattr 16
-+#endif
-+
-+#if !defined(__NR_getcwd)
-+#define __NR_getcwd 17
-+#endif
-+
-+#if !defined(__NR_lookup_dcookie)
-+#define __NR_lookup_dcookie 18
-+#endif
-+
-+#if !defined(__NR_eventfd2)
-+#define __NR_eventfd2 19
-+#endif
-+
-+#if !defined(__NR_epoll_create1)
-+#define __NR_epoll_create1 20
-+#endif
-+
-+#if !defined(__NR_epoll_ctl)
-+#define __NR_epoll_ctl 21
-+#endif
-+
-+#if !defined(__NR_epoll_pwait)
-+#define __NR_epoll_pwait 22
-+#endif
-+
-+#if !defined(__NR_dup)
-+#define __NR_dup 23
-+#endif
-+
-+#if !defined(__NR_dup3)
-+#define __NR_dup3 24
-+#endif
-+
-+#if !defined(__NR_fcntl)
-+#define __NR_fcntl 25
-+#endif
-+
-+#if !defined(__NR_inotify_init1)
-+#define __NR_inotify_init1 26
-+#endif
-+
-+#if !defined(__NR_inotify_add_watch)
-+#define __NR_inotify_add_watch 27
-+#endif
-+
-+#if !defined(__NR_inotify_rm_watch)
-+#define __NR_inotify_rm_watch 28
-+#endif
-+
-+#if !defined(__NR_ioctl)
-+#define __NR_ioctl 29
-+#endif
-+
-+#if !defined(__NR_ioprio_set)
-+#define __NR_ioprio_set 30
-+#endif
-+
-+#if !defined(__NR_ioprio_get)
-+#define __NR_ioprio_get 31
-+#endif
-+
-+#if !defined(__NR_flock)
-+#define __NR_flock 32
-+#endif
-+
-+#if !defined(__NR_mknodat)
-+#define __NR_mknodat 33
-+#endif
-+
-+#if !defined(__NR_mkdirat)
-+#define __NR_mkdirat 34
-+#endif
-+
-+#if !defined(__NR_unlinkat)
-+#define __NR_unlinkat 35
-+#endif
-+
-+#if !defined(__NR_symlinkat)
-+#define __NR_symlinkat 36
-+#endif
-+
-+#if !defined(__NR_linkat)
-+#define __NR_linkat 37
-+#endif
-+
-+#if !defined(__NR_renameat)
-+#define __NR_renameat 38
-+#endif
-+
-+#if !defined(__NR_umount2)
-+#define __NR_umount2 39
-+#endif
-+
-+#if !defined(__NR_mount)
-+#define __NR_mount 40
-+#endif
-+
-+#if !defined(__NR_pivot_root)
-+#define __NR_pivot_root 41
-+#endif
-+
-+#if !defined(__NR_nfsservctl)
-+#define __NR_nfsservctl 42
-+#endif
-+
-+#if !defined(__NR_statfs)
-+#define __NR_statfs 43
-+#endif
-+
-+#if !defined(__NR_fstatfs)
-+#define __NR_fstatfs 44
-+#endif
-+
-+#if !defined(__NR_truncate)
-+#define __NR_truncate 45
-+#endif
-+
-+#if !defined(__NR_ftruncate)
-+#define __NR_ftruncate 46
-+#endif
-+
-+#if !defined(__NR_fallocate)
-+#define __NR_fallocate 47
-+#endif
-+
-+#if !defined(__NR_faccessat)
-+#define __NR_faccessat 48
-+#endif
-+
-+#if !defined(__NR_chdir)
-+#define __NR_chdir 49
-+#endif
-+
-+#if !defined(__NR_fchdir)
-+#define __NR_fchdir 50
-+#endif
-+
-+#if !defined(__NR_chroot)
-+#define __NR_chroot 51
-+#endif
-+
-+#if !defined(__NR_fchmod)
-+#define __NR_fchmod 52
-+#endif
-+
-+#if !defined(__NR_fchmodat)
-+#define __NR_fchmodat 53
-+#endif
-+
-+#if !defined(__NR_fchownat)
-+#define __NR_fchownat 54
-+#endif
-+
-+#if !defined(__NR_fchown)
-+#define __NR_fchown 55
-+#endif
-+
-+#if !defined(__NR_openat)
-+#define __NR_openat 56
-+#endif
-+
-+#if !defined(__NR_close)
-+#define __NR_close 57
-+#endif
-+
-+#if !defined(__NR_vhangup)
-+#define __NR_vhangup 58
-+#endif
-+
-+#if !defined(__NR_pipe2)
-+#define __NR_pipe2 59
-+#endif
-+
-+#if !defined(__NR_quotactl)
-+#define __NR_quotactl 60
-+#endif
-+
-+#if !defined(__NR_getdents64)
-+#define __NR_getdents64 61
-+#endif
-+
-+#if !defined(__NR_lseek)
-+#define __NR_lseek 62
-+#endif
-+
-+#if !defined(__NR_read)
-+#define __NR_read 63
-+#endif
-+
-+#if !defined(__NR_write)
-+#define __NR_write 64
-+#endif
-+
-+#if !defined(__NR_readv)
-+#define __NR_readv 65
-+#endif
-+
-+#if !defined(__NR_writev)
-+#define __NR_writev 66
-+#endif
-+
-+#if !defined(__NR_pread64)
-+#define __NR_pread64 67
-+#endif
-+
-+#if !defined(__NR_pwrite64)
-+#define __NR_pwrite64 68
-+#endif
-+
-+#if !defined(__NR_preadv)
-+#define __NR_preadv 69
-+#endif
-+
-+#if !defined(__NR_pwritev)
-+#define __NR_pwritev 70
-+#endif
-+
-+#if !defined(__NR_sendfile)
-+#define __NR_sendfile 71
-+#endif
-+
-+#if !defined(__NR_pselect6)
-+#define __NR_pselect6 72
-+#endif
-+
-+#if !defined(__NR_ppoll)
-+#define __NR_ppoll 73
-+#endif
-+
-+#if !defined(__NR_signalfd4)
-+#define __NR_signalfd4 74
-+#endif
-+
-+#if !defined(__NR_vmsplice)
-+#define __NR_vmsplice 75
-+#endif
-+
-+#if !defined(__NR_splice)
-+#define __NR_splice 76
-+#endif
-+
-+#if !defined(__NR_tee)
-+#define __NR_tee 77
-+#endif
-+
-+#if !defined(__NR_readlinkat)
-+#define __NR_readlinkat 78
-+#endif
-+
-+#if !defined(__NR_newfstatat)
-+#define __NR_newfstatat 79
-+#endif
-+
-+#if !defined(__NR_fstat)
-+#define __NR_fstat 80
-+#endif
-+
-+#if !defined(__NR_sync)
-+#define __NR_sync 81
-+#endif
-+
-+#if !defined(__NR_fsync)
-+#define __NR_fsync 82
-+#endif
-+
-+#if !defined(__NR_fdatasync)
-+#define __NR_fdatasync 83
-+#endif
-+
-+#if !defined(__NR_sync_file_range)
-+#define __NR_sync_file_range 84
-+#endif
-+
-+#if !defined(__NR_timerfd_create)
-+#define __NR_timerfd_create 85
-+#endif
-+
-+#if !defined(__NR_timerfd_settime)
-+#define __NR_timerfd_settime 86
-+#endif
-+
-+#if !defined(__NR_timerfd_gettime)
-+#define __NR_timerfd_gettime 87
-+#endif
-+
-+#if !defined(__NR_utimensat)
-+#define __NR_utimensat 88
-+#endif
-+
-+#if !defined(__NR_acct)
-+#define __NR_acct 89
-+#endif
-+
-+#if !defined(__NR_capget)
-+#define __NR_capget 90
-+#endif
-+
-+#if !defined(__NR_capset)
-+#define __NR_capset 91
-+#endif
-+
-+#if !defined(__NR_personality)
-+#define __NR_personality 92
-+#endif
-+
-+#if !defined(__NR_exit)
-+#define __NR_exit 93
-+#endif
-+
-+#if !defined(__NR_exit_group)
-+#define __NR_exit_group 94
-+#endif
-+
-+#if !defined(__NR_waitid)
-+#define __NR_waitid 95
-+#endif
-+
-+#if !defined(__NR_set_tid_address)
-+#define __NR_set_tid_address 96
-+#endif
-+
-+#if !defined(__NR_unshare)
-+#define __NR_unshare 97
-+#endif
-+
-+#if !defined(__NR_futex)
-+#define __NR_futex 98
-+#endif
-+
-+#if !defined(__NR_set_robust_list)
-+#define __NR_set_robust_list 99
-+#endif
-+
-+#if !defined(__NR_get_robust_list)
-+#define __NR_get_robust_list 100
-+#endif
-+
-+#if !defined(__NR_nanosleep)
-+#define __NR_nanosleep 101
-+#endif
-+
-+#if !defined(__NR_getitimer)
-+#define __NR_getitimer 102
-+#endif
-+
-+#if !defined(__NR_setitimer)
-+#define __NR_setitimer 103
-+#endif
-+
-+#if !defined(__NR_kexec_load)
-+#define __NR_kexec_load 104
-+#endif
-+
-+#if !defined(__NR_init_module)
-+#define __NR_init_module 105
-+#endif
-+
-+#if !defined(__NR_delete_module)
-+#define __NR_delete_module 106
-+#endif
-+
-+#if !defined(__NR_timer_create)
-+#define __NR_timer_create 107
-+#endif
-+
-+#if !defined(__NR_timer_gettime)
-+#define __NR_timer_gettime 108
-+#endif
-+
-+#if !defined(__NR_timer_getoverrun)
-+#define __NR_timer_getoverrun 109
-+#endif
-+
-+#if !defined(__NR_timer_settime)
-+#define __NR_timer_settime 110
-+#endif
-+
-+#if !defined(__NR_timer_delete)
-+#define __NR_timer_delete 111
-+#endif
-+
-+#if !defined(__NR_clock_settime)
-+#define __NR_clock_settime 112
-+#endif
-+
-+#if !defined(__NR_clock_gettime)
-+#define __NR_clock_gettime 113
-+#endif
-+
-+#if !defined(__NR_clock_getres)
-+#define __NR_clock_getres 114
-+#endif
-+
-+#if !defined(__NR_clock_nanosleep)
-+#define __NR_clock_nanosleep 115
-+#endif
-+
-+#if !defined(__NR_syslog)
-+#define __NR_syslog 116
-+#endif
-+
-+#if !defined(__NR_ptrace)
-+#define __NR_ptrace 117
-+#endif
-+
-+#if !defined(__NR_sched_setparam)
-+#define __NR_sched_setparam 118
-+#endif
-+
-+#if !defined(__NR_sched_setscheduler)
-+#define __NR_sched_setscheduler 119
-+#endif
-+
-+#if !defined(__NR_sched_getscheduler)
-+#define __NR_sched_getscheduler 120
-+#endif
-+
-+#if !defined(__NR_sched_getparam)
-+#define __NR_sched_getparam 121
-+#endif
-+
-+#if !defined(__NR_sched_setaffinity)
-+#define __NR_sched_setaffinity 122
-+#endif
-+
-+#if !defined(__NR_sched_getaffinity)
-+#define __NR_sched_getaffinity 123
-+#endif
-+
-+#if !defined(__NR_sched_yield)
-+#define __NR_sched_yield 124
-+#endif
-+
-+#if !defined(__NR_sched_get_priority_max)
-+#define __NR_sched_get_priority_max 125
-+#endif
-+
-+#if !defined(__NR_sched_get_priority_min)
-+#define __NR_sched_get_priority_min 126
-+#endif
-+
-+#if !defined(__NR_sched_rr_get_interval)
-+#define __NR_sched_rr_get_interval 127
-+#endif
-+
-+#if !defined(__NR_restart_syscall)
-+#define __NR_restart_syscall 128
-+#endif
-+
-+#if !defined(__NR_kill)
-+#define __NR_kill 129
-+#endif
-+
-+#if !defined(__NR_tkill)
-+#define __NR_tkill 130
-+#endif
-+
-+#if !defined(__NR_tgkill)
-+#define __NR_tgkill 131
-+#endif
-+
-+#if !defined(__NR_sigaltstack)
-+#define __NR_sigaltstack 132
-+#endif
-+
-+#if !defined(__NR_rt_sigsuspend)
-+#define __NR_rt_sigsuspend 133
-+#endif
-+
-+#if !defined(__NR_rt_sigaction)
-+#define __NR_rt_sigaction 134
-+#endif
-+
-+#if !defined(__NR_rt_sigprocmask)
-+#define __NR_rt_sigprocmask 135
-+#endif
-+
-+#if !defined(__NR_rt_sigpending)
-+#define __NR_rt_sigpending 136
-+#endif
-+
-+#if !defined(__NR_rt_sigtimedwait)
-+#define __NR_rt_sigtimedwait 137
-+#endif
-+
-+#if !defined(__NR_rt_sigqueueinfo)
-+#define __NR_rt_sigqueueinfo 138
-+#endif
-+
-+#if !defined(__NR_rt_sigreturn)
-+#define __NR_rt_sigreturn 139
-+#endif
-+
-+#if !defined(__NR_setpriority)
-+#define __NR_setpriority 140
-+#endif
-+
-+#if !defined(__NR_getpriority)
-+#define __NR_getpriority 141
-+#endif
-+
-+#if !defined(__NR_reboot)
-+#define __NR_reboot 142
-+#endif
-+
-+#if !defined(__NR_setregid)
-+#define __NR_setregid 143
-+#endif
-+
-+#if !defined(__NR_setgid)
-+#define __NR_setgid 144
-+#endif
-+
-+#if !defined(__NR_setreuid)
-+#define __NR_setreuid 145
-+#endif
-+
-+#if !defined(__NR_setuid)
-+#define __NR_setuid 146
-+#endif
-+
-+#if !defined(__NR_setresuid)
-+#define __NR_setresuid 147
-+#endif
-+
-+#if !defined(__NR_getresuid)
-+#define __NR_getresuid 148
-+#endif
-+
-+#if !defined(__NR_setresgid)
-+#define __NR_setresgid 149
-+#endif
-+
-+#if !defined(__NR_getresgid)
-+#define __NR_getresgid 150
-+#endif
-+
-+#if !defined(__NR_setfsuid)
-+#define __NR_setfsuid 151
-+#endif
-+
-+#if !defined(__NR_setfsgid)
-+#define __NR_setfsgid 152
-+#endif
-+
-+#if !defined(__NR_times)
-+#define __NR_times 153
-+#endif
-+
-+#if !defined(__NR_setpgid)
-+#define __NR_setpgid 154
-+#endif
-+
-+#if !defined(__NR_getpgid)
-+#define __NR_getpgid 155
-+#endif
-+
-+#if !defined(__NR_getsid)
-+#define __NR_getsid 156
-+#endif
-+
-+#if !defined(__NR_setsid)
-+#define __NR_setsid 157
-+#endif
-+
-+#if !defined(__NR_getgroups)
-+#define __NR_getgroups 158
-+#endif
-+
-+#if !defined(__NR_setgroups)
-+#define __NR_setgroups 159
-+#endif
-+
-+#if !defined(__NR_uname)
-+#define __NR_uname 160
-+#endif
-+
-+#if !defined(__NR_sethostname)
-+#define __NR_sethostname 161
-+#endif
-+
-+#if !defined(__NR_setdomainname)
-+#define __NR_setdomainname 162
-+#endif
-+
-+#if !defined(__NR_getrlimit)
-+#define __NR_getrlimit 163
-+#endif
-+
-+#if !defined(__NR_setrlimit)
-+#define __NR_setrlimit 164
-+#endif
-+
-+#if !defined(__NR_getrusage)
-+#define __NR_getrusage 165
-+#endif
-+
-+#if !defined(__NR_umask)
-+#define __NR_umask 166
-+#endif
-+
-+#if !defined(__NR_prctl)
-+#define __NR_prctl 167
-+#endif
-+
-+#if !defined(__NR_getcpu)
-+#define __NR_getcpu 168
-+#endif
-+
-+#if !defined(__NR_gettimeofday)
-+#define __NR_gettimeofday 169
-+#endif
-+
-+#if !defined(__NR_settimeofday)
-+#define __NR_settimeofday 170
-+#endif
-+
-+#if !defined(__NR_adjtimex)
-+#define __NR_adjtimex 171
-+#endif
-+
-+#if !defined(__NR_getpid)
-+#define __NR_getpid 172
-+#endif
-+
-+#if !defined(__NR_getppid)
-+#define __NR_getppid 173
-+#endif
-+
-+#if !defined(__NR_getuid)
-+#define __NR_getuid 174
-+#endif
-+
-+#if !defined(__NR_geteuid)
-+#define __NR_geteuid 175
-+#endif
-+
-+#if !defined(__NR_getgid)
-+#define __NR_getgid 176
-+#endif
-+
-+#if !defined(__NR_getegid)
-+#define __NR_getegid 177
-+#endif
-+
-+#if !defined(__NR_gettid)
-+#define __NR_gettid 178
-+#endif
-+
-+#if !defined(__NR_sysinfo)
-+#define __NR_sysinfo 179
-+#endif
-+
-+#if !defined(__NR_mq_open)
-+#define __NR_mq_open 180
-+#endif
-+
-+#if !defined(__NR_mq_unlink)
-+#define __NR_mq_unlink 181
-+#endif
-+
-+#if !defined(__NR_mq_timedsend)
-+#define __NR_mq_timedsend 182
-+#endif
-+
-+#if !defined(__NR_mq_timedreceive)
-+#define __NR_mq_timedreceive 183
-+#endif
-+
-+#if !defined(__NR_mq_notify)
-+#define __NR_mq_notify 184
-+#endif
-+
-+#if !defined(__NR_mq_getsetattr)
-+#define __NR_mq_getsetattr 185
-+#endif
-+
-+#if !defined(__NR_msgget)
-+#define __NR_msgget 186
-+#endif
-+
-+#if !defined(__NR_msgctl)
-+#define __NR_msgctl 187
-+#endif
-+
-+#if !defined(__NR_msgrcv)
-+#define __NR_msgrcv 188
-+#endif
-+
-+#if !defined(__NR_msgsnd)
-+#define __NR_msgsnd 189
-+#endif
-+
-+#if !defined(__NR_semget)
-+#define __NR_semget 190
-+#endif
-+
-+#if !defined(__NR_semctl)
-+#define __NR_semctl 191
-+#endif
-+
-+#if !defined(__NR_semtimedop)
-+#define __NR_semtimedop 192
-+#endif
-+
-+#if !defined(__NR_semop)
-+#define __NR_semop 193
-+#endif
-+
-+#if !defined(__NR_shmget)
-+#define __NR_shmget 194
-+#endif
-+
-+#if !defined(__NR_shmctl)
-+#define __NR_shmctl 195
-+#endif
-+
-+#if !defined(__NR_shmat)
-+#define __NR_shmat 196
-+#endif
-+
-+#if !defined(__NR_shmdt)
-+#define __NR_shmdt 197
-+#endif
-+
-+#if !defined(__NR_socket)
-+#define __NR_socket 198
-+#endif
-+
-+#if !defined(__NR_socketpair)
-+#define __NR_socketpair 199
-+#endif
-+
-+#if !defined(__NR_bind)
-+#define __NR_bind 200
-+#endif
-+
-+#if !defined(__NR_listen)
-+#define __NR_listen 201
-+#endif
-+
-+#if !defined(__NR_accept)
-+#define __NR_accept 202
-+#endif
-+
-+#if !defined(__NR_connect)
-+#define __NR_connect 203
-+#endif
-+
-+#if !defined(__NR_getsockname)
-+#define __NR_getsockname 204
-+#endif
-+
-+#if !defined(__NR_getpeername)
-+#define __NR_getpeername 205
-+#endif
-+
-+#if !defined(__NR_sendto)
-+#define __NR_sendto 206
-+#endif
-+
-+#if !defined(__NR_recvfrom)
-+#define __NR_recvfrom 207
-+#endif
-+
-+#if !defined(__NR_setsockopt)
-+#define __NR_setsockopt 208
-+#endif
-+
-+#if !defined(__NR_getsockopt)
-+#define __NR_getsockopt 209
-+#endif
-+
-+#if !defined(__NR_shutdown)
-+#define __NR_shutdown 210
-+#endif
-+
-+#if !defined(__NR_sendmsg)
-+#define __NR_sendmsg 211
-+#endif
-+
-+#if !defined(__NR_recvmsg)
-+#define __NR_recvmsg 212
-+#endif
-+
-+#if !defined(__NR_readahead)
-+#define __NR_readahead 213
-+#endif
-+
-+#if !defined(__NR_brk)
-+#define __NR_brk 214
-+#endif
-+
-+#if !defined(__NR_munmap)
-+#define __NR_munmap 215
-+#endif
-+
-+#if !defined(__NR_mremap)
-+#define __NR_mremap 216
-+#endif
-+
-+#if !defined(__NR_add_key)
-+#define __NR_add_key 217
-+#endif
-+
-+#if !defined(__NR_request_key)
-+#define __NR_request_key 218
-+#endif
-+
-+#if !defined(__NR_keyctl)
-+#define __NR_keyctl 219
-+#endif
-+
-+#if !defined(__NR_clone)
-+#define __NR_clone 220
-+#endif
-+
-+#if !defined(__NR_execve)
-+#define __NR_execve 221
-+#endif
-+
-+#if !defined(__NR_mmap)
-+#define __NR_mmap 222
-+#endif
-+
-+#if !defined(__NR_fadvise64)
-+#define __NR_fadvise64 223
-+#endif
-+
-+#if !defined(__NR_swapon)
-+#define __NR_swapon 224
-+#endif
-+
-+#if !defined(__NR_swapoff)
-+#define __NR_swapoff 225
-+#endif
-+
-+#if !defined(__NR_mprotect)
-+#define __NR_mprotect 226
-+#endif
-+
-+#if !defined(__NR_msync)
-+#define __NR_msync 227
-+#endif
-+
-+#if !defined(__NR_mlock)
-+#define __NR_mlock 228
-+#endif
-+
-+#if !defined(__NR_munlock)
-+#define __NR_munlock 229
-+#endif
-+
-+#if !defined(__NR_mlockall)
-+#define __NR_mlockall 230
-+#endif
-+
-+#if !defined(__NR_munlockall)
-+#define __NR_munlockall 231
-+#endif
-+
-+#if !defined(__NR_mincore)
-+#define __NR_mincore 232
-+#endif
-+
-+#if !defined(__NR_madvise)
-+#define __NR_madvise 233
-+#endif
-+
-+#if !defined(__NR_remap_file_pages)
-+#define __NR_remap_file_pages 234
-+#endif
-+
-+#if !defined(__NR_mbind)
-+#define __NR_mbind 235
-+#endif
-+
-+#if !defined(__NR_get_mempolicy)
-+#define __NR_get_mempolicy 236
-+#endif
-+
-+#if !defined(__NR_set_mempolicy)
-+#define __NR_set_mempolicy 237
-+#endif
-+
-+#if !defined(__NR_migrate_pages)
-+#define __NR_migrate_pages 238
-+#endif
-+
-+#if !defined(__NR_move_pages)
-+#define __NR_move_pages 239
-+#endif
-+
-+#if !defined(__NR_rt_tgsigqueueinfo)
-+#define __NR_rt_tgsigqueueinfo 240
-+#endif
-+
-+#if !defined(__NR_perf_event_open)
-+#define __NR_perf_event_open 241
-+#endif
-+
-+#if !defined(__NR_accept4)
-+#define __NR_accept4 242
-+#endif
-+
-+#if !defined(__NR_recvmmsg)
-+#define __NR_recvmmsg 243
-+#endif
-+
-+#if !defined(__NR_riscv_flush_icache)
-+#define __NR_riscv_flush_icache 259
-+#endif
-+
-+#if !defined(__NR_wait4)
-+#define __NR_wait4 260
-+#endif
-+
-+#if !defined(__NR_prlimit64)
-+#define __NR_prlimit64 261
-+#endif
-+
-+#if !defined(__NR_fanotify_init)
-+#define __NR_fanotify_init 262
-+#endif
-+
-+#if !defined(__NR_fanotify_mark)
-+#define __NR_fanotify_mark 263
-+#endif
-+
-+#if !defined(__NR_name_to_handle_at)
-+#define __NR_name_to_handle_at 264
-+#endif
-+
-+#if !defined(__NR_open_by_handle_at)
-+#define __NR_open_by_handle_at 265
-+#endif
-+
-+#if !defined(__NR_clock_adjtime)
-+#define __NR_clock_adjtime 266
-+#endif
-+
-+#if !defined(__NR_syncfs)
-+#define __NR_syncfs 267
-+#endif
-+
-+#if !defined(__NR_setns)
-+#define __NR_setns 268
-+#endif
-+
-+#if !defined(__NR_sendmmsg)
-+#define __NR_sendmmsg 269
-+#endif
-+
-+#if !defined(__NR_process_vm_readv)
-+#define __NR_process_vm_readv 270
-+#endif
-+
-+#if !defined(__NR_process_vm_writev)
-+#define __NR_process_vm_writev 271
-+#endif
-+
-+#if !defined(__NR_kcmp)
-+#define __NR_kcmp 272
-+#endif
-+
-+#if !defined(__NR_finit_module)
-+#define __NR_finit_module 273
-+#endif
-+
-+#if !defined(__NR_sched_setattr)
-+#define __NR_sched_setattr 274
-+#endif
-+
-+#if !defined(__NR_sched_getattr)
-+#define __NR_sched_getattr 275
-+#endif
-+
-+#if !defined(__NR_renameat2)
-+#define __NR_renameat2 276
-+#endif
-+
-+#if !defined(__NR_seccomp)
-+#define __NR_seccomp 277
-+#endif
-+
-+#if !defined(__NR_getrandom)
-+#define __NR_getrandom 278
-+#endif
-+
-+#if !defined(__NR_memfd_create)
-+#define __NR_memfd_create 279
-+#endif
-+
-+#if !defined(__NR_faccessat2)
-+#define __NR_faccessat2 439
-+#endif
-+
-+#endif  // SANDBOX_LINUX_SYSTEM_HEADERS_RISCV64_LINUX_SYSCALLS_H_
-diff --git a/sandbox/policy/linux/bpf_cros_amd_gpu_policy_linux.cc b/sandbox/policy/linux/bpf_cros_amd_gpu_policy_linux.cc
-index cd64d06ae39d..1dad48a7caae 100644
---- a/sandbox/policy/linux/bpf_cros_amd_gpu_policy_linux.cc
-+++ b/sandbox/policy/linux/bpf_cros_amd_gpu_policy_linux.cc
-@@ -38,7 +38,7 @@ ResultExpr CrosAmdGpuProcessPolicy::EvaluateSyscall(int sysno) const {
-     case __NR_sched_setscheduler:
-     case __NR_sysinfo:
-     case __NR_uname:
--#if !defined(__aarch64__)
-+#if !defined(__aarch64__) && !defined(__riscv)
-     case __NR_readlink:
-     case __NR_stat:
- #endif
-diff --git a/sandbox/policy/linux/bpf_gpu_policy_linux.cc b/sandbox/policy/linux/bpf_gpu_policy_linux.cc
-index f8df9dcbd931..4a6287aba2ef 100644
---- a/sandbox/policy/linux/bpf_gpu_policy_linux.cc
-+++ b/sandbox/policy/linux/bpf_gpu_policy_linux.cc
-@@ -73,7 +73,7 @@ ResultExpr GpuProcessPolicy::EvaluateSyscall(int sysno) const {
-     (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-     case __NR_ftruncate64:
- #endif
--#if !defined(__aarch64__)
-+#if !defined(__aarch64__) && !defined(__riscv)
-     case __NR_getdents:
- #endif
-     case __NR_getdents64:
--- 
-2.25.1
-

+ 0 - 26
archive/0004-skia-add-riscv64.patch

@@ -1,26 +0,0 @@
-From 3eaf67ac02abe0244bbcd85e362c19919f458631 Mon Sep 17 00:00:00 2001
-From: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
-Date: Fri, 14 Jan 2022 01:04:19 +0000
-Subject: [PATCH 04/21] skia: add riscv64
-
-Signed-off-by: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
----
- skia/BUILD.gn | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/skia/BUILD.gn b/skia/BUILD.gn
-index 5c3a90ee7fcdc..daea4ff50a4b3 100644
---- a/skia/BUILD.gn
-+++ b/skia/BUILD.gn
-@@ -809,6 +809,8 @@ skia_source_set("skia_opts") {
-     sources = skia_opts.none_sources
-   } else if (current_cpu == "s390x") {
-     sources = skia_opts.none_sources
-+  } else if (current_cpu == "riscv64") {
-+    sources = skia_opts.none_sources
-   } else {
-     assert(false, "Need to port cpu specific stuff from skia_library_opts.gyp")
-   }
--- 
-2.25.1
-

+ 0 - 87
archive/0005-base-allocator-partition_allocator-add-riscv64-suppo.patch

@@ -1,87 +0,0 @@
-From 562b84239679c524a687d6fe51b4f15d87665415 Mon Sep 17 00:00:00 2001
-From: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
-Date: Tue, 5 Apr 2022 02:22:48 +0000
-Subject: [PATCH 05/21] base: allocator: partition_allocator: add riscv64
- support
-
-Signed-off-by: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
----
- base/allocator/partition_allocator/BUILD.gn   |  3 ++
- .../stack/asm/riscv64/push_registers_asm.cc   | 51 +++++++++++++++++++
- 2 files changed, 54 insertions(+)
- create mode 100644 base/allocator/partition_allocator/starscan/stack/asm/riscv64/push_registers_asm.cc
-
-diff --git a/base/allocator/partition_allocator/BUILD.gn b/base/allocator/partition_allocator/BUILD.gn
-index 0aa0c78692c0c..68814667eee52 100644
---- a/base/allocator/partition_allocator/BUILD.gn
-+++ b/base/allocator/partition_allocator/BUILD.gn
-@@ -268,6 +268,9 @@ target(partition_alloc_target_type, "partition_alloc") {
-   } else if (current_cpu == "arm64") {
-     defines += [ "PA_PCSCAN_STACK_SUPPORTED" ]
-     sources += [ "starscan/stack/asm/arm64/push_registers_asm.cc" ]
-+  } else if (current_cpu == "riscv64") {
-+    defines += [ "PA_PCSCAN_STACK_SUPPORTED" ]
-+    sources += [ "starscan/stack/asm/riscv64/push_registers_asm.cc" ]
-   } else {
-     # To support a trampoline for another arch, please refer to v8/src/heap/base.
-   }
-diff --git a/base/allocator/partition_allocator/starscan/stack/asm/riscv64/push_registers_asm.cc b/base/allocator/partition_allocator/starscan/stack/asm/riscv64/push_registers_asm.cc
-new file mode 100644
-index 0000000000000..2d90aab182988
---- /dev/null
-+++ b/base/allocator/partition_allocator/starscan/stack/asm/riscv64/push_registers_asm.cc
-@@ -0,0 +1,51 @@
-+// Copyright 2020 the V8 project authors. All rights reserved.
-+// Use of this source code is governed by a BSD-style license that can be
-+// found in the LICENSE file.
-+
-+// Push all callee-saved registers to get them on the stack for conservative
-+// stack scanning.
-+//
-+// See asm/x64/push_registers_asm.cc for why the function is not generated
-+// using clang.
-+//
-+// Calling convention source:
-+// https://riscv.org/wp-content/uploads/2015/01/riscv-calling.pdf Table 18.2
-+asm(".global PushAllRegistersAndIterateStack             \n"
-+    ".type PushAllRegistersAndIterateStack, %function    \n"
-+    ".hidden PushAllRegistersAndIterateStack             \n"
-+    "PushAllRegistersAndIterateStack:                    \n"
-+    // Push all callee-saved registers and save return address.
-+    "  addi sp, sp, -112                                 \n"
-+    // Save return address.
-+    "  sd ra, 104(sp)                                    \n"
-+    // sp is callee-saved.
-+    "  sd sp, 96(sp)                                     \n"
-+    // s0-s11 are callee-saved.
-+    "  sd s11, 88(sp)                                    \n"
-+    "  sd s10, 80(sp)                                    \n"
-+    "  sd s9, 72(sp)                                     \n"
-+    "  sd s8, 64(sp)                                     \n"
-+    "  sd s7, 56(sp)                                     \n"
-+    "  sd s6, 48(sp)                                     \n"
-+    "  sd s5, 40(sp)                                     \n"
-+    "  sd s4, 32(sp)                                     \n"
-+    "  sd s3, 24(sp)                                     \n"
-+    "  sd s2, 16(sp)                                     \n"
-+    "  sd s1,  8(sp)                                     \n"
-+    "  sd s0,  0(sp)                                     \n"
-+    // Maintain frame pointer(fp is s0).
-+    "  mv s0, sp                                         \n"
-+    // Pass 1st parameter (a0) unchanged (Stack*).
-+    // Pass 2nd parameter (a1) unchanged (StackVisitor*).
-+    // Save 3rd parameter (a2; IterateStackCallback) to a3.
-+    "  mv a3, a2                                         \n"
-+    // Pass 3rd parameter as sp (stack pointer).
-+    "  mv a2, sp                                         \n"
-+    // Call the callback.
-+    "  jalr a3                                           \n"
-+    // Load return address.
-+    "  ld ra, 104(sp)                                    \n"
-+    // Restore frame pointer.
-+    "  ld s0, 0(sp)                                      \n"
-+    "  addi sp, sp, 112                                  \n"
-+    "  jr ra                                             \n");
--- 
-2.25.1
-

+ 0 - 27
archive/0006-base-process-add-riscv64-arch-definition.patch

@@ -1,27 +0,0 @@
-From c6c9e34871fb5cefebd72b2a213471f766582aa8 Mon Sep 17 00:00:00 2001
-From: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
-Date: Tue, 10 May 2022 02:21:16 +0000
-Subject: [PATCH 06/21] base: process: add riscv64 arch definition
-
-Signed-off-by: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
----
- base/process/launch_posix.cc | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/base/process/launch_posix.cc b/base/process/launch_posix.cc
-index c5eb76eba5a7c..96df11f406f41 100644
---- a/base/process/launch_posix.cc
-+++ b/base/process/launch_posix.cc
-@@ -706,7 +706,8 @@ NOINLINE pid_t CloneAndLongjmpInChild(unsigned long flags,
-   alignas(16) char stack_buf[PTHREAD_STACK_MIN];
- #if defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARM_FAMILY) ||   \
-     defined(ARCH_CPU_MIPS_FAMILY) || defined(ARCH_CPU_S390_FAMILY) || \
--    defined(ARCH_CPU_PPC64_FAMILY) || defined(ARCH_CPU_LOONG_FAMILY)
-+    defined(ARCH_CPU_PPC64_FAMILY) || defined(ARCH_CPU_LOONG_FAMILY) || \
-+    defined(ARCH_CPU_RISCV_FAMILY)
-   // The stack grows downward.
-   void* stack = stack_buf + sizeof(stack_buf);
- #else
--- 
-2.25.1
-

+ 0 - 81
archive/0007-remoting-fix-missing-cstring-header.patch

@@ -1,81 +0,0 @@
-From d4acfec99e4386a9fe985fc565bd49cc5c368f14 Mon Sep 17 00:00:00 2001
-From: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
-Date: Thu, 13 Jan 2022 09:44:47 +0000
-Subject: [PATCH 07/21] remoting: fix missing cstring header
-
-Signed-off-by: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
----
- remoting/base/util.cc                      | 2 +-
- remoting/client/display/gl_helpers.cc      | 2 +-
- remoting/host/fake_mouse_cursor_monitor.cc | 2 +-
- remoting/host/host_config_unittest.cc      | 1 +
- remoting/host/host_secret.cc               | 2 +-
- 5 files changed, 5 insertions(+), 4 deletions(-)
-
-diff --git a/remoting/base/util.cc b/remoting/base/util.cc
-index df36b1b8ee848..b80da87b4f558 100644
---- a/remoting/base/util.cc
-+++ b/remoting/base/util.cc
-@@ -3,7 +3,7 @@
- // found in the LICENSE file.
- 
- #include "remoting/base/util.h"
--
-+#include <cstring>
- #include <math.h>
- 
- #include "base/logging.h"
-diff --git a/remoting/client/display/gl_helpers.cc b/remoting/client/display/gl_helpers.cc
-index bce438b7625e3..5215980462f8a 100644
---- a/remoting/client/display/gl_helpers.cc
-+++ b/remoting/client/display/gl_helpers.cc
-@@ -5,7 +5,7 @@
- #include "remoting/client/display/gl_helpers.h"
- 
- #include "base/logging.h"
--
-+#include <cstring>
- namespace remoting {
- 
- GLuint CompileShader(GLenum shader_type, const char* shader_source) {
-diff --git a/remoting/host/fake_mouse_cursor_monitor.cc b/remoting/host/fake_mouse_cursor_monitor.cc
-index 0f8b6c72fd422..a7c499b85d055 100644
---- a/remoting/host/fake_mouse_cursor_monitor.cc
-+++ b/remoting/host/fake_mouse_cursor_monitor.cc
-@@ -3,7 +3,7 @@
- // found in the LICENSE file.
- 
- #include "remoting/host/fake_mouse_cursor_monitor.h"
--
-+#include <cstring>
- #include <memory>
- 
- #include "base/check.h"
-diff --git a/remoting/host/host_config_unittest.cc b/remoting/host/host_config_unittest.cc
-index 31a9bcb7ae779..9c7c176721d76 100644
---- a/remoting/host/host_config_unittest.cc
-+++ b/remoting/host/host_config_unittest.cc
-@@ -10,6 +10,7 @@
- #include "base/values.h"
- #include "testing/gtest/include/gtest/gtest.h"
- #include "third_party/abseil-cpp/absl/types/optional.h"
-+#include <cstring>
- 
- namespace remoting {
- 
-diff --git a/remoting/host/host_secret.cc b/remoting/host/host_secret.cc
-index c70c9c211c061..dc2f697b5ae26 100644
---- a/remoting/host/host_secret.cc
-+++ b/remoting/host/host_secret.cc
-@@ -6,7 +6,7 @@
- 
- #include <stdint.h>
- 
--#include <string>
-+#include <cstring>
- 
- #include "base/rand_util.h"
- #include "base/strings/string_number_conversions.h"
--- 
-2.25.1
-

+ 0 - 25
archive/0008-remoting-codec-fix-missing-cmath-header.patch

@@ -1,25 +0,0 @@
-From 2930864be17f9be1b3b8634f04b9e93297af8841 Mon Sep 17 00:00:00 2001
-From: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
-Date: Thu, 13 Jan 2022 09:48:12 +0000
-Subject: [PATCH 08/21] remoting: codec: fix missing cmath header
-
-Signed-off-by: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
----
- remoting/codec/codec_test.cc | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/remoting/codec/codec_test.cc b/remoting/codec/codec_test.cc
-index 55b9aa77c8e07..9923ba7bdef78 100644
---- a/remoting/codec/codec_test.cc
-+++ b/remoting/codec/codec_test.cc
-@@ -8,6 +8,7 @@
- #include <stdint.h>
- #include <stdlib.h>
- 
-+#include <cmath>
- #include <memory>
- #include <utility>
- 
--- 
-2.25.1
-

+ 0 - 49
archive/0009-components-update_client-add-riscv64-arch-definition.patch

@@ -1,49 +0,0 @@
-From e7cc091068534e90a7c3b4077b2bf04c6b93a7c4 Mon Sep 17 00:00:00 2001
-From: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
-Date: Tue, 5 Apr 2022 02:27:27 +0000
-Subject: [PATCH 09/21] components: update_client: add riscv64 arch definition
-
-Signed-off-by: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
----
- components/update_client/update_query_params.cc | 4 ++++
- components/update_client/update_query_params.h  | 2 +-
- 2 files changed, 5 insertions(+), 1 deletion(-)
-
-diff --git a/components/update_client/update_query_params.cc b/components/update_client/update_query_params.cc
-index a707c0ea2ca62..29136a51488cf 100644
---- a/components/update_client/update_query_params.cc
-+++ b/components/update_client/update_query_params.cc
-@@ -63,6 +63,8 @@ const char kArch[] =
-     "loong32";
- #elif defined(__loongarch64)
-     "loong64";
-+#elif defined(__riscv) && (__riscv_xlen == 64)
-+    "riscv64";
- #else
- #error "unknown arch"
- #endif
-@@ -136,6 +138,8 @@ const char* UpdateQueryParams::GetNaclArch() {
-   return "loong32";
- #elif defined(ARCH_CPU_LOONG64)
-   return "loong64";
-+#elif defined(ARCH_CPU_RISCV64)
-+  return "riscv64";
- #else
- // NOTE: when adding new values here, please remember to update the
- // comment in the .h file about possible return values from this function.
-diff --git a/components/update_client/update_query_params.h b/components/update_client/update_query_params.h
-index a22f8b85bc0d9..969582bf92289 100644
---- a/components/update_client/update_query_params.h
-+++ b/components/update_client/update_query_params.h
-@@ -44,7 +44,7 @@ class UpdateQueryParams {
-   // Returns the value we use for the "nacl_arch" parameter. Note that this may
-   // be different from the "arch" parameter above (e.g. one may be 32-bit and
-   // the other 64-bit). Possible return values include: "x86-32", "x86-64",
--  // "arm", "mips32", and "ppc64".
-+  // "arm", "mips32", "ppc64", and "riscv64".
-   static const char* GetNaclArch();
- 
-   // Returns the current version of Chrome/Chromium.
--- 
-2.25.1
-

+ 0 - 26
archive/0010-build-config-compiler-use_gold-linker-option.patch

@@ -1,26 +0,0 @@
-From 5905f914424bd3d88fc3f13f3162c09041ac3827 Mon Sep 17 00:00:00 2001
-From: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
-Date: Mon, 17 Jan 2022 04:48:24 +0000
-Subject: [PATCH 10/21] build: config: compiler: use_gold linker option
-
-Signed-off-by: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
----
- build/config/compiler/compiler.gni | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/build/config/compiler/compiler.gni b/build/config/compiler/compiler.gni
-index 36108aaf7a091..3b8732d8b4c40 100644
---- a/build/config/compiler/compiler.gni
-+++ b/build/config/compiler/compiler.gni
-@@ -223,7 +223,7 @@ declare_args() {
-              (((is_linux || is_chromeos_lacros) &&
-                (current_cpu == "x64" || current_cpu == "x86" ||
-                 current_cpu == "arm" || current_cpu == "arm64" ||
--                current_cpu == "mipsel" || current_cpu == "mips64el")) ||
-+                current_cpu == "mipsel" || current_cpu == "mips64el" || current_cpu == "riscv64")) ||
-               (is_android && (current_cpu == "x86" || current_cpu == "x64" ||
-                               current_cpu == "arm" || current_cpu == "arm64")))
- }
--- 
-2.25.1
-

+ 0 - 66
archive/0011-build-config-compiler-remove-flags-not-available-in-.patch

@@ -1,66 +0,0 @@
-From 33b1085723465d61aff44f41229061d047235eda Mon Sep 17 00:00:00 2001
-From: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
-Date: Mon, 17 Jan 2022 08:15:52 +0000
-Subject: [PATCH 11/21] build: config: compiler: remove flags not available in
- custom clang
-
-Signed-off-by: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
----
- build/config/compiler/BUILD.gn | 13 -------------
- 1 file changed, 13 deletions(-)
-
-diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
-index df8610696cc6e..c9b6fb9c83114 100644
---- a/build/config/compiler/BUILD.gn
-+++ b/build/config/compiler/BUILD.gn
-@@ -345,7 +345,6 @@ config("compiler") {
-     }
- 
-     if (use_lld) {
--      ldflags += [ "-fuse-ld=lld" ]
-       if (lld_path != "") {
-         ldflags += [ "-B$lld_path" ]
-       }
-@@ -478,10 +477,6 @@ config("compiler") {
-     #}
-   }
- 
--  if (use_icf && (!is_apple || use_lld)) {
--    ldflags += [ "-Wl,--icf=all" ]
--  }
--
-   if (is_linux || is_chromeos) {
-     cflags += [ "-pthread" ]
-     # Do not use the -pthread ldflag here since it becomes a no-op
-@@ -492,8 +487,6 @@ config("compiler") {
-   # Clang-specific compiler flags setup.
-   # ------------------------------------
-   if (is_clang) {
--    cflags += [ "-fcolor-diagnostics" ]
--
-     # Enable -fmerge-all-constants. This used to be the default in clang
-     # for over a decade. It makes clang non-conforming, but is fairly safe
-     # in practice and saves some binary size. We might want to consider
-@@ -511,8 +504,6 @@ config("compiler") {
-       # On Windows, we call the linker directly, instead of calling it through
-       # the driver.
-       ldflags += [ "--color-diagnostics" ]
--    } else {
--      ldflags += [ "-Wl,--color-diagnostics" ]
-     }
-   }
- 
-@@ -755,10 +746,6 @@ config("compiler") {
-   if (use_lld && !enable_call_graph_profile_sort) {
-     if (is_win) {
-       ldflags += [ "/call-graph-profile-sort:no" ]
--    } else if (!is_apple) {
--      # TODO(thakis): Once LLD's Mach-O port basically works, implement call
--      # graph profile sorting for it, add an opt-out flag, and pass it here.
--      ldflags += [ "-Wl,--no-call-graph-profile-sort" ]
-     }
-   }
- 
--- 
-2.25.1
-

+ 0 - 25
archive/0012-build-config-add-atomic-build-flag.patch

@@ -1,25 +0,0 @@
-From 469d52902d6995983352b93a8e0f2d98f739f03a Mon Sep 17 00:00:00 2001
-From: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
-Date: Wed, 30 Mar 2022 05:43:35 +0000
-Subject: [PATCH 12/21] build: config: add atomic build flag
-
-Signed-off-by: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
----
- build/config/BUILD.gn | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/build/config/BUILD.gn b/build/config/BUILD.gn
-index 392733e36defc..562e66ede051a 100644
---- a/build/config/BUILD.gn
-+++ b/build/config/BUILD.gn
-@@ -223,6 +223,7 @@ config("default_libs") {
-       "dl",
-       "pthread",
-       "rt",
-+      "atomic",
-     ]
-   }
- }
--- 
-2.25.1
-

+ 0 - 30
archive/0013-build-config-compiler-do-not-use-linker-relaxation.patch

@@ -1,30 +0,0 @@
-From 96e93f17115bf90b309a8a82d45d90788a92f3ca Mon Sep 17 00:00:00 2001
-From: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
-Date: Fri, 17 Jun 2022 06:19:14 +0000
-Subject: [PATCH] build: config: compiler: do not use linker relaxation
-
-Signed-off-by: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
----
- build/config/compiler/BUILD.gn | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
-index 676efeddd22bd..5d82fa963d7b7 100644
---- a/build/config/compiler/BUILD.gn
-+++ b/build/config/compiler/BUILD.gn
-@@ -1177,10 +1177,12 @@ config("compiler_cpu_abi") {
-       }
-     } else if (current_cpu == "riscv64") {
-       cflags += [
-+        "-mno-relax",
-         "-mabi=lp64d",
-         "--target=riscv64-linux-gnu",
-       ]
-       ldflags += [
-+        "-mno-relax",
-         "--target=riscv64-linux-gnu",
-       ]
-     } else if (current_cpu == "s390x") {
--- 
-2.25.1
-

+ 0 - 116
archive/0014-chrome-common-remove-unrar-code.patch

@@ -1,116 +0,0 @@
-From f30ae7596f0cfc6ccda8b1eb286526223b0d9271 Mon Sep 17 00:00:00 2001
-From: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
-Date: Thu, 13 Jan 2022 08:57:34 +0000
-Subject: [PATCH 14/21] chrome: common: remove unrar code
-
-Upstream-status: Inappropriate
-
-unrar code is non-free. This might not be suitable for
-distributing as third_party. Hence we disabled it from
-our build.
-
-Signed-off-by: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
----
- chrome/common/safe_browsing/BUILD.gn          | 34 -------------------
- chrome/common/safe_browsing/DEPS              |  1 -
- chrome/services/file_util/BUILD.gn            |  1 -
- .../file_util/safe_archive_analyzer.cc        |  4 +++
- 4 files changed, 4 insertions(+), 36 deletions(-)
-
-diff --git a/chrome/common/safe_browsing/BUILD.gn b/chrome/common/safe_browsing/BUILD.gn
-index dbd1ae28552ce..b67ca3bf09031 100644
---- a/chrome/common/safe_browsing/BUILD.gn
-+++ b/chrome/common/safe_browsing/BUILD.gn
-@@ -58,39 +58,6 @@ if (safe_browsing_mode == 1) {
-     public_deps = [ "//components/safe_browsing/core/common/proto:csd_proto" ]
-   }
- 
--  source_set("rar_analyzer") {
--    sources = [
--      "rar_analyzer.cc",
--      "rar_analyzer.h",
--    ]
--
--    deps = [
--      ":archive_analyzer_results",
--      ":download_type_util",
--      "//base",
--      "//base:i18n",
--      "//components/safe_browsing/content/common:file_type_policies",
--      "//components/safe_browsing/core/common",
--      "//third_party/unrar:unrar",
--    ]
--
--    defines = [
--      "_FILE_OFFSET_BITS=64",
--      "LARGEFILE_SOURCE",
--      "RAR_SMP",
--      "SILENT",
--
--      # The following is set to disable certain macro definitions in the unrar
--      # source code.
--      "CHROMIUM_UNRAR",
--
--      # Disables exceptions in unrar, replaces them with process termination.
--      "UNRAR_NO_EXCEPTIONS",
--    ]
--
--    public_deps = [ "//components/safe_browsing/core/common/proto:csd_proto" ]
--  }
--
-   if (is_linux || is_win) {
-     source_set("document_analyzer") {
-       sources = [
-@@ -189,7 +156,6 @@ source_set("safe_browsing") {
-       ":archive_analyzer_results",
-       ":binary_feature_extractor",
-       ":download_type_util",
--      ":rar_analyzer",
-       "//components/safe_browsing/core/common",
-     ]
- 
-diff --git a/chrome/common/safe_browsing/DEPS b/chrome/common/safe_browsing/DEPS
-index b8f7708dcef7b..28723c2e64728 100644
---- a/chrome/common/safe_browsing/DEPS
-+++ b/chrome/common/safe_browsing/DEPS
-@@ -3,6 +3,5 @@ include_rules = [
-   "+components/safe_browsing/core/common",
-   "+third_party/maldoca",
-   "+third_party/protobuf",
--  "+third_party/unrar",
-   "+third_party/zlib",
- ]
-diff --git a/chrome/services/file_util/BUILD.gn b/chrome/services/file_util/BUILD.gn
-index 8a50b0932e0bc..85ec598cf712a 100644
---- a/chrome/services/file_util/BUILD.gn
-+++ b/chrome/services/file_util/BUILD.gn
-@@ -60,7 +60,6 @@ source_set("file_util") {
-     deps += [
-       "//chrome/common/safe_browsing",
-       "//chrome/common/safe_browsing:archive_analyzer_results",
--      "//chrome/common/safe_browsing:rar_analyzer",
-     ]
- 
-     if (is_linux || is_win) {
-diff --git a/chrome/services/file_util/safe_archive_analyzer.cc b/chrome/services/file_util/safe_archive_analyzer.cc
-index 3b647cd93546f..d29f46c473bee 100644
---- a/chrome/services/file_util/safe_archive_analyzer.cc
-+++ b/chrome/services/file_util/safe_archive_analyzer.cc
-@@ -44,10 +44,14 @@ void SafeArchiveAnalyzer::AnalyzeDmgFile(base::File dmg_file,
- void SafeArchiveAnalyzer::AnalyzeRarFile(base::File rar_file,
-                                          base::File temporary_file,
-                                          AnalyzeRarFileCallback callback) {
-+#if 0
-   DCHECK(rar_file.IsValid());
- 
-   safe_browsing::ArchiveAnalyzerResults results;
-   safe_browsing::rar_analyzer::AnalyzeRarFile(
-       std::move(rar_file), std::move(temporary_file), &results);
-   std::move(callback).Run(results);
-+#else
-+  NOTREACHED();
-+#endif
- }
--- 
-2.25.1
-

+ 0 - 26
archive/0015-third_party-libaom-add-riscv-target.patch

@@ -1,26 +0,0 @@
-From b696f43d6dcd36827dad04e38e49d4f90335b178 Mon Sep 17 00:00:00 2001
-From: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
-Date: Wed, 30 Mar 2022 11:24:25 +0000
-Subject: [PATCH 15/21] third_party: libaom: add riscv target
-
-Signed-off-by: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
----
- third_party/libaom/BUILD.gn | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/third_party/libaom/BUILD.gn b/third_party/libaom/BUILD.gn
-index 49dbee305c6d5..4f5b56c7e7f0e 100644
---- a/third_party/libaom/BUILD.gn
-+++ b/third_party/libaom/BUILD.gn
-@@ -36,6 +36,8 @@ if (current_cpu == "x86") {
-   } else {
-     cpu_arch_full = "arm"
-   }
-+} else if (current_cpu == "riscv64") {
-+  cpu_arch_full = "generic"
- } else {
-   cpu_arch_full = current_cpu
- }
--- 
-2.25.1
-

+ 0 - 35
archive/0016-third_party-libvpx-add-riscv-target.patch

@@ -1,35 +0,0 @@
-From 9aab974f2c32f2771a002c36c1d0ca1854521588 Mon Sep 17 00:00:00 2001
-From: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
-Date: Wed, 30 Mar 2022 11:26:18 +0000
-Subject: [PATCH 16/21] third_party: libvpx: add riscv target
-
-Signed-off-by: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
----
- third_party/libvpx/BUILD.gn | 4 +++-
- 1 file changed, 3 insertions(+), 1 deletion(-)
-
-diff --git a/third_party/libvpx/BUILD.gn b/third_party/libvpx/BUILD.gn
-index a972e1f18b700..0af79ee63344a 100644
---- a/third_party/libvpx/BUILD.gn
-+++ b/third_party/libvpx/BUILD.gn
-@@ -35,6 +35,8 @@ if (current_cpu == "x86") {
-   } else {
-     cpu_arch_full = current_cpu
-   }
-+} else if (current_cpu == "riscv64") {
-+  cpu_arch_full = "generic"
- } else {
-   cpu_arch_full = current_cpu
- }
-@@ -360,7 +362,7 @@ static_library("libvpx") {
-     configs += [ "//build/config/compiler:optimize_max" ]
-   }
- 
--  if (is_nacl) {
-+  if (is_nacl || current_cpu == "riscv64") {
-     sources = libvpx_srcs_generic
-     public_deps = [ ":libvpx_generic_headers" ]
-   } else if (current_cpu == "x86") {
--- 
-2.25.1
-

+ 0 - 808
archive/0017-third_party-crashpad-add-support-for-riscv.patch

@@ -1,808 +0,0 @@
-From 57fb23b78c06744d5e7c688d6716bcbff4b48e55 Mon Sep 17 00:00:00 2001
-From: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
-Date: Thu, 31 Mar 2022 00:35:10 +0000
-Subject: [PATCH 17/21] third_party: crashpad: add support for riscv
-
-Credit to work contributed in Github.
-https://github.com/felixonmars/archriscv-packages/tree/master/chromium
-
-Signed-off-by: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
----
- .../crashpad/minidump/minidump_context.h      | 35 +++++++++
- .../minidump/minidump_context_writer.cc       | 44 +++++++++++
- .../minidump/minidump_context_writer.h        | 41 ++++++++++
- .../minidump/minidump_misc_info_writer.cc     |  4 +
- .../crashpad/snapshot/capture_memory.cc       | 10 +++
- .../crashpad/snapshot/cpu_architecture.h      |  8 +-
- .../crashpad/crashpad/snapshot/cpu_context.cc |  2 +
- .../crashpad/crashpad/snapshot/cpu_context.h  | 16 ++++
- .../snapshot/linux/cpu_context_linux.cc       | 24 ++++++
- .../snapshot/linux/cpu_context_linux.h        | 16 ++++
- .../linux/exception_snapshot_linux.cc         | 55 +++++++++++++
- .../snapshot/linux/exception_snapshot_linux.h |  3 +
- .../snapshot/linux/process_reader_linux.cc    |  3 +
- .../crashpad/snapshot/linux/signal_context.h  | 61 +++++++++++++++
- .../snapshot/linux/system_snapshot_linux.cc   | 12 +++
- .../snapshot/linux/thread_snapshot_linux.cc   | 16 ++++
- .../snapshot/linux/thread_snapshot_linux.h    |  3 +
- .../crashpad/crashpad/util/linux/ptracer.cc   | 44 +++++++++++
- .../crashpad/util/linux/thread_info.h         | 78 ++++++++++++++++++-
- .../util/net/http_transport_libcurl.cc        |  2 +
- 20 files changed, 475 insertions(+), 2 deletions(-)
-
-diff --git a/third_party/crashpad/crashpad/minidump/minidump_context.h b/third_party/crashpad/crashpad/minidump/minidump_context.h
-index c10743d84899d..616b43654d11f 100644
---- a/third_party/crashpad/crashpad/minidump/minidump_context.h
-+++ b/third_party/crashpad/crashpad/minidump/minidump_context.h
-@@ -637,6 +637,41 @@ struct MinidumpContextMIPS64 {
-   uint64_t fir;
- };
- 
-+//! \brief 64bit RISC-V-specifc flags for MinidumpContextRISCV64::context_flags.
-+//! Based on minidump_cpu_riscv64.h from breakpad
-+enum MinidumpContextRISCV64Flags : uint32_t {
-+  //! \brief Identifies the context structure as RISCV64.
-+  kMinidumpContextRISCV64 = 0x00080000,
-+
-+  //! \brief Indicates the validity of integer registers.
-+  //!
-+  //! Registers `x1`-`x31` and pc are valid.
-+  kMinidumpContextRISCV64Integer = kMinidumpContextRISCV64 | 0x00000002,
-+
-+  //! \brief Indicates the validity of floating point registers.
-+  //!
-+  //! Floating point registers `f0`-`f31`, and `fcsr` are valid
-+  kMinidumpContextRISCV64FloatingPoint = kMinidumpContextRISCV64 | 0x00000004,
-+
-+  //! \brief Indicates the validity of all registers.
-+  kMinidumpContextRISCV64All = kMinidumpContextRISCV64Integer |
-+                              kMinidumpContextRISCV64FloatingPoint,
-+};
-+
-+//! \brief A 64bit RISCV CPU context (register state) carried in a minidump file.
-+struct MinidumpContextRISCV64 {
-+  uint64_t context_flags;
-+
-+  //! \brief General purpose registers.
-+  uint64_t regs[32];
-+
-+  //! \brief FPU registers.
-+  uint64_t fpregs[32];
-+
-+  //! \brief FPU status register.
-+  uint64_t fcsr;
-+};
-+
- }  // namespace crashpad
- 
- #endif  // CRASHPAD_MINIDUMP_MINIDUMP_CONTEXT_H_
-diff --git a/third_party/crashpad/crashpad/minidump/minidump_context_writer.cc b/third_party/crashpad/crashpad/minidump/minidump_context_writer.cc
-index bf02c1bd28926..796c8b5383613 100644
---- a/third_party/crashpad/crashpad/minidump/minidump_context_writer.cc
-+++ b/third_party/crashpad/crashpad/minidump/minidump_context_writer.cc
-@@ -102,6 +102,13 @@ MinidumpContextWriter::CreateFromSnapshot(const CPUContext* context_snapshot) {
-       break;
-     }
- 
-+    case kCPUArchitectureRISCV64: {
-+      context = std::make_unique<MinidumpContextRISCV64Writer>();
-+      reinterpret_cast<MinidumpContextRISCV64Writer*>(context.get())
-+          ->InitializeFromSnapshot(context_snapshot->riscv64);
-+      break;
-+    }
-+
-     default: {
-       LOG(ERROR) << "unknown context architecture "
-                  << context_snapshot->architecture;
-@@ -556,4 +563,41 @@ size_t MinidumpContextMIPS64Writer::ContextSize() const {
-   return sizeof(context_);
- }
- 
-+MinidumpContextRISCV64Writer::MinidumpContextRISCV64Writer()
-+    : MinidumpContextWriter(), context_() {
-+  context_.context_flags = kMinidumpContextRISCV64;
-+}
-+
-+MinidumpContextRISCV64Writer::~MinidumpContextRISCV64Writer() = default;
-+
-+void MinidumpContextRISCV64Writer::InitializeFromSnapshot(
-+    const CPUContextRISCV64* context_snapshot) {
-+  DCHECK_EQ(state(), kStateMutable);
-+  DCHECK_EQ(context_.context_flags, kMinidumpContextRISCV64);
-+
-+  context_.context_flags = kMinidumpContextRISCV64All;
-+
-+  static_assert(sizeof(context_.regs) == sizeof(context_snapshot->regs),
-+                "GPRs size mismatch");
-+  memcpy(context_.regs, context_snapshot->regs, sizeof(context_.regs));
-+
-+  static_assert(sizeof(context_.fpregs) == sizeof(context_snapshot->fpregs),
-+                "FPRs size mismatch");
-+  memcpy(context_.fpregs,
-+         context_snapshot->fpregs,
-+         sizeof(context_.fpregs));
-+  context_.fcsr = context_snapshot->fcsr;
-+}
-+
-+bool MinidumpContextRISCV64Writer::WriteObject(
-+    FileWriterInterface* file_writer) {
-+  DCHECK_EQ(state(), kStateWritable);
-+  return file_writer->Write(&context_, sizeof(context_));
-+}
-+
-+size_t MinidumpContextRISCV64Writer::ContextSize() const {
-+  DCHECK_GE(state(), kStateFrozen);
-+  return sizeof(context_);
-+}
-+
- }  // namespace crashpad
-diff --git a/third_party/crashpad/crashpad/minidump/minidump_context_writer.h b/third_party/crashpad/crashpad/minidump/minidump_context_writer.h
-index 9acc7fa012f84..da48628f5ae0d 100644
---- a/third_party/crashpad/crashpad/minidump/minidump_context_writer.h
-+++ b/third_party/crashpad/crashpad/minidump/minidump_context_writer.h
-@@ -369,6 +369,47 @@ class MinidumpContextMIPS64Writer final : public MinidumpContextWriter {
-   MinidumpContextMIPS64 context_;
- };
- 
-+//! \brief The writer for a MinidumpContextRISCV64 structure in a minidump file.
-+class MinidumpContextRISCV64Writer final : public MinidumpContextWriter {
-+ public:
-+  MinidumpContextRISCV64Writer();
-+  ~MinidumpContextRISCV64Writer() override;
-+
-+  MinidumpContextRISCV64Writer(const MinidumpContextRISCV64Writer&) = delete;
-+  void operator=(const MinidumpContextRISCV64Writer&) = delete;
-+
-+  //! \brief Initializes the MinidumpContextRISCV based on \a context_snapshot.
-+  //!
-+  //! \param[in] context_snapshot The context snapshot to use as source data.
-+  //!
-+  //! \note Valid in #kStateMutable. No mutation of context() may be done before
-+  //!     calling this method, and it is not normally necessary to alter
-+  //!     context() after calling this method.
-+  void InitializeFromSnapshot(const CPUContextRISCV64* context_snapshot);
-+
-+  //! \brief Returns a pointer to the context structure that this object will
-+  //!     write.
-+  //!
-+  //! \attention This returns a non-`const` pointer to this object’s private
-+  //!     data so that a caller can populate the context structure directly.
-+  //!     This is done because providing setter interfaces to each field in the
-+  //!     context structure would be unwieldy and cumbersome. Care must be taken
-+  //!     to populate the context structure correctly. The context structure
-+  //!     must only be modified while this object is in the #kStateMutable
-+  //!     state.
-+  MinidumpContextRISCV64* context() { return &context_; }
-+
-+ protected:
-+  // MinidumpWritable:
-+  bool WriteObject(FileWriterInterface* file_writer) override;
-+
-+  // MinidumpContextWriter:
-+  size_t ContextSize() const override;
-+
-+ private:
-+  MinidumpContextRISCV64 context_;
-+};
-+
- }  // namespace crashpad
- 
- #endif  // CRASHPAD_MINIDUMP_MINIDUMP_CONTEXT_WRITER_H_
-diff --git a/third_party/crashpad/crashpad/minidump/minidump_misc_info_writer.cc b/third_party/crashpad/crashpad/minidump/minidump_misc_info_writer.cc
-index 51c91c4c90e6f..4945b3976e5e3 100644
---- a/third_party/crashpad/crashpad/minidump/minidump_misc_info_writer.cc
-+++ b/third_party/crashpad/crashpad/minidump/minidump_misc_info_writer.cc
-@@ -175,6 +175,10 @@ std::string MinidumpMiscInfoDebugBuildString() {
-   static constexpr char kCPU[] = "mips";
- #elif defined(ARCH_CPU_MIPS64EL)
-   static constexpr char kCPU[] = "mips64";
-+#elif defined(ARCH_CPU_RISCV)
-+  static constexpr char kCPU[] = "riscv";
-+#elif defined(ARCH_CPU_RISCV64)
-+  static constexpr char kCPU[] = "riscv64";
- #else
- #error define kCPU for this CPU
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/capture_memory.cc b/third_party/crashpad/crashpad/snapshot/capture_memory.cc
-index cb8231bdb97ca..08de6392466f7 100644
---- a/third_party/crashpad/crashpad/snapshot/capture_memory.cc
-+++ b/third_party/crashpad/crashpad/snapshot/capture_memory.cc
-@@ -117,6 +117,16 @@ void CaptureMemory::PointedToByContext(const CPUContext& context,
-   for (size_t i = 0; i < std::size(context.mipsel->regs); ++i) {
-     MaybeCaptureMemoryAround(delegate, context.mipsel->regs[i]);
-   }
-+#elif defined(ARCH_CPU_RISCV_FAMILY)
-+  if (context.architecture == kCPUArchitectureRISCV) {
-+    for (size_t i = 0; i < base::size(context.riscv->regs); ++i) {
-+      MaybeCaptureMemoryAround(delegate, context.riscv->regs[i]);
-+    }
-+  } else {
-+    for (size_t i = 0; i < base::size(context.riscv64->regs); ++i) {
-+      MaybeCaptureMemoryAround(delegate, context.riscv64->regs[i]);
-+    }
-+  }
- #else
- #error Port.
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/cpu_architecture.h b/third_party/crashpad/crashpad/snapshot/cpu_architecture.h
-index 811a7209587d2..5b09abdb96761 100644
---- a/third_party/crashpad/crashpad/snapshot/cpu_architecture.h
-+++ b/third_party/crashpad/crashpad/snapshot/cpu_architecture.h
-@@ -43,7 +43,13 @@ enum CPUArchitecture {
-   kCPUArchitectureMIPSEL,
- 
-   //! \brief 64-bit MIPSEL.
--  kCPUArchitectureMIPS64EL
-+  kCPUArchitectureMIPS64EL,
-+
-+  //! \brief 32-bit RISCV.
-+  kCPUArchitectureRISCV,
-+
-+  //! \brief 64-bit RISCV.
-+  kCPUArchitectureRISCV64
- };
- 
- }  // namespace crashpad
-diff --git a/third_party/crashpad/crashpad/snapshot/cpu_context.cc b/third_party/crashpad/crashpad/snapshot/cpu_context.cc
-index 9b7b3f14f1164..b717e5ea007f9 100644
---- a/third_party/crashpad/crashpad/snapshot/cpu_context.cc
-+++ b/third_party/crashpad/crashpad/snapshot/cpu_context.cc
-@@ -226,10 +226,12 @@ bool CPUContext::Is64Bit() const {
-     case kCPUArchitectureX86_64:
-     case kCPUArchitectureARM64:
-     case kCPUArchitectureMIPS64EL:
-+    case kCPUArchitectureRISCV64:
-       return true;
-     case kCPUArchitectureX86:
-     case kCPUArchitectureARM:
-     case kCPUArchitectureMIPSEL:
-+    case kCPUArchitectureRISCV:
-       return false;
-     default:
-       NOTREACHED();
-diff --git a/third_party/crashpad/crashpad/snapshot/cpu_context.h b/third_party/crashpad/crashpad/snapshot/cpu_context.h
-index 4e21b56c590da..42b405f863428 100644
---- a/third_party/crashpad/crashpad/snapshot/cpu_context.h
-+++ b/third_party/crashpad/crashpad/snapshot/cpu_context.h
-@@ -362,6 +362,20 @@ struct CPUContextMIPS64 {
-   uint64_t fir;
- };
- 
-+//! \brief A context structure carrying RISC CPU state.
-+struct CPUContextRISCV {
-+  uint32_t regs[32];
-+  uint64_t fpregs[32];
-+  uint32_t fcsr;
-+};
-+
-+//! \brief A context structure carrying RISC64 CPU state.
-+struct CPUContextRISCV64 {
-+  uint64_t regs[32];
-+  uint64_t fpregs[32];
-+  uint32_t fcsr;
-+};
-+
- //! \brief A context structure capable of carrying the context of any supported
- //!     CPU architecture.
- struct CPUContext {
-@@ -402,6 +416,8 @@ struct CPUContext {
-     CPUContextARM64* arm64;
-     CPUContextMIPS* mipsel;
-     CPUContextMIPS64* mips64;
-+    CPUContextRISCV* riscv;
-+    CPUContextRISCV64* riscv64;
-   };
- };
- 
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.cc b/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.cc
-index 8464a5a27b2dc..ec41216daa902 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.cc
-@@ -266,6 +266,30 @@ void InitializeCPUContextARM64_OnlyFPSIMD(
-   context->fpcr = float_context.fpcr;
- }
- 
-+#elif defined(ARCH_CPU_RISCV_FAMILY)
-+
-+template <typename Traits>
-+void InitializeCPUContextRISCV(
-+    const typename Traits::SignalThreadContext& thread_context,
-+    const typename Traits::SignalFloatContext& float_context,
-+    typename Traits::CPUContext* context) {
-+  static_assert(sizeof(context->regs) == sizeof(thread_context),
-+                "registers size mismatch");
-+  static_assert(sizeof(context->fpregs) == sizeof(float_context.f),
-+                "fp registers size mismatch");
-+  memcpy(&context->regs, &thread_context, sizeof(context->regs));
-+  memcpy(&context->fpregs, &float_context, sizeof(context->fpregs));
-+  context->fcsr = float_context.fcsr;
-+}
-+template void InitializeCPUContextRISCV<ContextTraits32>(
-+    const ContextTraits32::SignalThreadContext& thread_context,
-+    const ContextTraits32::SignalFloatContext& float_context,
-+    ContextTraits32::CPUContext* context);
-+template void InitializeCPUContextRISCV<ContextTraits64>(
-+    const ContextTraits64::SignalThreadContext& thread_context,
-+    const ContextTraits64::SignalFloatContext& float_context,
-+    ContextTraits64::CPUContext* context);
-+
- #endif  // ARCH_CPU_X86_FAMILY
- 
- }  // namespace internal
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h b/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h
-index 9f46a48977e12..1add07f81af88 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h
-+++ b/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h
-@@ -174,6 +174,22 @@ void InitializeCPUContextMIPS(
- 
- #endif  // ARCH_CPU_MIPS_FAMILY || DOXYGEN
- 
-+#if defined(ARCH_CPU_RISCV_FAMILY) || DOXYGEN
-+
-+//! \brief Initializes a CPUContextRISCV structure from native context
-+//!     structures on Linux.
-+//!
-+//! \param[in] thread_context The native thread context.
-+//! \param[in] float_context The native float context.
-+//! \param[out] context The CPUContextRISCV structure to initialize.
-+template <typename Traits>
-+void InitializeCPUContextRISCV(
-+    const typename Traits::SignalThreadContext& thread_context,
-+    const typename Traits::SignalFloatContext& float_context,
-+    typename Traits::CPUContext* context);
-+
-+#endif  // ARCH_CPU_RISCV_FAMILY || DOXYGEN
-+
- }  // namespace internal
- }  // namespace crashpad
- 
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.cc b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.cc
-index efc9e5694ea8b..3d57d96756208 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.cc
-@@ -325,6 +325,61 @@ bool ExceptionSnapshotLinux::ReadContext<ContextTraits64>(
-       reader, context_address, context_.mips64);
- }
- 
-+#elif defined(ARCH_CPU_RISCV_FAMILY)
-+
-+template <typename Traits>
-+static bool ReadContext(ProcessReaderLinux* reader,
-+                        LinuxVMAddress context_address,
-+                        typename Traits::CPUContext* dest_context) {
-+  const ProcessMemory* memory = reader->Memory();
-+
-+  LinuxVMAddress gregs_address = context_address +
-+                                 offsetof(UContext<Traits>, mcontext) +
-+                                 offsetof(typename Traits::MContext, gregs);
-+
-+  typename Traits::SignalThreadContext thread_context;
-+  if (!memory->Read(gregs_address, sizeof(thread_context), &thread_context)) {
-+    LOG(ERROR) << "Couldn't read gregs";
-+    return false;
-+  }
-+
-+  LinuxVMAddress fpregs_address = context_address +
-+                                  offsetof(UContext<Traits>, mcontext) +
-+                                  offsetof(typename Traits::MContext, fpregs);
-+
-+  typename Traits::SignalFloatContext fp_context;
-+  if (!memory->Read(fpregs_address, sizeof(fp_context), &fp_context)) {
-+    LOG(ERROR) << "Couldn't read fpregs";
-+    return false;
-+  }
-+
-+  InitializeCPUContextRISCV<Traits>(thread_context, fp_context, dest_context);
-+
-+  return true;
-+}
-+
-+template <>
-+bool ExceptionSnapshotLinux::ReadContext<ContextTraits32>(
-+    ProcessReaderLinux* reader,
-+    LinuxVMAddress context_address) {
-+  context_.architecture = kCPUArchitectureRISCV;
-+  context_.riscv = &context_union_.riscv;
-+
-+  return internal::ReadContext<ContextTraits32>(
-+      reader, context_address, context_.riscv);
-+}
-+
-+template <>
-+bool ExceptionSnapshotLinux::ReadContext<ContextTraits64>(
-+    ProcessReaderLinux* reader,
-+    LinuxVMAddress context_address) {
-+  context_.architecture = kCPUArchitectureRISCV64;
-+  context_.riscv64 = &context_union_.riscv64;
-+
-+  return internal::ReadContext<ContextTraits64>(
-+      reader, context_address, context_.riscv64);
-+}
-+
- #endif  // ARCH_CPU_X86_FAMILY
- 
- bool ExceptionSnapshotLinux::Initialize(
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.h b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.h
-index 05f6004e11d1e..0520af4ce9019 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.h
-+++ b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.h
-@@ -89,6 +89,9 @@ class ExceptionSnapshotLinux final : public ExceptionSnapshot {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
-     CPUContextMIPS mipsel;
-     CPUContextMIPS64 mips64;
-+#elif defined(ARCH_CPU_RISCV_FAMILY)
-+    CPUContextRISCV riscv;
-+    CPUContextRISCV64 riscv64;
- #endif
-   } context_union_;
-   CPUContext context_;
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/process_reader_linux.cc b/third_party/crashpad/crashpad/snapshot/linux/process_reader_linux.cc
-index 5711f343a46c4..abbb1662c3e0a 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/process_reader_linux.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/process_reader_linux.cc
-@@ -108,6 +108,9 @@ void ProcessReaderLinux::Thread::InitializeStack(ProcessReaderLinux* reader) {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
-   stack_pointer = reader->Is64Bit() ? thread_info.thread_context.t64.regs[29]
-                                     : thread_info.thread_context.t32.regs[29];
-+#elif defined(ARCH_CPU_RISCV_FAMILY)
-+  stack_pointer = reader->Is64Bit() ? thread_info.thread_context.t64.sp
-+                                    : thread_info.thread_context.t32.sp;
- #else
- #error Port.
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/signal_context.h b/third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-index c004f8f6dfab6..6aa9ee38f5b04 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-+++ b/third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-@@ -422,6 +422,67 @@ static_assert(offsetof(UContext<ContextTraits64>, mcontext.fpregs) ==
-               "context offset mismatch");
- #endif
- 
-+#elif defined(ARCH_CPU_RISCV_FAMILY)
-+
-+struct MContext32 {
-+  uint32_t gregs[32];
-+  uint64_t fpregs[32];
-+  unsigned int fcsr;
-+};
-+
-+struct MContext64 {
-+  uint64_t gregs[32];
-+  uint64_t fpregs[32];
-+  unsigned int fcsr;
-+};
-+
-+struct ContextTraits32 : public Traits32 {
-+  using MContext = MContext32;
-+  using SignalThreadContext = ThreadContext::t32_t;
-+  using SignalFloatContext = FloatContext::f32_t;
-+  using CPUContext = CPUContextRISCV;
-+};
-+
-+struct ContextTraits64 : public Traits64 {
-+  using MContext = MContext64;
-+  using SignalThreadContext = ThreadContext::t64_t;
-+  using SignalFloatContext = FloatContext::f64_t;
-+  using CPUContext = CPUContextRISCV64;
-+};
-+
-+template <typename Traits>
-+struct UContext {
-+  typename Traits::ULong flags;
-+  typename Traits::Address link;
-+  SignalStack<Traits> stack;
-+  Sigset<Traits> sigmask;
-+  char padding[128 - sizeof(sigmask)];
-+  typename Traits::Char_64Only padding2[8];
-+  typename Traits::MContext mcontext;
-+};
-+
-+#if defined(ARCH_CPU_RISCV)
-+static_assert(offsetof(UContext<ContextTraits32>, mcontext) ==
-+                  offsetof(ucontext_t, uc_mcontext),
-+              "context offset mismatch");
-+static_assert(offsetof(UContext<ContextTraits32>, mcontext.gregs) ==
-+                  offsetof(ucontext_t, uc_mcontext.__gregs),
-+              "context offset mismatch");
-+static_assert(offsetof(UContext<ContextTraits32>, mcontext.fpregs) ==
-+                  offsetof(ucontext_t, uc_mcontext.__fpregs),
-+              "context offset mismatch");
-+#elif defined(ARCH_CPU_RISCV64)
-+static_assert(offsetof(UContext<ContextTraits64>, mcontext) ==
-+                  offsetof(ucontext_t, uc_mcontext),
-+              "context offset mismatch");
-+static_assert(offsetof(UContext<ContextTraits64>, mcontext.gregs) ==
-+                  offsetof(ucontext_t, uc_mcontext.__gregs),
-+              "context offset mismatch");
-+static_assert(offsetof(UContext<ContextTraits64>, mcontext.fpregs) ==
-+                  offsetof(ucontext_t, uc_mcontext.__fpregs),
-+              "context offset mismatch");
-+#endif
-+
- #else
- #error Port.
- #endif  // ARCH_CPU_X86_FAMILY
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/system_snapshot_linux.cc b/third_party/crashpad/crashpad/snapshot/linux/system_snapshot_linux.cc
-index e77bcafa9c6b5..55564ae4aeaf5 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/system_snapshot_linux.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/system_snapshot_linux.cc
-@@ -205,6 +205,9 @@ CPUArchitecture SystemSnapshotLinux::GetCPUArchitecture() const {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
-   return process_reader_->Is64Bit() ? kCPUArchitectureMIPS64EL
-                                     : kCPUArchitectureMIPSEL;
-+#elif defined(ARCH_CPU_RISCV_FAMILY)
-+  return process_reader_->Is64Bit() ? kCPUArchitectureRISCV64
-+                                    : kCPUArchitectureRISCV;
- #else
- #error port to your architecture
- #endif
-@@ -220,6 +223,9 @@ uint32_t SystemSnapshotLinux::CPURevision() const {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
-   // Not implementable on MIPS
-   return 0;
-+#elif defined(ARCH_CPU_RISCV_FAMILY)
-+  // Not implementable on RISCV
-+  return 0;
- #else
- #error port to your architecture
- #endif
-@@ -240,6 +246,9 @@ std::string SystemSnapshotLinux::CPUVendor() const {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
-   // Not implementable on MIPS
-   return std::string();
-+#elif defined(ARCH_CPU_RISCV_FAMILY)
-+  // Not implementable on RISCV
-+  return std::string();
- #else
- #error port to your architecture
- #endif
-@@ -373,6 +382,9 @@ bool SystemSnapshotLinux::NXEnabled() const {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
-   // Not implementable on MIPS
-   return false;
-+#elif defined(ARCH_CPU_RISCV_FAMILY)
-+  // Not implementable on RISCV
-+  return false;
- #else
- #error Port.
- #endif  // ARCH_CPU_X86_FAMILY
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.cc b/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.cc
-index f279e0adaddba..8c133a7ca909f 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.cc
-@@ -189,6 +189,22 @@ bool ThreadSnapshotLinux::Initialize(
-         thread.thread_info.float_context.f32,
-         context_.mipsel);
-   }
-+#elif defined(ARCH_CPU_RISCV_FAMILY)
-+  if (process_reader->Is64Bit()) {
-+    context_.architecture = kCPUArchitectureRISCV64;
-+    context_.riscv64 = &context_union_.riscv64;
-+    InitializeCPUContextRISCV<ContextTraits64>(
-+	thread.thread_info.thread_context.t64,
-+	thread.thread_info.float_context.f64,
-+	context_.riscv64);
-+  } else {
-+    context_.architecture = kCPUArchitectureRISCV;
-+    context_.riscv = &context_union_.riscv;
-+    InitializeCPUContextRISCV<ContextTraits32>(
-+	thread.thread_info.thread_context.t32,
-+	thread.thread_info.float_context.f32,
-+	context_.riscv);
-+  }
- #else
- #error Port.
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.h b/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.h
-index 40cd7e7f54a39..aea1ce2047a6b 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.h
-+++ b/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.h
-@@ -73,6 +73,9 @@ class ThreadSnapshotLinux final : public ThreadSnapshot {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
-     CPUContextMIPS mipsel;
-     CPUContextMIPS64 mips64;
-+#elif defined(ARCH_CPU_RISCV_FAMILY)
-+    CPUContextRISCV riscv;
-+    CPUContextRISCV64 riscv64;
- #else
- #error Port.
- #endif  // ARCH_CPU_X86_FAMILY
-diff --git a/third_party/crashpad/crashpad/util/linux/ptracer.cc b/third_party/crashpad/crashpad/util/linux/ptracer.cc
-index 557e0d3635752..d74dbc1ba1688 100644
---- a/third_party/crashpad/crashpad/util/linux/ptracer.cc
-+++ b/third_party/crashpad/crashpad/util/linux/ptracer.cc
-@@ -397,6 +397,50 @@ bool GetThreadArea64(pid_t tid,
-   *address = FromPointerCast<LinuxVMAddress>(result);
-   return true;
- }
-+#elif defined(ARCH_CPU_RISCV_FAMILY)
-+
-+template <typename Destination>
-+bool GetRegisterSet(pid_t tid, int set, Destination* dest, bool can_log) {
-+  iovec iov;
-+  iov.iov_base = dest;
-+  iov.iov_len = sizeof(*dest);
-+  if (ptrace(PTRACE_GETREGSET, tid, reinterpret_cast<void*>(set), &iov) != 0) {
-+    PLOG_IF(ERROR, can_log) << "ptrace";
-+    return false;
-+  }
-+  if (iov.iov_len != sizeof(*dest)) {
-+    LOG_IF(ERROR, can_log) << "Unexpected registers size";
-+    return false;
-+  }
-+  return true;
-+}
-+
-+bool GetFloatingPointRegisters32(pid_t tid,
-+                                 FloatContext* context,
-+                                 bool can_log) {
-+  return false;
-+}
-+
-+bool GetFloatingPointRegisters64(pid_t tid,
-+                                 FloatContext* context,
-+                                 bool can_log) {
-+  return GetRegisterSet(tid, NT_PRFPREG, &context->f64.f, can_log);
-+}
-+
-+bool GetThreadArea32(pid_t tid,
-+                     const ThreadContext& context,
-+                     LinuxVMAddress* address,
-+                     bool can_log) {
-+  return false;
-+}
-+
-+bool GetThreadArea64(pid_t tid,
-+                     const ThreadContext& context,
-+                     LinuxVMAddress* address,
-+                     bool can_log) {
-+  *address = context.t64.tp;
-+  return true;
-+}
- 
- #else
- #error Port.
-diff --git a/third_party/crashpad/crashpad/util/linux/thread_info.h b/third_party/crashpad/crashpad/util/linux/thread_info.h
-index d3f3b2c6953fa..6a649dc3d7ac7 100644
---- a/third_party/crashpad/crashpad/util/linux/thread_info.h
-+++ b/third_party/crashpad/crashpad/util/linux/thread_info.h
-@@ -79,6 +79,40 @@ union ThreadContext {
-     uint32_t cp0_status;
-     uint32_t cp0_cause;
-     uint32_t padding1_;
-+#elif defined(ARCH_CPU_RISCV_FAMILY)
-+    // Reflects user_regs_struct in asm/ptrace.h.
-+    uint32_t pc;
-+    uint32_t ra;
-+    uint32_t sp;
-+    uint32_t gp;
-+    uint32_t tp;
-+    uint32_t t0;
-+    uint32_t t1;
-+    uint32_t t2;
-+    uint32_t s0;
-+    uint32_t s1;
-+    uint32_t a0;
-+    uint32_t a1;
-+    uint32_t a2;
-+    uint32_t a3;
-+    uint32_t a4;
-+    uint32_t a5;
-+    uint32_t a6;
-+    uint32_t a7;
-+    uint32_t s2;
-+    uint32_t s3;
-+    uint32_t s4;
-+    uint32_t s5;
-+    uint32_t s6;
-+    uint32_t s7;
-+    uint32_t s8;
-+    uint32_t s9;
-+    uint32_t s10;
-+    uint32_t s11;
-+    uint32_t t3;
-+    uint32_t t4;
-+    uint32_t t5;
-+    uint32_t t6;
- #else
- #error Port.
- #endif  // ARCH_CPU_X86_FAMILY
-@@ -132,6 +166,40 @@ union ThreadContext {
-     uint64_t cp0_badvaddr;
-     uint64_t cp0_status;
-     uint64_t cp0_cause;
-+#elif defined(ARCH_CPU_RISCV_FAMILY)
-+    // Reflects user_regs_struct in asm/ptrace.h.
-+    uint64_t pc;
-+    uint64_t ra;
-+    uint64_t sp;
-+    uint64_t gp;
-+    uint64_t tp;
-+    uint64_t t0;
-+    uint64_t t1;
-+    uint64_t t2;
-+    uint64_t s0;
-+    uint64_t s1;
-+    uint64_t a0;
-+    uint64_t a1;
-+    uint64_t a2;
-+    uint64_t a3;
-+    uint64_t a4;
-+    uint64_t a5;
-+    uint64_t a6;
-+    uint64_t a7;
-+    uint64_t s2;
-+    uint64_t s3;
-+    uint64_t s4;
-+    uint64_t s5;
-+    uint64_t s6;
-+    uint64_t s7;
-+    uint64_t s8;
-+    uint64_t s9;
-+    uint64_t s10;
-+    uint64_t s11;
-+    uint64_t t3;
-+    uint64_t t4;
-+    uint64_t t5;
-+    uint64_t t6;
- #else
- #error Port.
- #endif  // ARCH_CPU_X86_FAMILY
-@@ -143,11 +211,12 @@ union ThreadContext {
-   using NativeThreadContext = user_regs;
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- // No appropriate NativeThreadsContext type available for MIPS
-+#elif defined(ARCH_CPU_RISCV_FAMILY)
- #else
- #error Port.
- #endif  // ARCH_CPU_X86_FAMILY || ARCH_CPU_ARM64
- 
--#if !defined(ARCH_CPU_MIPS_FAMILY)
-+#if !defined(ARCH_CPU_MIPS_FAMILY) && !defined(ARCH_CPU_RISCV_FAMILY)
- #if defined(ARCH_CPU_32_BITS)
-   static_assert(sizeof(t32_t) == sizeof(NativeThreadContext), "Size mismatch");
- #else  // ARCH_CPU_64_BITS
-@@ -218,6 +287,9 @@ union FloatContext {
-     } fpregs[32];
-     uint32_t fpcsr;
-     uint32_t fpu_id;
-+#elif defined(ARCH_CPU_RISCV_FAMILY)
-+    uint64_t f[32];
-+    uint32_t fcsr;
- #else
- #error Port.
- #endif  // ARCH_CPU_X86_FAMILY
-@@ -252,6 +324,9 @@ union FloatContext {
-     double fpregs[32];
-     uint32_t fpcsr;
-     uint32_t fpu_id;
-+#elif defined(ARCH_CPU_RISCV_FAMILY)
-+    uint64_t f[32];
-+    uint32_t fcsr;
- #else
- #error Port.
- #endif  // ARCH_CPU_X86_FAMILY
-@@ -281,6 +356,7 @@ union FloatContext {
-   static_assert(sizeof(f64) == sizeof(user_fpsimd_struct), "Size mismatch");
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- // No appropriate floating point context native type for available MIPS.
-+#elif defined(ARCH_CPU_RISCV_FAMILY)
- #else
- #error Port.
- #endif  // ARCH_CPU_X86
-diff --git a/third_party/crashpad/crashpad/util/net/http_transport_libcurl.cc b/third_party/crashpad/crashpad/util/net/http_transport_libcurl.cc
-index 7e3f41186f462..9568dc2e24f97 100644
---- a/third_party/crashpad/crashpad/util/net/http_transport_libcurl.cc
-+++ b/third_party/crashpad/crashpad/util/net/http_transport_libcurl.cc
-@@ -237,6 +237,8 @@ std::string UserAgent() {
- #elif defined(ARCH_CPU_BIG_ENDIAN)
-     static constexpr char arch[] = "aarch64_be";
- #endif
-+#elif defined(ARCH_CPU_RISCV64)
-+    static constexpr char arch[] = "riscv64";
- #else
- #error Port
- #endif
--- 
-2.25.1
-

+ 0 - 31
archive/0018-third_party-lzma_sdk-add-riscv-arch-definition.patch

@@ -1,31 +0,0 @@
-From 7aace00cb0decea066c70ddc4f51a873ef734ae2 Mon Sep 17 00:00:00 2001
-From: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
-Date: Fri, 14 Jan 2022 05:07:31 +0000
-Subject: [PATCH 18/21] third_party: lzma_sdk: add riscv arch definition
-
-Signed-off-by: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
----
- third_party/lzma_sdk/CpuArch.h | 7 +++++++
- 1 file changed, 7 insertions(+)
-
-diff --git a/third_party/lzma_sdk/CpuArch.h b/third_party/lzma_sdk/CpuArch.h
-index bd429388024d7..5a6306641b92f 100644
---- a/third_party/lzma_sdk/CpuArch.h
-+++ b/third_party/lzma_sdk/CpuArch.h
-@@ -107,6 +107,13 @@ MY_CPU_LE_UNALIGN means that CPU is LITTLE ENDIAN and CPU supports unaligned mem
- #endif
- 
- 
-+#if defined(__riscv) && (__riscv_xlen == 64)
-+  #define MY_CPU_NAME "riscv64"
-+  #define MY_CPU_64BIT
-+  #define MY_CPU_LE
-+#endif
-+
-+
- #if defined(MY_CPU_X86) || defined(MY_CPU_AMD64)
- #define MY_CPU_X86_OR_AMD64
- #endif
--- 
-2.25.1
-

+ 0 - 1104
archive/0019-build-linux-sysroot-create-a-sysroot-for-riscv.patch

@@ -1,1104 +0,0 @@
-From c0d3509f68c1fd87bf107283ad7a24e8249f6a10 Mon Sep 17 00:00:00 2001
-From: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
-Date: Tue, 5 Apr 2022 06:40:16 +0000
-Subject: [PATCH 19/21] build: linux: sysroot: create a sysroot for riscv
-
-Upstream-status: Unidentified
-
-Since riscv is not an official port in Debian, this might not be
-able to upstream.
-
-Signed-off-by: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
----
- build/config/posix/BUILD.gn                   |  12 -
- build/config/sysroot.gni                      |   5 +-
- .../debian-ports-archive-2022.gpg             | Bin 0 -> 1210 bytes
- .../sysroot-builder-riscv64.sh                | 588 ++++++++++++++++++
- .../sysroot-creator-riscv64.sh                | 400 ++++++++++++
- 5 files changed, 992 insertions(+), 13 deletions(-)
- create mode 100644 build/linux/sysroot_scripts/debian-ports-archive-2022.gpg
- create mode 100755 build/linux/sysroot_scripts/sysroot-builder-riscv64.sh
- create mode 100755 build/linux/sysroot_scripts/sysroot-creator-riscv64.sh
-
-diff --git a/build/config/posix/BUILD.gn b/build/config/posix/BUILD.gn
-index 5d15163875717..3e0ded398ced3 100644
---- a/build/config/posix/BUILD.gn
-+++ b/build/config/posix/BUILD.gn
-@@ -28,18 +28,6 @@ config("runtime_library") {
-   if (!is_apple && sysroot != "" && current_os != "zos") {
-     # Pass the sysroot to all C compiler variants, the assembler, and linker.
-     sysroot_flags = [ "--sysroot=" + rebase_path(sysroot, root_build_dir) ]
--    if (is_linux || is_chromeos) {
--      # This is here so that all files get recompiled after a sysroot roll and
--      # when turning the sysroot on or off. (defines are passed via the command
--      # line, and build system rebuilds things when their commandline
--      # changes). Nothing should ever read this define.
--      sysroot_hash =
--          exec_script("//build/linux/sysroot_scripts/install-sysroot.py",
--                      [ "--print-hash=$current_cpu" ],
--                      "trim string",
--                      [ "//build/linux/sysroot_scripts/sysroots.json" ])
--      defines += [ "CR_SYSROOT_HASH=$sysroot_hash" ]
--    }
-     asmflags += sysroot_flags
-     ldflags += sysroot_flags
- 
-diff --git a/build/config/sysroot.gni b/build/config/sysroot.gni
-index cbcf0a3f09615..aaf1b21baf5f7 100644
---- a/build/config/sysroot.gni
-+++ b/build/config/sysroot.gni
-@@ -23,7 +23,8 @@ declare_args() {
-   # is empty, default sysroot is calculated.
-   use_sysroot = current_cpu == "x86" || current_cpu == "x64" ||
-                 current_cpu == "arm" || current_cpu == "arm64" ||
--                current_cpu == "mipsel" || current_cpu == "mips64el"
-+                current_cpu == "mipsel" || current_cpu == "mips64el" ||
-+                current_cpu == "riscv64"
- }
- 
- if (sysroot == "") {
-@@ -50,6 +51,8 @@ if (sysroot == "") {
-       sysroot = "$target_sysroot_dir/debian_bullseye_arm-sysroot"
-     } else if (current_cpu == "arm64") {
-       sysroot = "$target_sysroot_dir/debian_bullseye_arm64-sysroot"
-+    } else if (current_cpu == "riscv64") {
-+      sysroot = "$target_sysroot_dir/debian_sid_riscv64-sysroot"
-     } else {
-       assert(false, "No linux sysroot for cpu: $target_cpu")
-     }
-diff --git a/build/linux/sysroot_scripts/debian-ports-archive-2022.gpg b/build/linux/sysroot_scripts/debian-ports-archive-2022.gpg
-new file mode 100644
-index 0000000000000000000000000000000000000000..946d514f68f75bf1035d3c2fec23be503bcaa7de
-GIT binary patch
-literal 1210
-zcmV;r1V#Iq0u2OT`-isy5CFX&gr2KN<iC3NKjKXSf#TTjm+=kmq;H8*cck8*9X4Ny
-z$uTg6SpzoPR)&h1IDe2W!ug=bbT++nGuhzYnVPO;_6%7*XzzKZaHt|$K>m94Nd<p?
-z|5QU>d+VlNCb*dZjQHg|t7oNC+@8OhGsvhjVFz-oqj3UkCZ8Eq(N@y2$KJxGW3j74
-zV36~q(PbY90ZTh0;046Ekk!SucYoHzuB$!@arn!b1x7ffCGu?~xpH;3rnbNsFM`+J
-zMIjL{5r8BNNbfPEq?e;qApDDwB7l4$oVIpEj04Xp?QEETGbPp4=cm{8Uszr(Og0Nr
-zqMQKYohL`1hup>L8d&x@+^&)_>1ENsGp1)nv&mK_jGxt&cyXY+#D)%S4f0@D3FM@7
-z3V1$RsbHI#?W2fQ41aMPMXmL?r%Xkeicrl+u8}$%i?9ga(V9^2|MF0}<~%)2;hd3e
-zKlZrTM_VCp(sD7CqF4`WURB??O{aaSWt`0FD7Y>rKPx&g+=qIv*=ej<cqgO&z^BC@
-zS5y^LPUUBZd*KZX4?o!rLuf78H*A5@MoS@H=^~njX+MG$BHv2pQub6G>+Wi9F)Ec}
-zp+s=)26mw;auSFp;L|i#LtEL!z91C6gtL3(Y(_l)kQt$!#Bp58bwc+AR{^eofl7Lo
-z`!1Lt(iUXdDLnuY0RRECRYYZCX<=?4P;YW{b09%-V`yo1WgtOybZ>28bZKKCQ)y>z
-zX>MmAOJ#W=C^9fIGASTDW^{0EVRLk4azJoza&&VoZDDhCWpXZLWnyVzZZ2<fXFiDn
-zPy`bJ3IIA5Aq30E3ShbIZzFnNTMOt?QBPg-67~fGU;Br*0viJb2?O31fC38%1QiMi
-z2n7}b0|5X69svRufB*^!5a?1-PhIm8_67(L0FApGI%0TlFf#s^R&9KJAEk|G%nNhM
-ztZ(BCz^290)D8w1_L^HlT&zMSPS;C2i5xot35$Uy>cASU=7-o<oXr8BtFDeQ_rruT
-zG*MhWOe;0?-qnBhVd^S6&Dy~$cJFw1VJi8#MJ1VH_W4_1o~5=SBp9GE$Ovg&P`;m@
-z@MU(p+3@WjKSH6vik&^rwTLJ7nz<+7LN?@IdP{WcGr==H9Q|`j!><J7IwOQoYruZa
-zlrFvfQ>O}1=P+SqwopNCZdZdc#+ebWmyaRKb;dgyi>RzfdCTyG$IUE^?m?2Az~>l0
-zd&z|kG6R}PfY%;KH+%9JDq#=c<yEzF2JYv5W39%{6NsNFEAsr5<{DowWuVgy)n*+f
-z5+m595pn)kfuNdrpC^N-N1k#$xZ8)iieVwBbOgVYnegAeez;g1*03EU&%RAoB#EGk
-z!j)qAlNOA|S6iGi1|xfW29dL<Q+zKx!vvEgVs8THQ6DHD5(c8-98c+vGG}wlD91B8
-z8?S5iGtavOoHtN1=uRRu-s6|XSxFReLd8$Cw?ZZnZq$>y=!}46xHery{3VEv-wYt9
-zOjq@MUta10RIH^9WK`+Og$(oIaFmE?5NK!Ok3M@mhVybBY-K~oCud(;>!u%`XV7n1
-YXx^}TJV%j3zJt}E_<gtaMn?Bg9P=nExc~qF
-
-literal 0
-HcmV?d00001
-
-diff --git a/build/linux/sysroot_scripts/sysroot-builder-riscv64.sh b/build/linux/sysroot_scripts/sysroot-builder-riscv64.sh
-new file mode 100755
-index 0000000000000..34cfe5a370428
---- /dev/null
-+++ b/build/linux/sysroot_scripts/sysroot-builder-riscv64.sh
-@@ -0,0 +1,588 @@
-+# Copyright 2014 The Chromium Authors. All rights reserved.
-+# Use of this source code is governed by a BSD-style license that can be
-+# found in the LICENSE file.
-+#
-+# This script should not be run directly but sourced by the other
-+# scripts (e.g. sysroot-creator-sid.sh).  Its up to the parent scripts
-+# to define certain environment variables: e.g.
-+#  DISTRO=debian
-+#  DIST=sid
-+#  # Similar in syntax to /etc/apt/sources.list
-+#  APT_SOURCES_LIST="http://ftp.us.debian.org/debian/ sid main"
-+#  KEYRING_FILE=debian-archive-sid-stable.gpg
-+#  DEBIAN_PACKAGES="gcc libz libssl"
-+
-+#@ This script builds Debian/Ubuntu sysroot images for building Google Chrome.
-+#@
-+#@  Generally this script is invoked as:
-+#@  sysroot-creator-<flavour>.sh <mode> <args>*
-+#@  Available modes are shown below.
-+#@
-+#@ List of modes:
-+
-+######################################################################
-+# Config
-+######################################################################
-+
-+set -o nounset
-+set -o errexit
-+
-+SCRIPT_DIR=$(cd $(dirname $0) && pwd)
-+
-+if [ -z "${DIST:-}" ]; then
-+  echo "error: DIST not defined"
-+  exit 1
-+fi
-+
-+if [ -z "${KEYRING_FILE:-}" ]; then
-+  echo "error: KEYRING_FILE not defined"
-+  exit 1
-+fi
-+
-+if [ -z "${DEBIAN_PACKAGES:-}" ]; then
-+  echo "error: DEBIAN_PACKAGES not defined"
-+  exit 1
-+fi
-+
-+readonly HAS_ARCH_RISCV64=${HAS_ARCH_RISCV64:=0}
-+
-+readonly REQUIRED_TOOLS="curl xzcat"
-+
-+######################################################################
-+# Package Config
-+######################################################################
-+
-+readonly PACKAGES_EXT=xz
-+readonly RELEASE_FILE="Release"
-+readonly RELEASE_FILE_GPG="Release.gpg"
-+
-+readonly DEBIAN_DEP_LIST_RISCV64="generated_package_lists/${DIST}.riscv64"
-+
-+
-+######################################################################
-+# Helper
-+######################################################################
-+
-+Banner() {
-+  echo "######################################################################"
-+  echo $*
-+  echo "######################################################################"
-+}
-+
-+
-+SubBanner() {
-+  echo "----------------------------------------------------------------------"
-+  echo $*
-+  echo "----------------------------------------------------------------------"
-+}
-+
-+
-+Usage() {
-+  egrep "^#@" "${BASH_SOURCE[0]}" | cut --bytes=3-
-+}
-+
-+
-+DownloadOrCopyNonUniqueFilename() {
-+  # Use this function instead of DownloadOrCopy when the url uniquely
-+  # identifies the file, but the filename (excluding the directory)
-+  # does not.
-+  local url="$1"
-+  local dest="$2"
-+
-+  local hash="$(echo "$url" | sha256sum | cut -d' ' -f1)"
-+
-+  DownloadOrCopy "${url}" "${dest}.${hash}"
-+  # cp the file to prevent having to redownload it, but mv it to the
-+  # final location so that it's atomic.
-+  cp "${dest}.${hash}" "${dest}.$$"
-+  mv "${dest}.$$" "${dest}"
-+}
-+
-+DownloadOrCopy() {
-+  if [ -f "$2" ] ; then
-+    echo "$2 already in place"
-+    return
-+  fi
-+
-+  HTTP=0
-+  echo "$1" | grep -Eqs '^https?://' && HTTP=1
-+  if [ "$HTTP" = "1" ]; then
-+    SubBanner "downloading from $1 -> $2"
-+    # Appending the "$$" shell pid is necessary here to prevent concurrent
-+    # instances of sysroot-creator.sh from trying to write to the same file.
-+    local temp_file="${2}.partial.$$"
-+    # curl --retry doesn't retry when the page gives a 4XX error, so we need to
-+    # manually rerun.
-+    for i in {1..10}; do
-+      # --create-dirs is added in case there are slashes in the filename, as can
-+      # happen with the "debian/security" release class.
-+      local http_code=$(curl -L "$1" --create-dirs -o "${temp_file}" \
-+                        -w "%{http_code}")
-+      if [ ${http_code} -eq 200 ]; then
-+        break
-+      fi
-+      echo "Bad HTTP code ${http_code} when downloading $1"
-+      rm -f "${temp_file}"
-+      sleep $i
-+    done
-+    if [ ! -f "${temp_file}" ]; then
-+      exit 1
-+    fi
-+    mv "${temp_file}" $2
-+  else
-+    SubBanner "copying from $1"
-+    cp "$1" "$2"
-+  fi
-+}
-+
-+
-+SetEnvironmentVariables() {
-+  case $1 in
-+    *Riscv*)
-+      ARCH=RISCV64
-+      ;;
-+    *)
-+      echo "ERROR: Unable to determine architecture based on: $1"
-+      exit 1
-+      ;;
-+  esac
-+  ARCH_LOWER=$(echo $ARCH | tr '[:upper:]' '[:lower:]')
-+}
-+
-+
-+# some sanity checks to make sure this script is run from the right place
-+# with the right tools
-+SanityCheck() {
-+  Banner "Sanity Checks"
-+
-+  local chrome_dir=$(cd "${SCRIPT_DIR}/../../.." && pwd)
-+  BUILD_DIR="${chrome_dir}/out/sysroot-build/${DIST}"
-+  mkdir -p ${BUILD_DIR}
-+  echo "Using build directory: ${BUILD_DIR}"
-+
-+  for tool in ${REQUIRED_TOOLS} ; do
-+    if ! which ${tool} > /dev/null ; then
-+      echo "Required binary $tool not found."
-+      echo "Exiting."
-+      exit 1
-+    fi
-+  done
-+
-+  # This is where the staging sysroot is.
-+  INSTALL_ROOT="${BUILD_DIR}/${DIST}_${ARCH_LOWER}_staging"
-+  TARBALL="${BUILD_DIR}/${DISTRO}_${DIST}_${ARCH_LOWER}_sysroot.tar.xz"
-+
-+  if ! mkdir -p "${INSTALL_ROOT}" ; then
-+    echo "ERROR: ${INSTALL_ROOT} can't be created."
-+    exit 1
-+  fi
-+}
-+
-+
-+ChangeDirectory() {
-+  # Change directory to where this script is.
-+  cd ${SCRIPT_DIR}
-+}
-+
-+
-+ClearInstallDir() {
-+  Banner "Clearing dirs in ${INSTALL_ROOT}"
-+  rm -rf ${INSTALL_ROOT}/*
-+}
-+
-+
-+CreateTarBall() {
-+  Banner "Creating tarball ${TARBALL}"
-+  tar -I "xz -9 -T0" -cf ${TARBALL} -C ${INSTALL_ROOT} .
-+}
-+
-+ExtractPackageXz() {
-+  local src_file="$1"
-+  local dst_file="$2"
-+  local repo="$3"
-+  xzcat "${src_file}" | egrep '^(Package:|Filename:|SHA256:) ' |
-+    sed "s|Filename: |Filename: ${repo}|" > "${dst_file}"
-+}
-+
-+GeneratePackageListDist() {
-+  local arch="$1"
-+  set -- $2
-+  local repo="$1"
-+  local dist="$2"
-+  local repo_name="$3"
-+
-+  TMP_PACKAGE_LIST="${BUILD_DIR}/Packages.${dist}_${repo_name}_${arch}"
-+  local repo_basedir="${repo}/dists/${dist}"
-+  local package_list="${BUILD_DIR}/Packages.${dist}_${repo_name}_${arch}.${PACKAGES_EXT}"
-+  local package_file_arch="${repo_name}/binary-${arch}/Packages.${PACKAGES_EXT}"
-+  local package_list_arch="${repo_basedir}/${package_file_arch}"
-+
-+  DownloadOrCopyNonUniqueFilename "${package_list_arch}" "${package_list}"
-+  VerifyPackageListing "${package_file_arch}" "${package_list}" ${repo} ${dist}
-+  ExtractPackageXz "${package_list}" "${TMP_PACKAGE_LIST}" ${repo}
-+}
-+
-+GeneratePackageListCommon() {
-+  local output_file="$1"
-+  local arch="$2"
-+  local packages="$3"
-+
-+  local dists="${DIST} ${DIST_UPDATES:-}"
-+
-+  local list_base="${BUILD_DIR}/Packages.${DIST}_${arch}"
-+  > "${list_base}"  # Create (or truncate) a zero-length file.
-+  echo "${APT_SOURCES_LIST}" | while read source; do
-+    GeneratePackageListDist "${arch}" "${source}"
-+    cat "${TMP_PACKAGE_LIST}" | ./merge-package-lists.py "${list_base}"
-+  done
-+
-+  GeneratePackageList "${list_base}" "${output_file}" "${packages}"
-+}
-+
-+GeneratePackageListRiscv64() {
-+  GeneratePackageListCommon "$1" riscv64 "${DEBIAN_PACKAGES}
-+  ${DEBIAN_PACKAGES_RISCV64:=}"
-+}
-+
-+StripChecksumsFromPackageList() {
-+  local package_file="$1"
-+  sed -i 's/ [a-f0-9]\{64\}$//' "$package_file"
-+}
-+
-+######################################################################
-+#
-+######################################################################
-+
-+HacksAndPatchesCommon() {
-+  local arch=$1
-+  local os=$2
-+  local strip=$3
-+  Banner "Misc Hacks & Patches"
-+  # these are linker scripts with absolute pathnames in them
-+  # which we rewrite here
-+  lscripts="${INSTALL_ROOT}/usr/lib/${arch}-${os}/libpthread.so \
-+            ${INSTALL_ROOT}/usr/lib/${arch}-${os}/libc.so"
-+
-+  # Rewrite linker scripts
-+  sed -i -e 's|/usr/lib/${arch}-${os}/||g'  ${lscripts}
-+  sed -i -e 's|/lib/${arch}-${os}/||g' ${lscripts}
-+
-+  # Unversion libdbus and libxkbcommon symbols.  This is required because
-+  # libdbus-1-3 and libxkbcommon0 switched from unversioned symbols to versioned
-+  # ones, and we must still support distros using the unversioned library.  This
-+  # hack can be removed once support for Ubuntu Trusty and Debian Jessie are
-+  # dropped.
-+  ${strip} -R .gnu.version_d -R .gnu.version \
-+    "${INSTALL_ROOT}/lib/${arch}-${os}/libdbus-1.so.3"
-+  cp "${SCRIPT_DIR}/libdbus-1-3-symbols" \
-+    "${INSTALL_ROOT}/debian/libdbus-1-3/DEBIAN/symbols"
-+
-+  ${strip} -R .gnu.version_d -R .gnu.version \
-+    "${INSTALL_ROOT}/usr/lib/${arch}-${os}/libxkbcommon.so.0.0.0"
-+  cp "${SCRIPT_DIR}/libxkbcommon0-symbols" \
-+    "${INSTALL_ROOT}/debian/libxkbcommon0/DEBIAN/symbols"
-+
-+  # libxcomposite1 is missing a symbols file.
-+  cp "${SCRIPT_DIR}/libxcomposite1-symbols" \
-+    "${INSTALL_ROOT}/debian/libxcomposite1/DEBIAN/symbols"
-+
-+  # Shared objects depending on libdbus-1.so.3 have unsatisfied undefined
-+  # versioned symbols. To avoid LLD --no-allow-shlib-undefined errors, rewrite
-+  # DT_NEEDED entries from libdbus-1.so.3 to a different string. LLD will
-+  # suppress --no-allow-shlib-undefined diagnostics for such shared objects.
-+  set +e
-+  for f in "${INSTALL_ROOT}/lib/${arch}-${os}"/*.so \
-+           "${INSTALL_ROOT}/usr/lib/${arch}-${os}"/*.so; do
-+    echo "$f" | grep -q 'libdbus-1.so$' && continue
-+    # In a dependent shared object, the only occurrence of "libdbus-1.so.3" is
-+    # the string referenced by the DT_NEEDED entry.
-+    offset=$(LANG=C grep -abo libdbus-1.so.3 "$f")
-+    [ -n "$offset" ] || continue
-+    echo -n 'libdbus-1.so.0' | dd of="$f" conv=notrunc bs=1 \
-+      seek="$(echo -n "$offset" | cut -d : -f 1)" status=none
-+  done
-+  set -e
-+
-+  # Avoid requiring unsupported glibc versions.
-+  "${SCRIPT_DIR}/reversion_glibc.py" \
-+    "${INSTALL_ROOT}/lib/${arch}-${os}/libc.so.6"
-+  "${SCRIPT_DIR}/reversion_glibc.py" \
-+    "${INSTALL_ROOT}/lib/${arch}-${os}/libm.so.6"
-+
-+  # fcntl64() was introduced in glibc 2.28.  Make sure to use fcntl() instead.
-+  local fcntl_h="${INSTALL_ROOT}/usr/include/fcntl.h"
-+  sed -i '{N; s/#ifndef __USE_FILE_OFFSET64\(\nextern int fcntl\)/#if 1\1/}' \
-+      "${fcntl_h}"
-+
-+  # __GLIBC_MINOR__ is used as a feature test macro.  Replace it with the
-+  # earliest supported version of glibc (2.17, https://crbug.com/376567).
-+  local features_h="${INSTALL_ROOT}/usr/include/features.h"
-+  sed -i 's|\(#define\s\+__GLIBC_MINOR__\)|\1 17 //|' "${features_h}"
-+
-+  # This is for chrome's ./build/linux/pkg-config-wrapper
-+  # which overwrites PKG_CONFIG_LIBDIR internally
-+  SubBanner "Move pkgconfig scripts"
-+  mkdir -p ${INSTALL_ROOT}/usr/lib/pkgconfig
-+  mv ${INSTALL_ROOT}/usr/lib/${arch}-${os}/pkgconfig/* \
-+      ${INSTALL_ROOT}/usr/lib/pkgconfig
-+}
-+
-+
-+HacksAndPatchesRiscv64() {
-+  HacksAndPatchesCommon riscv64 linux-gnu riscv64-linux-gnu-strip
-+}
-+
-+
-+InstallIntoSysroot() {
-+  Banner "Install Libs And Headers Into Jail"
-+
-+  mkdir -p ${BUILD_DIR}/debian-packages
-+  # The /debian directory is an implementation detail that's used to cd into
-+  # when running dpkg-shlibdeps.
-+  mkdir -p ${INSTALL_ROOT}/debian
-+  # An empty control file is necessary to run dpkg-shlibdeps.
-+  touch ${INSTALL_ROOT}/debian/control
-+  while (( "$#" )); do
-+    local file="$1"
-+    local package="${BUILD_DIR}/debian-packages/${file##*/}"
-+    shift
-+    local sha256sum="$1"
-+    shift
-+    if [ "${#sha256sum}" -ne "64" ]; then
-+      echo "Bad sha256sum from package list"
-+      # exit 1
-+    fi
-+
-+    Banner "Installing $(basename ${file})"
-+    DownloadOrCopy ${file} ${package}
-+    if [ ! -s "${package}" ] ; then
-+      echo
-+      echo "ERROR: bad package ${package}"
-+      exit 1
-+    fi
-+    echo "${sha256sum}  ${package}" | sha256sum --quiet -c
-+
-+    SubBanner "Extracting to ${INSTALL_ROOT}"
-+    dpkg-deb -x ${package} ${INSTALL_ROOT}
-+
-+    base_package=$(dpkg-deb --field ${package} Package)
-+    mkdir -p ${INSTALL_ROOT}/debian/${base_package}/DEBIAN
-+    dpkg-deb -e ${package} ${INSTALL_ROOT}/debian/${base_package}/DEBIAN
-+  done
-+
-+  # Prune /usr/share, leaving only pkgconfig.
-+  ls -d ${INSTALL_ROOT}/usr/share/* | grep -v "/pkgconfig$" | xargs rm -r
-+}
-+
-+
-+CleanupJailSymlinks() {
-+  Banner "Jail symlink cleanup"
-+
-+  SAVEDPWD=$(pwd)
-+  cd ${INSTALL_ROOT}
-+  local libdirs="lib usr/lib"
-+  libdirs="${libdirs} lib64"
-+
-+  find $libdirs -type l -printf '%p %l\n' | while read link target; do
-+    # skip links with non-absolute paths
-+    echo "${target}" | grep -qs ^/ || continue
-+    echo "${link}: ${target}"
-+    # Relativize the symlink.
-+    prefix=$(echo "${link}" | sed -e 's/[^/]//g' | sed -e 's|/|../|g')
-+    ln -snfv "${prefix}${target}" "${link}"
-+  done
-+
-+  find $libdirs -type l -printf '%p %l\n' | while read link target; do
-+    # Make sure we catch new bad links.
-+    if [ ! -r "${link}" ]; then
-+      echo "ERROR: FOUND BAD LINK ${link}"
-+      ls -l ${link}
-+      exit 1
-+    fi
-+  done
-+  cd "$SAVEDPWD"
-+}
-+
-+
-+VerifyLibraryDepsCommon() {
-+  local arch=$1
-+  local os=$2
-+  local find_dirs=(
-+    "${INSTALL_ROOT}/lib/"
-+    "${INSTALL_ROOT}/lib/${arch}-${os}/"
-+    "${INSTALL_ROOT}/usr/lib/${arch}-${os}/"
-+  )
-+  local needed_libs="$(
-+    find ${find_dirs[*]} -name "*\.so*" -type f -exec file {} \; | \
-+      grep ': ELF' | sed 's/^\(.*\): .*$/\1/' | xargs readelf -d | \
-+      grep NEEDED | sort | uniq | sed 's/^.*Shared library: \[\(.*\)\]$/\1/g')"
-+  local all_libs="$(find ${find_dirs[*]} -printf '%f\n')"
-+  # Ignore missing libdbus-1.so.0
-+  all_libs+="$(echo -e '\nlibdbus-1.so.0')"
-+  local missing_libs="$(grep -vFxf <(echo "${all_libs}") \
-+    <(echo "${needed_libs}"))"
-+  if [ ! -z "${missing_libs}" ]; then
-+    echo "Missing libraries:"
-+    echo "${missing_libs}"
-+    exit 1
-+  fi
-+}
-+
-+VerifyLibraryDepsRiscv64() {
-+  VerifyLibraryDepsCommon riscv64 linux-gnu
-+}
-+
-+#@
-+#@ BuildSysrootRiscv64
-+#@
-+#@    Build everything and package it
-+BuildSysrootRiscv64() {
-+  if [ "$HAS_ARCH_RISCV64" = "0" ]; then
-+    return
-+  fi
-+  ClearInstallDir
-+  local package_file="${DEBIAN_DEP_LIST_RISCV64}"
-+  # GeneratePackageListRiscv64 "$package_file"
-+  local files_and_sha256sums="$(cat ${package_file})"
-+  StripChecksumsFromPackageList "$package_file"
-+  InstallIntoSysroot ${files_and_sha256sums}
-+  CleanupJailSymlinks
-+  HacksAndPatchesRiscv64
-+  VerifyLibraryDepsRiscv64
-+  CreateTarBall
-+}
-+
-+#
-+# CheckForDebianGPGKeyring
-+#
-+#     Make sure the Debian GPG keys exist. Otherwise print a helpful message.
-+#
-+CheckForDebianGPGKeyring() {
-+  if [ ! -e "$KEYRING_FILE" ]; then
-+    echo "KEYRING_FILE not found: ${KEYRING_FILE}"
-+    echo "Debian GPG keys missing. Install the debian-archive-keyring package."
-+    exit 1
-+  fi
-+}
-+
-+#
-+# VerifyPackageListing
-+#
-+#     Verifies the downloaded Packages.xz file has the right checksums.
-+#
-+VerifyPackageListing() {
-+  local file_path="$1"
-+  local output_file="$2"
-+  local repo="$3"
-+  local dist="$4"
-+
-+  local repo_basedir="${repo}/dists/${dist}"
-+  local release_list="${repo_basedir}/${RELEASE_FILE}"
-+  local release_list_gpg="${repo_basedir}/${RELEASE_FILE_GPG}"
-+
-+  local release_file="${BUILD_DIR}/${dist}-${RELEASE_FILE}"
-+  local release_file_gpg="${BUILD_DIR}/${dist}-${RELEASE_FILE_GPG}"
-+
-+  CheckForDebianGPGKeyring
-+
-+  DownloadOrCopyNonUniqueFilename ${release_list} ${release_file}
-+  DownloadOrCopyNonUniqueFilename ${release_list_gpg} ${release_file_gpg}
-+  echo "Verifying: ${release_file} with ${release_file_gpg}"
-+  set -x
-+  gpgv --keyring "${KEYRING_FILE}" "${release_file_gpg}" "${release_file}"
-+  set +x
-+
-+  echo "Verifying: ${output_file}"
-+  local sha256sum=$(grep -E "${file_path}\$|:\$" "${release_file}" | \
-+    grep "SHA256:" -A 1 | xargs echo | awk '{print $2;}')
-+
-+  if [ "${#sha256sum}" -ne "64" ]; then
-+    echo "Bad sha256sum from ${release_list}"
-+    exit 1
-+  fi
-+
-+  echo "${sha256sum}  ${output_file}" | sha256sum --quiet -c
-+}
-+
-+#
-+# GeneratePackageList
-+#
-+#     Looks up package names in ${BUILD_DIR}/Packages and write list of URLs
-+#     to output file.
-+#
-+GeneratePackageList() {
-+  local input_file="$1"
-+  local output_file="$2"
-+  echo "Updating: ${output_file} from ${input_file}"
-+  /bin/rm -f "${output_file}"
-+  shift
-+  shift
-+  for pkg in $@ ; do
-+    local pkg_full=$(grep -A 1 " ${pkg}\$" "$input_file" | \
-+      egrep "debian-ports/.*" | sed 's/.*Filename: //')
-+    if [ -z "${pkg_full}" ]; then
-+        echo "ERROR: missing package: $pkg"
-+        exit 1
-+    fi
-+    local sha256sum=$(grep -A 4 " ${pkg}\$" "$input_file" | \
-+      grep ^SHA256: | sed 's/^SHA256: //')
-+    if [ "${#sha256sum}" -ne "64" ]; then
-+      echo "Bad sha256sum from Packages"
-+      exit 1
-+    fi
-+    echo $pkg_full $sha256sum >> "$output_file"
-+  done
-+  # sort -o does an in-place sort of this file
-+  sort "$output_file" -o "$output_file"
-+}
-+
-+#@
-+#@ PrintArchitectures
-+#@
-+#@    Prints supported architectures.
-+PrintArchitectures() {
-+  if [ "$HAS_ARCH_RISCV64" = "1" ]; then
-+    echo Riscv64
-+  fi
-+}
-+
-+#@
-+#@ PrintDistro
-+#@
-+#@    Prints distro.  eg: ubuntu
-+PrintDistro() {
-+  echo ${DISTRO}
-+}
-+
-+#@
-+#@ DumpRelease
-+#@
-+#@    Prints disto release.  eg: jessie
-+PrintRelease() {
-+  echo ${DIST}
-+}
-+
-+RunCommand() {
-+  SetEnvironmentVariables "$1"
-+  SanityCheck
-+  "$@"
-+}
-+
-+if [ $# -eq 0 ] ; then
-+  echo "ERROR: you must specify a mode on the commandline"
-+  echo
-+  Usage
-+  exit 1
-+elif [ "$(type -t $1)" != "function" ]; then
-+  echo "ERROR: unknown function '$1'." >&2
-+  echo "For help, try:"
-+  echo "    $0 help"
-+  exit 1
-+else
-+  ChangeDirectory
-+  if echo $1 | grep -qs --regexp='\(^Print\)\|\(All$\)'; then
-+    "$@"
-+  else
-+    RunCommand "$@"
-+  fi
-+fi
-diff --git a/build/linux/sysroot_scripts/sysroot-creator-riscv64.sh b/build/linux/sysroot_scripts/sysroot-creator-riscv64.sh
-new file mode 100755
-index 0000000000000..aa4a34c04988e
---- /dev/null
-+++ b/build/linux/sysroot_scripts/sysroot-creator-riscv64.sh
-@@ -0,0 +1,400 @@
-+#!/bin/bash
-+# Copyright 2017 The Chromium Authors. All rights reserved.
-+# Use of this source code is governed by a BSD-style license that can be
-+# found in the LICENSE file.
-+
-+SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-+
-+DISTRO=debian
-+DIST=sid
-+
-+# Keep the "experimental" repo before the "sid" repo.  There are some packages
-+# that are currently only available in experimental like libgtk-4-1, but if it
-+# were to be placed first, experimental (unreleased) versions of other packages
-+# like libc6 would take precedence over the sid (released) versions.  While this
-+# may be useful for certain kinds of development, the standard sysroots should
-+# continue to be shipped only with released packages.
-+# Also keep "stretch" before "sid".  For now, it's needed to bring back
-+# libgnome-keyring-dev which has since been deprecated and removed from sid.
-+# It will be needed until gnome keyring is removed (http://crbug.com/466975 and
-+# http://crbug.com/355223).
-+ARCHIVE_URL="http://ftp.ports.debian.org/debian-ports"
-+APT_SOURCES_LIST="${ARCHIVE_URL}/ unstable main
-+${ARCHIVE_URL}/ experimental main
-+${ARCHIVE_URL}/ sid main"
-+
-+# gpg keyring file generated using generate_debian_archive_unstable.sh
-+KEYRING_FILE="/etc/apt/trusted.gpg.d/debian-ports-archive-2022.gpg"
-+
-+HAS_ARCH_RISCV64=1
-+
-+# Sysroot packages: these are the packages needed to build chrome.
-+# NOTE: When DEBIAN_PACKAGES is modified, the packagelist files must be updated
-+# by running this script in GeneratePackageList mode.
-+# comerr-dev
-+# krb5-multidev
-+# libappindicator-dev libappindicator1 libappindicator3-1 libappindicator3-dev
-+# libffi6 libffi7
-+# libgcc1
-+# libgnome-keyring-dev libgnome-keyring0
-+# libindicator3-7 libindicator7
-+# libpango-1.0-0 libpango1.0-dev
-+# libpangox-1.0-0
-+DEBIAN_PACKAGES="\
-+  libasound2
-+  libasound2-dev
-+  libasyncns0
-+  libatk-bridge2.0-0
-+  libatk-bridge2.0-dev
-+  libatk1.0-0
-+  libatk1.0-dev
-+  libatomic1
-+  libatspi2.0-0
-+  libatspi2.0-dev
-+  libattr1
-+  libaudit1
-+  libavahi-client3
-+  libavahi-common3
-+  libblkid-dev
-+  libblkid1
-+  libbluetooth-dev
-+  libbluetooth3
-+  libbrotli-dev
-+  libbrotli1
-+  libbsd0
-+  libc6
-+  libc6-dev
-+  libcairo-gobject2
-+  libcairo-script-interpreter2
-+  libcairo2
-+  libcairo2-dev
-+  libcap-dev
-+  libcap-ng0
-+  libcap2
-+  libcloudproviders0
-+  libcolord2
-+  libcom-err2
-+  libcups2
-+  libcups2-dev
-+  libcupsimage2
-+  libcupsimage2-dev
-+  libdatrie-dev
-+  libcurl3-gnutls
-+  libcurl4-gnutls-dev
-+  libdatrie1
-+  libdb5.3
-+  libdbus-1-3
-+  libdbus-1-dev
-+  libdbus-glib-1-2
-+  libdbusmenu-glib-dev
-+  libdbusmenu-glib4
-+  libdbusmenu-gtk3-4
-+  libdbusmenu-gtk4
-+  libdeflate-dev
-+  libdeflate0
-+  libdrm-amdgpu1
-+  libdrm-dev
-+  libdrm-nouveau2
-+  libdrm-radeon1
-+  libdrm2
-+  libegl-dev
-+  libegl1
-+  libegl1-mesa
-+  libegl1-mesa-dev
-+  libelf-dev
-+  libelf1
-+  libepoxy-dev
-+  libepoxy0
-+  libevdev-dev
-+  libevdev2
-+  libevent-2.1-7
-+  libexpat1
-+  libexpat1-dev
-+  libffi-dev
-+  libffi8
-+  libflac-dev
-+  libflac8
-+  libfontconfig-dev
-+  libfontconfig1
-+  libfreetype-dev
-+  libfreetype6
-+  libfribidi-dev
-+  libfribidi0
-+  libgbm-dev
-+  libgbm1
-+  libgcc-10-dev
-+  libgcc-s1
-+  libgcrypt20
-+  libgcrypt20-dev
-+  libgdk-pixbuf-2.0-0
-+  libgdk-pixbuf-2.0-dev
-+  libgl-dev
-+  libgl1
-+  libgl1-mesa-dev
-+  libgl1-mesa-glx
-+  libglapi-mesa
-+  libgles-dev
-+  libgles1
-+  libgles2
-+  libglib2.0-0
-+  libglib2.0-dev
-+  libglvnd-dev
-+  libglvnd0
-+  libglx-dev
-+  libglx0
-+  libgmp10
-+  libgnutls-dane0
-+  libgnutls-openssl27
-+  libgnutls28-dev
-+  libgnutls30
-+  libgnutlsxx28
-+  libgomp1
-+  libgpg-error-dev
-+  libgpg-error0
-+  libgraphene-1.0-0
-+  libgraphene-1.0-dev
-+  libgraphite2-3
-+  libgraphite2-dev
-+  libgssapi-krb5-2
-+  libgssrpc4
-+  libgtk-3-0
-+  libgtk-3-dev
-+  libgtk2.0-0
-+  libgudev-1.0-0
-+  libharfbuzz-dev
-+  libharfbuzz-gobject0
-+  libharfbuzz-icu0
-+  libharfbuzz0b
-+  libhogweed6
-+  libice6
-+  libicu-le-hb0
-+  libicu67
-+  libidl-2-0
-+  libidn12
-+  libidn2-0
-+  libinput-dev
-+  libinput10
-+  libjbig-dev
-+  libjbig0
-+  libjpeg62-turbo
-+  libjpeg62-turbo-dev
-+  libjson-glib-1.0-0
-+  libjsoncpp-dev
-+  libjsoncpp25
-+  libk5crypto3
-+  libkadm5clnt-mit12
-+  libkadm5srv-mit12
-+  libkdb5-10
-+  libkeyutils1
-+  libkrb5-3
-+  libkrb5-dev
-+  libkrb5support0
-+  liblcms2-2
-+  libldap-2.5-0
-+  libltdl7
-+  liblz4-1
-+  liblzma5
-+  liblzo2-2
-+  libmd0
-+  libminizip-dev
-+  libminizip1
-+  libmount-dev
-+  libmount1
-+  libmtdev1
-+  libncurses-dev
-+  libncurses6
-+  libncursesw6
-+  libnettle8
-+  libnghttp2-14
-+  libnsl2
-+  libnspr4
-+  libnspr4-dev
-+  libnss-db
-+  libnss3
-+  libnss3-dev
-+  libogg-dev
-+  libogg0
-+  libopengl0
-+  libopus-dev
-+  libopus0
-+  libp11-kit0
-+  libpam0g
-+  libpam0g-dev
-+  libpangocairo-1.0-0
-+  libpangoft2-1.0-0
-+  libpangoxft-1.0-0
-+  libpci-dev
-+  libpci3
-+  libpciaccess0
-+  libpcre16-3
-+  libpcre2-16-0
-+  libpcre2-32-0
-+  libpcre2-8-0
-+  libpcre2-dev
-+  libpcre2-posix3
-+  libpcre3
-+  libpcre3-dev
-+  libpcre32-3
-+  libpcrecpp0v5
-+  libpipewire-0.3-0
-+  libpipewire-0.3-dev
-+  libpixman-1-0
-+  libpixman-1-dev
-+  libpng-dev
-+  libpng16-16
-+  libpsl5
-+  libpthread-stubs0-dev
-+  libpulse-dev
-+  libpulse-mainloop-glib0
-+  libpulse0
-+  libre2-9
-+  libre2-dev
-+  librest-0.7-0
-+  librtmp1
-+  libsasl2-2
-+  libselinux1
-+  libselinux1-dev
-+  libsepol2
-+  libsepol-dev
-+  libsm6
-+  libsnappy-dev
-+  libsnappy1v5
-+  libsndfile1
-+  libsoup-gnome2.4-1
-+  libsoup2.4-1
-+  libspa-0.2-dev
-+  libspeechd-dev
-+  libspeechd2
-+  libsqlite3-0
-+  libssh2-1
-+  libssl-dev
-+  libssl1.1
-+  libstdc++-10-dev
-+  libstdc++6
-+  libsystemd0
-+  libtasn1-6
-+  libthai-dev
-+  libthai0
-+  libtiff-dev
-+  libtiff5
-+  libtiffxx5
-+  libtinfo6
-+  libtirpc3
-+  libudev-dev
-+  libudev1
-+  libunbound8
-+  libunistring2
-+  libutempter-dev
-+  libutempter0
-+  libuuid1
-+  libva-dev
-+  libva-drm2
-+  libva-glx2
-+  libva-wayland2
-+  libva-x11-2
-+  libva2
-+  libvorbis0a
-+  libvorbisenc2
-+  libvulkan-dev
-+  libvulkan1
-+  libwacom9
-+  libwayland-client0
-+  libwayland-cursor0
-+  libwayland-dev
-+  libwayland-egl1
-+  libwayland-egl1-mesa
-+  libwayland-server0
-+  libwebp-dev
-+  libwebp7
-+  libwebpdemux2
-+  libwebpmux3
-+  libwrap0
-+  libx11-6
-+  libx11-dev
-+  libx11-xcb-dev
-+  libx11-xcb1
-+  libxau-dev
-+  libxau6
-+  libxcb-dri2-0
-+  libxcb-dri2-0-dev
-+  libxcb-dri3-0
-+  libxcb-dri3-dev
-+  libxcb-glx0
-+  libxcb-glx0-dev
-+  libxcb-present-dev
-+  libxcb-present0
-+  libxcb-render0
-+  libxcb-render0-dev
-+  libxcb-shm0
-+  libxcb-shm0-dev
-+  libxcb-sync1
-+  libxcb-xfixes0
-+  libxcb1
-+  libxcb1-dev
-+  libxcomposite-dev
-+  libxcomposite1
-+  libxcursor-dev
-+  libxcursor1
-+  libxdamage-dev
-+  libxdamage1
-+  libxdmcp-dev
-+  libxdmcp6
-+  libxext-dev
-+  libxext6
-+  libxfixes-dev
-+  libxfixes3
-+  libxft-dev
-+  libxft2
-+  libxi-dev
-+  libxi6
-+  libxinerama-dev
-+  libxinerama1
-+  libxkbcommon-dev
-+  libxkbcommon0
-+  libxml2
-+  libxml2-dev
-+  libxrandr-dev
-+  libxrandr2
-+  libxrender-dev
-+  libxrender1
-+  libxshmfence-dev
-+  libxshmfence1
-+  libxslt1-dev
-+  libxslt1.1
-+  libxss-dev
-+  libxss1
-+  libxt-dev
-+  libxt6
-+  libxtst-dev
-+  libxtst6
-+  libxxf86vm-dev
-+  libxxf86vm1
-+  libzstd1
-+  linux-libc-dev
-+  mesa-common-dev
-+  shared-mime-info
-+  uuid-dev
-+  wayland-protocols
-+  x11proto-core-dev
-+  x11proto-dev
-+  x11proto-input-dev
-+  x11proto-kb-dev
-+  x11proto-randr-dev
-+  x11proto-record-dev
-+  x11proto-render-dev
-+  x11proto-scrnsaver-dev
-+  x11proto-xext-dev
-+  x11proto-xinerama-dev
-+  zlib1g
-+  zlib1g-dev
-+"
-+
-+DEBIAN_PACKAGES_RISCV64="
-+  libasan6
-+  libgmp10
-+  libgtk-4-1
-+  libgtk-4-dev
-+  libthai0
-+"
-+
-+. "${SCRIPT_DIR}/sysroot-builder-riscv64.sh"
--- 
-2.25.1
-

+ 0 - 31
archive/0020-build-config-linux-workaround-for-files-not-found-wi.patch

@@ -1,31 +0,0 @@
-From 3d3072b3f31a58a5f56908afcadef6ebe09c7321 Mon Sep 17 00:00:00 2001
-From: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
-Date: Fri, 17 Jun 2022 06:06:06 +0000
-Subject: [PATCH] build: config: linux: workaround for files not found within
- sysroot
-
-Signed-off-by: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
----
- build/config/linux/BUILD.gn | 6 ++++++
- 1 file changed, 6 insertions(+)
-
-diff --git a/build/config/linux/BUILD.gn b/build/config/linux/BUILD.gn
-index b897c9920bc8..03e85a7c9b7c 100644
---- a/build/config/linux/BUILD.gn
-+++ b/build/config/linux/BUILD.gn
-@@ -27,6 +27,12 @@ config("compiler") {
-       asmflags += [ "-mbranch-protection=pac-ret" ]
-     }
-   }
-+
-+  if (current_cpu == "riscv64") {
-+    cflags = []
-+    cflags += [ "-I../../build/linux/debian_sid_riscv64-sysroot/usr/include",
-+                "-I../../build/linux/debian_sid_riscv64-sysroot/usr/include/riscv64-linux-gnu", ]
-+  }
- }
- 
- # This is included by reference in the //build/config/compiler:runtime_library
--- 
-2.25.1
-

+ 0 - 27
archive/0021-v8-settings.patch

@@ -1,27 +0,0 @@
-From f3fc8ee028d27beee7a7b5b57e408c0671b6e857 Mon Sep 17 00:00:00 2001
-From: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
-Date: Thu, 28 Apr 2022 01:04:27 +0000
-Subject: [PATCH 21/21] v8 settings
-
-Signed-off-by: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
----
- build/config/v8_target_cpu.gni | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/build/config/v8_target_cpu.gni b/build/config/v8_target_cpu.gni
-index 305981f3fa538..44b7700935cc6 100644
---- a/build/config/v8_target_cpu.gni
-+++ b/build/config/v8_target_cpu.gni
-@@ -49,6 +49,9 @@ if (v8_target_cpu == "") {
-     # code that will be run under a simulator, then the generated code
-     # also gets the benefits of the sanitizer.
-     v8_target_cpu = "arm64"
-+  } else if (current_toolchain ==
-+             "//build/toolchain/linux:clang_x86_v8_riscv64") {
-+    v8_target_cpu = "riscv64"
-   } else {
-     v8_target_cpu = target_cpu
-   }
--- 
-2.25.1
-

+ 0 - 44
archive/0022-chrome-installer-add-riscv64-as-one-of-the-target-ar.patch

@@ -1,44 +0,0 @@
-From ded0b5e0b64f84678e9c30741653c8914823cced Mon Sep 17 00:00:00 2001
-From: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
-Date: Fri, 17 Jun 2022 00:29:10 +0000
-Subject: [PATCH] chrome: installer: add riscv64 as one of the target arch
-
-Signed-off-by: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
----
- chrome/installer/linux/BUILD.gn | 6 ++++++
- 1 file changed, 6 insertions(+)
-
-diff --git a/chrome/installer/linux/BUILD.gn b/chrome/installer/linux/BUILD.gn
-index 6623fff2ba8a..104b8b5bb135 100644
---- a/chrome/installer/linux/BUILD.gn
-+++ b/chrome/installer/linux/BUILD.gn
-@@ -477,6 +477,8 @@ template("linux_package") {
-       deb_arch = "mipsel"
-     } else if (current_cpu == "mips64el") {
-       deb_arch = "mips64el"
-+    } else if (current_cpu == "riscv64") {
-+      deb_arch = "riscv64"
-     } else {
-       assert(false, "Linux installer not configured for this architecture.")
-     }
-@@ -526,6 +528,8 @@ template("linux_package") {
-         rpm_arch = "mipsel"
-       } else if (current_cpu == "mips64el") {
-         rpm_arch = "mips64el"
-+      } else if (current_cpu == "riscv64") {
-+        rpm_arch = "riscv64"
-       } else {
-         assert(false, "Linux installer not configured for this architecture.")
-       }
-@@ -579,6 +583,8 @@ template("linux_package") {
-           snap_arch = "armhf"
-         } else if (current_cpu == "arm64") {
-           snap_arch = "arm64"
-+        } else if (current_cpu == "riscv64") {
-+          snap_arch = "riscv64"
-         } else {
-           assert(false, "Linux installer not configured for this architecture.")
-         }
--- 
-2.25.1
-

+ 0 - 25
archive/0023-ui-gl-enable-swiftshader-for-riscv64.patch

@@ -1,25 +0,0 @@
-From 186eddd3eeb35ebfb562124b1100f48b75e14a2b Mon Sep 17 00:00:00 2001
-From: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
-Date: Fri, 17 Jun 2022 05:49:33 +0000
-Subject: [PATCH] ui: gl: enable swiftshader for riscv64
-
-Signed-off-by: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
----
- ui/gl/features.gni | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/ui/gl/features.gni b/ui/gl/features.gni
-index 1bbc06c62715..3951bc279222 100644
---- a/ui/gl/features.gni
-+++ b/ui/gl/features.gni
-@@ -31,5 +31,6 @@ declare_args() {
-                         (is_mac && use_egl) || is_chromeos_ash || is_fuchsia) &&
-                        (target_cpu == "x86" || target_cpu == "x64" ||
-                         target_cpu == "arm" || target_cpu == "arm64" ||
--                        target_cpu == "mipsel" || target_cpu == "mips64el")
-+                        target_cpu == "mipsel" || target_cpu == "mips64el" ||
-+                        target_cpu == "riscv64")
- }
--- 
-2.25.1
-