Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions cc/private/toolchain/unix_cc_configure.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,13 @@ def _find_linker_path(repository_ctx, cc, linker, is_clang):

# Extract linker path from:
# /usr/bin/clang ...
# "/usr/bin/ld.lld" -pie -z ...
linker_command = result.stderr.splitlines()[-1]
# "/usr/bin/ld.lld" -pie -z ...
# We use the leading space and quoted path to find invocations.
# https://github.com/llvm/llvm-project/blob/85c78274358717e4d5d019a801decba5c1add484/clang/lib/Driver/Job.cpp#L207-L209
invocations = [line for line in result.stderr.splitlines() if line.startswith(" \"")]
Comment thread
fmeum marked this conversation as resolved.
if not invocations:
return linker
linker_command = invocations[-1]
return linker_command.strip().split(" ")[0].strip("\"'")

def _add_compiler_option_if_supported(repository_ctx, cc, option):
Expand Down