Skip to content

Use llvm-bitcode-linker as the default linker for nvptx64-nvidia-cuda #927

@kjetilkjeka

Description

@kjetilkjeka

Proposal

The current default linker for the nvptx64-nvidia-cuda target is rust-ptx-linker. However, the upstream rust-ptx-linker project has been broken since 2022 and is effectively unmaintained. In practice, this makes it difficult or impossible to use for most builds.

Since the introduction of the llvm-bitcode-linker it has become the recommended linker for nvptx64-nvidia-cuda in the official Rust documentation. The llvm-bitcode-linker provides a stable and maintainable path forward, and is in real world use for targeting Nvidia GPUs.

Given that:

  • rust-ptx-linker is no longer functional or maintained,
  • llvm-bitcode-linker is the officially recommended solution and actively maintained,
  • and there are no known current users of rust-ptx-linker,

I propose to switch the default linker for the nvptx64-nvidia-cuda target to llvm-bitcode-linker.

This change will:

  • Eliminate the need for explicitly passing -C linker-flavor=llbc.
  • Simplify the build setup for CUDA targets.
  • Lay the groundwork for potentially removing the dedicated “ptx” linker flavor in the future.

Mentors or Reviewers

The actual engineering work is trivial. I will "mentor" and create the MR if accepted

Process

The main points of the Major Change Process are as follows:

  • File an issue describing the proposal.
  • A compiler team member who is knowledgeable in the area can second by writing @rustbot second or kickoff a team FCP with @rfcbot fcp $RESOLUTION.
  • Once an MCP is seconded, the Final Comment Period begins.
    • Final Comment Period lasts for 10 days after all outstanding concerns are solved.
    • Outstanding concerns will block the Final Comment Period from finishing. Once all concerns are resolved, the 10 day countdown is restarted.
    • If no concerns are raised after 10 days since the resolution of the last outstanding concern, the MCP is considered approved.

You can read more about Major Change Proposals on forge.

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-compilerAdd this label so rfcbot knows to poll the compiler teamfinal-comment-periodThe FCP has started, most (if not all) team members are in agreementmajor-changeA proposal to make a major change to rustc

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions