From 7d7e71d1163ef1a7bd594a8d32148cda85a36529 Mon Sep 17 00:00:00 2001 From: Evgenii Oparin Date: Mon, 8 Apr 2024 17:37:23 +0300 Subject: [PATCH] patch --- go/private/actions/link.bzl | 4 ++++ go/private/context.bzl | 1 + 2 files changed, 5 insertions(+) diff --git a/go/private/actions/link.bzl b/go/private/actions/link.bzl index 51875dad8..6b0181463 100644 --- a/go/private/actions/link.bzl +++ b/go/private/actions/link.bzl @@ -89,6 +89,10 @@ def emit_link( builder_args = go.builder_args(go, "link") tool_args = go.tool_args(go) + # use ar tool from cc toolchain if cc toolchain provides it + if go.cgo_tools and go.cgo_tools.ar_path and go.cgo_tools.ar_path.endswith("ar"): + tool_args.add_all(["-extar", go.cgo_tools.ar_path]) + # Add in any mode specific behaviours if go.mode.race: tool_args.add("-race") diff --git a/go/private/context.bzl b/go/private/context.bzl index 1b7dfb1d4..b24c6cbfd 100644 --- a/go/private/context.bzl +++ b/go/private/context.bzl @@ -837,6 +837,7 @@ def _cgo_context_data_impl(ctx): ld_static_lib_path = ld_static_lib_path, ld_dynamic_lib_path = ld_dynamic_lib_path, ld_dynamic_lib_options = ld_dynamic_lib_options, + ar_path = cc_toolchain.ar_executable, ), )]