1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
build / config / siso / clang_linux.star [blame]
# -*- bazel-starlark -*-
# Copyright 2023 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Siso configuration for clang/linux."""
load("@builtin//struct.star", "module")
load("./android.star", "android")
load("./clang_all.star", "clang_all")
load("./clang_unix.star", "clang_unix")
load("./fuchsia.star", "fuchsia")
load("./win_sdk.star", "win_sdk")
def __filegroups(ctx):
fg = {
# for precomputed subtrees
"build/linux/debian_bullseye_amd64-sysroot/usr/include:include": {
"type": "glob",
"includes": ["*"],
# need bits/stab.def, c++/*
},
"build/linux/debian_bullseye_amd64-sysroot/usr/lib:headers": {
"type": "glob",
"includes": ["*.h", "crtbegin.o"],
},
"build/linux/debian_bullseye_arm64-sysroot/usr/include:include": {
"type": "glob",
"includes": ["*"],
# need bits/stab.def, c++/*
},
"build/linux/debian_bullseye_arm64-sysroot/usr/lib:headers": {
"type": "glob",
"includes": ["*.h", "crtbegin.o"],
},
"build/linux/debian_bullseye_i386-sysroot/usr/include:include": {
"type": "glob",
"includes": ["*"],
# need bits/stab.def, c++/*
},
"build/linux/debian_bullseye_i386-sysroot/usr/lib:headers": {
"type": "glob",
"includes": ["*.h", "crtbegin.o"],
},
"build/linux/debian_bullseye_armhf-sysroot/usr/include:include": {
"type": "glob",
"includes": ["*"],
# need bits/stab.def, c++/*
},
"build/linux/debian_bullseye_armhf-sysroot/usr/lib:headers": {
"type": "glob",
"includes": ["*.h", "crtbegin.o"],
},
"third_party/android_toolchain/ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include:include": {
"type": "glob",
"includes": ["*"],
# can't use "*.h", because c++ headers have no extension.
},
"third_party/android_toolchain/ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/local/include:include": {
"type": "glob",
"includes": ["*"],
},
"third_party/llvm-build/Release+Asserts/bin:llddeps": {
"type": "glob",
"includes": [
"clang*",
"ld.lld",
"ld64.lld",
"lld",
"llvm-nm",
"llvm-objcopy",
"llvm-objdump",
"llvm-otool",
"llvm-readelf",
"llvm-readobj",
"llvm-strip",
],
},
"third_party/llvm-build/Release+Asserts/lib/clang:libs": {
"type": "glob",
"includes": ["*/lib/*/*", "*/lib/*", "*/share/*"],
},
"build/linux/debian_bullseye_amd64-sysroot/lib/x86_64-linux-gnu:libso": {
"type": "glob",
"includes": ["*.so*"],
},
"build/linux/debian_bullseye_amd64-sysroot/usr/lib/x86_64-linux-gnu:libs": {
"type": "glob",
"includes": ["*.o", "*.so*", "lib*.a"],
},
"build/linux/debian_bullseye_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu:libgcc": {
"type": "glob",
"includes": ["*.o", "*.a", "*.so"],
},
"build/linux/debian_bullseye_i386-sysroot/lib:libso": {
"type": "glob",
"includes": ["*.so*"],
},
"build/linux/debian_bullseye_i386-sysroot/usr/lib/i386-linux-gnu:libs": {
"type": "glob",
"includes": ["*.o", "*.so*", "lib*.a"],
},
"build/linux/debian_bullseye_i386-sysroot/usr/lib/gcc/i686-linux-gnu:libgcc": {
"type": "glob",
"includes": ["*.o", "*.a", "*.so"],
},
"build/linux/debian_bullseye_armhf-sysroot/lib:libso": {
"type": "glob",
"includes": ["*.so*"],
},
"build/linux/debian_bullseye_armhf-sysroot/usr/lib/arm-linux-gnueabihf:libs": {
"type": "glob",
"includes": ["*.o", "*.so*", "lib*.a"],
},
"build/linux/debian_bullseye_armhf-sysroot/usr/lib/gcc/arm-linux-gnueabihf:libgcc": {
"type": "glob",
"includes": ["*.o", "*.a", "*.so"],
},
}
if android.enabled(ctx):
fg.update(android.filegroups(ctx))
if fuchsia.enabled(ctx):
fg.update(fuchsia.filegroups(ctx))
fg.update(clang_all.filegroups(ctx))
return fg
__handlers = {}
__handlers.update(clang_unix.handlers)
def __step_config(ctx, step_config):
step_config["input_deps"].update({
# sysroot headers for precomputed subtrees
"build/linux/debian_bullseye_amd64-sysroot:headers": [
"build/linux/debian_bullseye_amd64-sysroot/usr/include:include",
"build/linux/debian_bullseye_amd64-sysroot/usr/lib:headers",
],
"build/linux/debian_bullseye_arm64-sysroot:headers": [
"build/linux/debian_bullseye_arm64-sysroot/usr/include:include",
"build/linux/debian_bullseye_arm64-sysroot/usr/lib:headers",
],
"build/linux/debian_bullseye_i386-sysroot:headers": [
"build/linux/debian_bullseye_i386-sysroot/usr/include:include",
"build/linux/debian_bullseye_i386-sysroot/usr/lib:headers",
],
"build/linux/debian_bullseye_armhf-sysroot:headers": [
"build/linux/debian_bullseye_armhf-sysroot/usr/include:include",
"build/linux/debian_bullseye_armhf-sysroot/usr/lib:headers",
],
"build/linux/debian_bullseye_amd64-sysroot:link": [
"build/linux/debian_bullseye_amd64-sysroot/lib/x86_64-linux-gnu:libso",
"build/linux/debian_bullseye_amd64-sysroot/lib64/ld-linux-x86-64.so.2",
"build/linux/debian_bullseye_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu:libgcc",
"build/linux/debian_bullseye_amd64-sysroot/usr/lib/x86_64-linux-gnu:libs",
"third_party/llvm-build/Release+Asserts/bin:llddeps",
# The following inputs are used for sanitizer builds.
# It might be better to add them only for sanitizer builds if there is a performance issue.
"third_party/llvm-build/Release+Asserts/lib/clang:libs",
],
"build/linux/debian_bullseye_i386-sysroot:link": [
"build/linux/debian_bullseye_i386-sysroot/lib:libso",
"build/linux/debian_bullseye_i386-sysroot/usr/lib/gcc/i686-linux-gnu:libgcc",
"build/linux/debian_bullseye_i386-sysroot/usr/lib/i386-linux-gnu:libs",
"third_party/llvm-build/Release+Asserts/bin:llddeps",
],
"build/linux/debian_bullseye_armhf-sysroot:link": [
"build/linux/debian_bullseye_armhf-sysroot/lib:libso",
"build/linux/debian_bullseye_armhf-sysroot/usr/lib/gcc/arm-linux-gnueabihf:libgcc",
"build/linux/debian_bullseye_armhf-sysroot/usr/lib/arm-linux-gnueabihf:libs",
"third_party/llvm-build/Release+Asserts/bin:llddeps",
],
"third_party/android_toolchain/ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot:headers": [
"third_party/android_toolchain/ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include:include",
"third_party/android_toolchain/ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/local/include:include",
],
"third_party/llvm-build/Release+Asserts/bin/clang++:link": [
"third_party/llvm-build/Release+Asserts/bin:llddeps",
],
"third_party/llvm-build/Release+Asserts:link": [
"third_party/llvm-build/Release+Asserts/bin:llddeps",
"third_party/llvm-build/Release+Asserts/lib/clang:libs",
],
})
step_config["input_deps"].update(clang_all.input_deps)
step_config["rules"].extend(clang_unix.rules(ctx))
if win_sdk.enabled(ctx):
win_sdk.step_config(ctx, step_config)
return step_config
clang = module(
"clang",
step_config = __step_config,
filegroups = __filegroups,
handlers = __handlers,
)