From f30a3afddeb50a3dc192230128e78eb4418a5229 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Sat, 1 Oct 2022 23:27:58 +0300 Subject: [PATCH] remove redundant flags - -target - linkopts --- toolchain/private/cc_toolchains.bzl | 4 ++-- toolchain/private/defs.bzl | 4 ---- toolchain/zig_toolchain.bzl | 14 +------------- 3 files changed, 3 insertions(+), 19 deletions(-) diff --git a/toolchain/private/cc_toolchains.bzl b/toolchain/private/cc_toolchains.bzl index a7b6ebe..7de5017 100644 --- a/toolchain/private/cc_toolchains.bzl +++ b/toolchain/private/cc_toolchains.bzl @@ -31,11 +31,11 @@ def declare_cc_toolchains(os, zig_sdk_path, zig_include_root): ) absolute_tool_paths[name] = tool_path - linkopts = target_config.linkopts dynamic_library_linkopts = target_config.dynamic_library_linkopts copts = target_config.copts + linkopts = [] for s in getattr(target_config, "linker_version_scripts", []): - linkopts = linkopts + ["-Wl,--version-script,%s/%s" % (zig_sdk_path, s)] + linkopts = ["-Wl,--version-script,%s/%s" % (zig_sdk_path, s)] for incl in getattr(target_config, "compiler_extra_includes", []): copts = copts + ["-include", zig_sdk_path + "/" + incl] diff --git a/toolchain/private/defs.bzl b/toolchain/private/defs.bzl index b86c1e6..25ee8e0 100644 --- a/toolchain/private/defs.bzl +++ b/toolchain/private/defs.bzl @@ -54,7 +54,6 @@ def _target_darwin(gocpu, zigcpu): "libc/include/any-macos.{}-any".format(min_os), "libc/include/any-macos-any", ], - linkopts = [], dynamic_library_linkopts = ["-Wl,-undefined=dynamic_lookup"], copts = [], bazel_target_cpu = "darwin", @@ -73,7 +72,6 @@ def _target_windows(gocpu, zigcpu): "libunwind/include", "libc/include/any-windows-any", ], - linkopts = [], dynamic_library_linkopts = [], copts = [], bazel_target_cpu = "x64_windows", @@ -106,7 +104,6 @@ def _target_linux_gnu(gocpu, zigcpu, glibc_version): toplevel_include = ["glibc-hacks"] if fcntl_hack else [], compiler_extra_includes = ["glibc-hacks/glibchack-fcntl.h"] if fcntl_hack else [], linker_version_scripts = ["glibc-hacks/fcntl.map"] if fcntl_hack else [], - linkopts = ["-lc++", "-lc++abi"], dynamic_library_linkopts = [], copts = [], bazel_target_cpu = "k8", @@ -131,7 +128,6 @@ def _target_linux_musl(gocpu, zigcpu): (["libc/include/{}-linux-any".format(zigcpu)] if zigcpu != "x86_64" else []) + [ "libc/include/any-linux-any", ], - linkopts = [], dynamic_library_linkopts = [], copts = ["-D_LIBCPP_HAS_MUSL_LIBC", "-D_LIBCPP_HAS_THREAD_API_PTHREAD"], bazel_target_cpu = "k8", diff --git a/toolchain/zig_toolchain.bzl b/toolchain/zig_toolchain.bzl index 7ffdba8..f76aa80 100644 --- a/toolchain/zig_toolchain.bzl +++ b/toolchain/zig_toolchain.bzl @@ -93,8 +93,6 @@ def _zig_cc_toolchain_config_impl(ctx): "-I" + d for d in ctx.attr.cxx_builtin_include_directories ] + [ - "-target", - ctx.attr.target + ctx.attr.target_suffix, "-no-canonical-prefixes", "-Wno-builtin-macro-redefined", "-D__DATE__=\"redacted\"", @@ -128,17 +126,7 @@ def _zig_cc_toolchain_config_impl(ctx): default_linker_flags = feature( name = "default_linker_flags", enabled = True, - flag_sets = [ - flag_set( - actions = all_link_actions, - flag_groups = [ - flag_group( - flags = ["-target", ctx.attr.target] + - ctx.attr.linkopts, - ), - ], - ), - ] + dynamic_library_flag_sets, + flag_sets = dynamic_library_flag_sets, ) features = [