Skip to content

Using rustc as the linker driver for mixed C++/Rust binaries #83282

Closed
@hlopko

Description

@hlopko

This is an opening of a very likely very short design discussion for #81490.

Hi @petrochenkov, thanks so much for pushing for this! I just filed bazelbuild/rules_rust#637 to document what and why we need to be able to link mixed C++/Rust binaries with rustc as the linker driver. I believe what you propose will solve all our problems, but just to be sure I'd like to reiterate:

  • we'd like to control bundling (whether or not a library is wrapped in --whole-archive/--no-whole-archive
  • we'd like to be able to pass --start-lib/--end-lib with object files instead of a static archive. I believe we will be able to do that using --codegen=link-arg after the proposed change to keep relative order of -l: flags and --codegen=link-arg respected
  • we'd like to pass libraries verbatim

My questions:

  1. Do all 3 points make sense to you and do you agree that native_link_modifiers aim to solve them?
  2. Do you have a timeline in which this could be implemented? Do you seek contributions for this effort?

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions