From 4302285e59fbb4d2a8376a9a2ee86828d9dec4a2 Mon Sep 17 00:00:00 2001
From: Collin Baker <collinbaker@chromium.org>
Date: Wed, 26 Mar 2025 14:41:58 -0700
Subject: [PATCH] Add third_party/compiler-rt

Bug: 405175242
Change-Id: I4ed17ef05d4a26c918eb028d443a194c09bbd496
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6377826
Reviewed-by: Hans Wennborg <hans@chromium.org>
Reviewed-by: Rick Byers <rbyers@chromium.org>
Auto-Submit: Collin Baker <collinbaker@chromium.org>
Commit-Queue: Collin Baker <collinbaker@chromium.org>
Commit-Queue: Rick Byers <rbyers@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1438412}
---
 .gitmodules                             |  3 +++
 DEPS                                    |  8 ++++++++
 third_party/compiler-rt/OWNERS          |  1 +
 third_party/compiler-rt/README.chromium | 13 +++++++++++++
 third_party/compiler-rt/src             |  1 +
 5 files changed, 26 insertions(+)
 create mode 100644 third_party/compiler-rt/OWNERS
 create mode 100644 third_party/compiler-rt/README.chromium
 create mode 160000 third_party/compiler-rt/src

diff --git a/.gitmodules b/.gitmodules
index 2cdc719961036..5a9a420335874 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -927,3 +927,6 @@
 	path = webkit/data/test_shell/plugins
 	url = https://chrome-internal.googlesource.com/chrome/data/webkit_plugin_tests
 	gclient-condition = checkout_src_internal
+[submodule "third_party/compiler-rt/src"]
+	path = third_party/compiler-rt/src
+	url = https://chromium.googlesource.com/external/github.com/llvm/llvm-project/compiler-rt
diff --git a/DEPS b/DEPS
index e00df0fe86d00..904b0483845da 100644
--- a/DEPS
+++ b/DEPS
@@ -520,6 +520,10 @@ vars = {
   # the commit queue can handle CLs rolling llvm-libc
   # and whatever else without interference from each other.
   'llvm_libc_revision':    '0976d379acfde4f2af3693bf5273ae053ce2fe49',
+  # Three lines of non-changing comments so that
+  # the commit queue can handle CLs rolling llvm-libc
+  # and whatever else without interference from each other.
+  'compiler_rt_revision': 'bc2b30185219a2defe3c8a3b45f95a11386a7f6f',
 
   # If you change this, also update the libc++ revision in
   # //buildtools/deps_revisions.gni.
@@ -1149,6 +1153,10 @@ deps = {
       'condition': 'checkout_chrome_release_scripts',
   },
 
+  'src/third_party/compiler-rt/src':
+    Var('chromium_git') +
+    '/external/github.com/llvm/llvm-project/compiler-rt.git' + '@' +
+    Var('compiler_rt_revision'),
   'src/third_party/libc++/src':
     Var('chromium_git') +
     '/external/github.com/llvm/llvm-project/libcxx.git' + '@' +
diff --git a/third_party/compiler-rt/OWNERS b/third_party/compiler-rt/OWNERS
new file mode 100644
index 0000000000000..48b1c63fe01c8
--- /dev/null
+++ b/third_party/compiler-rt/OWNERS
@@ -0,0 +1 @@
+file://tools/clang/scripts/OWNERS
diff --git a/third_party/compiler-rt/README.chromium b/third_party/compiler-rt/README.chromium
new file mode 100644
index 0000000000000..97df68de584fd
--- /dev/null
+++ b/third_party/compiler-rt/README.chromium
@@ -0,0 +1,13 @@
+Name: compiler-rt
+Short Name: compiler-rt
+URL: https://compiler-rt.llvm.org/
+Version: N/A
+Revision: DEPS
+License: NCSA, Apache-with-LLVM-Exception, MIT
+License File: src/LICENSE.TXT
+Security Critical: yes
+Shipped: yes
+
+Description:
+
+compiler-rt for Chromium.
diff --git a/third_party/compiler-rt/src b/third_party/compiler-rt/src
new file mode 160000
index 0000000000000..bc2b30185219a
--- /dev/null
+++ b/third_party/compiler-rt/src
@@ -0,0 +1 @@
+Subproject commit bc2b30185219a2defe3c8a3b45f95a11386a7f6f