From 5d23f7b6bbb188fb4976f7d8b641b0e3d7655970 Mon Sep 17 00:00:00 2001 From: Fabian Meumertzheim Date: Mon, 16 Aug 2021 18:27:23 +0200 Subject: Use lld only with clang on Linux Restores compatibility with gcc on linux. --- BUILD.bazel | 13 +++++++++++++ driver/BUILD.bazel | 6 +++--- examples/src/main/native/BUILD.bazel | 4 ++-- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index 4ad9b371..c98d0d72 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -81,3 +81,16 @@ alias( name = "jazzer-api.publish", actual = "//agent/src/main/java/com/code_intelligence/jazzer/api:api_export.publish", ) + +config_setting( + name = "clang", + flag_values = {"@bazel_tools//tools/cpp:compiler": "clang"}, +) + +alias( + name = "clang_on_linux", + actual = select({ + ":clang": "@platforms//os:linux", + "//conditions:default": ":clang", + }), +) diff --git a/driver/BUILD.bazel b/driver/BUILD.bazel index d38acffc..905289e6 100644 --- a/driver/BUILD.bazel +++ b/driver/BUILD.bazel @@ -91,7 +91,7 @@ cc_binary( linkopts = [ "-rdynamic", ] + select({ - "@platforms//os:linux": ["-fuse-ld=lld"], + "//:clang_on_linux": ["-fuse-ld=lld"], "//conditions:default": [], }), visibility = ["//visibility:public"], @@ -118,7 +118,7 @@ cc_binary( "-static-libsan", "-rdynamic", ] + select({ - "@platforms//os:linux": ["-fuse-ld=lld"], + "//:clang_on_linux": ["-fuse-ld=lld"], "//conditions:default": [], }), visibility = ["//visibility:public"], @@ -142,7 +142,7 @@ cc_binary( "-fsanitize-link-c++-runtime", "-rdynamic", ] + select({ - "@platforms//os:linux": ["-fuse-ld=lld"], + "//:clang_on_linux": ["-fuse-ld=lld"], "//conditions:default": [], }), visibility = ["//visibility:public"], diff --git a/examples/src/main/native/BUILD.bazel b/examples/src/main/native/BUILD.bazel index 255e3509..91d6f8cd 100644 --- a/examples/src/main/native/BUILD.bazel +++ b/examples/src/main/native/BUILD.bazel @@ -10,7 +10,7 @@ cc_shared_library( "-fsanitize=fuzzer-no-link,address", ], linkopts = select({ - "@platforms//os:linux": ["-fuse-ld=lld"], + "//:clang_on_linux": ["-fuse-ld=lld"], "//conditions:default": [], }), visibility = ["//examples:__pkg__"], @@ -30,7 +30,7 @@ cc_shared_library( "-fno-sanitize-recover=all", ], linkopts = select({ - "@platforms//os:linux": ["-fuse-ld=lld"], + "//:clang_on_linux": ["-fuse-ld=lld"], "//conditions:default": [], }), visibility = ["//examples:__pkg__"], -- cgit v1.2.3