Skip to content

Commit f8251fa

Browse files
committed
Skip adding -lstatic to libtest and libstd on macOS
1 parent 478fc3a commit f8251fa

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

rust/private/rustc.bzl

+4-4
Original file line numberDiff line numberDiff line change
@@ -1609,7 +1609,7 @@ def _get_crate_dirname(crate):
16091609
"""
16101610
return crate.output.dirname
16111611

1612-
def _portable_link_flags(lib, use_pic, ambiguous_libs, get_lib_name, for_windows):
1612+
def _portable_link_flags(lib, use_pic, ambiguous_libs, get_lib_name, for_windows=False, for_macos=False):
16131613
artifact = get_preferred_artifact(lib, use_pic)
16141614
if ambiguous_libs and artifact.path in ambiguous_libs:
16151615
artifact = ambiguous_libs[artifact.path]
@@ -1647,7 +1647,7 @@ def _portable_link_flags(lib, use_pic, ambiguous_libs, get_lib_name, for_windows
16471647
artifact.basename.startswith("libtest-") or artifact.basename.startswith("libstd-") or
16481648
artifact.basename.startswith("test-") or artifact.basename.startswith("std-")
16491649
):
1650-
return ["-lstatic=%s" % get_lib_name(artifact)]
1650+
return [] if for_macos else ["-lstatic=%s" % get_lib_name(artifact)]
16511651
return [
16521652
"-lstatic=%s" % get_lib_name(artifact),
16531653
"-Clink-arg=-l%s" % (get_lib_name(artifact) if not for_windows else artifact.basename),
@@ -1679,7 +1679,7 @@ def _make_link_flags_darwin(linker_input_and_use_pic_and_ambiguous_libs):
16791679
("link-arg=-Wl,-force_load,%s" % get_preferred_artifact(lib, use_pic).path),
16801680
])
16811681
else:
1682-
ret.extend(_portable_link_flags(lib, use_pic, ambiguous_libs, get_lib_name_default, for_windows = False))
1682+
ret.extend(_portable_link_flags(lib, use_pic, ambiguous_libs, get_lib_name_default, for_macos = True))
16831683
return ret
16841684

16851685
def _make_link_flags_default(linker_input_and_use_pic_and_ambiguous_libs):
@@ -1696,7 +1696,7 @@ def _make_link_flags_default(linker_input_and_use_pic_and_ambiguous_libs):
16961696
"link-arg=-Wl,--no-whole-archive",
16971697
])
16981698
else:
1699-
ret.extend(_portable_link_flags(lib, use_pic, ambiguous_libs, get_lib_name_default, for_windows = False))
1699+
ret.extend(_portable_link_flags(lib, use_pic, ambiguous_libs, get_lib_name_default))
17001700
return ret
17011701

17021702
def _libraries_dirnames(linker_input_and_use_pic_and_ambiguous_libs):

0 commit comments

Comments
 (0)