Skip to content

Commit 87554d1

Browse files
angusleesMaskRay
authored andcommitted
[bazel] Use binary_alias instead of symlinks for ld.lld and friends
Symlinks are poorly supported in Bazel+remote-exec. Create the links from `ld.lld`, `ld64.lld`, `lld-link`, `wasm-ld` to `lld` using LLVM's `binary_alias` instead. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D157830
1 parent 43114cb commit 87554d1

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

utils/bazel/llvm-project-overlay/lld/BUILD.bazel

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
load("@bazel_skylib//rules:expand_template.bzl", "expand_template")
66
load("//llvm:tblgen.bzl", "gentbl")
7+
load("//llvm:binary_alias.bzl", "binary_alias")
78
load(
89
"//:vars.bzl",
910
"LLVM_VERSION",
@@ -315,16 +316,15 @@ cc_binary(
315316
# macOS require that the binary be named "ld64.lld".
316317
# Windows require that the binary be named "lld-link".
317318
# WebAssembly builds require that the binary be named "wasm-ld".
318-
genrule(
319-
name = "gen_lld",
320-
srcs = [":lld"],
321-
outs = [
319+
[
320+
binary_alias(
321+
name = name,
322+
binary = ":lld",
323+
)
324+
for name in [
322325
"ld.lld",
323326
"ld64.lld",
324327
"lld-link",
325328
"wasm-ld",
326-
],
327-
cmd =
328-
"target=$$(basename $<); for n in ld.lld ld64.lld lld-link wasm-ld; do ln -sf $$target $(@D)/$$n; done",
329-
output_to_bindir = 1,
330-
)
329+
]
330+
]

0 commit comments

Comments
 (0)