Skip to content

Switch PLT default to "yes" for all targets except x86_64. #581

Closed
@pnkfelix

Description

@pnkfelix

Proposal

Back in 2018 with PR rust-lang/rust#54592, Rust changed to disable the procedure linkage table (PLT) by default, and the only way to opt back into enabling the PLT was via an unstable nightly-only debug flag, -Zplt=yes.

According to some experts on the instruction encodings, this is only an optimization for x86_64. As stated on PR rust-lang/rust#106380 (which proposed turning the global default to enable PLT for all targets, aka "default to -Zplt=yes"):

On x86-64, if the target symbol is preemptible, there is an R_X86_64_GLOB_DAT relocation, and the (very minor) optimization works as intended. However, if the target is non-preemptible, i.e. the target is resolved to the same component, this is actually a pessimization due to
the longer instruction.

PR rust-lang/rust#54592 only did its analysis against x86_64 performance, and we did find that disable PLT was a win there. So, if we are going to change the PLT default, we probably should ensure that x86_64 keeps the existing behavior.

(Spawned off of rust-lang/rust#106380 (comment) , where @nikic has provided an deeper analysis, that recommends the approach described in this MCP.)

Mentors or Reviewers

I would be willing to mentor/review this work.

Process

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

  • File an issue describing the proposal.
  • A compiler team member or contributor who is knowledgeable in the area can second by writing @rustbot second.
    • Finding a "second" suffices for internal changes. If however, you are proposing a new public-facing feature, such as a -C flag, then full team check-off is required.
    • Compiler team members can initiate a check-off via @rfcbot fcp merge on either the MCP or the PR.
  • Once an MCP is seconded, the Final Comment Period begins. If no objections are raised after 10 days, the MCP is considered approved.

You can read more about Major Change Proposals on forge.

Comments

This issue is not meant to be used for technical discussion. There is a Zulip stream for that. Use this issue to leave procedural comments, such as volunteering to review, indicating that you second the proposal (or third, etc), or raising a concern that you would like to be addressed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-compilerAdd this label so rfcbot knows to poll the compiler teammajor-changeA proposal to make a major change to rustcmajor-change-acceptedA major change proposal that was accepted

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions