[AMDGPU] Remove s_wakeup_barrier instruction (#122277)
[llvm-project.git] / utils / bazel / llvm-project-overlay / lld / BUILD.bazel
blob40154de2c7a02a2e018994a98d4105061d00c600
1 # This file is licensed under the Apache License v2.0 with LLVM Exceptions.
2 # See https://llvm.org/LICENSE.txt for license information.
3 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5 load(
6     "//:vars.bzl",
7     "LLVM_VERSION",
9 load("//llvm:binary_alias.bzl", "binary_alias")
10 load("//llvm:driver.bzl", "llvm_driver_cc_binary")
11 load("//llvm:tblgen.bzl", "gentbl")
13 package(
14     default_visibility = ["//visibility:public"],
15     features = ["layering_check"],
18 licenses(["notice"])
20 # TODO: Actually compute version info
21 genrule(
22     name = "config_version_gen",
23     outs = ["include/lld/Common/Version.inc"],
24     cmd = "echo '#define LLD_VERSION_STRING \"{}\"' > $@".format(LLVM_VERSION),
27 genrule(
28     name = "vcs_version_gen",
29     outs = ["Common/VCSVersion.inc"],
30     cmd = "echo '#undef LLD_REVISION' >> $@\n" +
31           "echo '#undef LLD_REPOSITORY' >> $@\n",
34 # See https://github.com/bazelbuild/bazel/issues/13803
35 cc_library(
36     name = "vcs_version",
37     hdrs = ["Common/VCSVersion.inc"],
38     strip_include_prefix = "Common",
41 cc_library(
42     name = "Common",
43     srcs = [":config_version_gen"] + glob(["Common/*.cpp"]),
44     hdrs = glob(["include/lld/Common/*.h"]),
45     includes = ["include"],
46     deps = [
47         ":vcs_version",
48         "//llvm:CodeGen",
49         "//llvm:Core",
50         "//llvm:DebugInfoDWARF",
51         "//llvm:IRPrinter",
52         "//llvm:Option",
53         "//llvm:ProfileData",
54         "//llvm:Support",
55         "//llvm:Target",
56         "//llvm:TargetParser",
57         "//llvm:config",
58     ],
61 gentbl(
62     name = "elf_options_inc_gen",
63     # See https://github.com/bazelbuild/bazel/issues/13803
64     strip_include_prefix = "ELF",
65     tbl_outs = [(
66         "-gen-opt-parser-defs",
67         "ELF/Options.inc",
68     )],
69     tblgen = "//llvm:llvm-tblgen",
70     td_file = "ELF/Options.td",
71     td_srcs = [
72         "//llvm:include/llvm/Option/OptParser.td",
73     ],
76 cc_library(
77     name = "ELF",
78     srcs = glob([
79         "ELF/*.cpp",
80         "ELF/*.h",
81         "ELF/Arch/*.cpp",
82     ]),
83     includes = ["ELF"],
84     textual_hdrs = [
85         "ELF/Arch/PPCInsns.def",
86     ],
87     deps = [
88         ":Common",
89         ":elf_options_inc_gen",
90         "//llvm:AllTargetsAsmParsers",
91         "//llvm:AllTargetsCodeGens",
92         "//llvm:AllTargetsDisassemblers",
93         "//llvm:Analysis",
94         "//llvm:BinaryFormat",
95         "//llvm:BitReader",
96         "//llvm:BitWriter",
97         "//llvm:CodeGen",
98         "//llvm:Core",
99         "//llvm:DebugInfoDWARF",
100         "//llvm:Demangle",
101         "//llvm:IPO",
102         "//llvm:LTO",
103         "//llvm:Linker",
104         "//llvm:MC",
105         "//llvm:Object",
106         "//llvm:Option",
107         "//llvm:Passes",
108         "//llvm:Remarks",
109         "//llvm:Support",
110         "//llvm:TargetParser",
111         "//llvm:TransformUtils",
112         "//llvm:config",
113         "@llvm_zlib//:zlib",
114         "@llvm_zstd//:zstd",
115     ],
118 gentbl(
119     name = "coff_options_inc_gen",
120     # See https://github.com/bazelbuild/bazel/issues/13803
121     strip_include_prefix = "COFF",
122     tbl_outs = [(
123         "-gen-opt-parser-defs",
124         "COFF/Options.inc",
125     )],
126     tblgen = "//llvm:llvm-tblgen",
127     td_file = "COFF/Options.td",
128     td_srcs = [
129         "//llvm:include/llvm/Option/OptParser.td",
130     ],
133 cc_library(
134     name = "COFF",
135     srcs = glob([
136         "COFF/*.cpp",
137         "COFF/*.h",
138     ]),
139     includes = ["COFF"],
140     deps = [
141         ":Common",
142         ":coff_options_inc_gen",
143         "//llvm:AllTargetsAsmParsers",
144         "//llvm:AllTargetsCodeGens",
145         "//llvm:AllTargetsDisassemblers",
146         "//llvm:Analysis",
147         "//llvm:BinaryFormat",
148         "//llvm:BitReader",
149         "//llvm:BitWriter",
150         "//llvm:Core",
151         "//llvm:DebugInfo",
152         "//llvm:DebugInfoCodeView",
153         "//llvm:DebugInfoMSF",
154         "//llvm:DebugInfoPDB",
155         "//llvm:Demangle",
156         "//llvm:IPO",
157         "//llvm:LTO",
158         "//llvm:LibDriver",
159         "//llvm:Linker",
160         "//llvm:MC",
161         "//llvm:Object",
162         "//llvm:Option",
163         "//llvm:Support",
164         "//llvm:Symbolize",
165         "//llvm:Target",
166         "//llvm:TargetParser",
167         "//llvm:TransformUtils",
168         "//llvm:WindowsDriver",
169         "//llvm:WindowsManifest",
170         "//llvm:config",
171     ],
174 gentbl(
175     name = "mingw_options_inc_gen",
176     tbl_outs = [(
177         "-gen-opt-parser-defs",
178         "MinGW/Options.inc",
179     )],
180     tblgen = "//llvm:llvm-tblgen",
181     td_file = "MinGW/Options.td",
182     td_srcs = [
183         "//llvm:include/llvm/Option/OptParser.td",
184     ],
187 cc_library(
188     name = "MinGW",
189     srcs = glob([
190         "MinGW/*.cpp",
191     ]),
192     includes = ["MinGW"],
193     deps = [
194         ":Common",
195         ":mingw_options_inc_gen",
196         "//llvm:Option",
197         "//llvm:Support",
198         "//llvm:TargetParser",
199     ],
202 gentbl(
203     name = "macho_options_inc_gen",
204     # See https://github.com/bazelbuild/bazel/issues/13803
205     strip_include_prefix = "MachO",
206     tbl_outs = [(
207         "-gen-opt-parser-defs",
208         "MachO/Options.inc",
209     )],
210     tblgen = "//llvm:llvm-tblgen",
211     td_file = "MachO/Options.td",
212     td_srcs = [
213         "//llvm:include/llvm/Option/OptParser.td",
214     ],
217 cc_library(
218     name = "MachO",
219     srcs = glob([
220         "MachO/**/*.cpp",
221         "MachO/**/*.h",
222     ]),
223     includes = ["MachO"],
224     deps = [
225         ":Common",
226         ":macho_options_inc_gen",
227         "//libunwind:unwind_headers_only",
228         "//llvm:BinaryFormat",
229         "//llvm:BitReader",
230         "//llvm:BitWriter",
231         "//llvm:CGData",
232         "//llvm:Core",
233         "//llvm:DebugInfoDWARF",
234         "//llvm:Demangle",
235         "//llvm:LTO",
236         "//llvm:MC",
237         "//llvm:ObjCARC",
238         "//llvm:Object",
239         "//llvm:Option",
240         "//llvm:ProfileData",
241         "//llvm:Support",
242         "//llvm:TargetParser",
243         "//llvm:TextAPI",
244         "//llvm:config",
245     ],
248 gentbl(
249     name = "wasm_options_inc_gen",
250     # See https://github.com/bazelbuild/bazel/issues/13803
251     strip_include_prefix = "wasm",
252     tbl_outs = [(
253         "-gen-opt-parser-defs",
254         "wasm/Options.inc",
255     )],
256     tblgen = "//llvm:llvm-tblgen",
257     td_file = "wasm/Options.td",
258     td_srcs = [
259         "//llvm:include/llvm/Option/OptParser.td",
260     ],
263 cc_library(
264     name = "Wasm",
265     srcs = glob([
266         "wasm/*.cpp",
267         "wasm/*.h",
268     ]),
269     includes = ["wasm"],
270     deps = [
271         ":Common",
272         ":wasm_options_inc_gen",
273         "//llvm:AllTargetsAsmParsers",
274         "//llvm:AllTargetsCodeGens",
275         "//llvm:BinaryFormat",
276         "//llvm:BitWriter",
277         "//llvm:Core",
278         "//llvm:Demangle",
279         "//llvm:LTO",
280         "//llvm:MC",
281         "//llvm:Object",
282         "//llvm:Option",
283         "//llvm:ProfileData",
284         "//llvm:Support",
285         "//llvm:TargetParser",
286         "//llvm:config",
287     ],
290 cc_library(
291     name = "lld-lib",
292     srcs = glob(["tools/lld/*.cpp"]),
293     deps = [
294         ":COFF",
295         ":Common",
296         ":ELF",
297         ":MachO",
298         ":MinGW",
299         ":Wasm",
300         "//llvm:Support",
301         "//llvm:TargetParser",
302     ],
305 llvm_driver_cc_binary(
306     name = "lld",
307     deps = [":lld-lib"],
310 # These are the required names for lld running under different environs.
312 # Unix/Linux require that the binary be named "ld.lld".
313 # macOS require that the binary be named "ld64.lld".
314 # Windows require that the binary be named "lld-link".
315 # WebAssembly builds require that the binary be named "wasm-ld".
317     binary_alias(
318         name = name,
319         binary = ":lld",
320     )
321     for name in [
322         "ld.lld",
323         "ld64.lld",
324         "lld-link",
325         "wasm-ld",
326     ]