@@ -26,7 +26,7 @@ load("//rust:rust_common.bzl", "BuildInfo")
2626load ("//rust/private:rustc.bzl" , "get_linker_and_args" )
2727
2828# buildifier: disable=bzl-visibility
29- load ("//rust/private:utils.bzl" , "find_cc_toolchain" , "get_preferred_artifact" )
29+ load ("//rust/private:utils.bzl" , "find_cc_toolchain" , "get_lib_name_default" , " get_preferred_artifact" )
3030
3131# TODO(hlopko): use the more robust logic from rustc.bzl also here, through a reasonable API.
3232def _get_libs_for_static_executable (dep ):
@@ -116,11 +116,11 @@ def _generate_cc_link_build_info(ctx, cc_lib):
116116 for linker_input in cc_lib [CcInfo ].linking_context .linker_inputs .to_list ():
117117 for lib in linker_input .libraries :
118118 if lib .static_library :
119- linker_flags .append ("-lstatic={}" .format (lib .static_library . owner . name ))
119+ linker_flags .append ("-lstatic={}" .format (get_lib_name_default ( lib .static_library ) ))
120120 linker_search_paths .append (lib .static_library .dirname )
121121 compile_data .append (lib .static_library )
122122 elif lib .pic_static_library :
123- linker_flags .append ("-lstatic={}" .format (lib .pic_static_library . owner . name ))
123+ linker_flags .append ("-lstatic={}" .format (get_lib_name_default ( lib .pic_static_library ) ))
124124 linker_search_paths .append (lib .pic_static_library .dirname )
125125 compile_data .append (lib .pic_static_library )
126126
0 commit comments