Skip to content

Commit

Permalink
Ship llvm-libc as required by libcxx
Browse files Browse the repository at this point in the history
  • Loading branch information
zcbenz committed Dec 19, 2024
1 parent cd5d502 commit ad2cb8b
Show file tree
Hide file tree
Showing 11 changed files with 46 additions and 14 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@
[submodule "third_party/re2/src"]
path = third_party/re2/src
url = https://github.com/google/re2
[submodule "third_party/llvm-libc/src"]
path = third_party/llvm-libc/src
url = https://chromium.googlesource.com/external/github.com/llvm/llvm-project/libc
8 changes: 4 additions & 4 deletions buildtools/deps_revisions.gni
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Copyright 2018 The Chromium Authors. All rights reserved.
# Copyright 2018 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

declare_args() {
# The libc++ svn revision that belongs to the git hash in DEPS. Used to cause
# full rebuilds on libc++ rolls.
libcxx_revision = "79a2e924d96e2fc1e4b937c42efd08898fa472d7"
# Used to cause full rebuilds on libc++ rolls. This should be kept in sync
# with the libcxx_revision var in //DEPS.
libcxx_revision = "d0ddad5b79581e19d8e1aec627bb2ad86e1554cd"
}
9 changes: 2 additions & 7 deletions scripts/create_dist.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const gnzip = new JSZip()
const files =
searchFiles('build_overrides').concat(
searchFiles('build')).concat(
searchFiles('buildtools/third_party')).concat(
searchFiles('testing')).concat(
searchFiles('tools/cfi')).concat(
searchFiles('tools/clang/scripts')).concat(
Expand All @@ -46,15 +47,9 @@ const files =
searchFiles('third_party/libc++abi/src/include')).concat(
searchFiles('third_party/libunwind/src/src')).concat(
searchFiles('third_party/libunwind/src/include')).concat(
searchFiles('third_party/llvm-libc')).concat(
searchFiles('third_party/re2'))
addFileToZip(gnzip, 'buildtools/deps_revisions.gni', '.')
addFileToZip(gnzip, 'buildtools/third_party/eu-strip/bin/eu-strip', '.')
addFileToZip(gnzip, 'buildtools/third_party/libc++/__assertion_handler', '.')
addFileToZip(gnzip, 'buildtools/third_party/libc++/__config_site', '.')
addFileToZip(gnzip, 'buildtools/third_party/libc++/BUILD.gn', '.')
addFileToZip(gnzip, 'buildtools/third_party/libc++abi/cxa_demangle_stub.cc', '.')
addFileToZip(gnzip, 'buildtools/third_party/libc++abi/BUILD.gn', '.')
addFileToZip(gnzip, 'buildtools/third_party/libunwind/BUILD.gn', '.')
for (let f of files) {
addFileToZip(gnzip, f, '.')
}
Expand Down
4 changes: 3 additions & 1 deletion scripts/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ async function main() {
}

function runTests(error) {
for (const project of fs.readdirSync('examples')) {
const projects = process.argv.length > 2 ? process.argv.slice(2)
: fs.readdirSync('examples')
for (const project of projects) {
runEachTest(project, path.resolve('examples', project))
}
}
Expand Down
16 changes: 16 additions & 0 deletions third_party/llvm-libc/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2024 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

config("config") {
visibility = [ ":*" ]
include_dirs = [ "src" ]
defines = [ "LIBC_NAMESPACE=__llvm_libc_cr" ]
}

group("llvm-libc-shared") {
# llvm-libc is only used as a dependency of libc++.
visibility = [ "//buildtools/third_party/libc++:libc++" ]

public_configs = [ ":config" ]
}
1 change: 1 addition & 0 deletions third_party/llvm-libc/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
file://third_party/libc++/OWNERS
12 changes: 12 additions & 0 deletions third_party/llvm-libc/README.chromium
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Name: llvm-libc
URL: https://libc.llvm.org/
Version: N/A
Revision: DEPS
License: MIT, University of Illinois/NCSA Open Source License
License File: src/LICENSE.TXT
Security Critical: yes
Shipped: yes

Description:

LLVM's C library. libc++ depends on a small subset of this for a few functions.
1 change: 1 addition & 0 deletions third_party/llvm-libc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
See README.chromium
1 change: 1 addition & 0 deletions third_party/llvm-libc/src
Submodule src added at 05bd4c
3 changes: 2 additions & 1 deletion tools/clang/scripts/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,8 @@ def UpdatePackage(package_name, host_os, dir=LLVM_BUILD_DIR):
assert package_file is not None

# TODO(hans): Create a clang-win-runtime package and use separate DEPS hook.
target_os = []
# PATCH(build-gn): Provide a default target_os.
target_os = [host_os]
if package_name == 'clang':
try:
GCLIENT_CONFIG = os.path.join(os.path.dirname(CHROMIUM_DIR), '.gclient')
Expand Down
2 changes: 1 addition & 1 deletion tools/gn

0 comments on commit ad2cb8b

Please sign in to comment.