From b5adb8aaa923da02cca09b4feba903e251edc914 Mon Sep 17 00:00:00 2001 From: Cameron Pickett Date: Tue, 20 Aug 2024 06:37:52 -0700 Subject: [PATCH] Revert D61490661: cxx: Remove `preferred_linkage = "static"` on bridges Differential Revision: D61490661 Original commit changeset: d4a7f6f69571 Original Phabricator Diff: D61490661 fbshipit-source-id: 3692eafac7920b555d2749dd2d8fe86eddccdeca --- decls/rust_common.bzl | 9 --------- decls/rust_rules.bzl | 1 - rust/link_info.bzl | 2 ++ rust/rust_library.bzl | 4 ---- 4 files changed, 2 insertions(+), 14 deletions(-) diff --git a/decls/rust_common.bzl b/decls/rust_common.bzl index 850804f51..4caebd7a3 100644 --- a/decls/rust_common.bzl +++ b/decls/rust_common.bzl @@ -70,14 +70,6 @@ def _linker_flags_arg(): """), } -def _exported_linker_flags_arg(): - return { - "exported_linker_flags": attrs.list(attrs.arg(anon_target_compatible = True), default = [], doc = """ - A set of additional flag to pass before this item on the link line, even if - this items is compiled to a DSO. -"""), - } - def _crate(crate_type): return { "crate": crate_type, @@ -165,7 +157,6 @@ rust_common = struct( edition_arg = _edition_arg, rustc_flags_arg = _rustc_flags_arg, linker_flags_arg = _linker_flags_arg, - exported_linker_flags_arg = _exported_linker_flags_arg, crate = _crate, crate_root = _crate_root, env_arg = _env_arg, diff --git a/decls/rust_rules.bzl b/decls/rust_rules.bzl index fc431a19b..ff99a9571 100644 --- a/decls/rust_rules.bzl +++ b/decls/rust_rules.bzl @@ -182,7 +182,6 @@ rust_library = prelude_rule( # don't have to know whether we're building a rust_binary or a # rust_library. rust_common.linker_flags_arg() | - rust_common.exported_linker_flags_arg() | rust_common.env_arg() | rust_common.crate(crate_type = attrs.option(attrs.string(), default = None)) | rust_common.crate_root() | diff --git a/rust/link_info.bzl b/rust/link_info.bzl index 06f77cf1a..34fafc7fd 100644 --- a/rust/link_info.bzl +++ b/rust/link_info.bzl @@ -402,6 +402,8 @@ def inherited_exported_link_deps(ctx: AnalysisContext, dep_ctx: DepCollectionCon if dep.proc_macro_marker != None: continue + if dep_ctx.advanced_unstable_linking: + deps[dep.label] = dep.dep for dep in dep.info.exported_link_deps: deps[dep.label] = dep diff --git a/rust/rust_library.bzl b/rust/rust_library.bzl index 1eaf2cac6..d0df276e9 100644 --- a/rust/rust_library.bzl +++ b/rust/rust_library.bzl @@ -425,12 +425,10 @@ def _link_infos( default = LinkInfo( linkables = [SharedLibLinkable(lib = lib.output)], external_debug_info = external_debug_info, - pre_flags = ctx.attrs.exported_linker_flags, ), stripped = LinkInfo( linkables = [SharedLibLinkable(lib = lib.stripped_output)], external_debug_info = external_debug_info, - pre_flags = ctx.attrs.exported_linker_flags, ), ) else: @@ -441,14 +439,12 @@ def _link_infos( linker_type = linker_type, )], external_debug_info = external_debug_info, - pre_flags = ctx.attrs.exported_linker_flags, ), stripped = LinkInfo( linkables = [ArchiveLinkable( archive = Archive(artifact = lib.stripped_output), linker_type = linker_type, )], - pre_flags = ctx.attrs.exported_linker_flags, ), ) return link_infos