Skip to content

Commit 139d945

Browse files
committed
Add llvm-project 17.0.3
1 parent 85a77ad commit 139d945

18 files changed

+2893
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module(
2+
name = "llvm-project",
3+
version = "17.0.3",
4+
)
5+
6+
# Skylark depedndencies
7+
bazel_dep(name = "bazel_skylib", version = "1.3.0")
8+
9+
# Library dependencies
10+
bazel_dep(name = "platforms", version = "0.0.7")
11+
bazel_dep(name = "rules_cc", version = "0.0.9")

modules/llvm-project/17.0.3/TODO.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# TODO
2+
3+
In increasing difficultly order:
4+
5+
- [ ] Figure out why permissions tests on Mac do not work with default temporary directory
6+
- [ ] Run `//llvm/unittests:all` on Windows
7+
- [ ] Validate why LLVM `LegalizerInfoTest.SizeChangeStrategy` fails on Windows
8+
- [ ] Validate why LLVM `SMEAttributes.Constructors` fails on Windows
9+
- [ ] Validate why LLVM `AttributorTestBase.AAReachabilityTest` fails on Windows
10+
- [ ] Add optional dependencies
11+
- [ ] Add `zlib` (or `zlib-ng`)
12+
- [ ] Add `zstd`
13+
- [ ] Add `pfm`
14+
- [ ] Add `mpfr` (and by extension, `gmp`)
15+
- [ ] Use `blake3` from BCR
16+
- [ ] Get `//clang` building on Windows
17+
- [ ] Get Clang unit tests passing on Windows
18+
- Run all LLVM project tests (`bazel test //...`)
19+
- [ ] Linux
20+
- [ ] Mac
21+
- [ ] Windows
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: Alexander Khabarov <[email protected]>
3+
Date: Thu, 19 Oct 2023 14:55:33 +0000
4+
Subject: [PATCH] Add Bazel files to `.gitignore`
5+
6+
---
7+
.gitignore | 8 ++++++++
8+
1 file changed, 8 insertions(+)
9+
10+
diff --git a/.gitignore b/.gitignore
11+
index 20c4f52cd..6d630bf1b 100644
12+
--- a/.gitignore
13+
+++ b/.gitignore
14+
@@ -70,3 +70,11 @@ pythonenv*
15+
/clang/utils/analyzer/projects/*/RefScanBuildResults
16+
# automodapi puts generated documentation files here.
17+
/lldb/docs/python_api/
18+
+
19+
+#==============================================================================
20+
+#
21+
+# Bazel paths to ignore
22+
+#==============================================================================
23+
+.bazelrc
24+
+.bazelversion
25+
+/bazel-*

modules/llvm-project/17.0.3/patches/0002-Add-LLVM-Bazel-overlay-files.patch

Lines changed: 2265 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: Alexander Khabarov <[email protected]>
3+
Date: Thu, 19 Oct 2023 14:58:38 +0000
4+
Subject: [PATCH] Add `MODULE.bazel`
5+
6+
---
7+
MODULE.bazel | 11 +++++++++++
8+
1 file changed, 11 insertions(+)
9+
create mode 100644 MODULE.bazel
10+
11+
diff --git a/MODULE.bazel b/MODULE.bazel
12+
new file mode 100644
13+
index 000000000..f945718c2
14+
--- /dev/null
15+
+++ b/MODULE.bazel
16+
@@ -0,0 +1,11 @@
17+
+module(
18+
+ name = "llvm-project",
19+
+ version = "17.0.3",
20+
+)
21+
+
22+
+# Skylark depedndencies
23+
+bazel_dep(name = "bazel_skylib", version = "1.3.0")
24+
+
25+
+# Library dependencies
26+
+bazel_dep(name = "platforms", version = "0.0.7")
27+
+bazel_dep(name = "rules_cc", version = "0.0.9")
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: Alexander Khabarov <[email protected]>
3+
Date: Thu, 19 Oct 2023 15:05:58 +0000
4+
Subject: [PATCH] Add `BUILD.bazel`
5+
6+
---
7+
BUILD.bazel | 4 ++++
8+
1 file changed, 4 insertions(+)
9+
create mode 100644 BUILD.bazel
10+
11+
diff --git a/BUILD.bazel b/BUILD.bazel
12+
new file mode 100644
13+
index 000000000..05c507654
14+
--- /dev/null
15+
+++ b/BUILD.bazel
16+
@@ -0,0 +1,4 @@
17+
+# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
18+
+# See https://llvm.org/LICENSE.txt for license information.
19+
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
20+
+
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: Alexander Khabarov <[email protected]>
3+
Date: Thu, 19 Oct 2023 15:00:17 +0000
4+
Subject: [PATCH] Add Bazel LLVM targets
5+
6+
The repository configuration step of the overlay generates the
7+
`llvm/targets.bzl`. We can generate it ourselves by using the
8+
`DEFAULT_TARGETS`:
9+
10+
```sh
11+
tr '\n' ' ' < utils/bazel/configure.bzl |
12+
grep -o 'DEFAULT_TARGETS *= *\[[^]]\+\]' |
13+
sed \
14+
-e 's|DEFAULT_TARGETS|llvm_targets|' \
15+
-e 's|,\( *\)|,\n\1|g' \
16+
-e 's|\[|[\n|' \
17+
> llvm/targets.bzl
18+
```
19+
---
20+
llvm/targets.bzl | 21 +++++++++++++++++++++
21+
1 file changed, 21 insertions(+)
22+
create mode 100644 llvm/targets.bzl
23+
24+
diff --git a/llvm/targets.bzl b/llvm/targets.bzl
25+
new file mode 100644
26+
index 000000000..7a31d801e
27+
--- /dev/null
28+
+++ b/llvm/targets.bzl
29+
@@ -0,0 +1,21 @@
30+
+llvm_targets = [
31+
+ "AArch64",
32+
+ "AMDGPU",
33+
+ "ARM",
34+
+ "AVR",
35+
+ "BPF",
36+
+ "Hexagon",
37+
+ "Lanai",
38+
+ "LoongArch",
39+
+ "Mips",
40+
+ "MSP430",
41+
+ "NVPTX",
42+
+ "PowerPC",
43+
+ "RISCV",
44+
+ "Sparc",
45+
+ "SystemZ",
46+
+ "VE",
47+
+ "WebAssembly",
48+
+ "X86",
49+
+ "XCore",
50+
+]
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: Alexander Khabarov <[email protected]>
3+
Date: Thu, 19 Oct 2023 15:01:20 +0000
4+
Subject: [PATCH] Add LLVM version vars
5+
6+
The repository configuration step of the overlay generates the
7+
`vars.bzl`. We have to add it manually.
8+
---
9+
vars.bzl | 5 +++++
10+
1 file changed, 5 insertions(+)
11+
create mode 100644 vars.bzl
12+
13+
diff --git a/vars.bzl b/vars.bzl
14+
new file mode 100644
15+
index 000000000..d744043d9
16+
--- /dev/null
17+
+++ b/vars.bzl
18+
@@ -0,0 +1,5 @@
19+
+LLVM_VERSION = "17.0.3"
20+
+LLVM_VERSION_MAJOR = 17
21+
+LLVM_VERSION_MINOR = 0
22+
+LLVM_VERSION_PATCH = 3
23+
+
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: Alexander Khabarov <[email protected]>
3+
Date: Thu, 19 Oct 2023 15:02:08 +0000
4+
Subject: [PATCH] Guard against empty workspace root
5+
6+
The workspace root in `llvm/tblgen.bzl` is empty when running the build
7+
from the root directory of the project. Default to `"."` to avoid
8+
include errors resulting from this.
9+
---
10+
llvm/tblgen.bzl | 2 +-
11+
1 file changed, 1 insertion(+), 1 deletion(-)
12+
13+
diff --git a/llvm/tblgen.bzl b/llvm/tblgen.bzl
14+
index d43390918..9486edf29 100644
15+
--- a/llvm/tblgen.bzl
16+
+++ b/llvm/tblgen.bzl
17+
@@ -35,7 +35,7 @@ def gentbl(
18+
tblgen_args: Extra arguments string to pass to the tblgen binary.
19+
**kwargs: Keyword arguments to pass to subsidiary cc_library() rule.
20+
"""
21+
- llvm_project_execroot_path = Label("//llvm:tblgen.bzl").workspace_root
22+
+ llvm_project_execroot_path = Label("//llvm:tblgen.bzl").workspace_root or "."
23+
24+
if td_file not in td_srcs:
25+
td_srcs += [td_file]
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: Alexander Khabarov <[email protected]>
3+
Date: Fri, 20 Oct 2023 10:57:18 +0000
4+
Subject: [PATCH] Correct builtin headers prefix
5+
6+
`$${src#*clang/lib/Headers}` works when building from the
7+
`llvm-project` root as well.
8+
---
9+
clang/BUILD.bazel | 2 +-
10+
1 file changed, 1 insertion(+), 1 deletion(-)
11+
12+
diff --git a/clang/BUILD.bazel b/clang/BUILD.bazel
13+
index 037719a51..ec87a37e2 100644
14+
--- a/clang/BUILD.bazel
15+
+++ b/clang/BUILD.bazel
16+
@@ -1691,7 +1691,7 @@ genrule(
17+
outs = [hdr.replace("lib/Headers/", "staging/include/") for hdr in builtin_headers],
18+
cmd = """
19+
for src in $(SRCS); do
20+
- relsrc=$${src#*"$(WORKSPACE_ROOT)"/clang/lib/Headers}
21+
+ relsrc=$${src#*clang/lib/Headers}
22+
target=$(@D)/staging/include/$$relsrc
23+
mkdir -p $$(dirname $$target)
24+
cp $$src $$target

0 commit comments

Comments
 (0)