From 1c3d02eb3594e9d92cd26562e797142ee34505b2 Mon Sep 17 00:00:00 2001 From: Ilya Biryukov Date: Tue, 4 Sep 2018 03:09:52 -0700 Subject: Use LLD when building with downloaded GPU toolchain This improves build times when using the downloaded clang toolchain. Additionally, remove '-B/usr/bin' flags from the cuda CROSSTOOL when using the downloaded toolchain. It was forcing 'clang' to first search for the linker in '/usr/bin', preventing downloaded LLD from being selected. PiperOrigin-RevId: 211430374 --- tools/bazel.rc | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tools') diff --git a/tools/bazel.rc b/tools/bazel.rc index 660e3d3280..601e07ffdd 100644 --- a/tools/bazel.rc +++ b/tools/bazel.rc @@ -33,6 +33,11 @@ build:mkl_open_source_only --define=using_mkl_dnn_only=true build:download_clang --crosstool_top=@local_config_download_clang//:toolchain build:download_clang --define=using_clang=true +# Instruct clang to use LLD for linking. +# This only works with GPU builds currently, since Bazel sets -B/usr/bin in +# auto-generated CPU crosstool, forcing /usr/bin/ld.lld to be preferred over +# the downloaded one. +build:download_clang_use_lld --linkopt='-fuse-ld=lld' build:cuda --crosstool_top=@local_config_cuda//crosstool:toolchain build:cuda --define=using_cuda=true --define=using_cuda_nvcc=true -- cgit v1.2.3