Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix linkage for large binaries on mips64 platforms #111772

Merged
merged 1 commit into from May 31, 2023

Conversation

liushuyu
Copy link
Contributor

@liushuyu liushuyu commented May 19, 2023

This pull request fixes the linkage for large binaries on mips64 platforms by enabling the xgot feature in LLVM.

It is well understood that the generated binary will gain a hefty performance penalty where the external symbol jumps now cost at least three instructions each.

Also, this pull request does not address the same issue on the mips32 counterparts (due to being unable to test the changes thoroughly).

Should fix #52108

@rustbot
Copy link
Collaborator

rustbot commented May 19, 2023

r? @compiler-errors

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 19, 2023
@rustbot
Copy link
Collaborator

rustbot commented May 19, 2023

These commits modify compiler targets.
(See the Target Tier Policy.)

@rust-log-analyzer

This comment has been minimized.

@liushuyu liushuyu force-pushed the ubuntu/mips64-linkage branch 2 times, most recently from bbaddbc to 5730d06 Compare May 20, 2023 23:25
@compiler-errors
Copy link
Member

r? compiler

@rustbot rustbot assigned jackh726 and unassigned compiler-errors May 23, 2023
Copy link
Member

@jackh726 jackh726 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it reasonable to write a test for this? Or is this fact that it only triggers for large binaries make that intractable?

# FIXME: remove this if condition on the next bootstrap bump
# cfg(bootstrap)
if self.build_triple().startswith('mips'):
env["RUSTFLAGS"] += " -Ctarget-feature=+xgot"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should ideally have a comment why this exists.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@liushuyu
Copy link
Contributor Author

Is it reasonable to write a test for this? Or is this fact that it only triggers for large binaries make that intractable?

Usually, it will trigger when the external symbol is situated in a location that is not encode-able into an ld instruction. As you can see from the assembly, the xgot basically workaround this by loading high bits and low bits separately into the register to avoid this situation.

liushuyu added a commit to AOSC-Archive/autobuild3 that referenced this pull request May 26, 2023
* Targets MIPS III
* Use xgot linkage (see rust-lang/rust#111772)
... by enabling xgot feature

Co-Authored-By: Zixing Liu <zixing.liu@canonical.com>
@jackh726
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented May 29, 2023

📌 Commit b65c2af has been approved by jackh726

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 29, 2023
Nilstrieb added a commit to Nilstrieb/rust that referenced this pull request May 30, 2023
…jackh726

Fix linkage for large binaries on mips64 platforms

This pull request fixes the linkage for large binaries on mips64 platforms by enabling the `xgot` feature in LLVM.

It is well understood that the generated binary will gain a hefty performance penalty where the external symbol jumps now cost at least three instructions each.

Also, this pull request does not address the same issue on the mips32 counterparts (due to being unable to test the changes thoroughly).

Should fix rust-lang#52108
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request May 31, 2023
…jackh726

Fix linkage for large binaries on mips64 platforms

This pull request fixes the linkage for large binaries on mips64 platforms by enabling the `xgot` feature in LLVM.

It is well understood that the generated binary will gain a hefty performance penalty where the external symbol jumps now cost at least three instructions each.

Also, this pull request does not address the same issue on the mips32 counterparts (due to being unable to test the changes thoroughly).

Should fix rust-lang#52108
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request May 31, 2023
…jackh726

Fix linkage for large binaries on mips64 platforms

This pull request fixes the linkage for large binaries on mips64 platforms by enabling the `xgot` feature in LLVM.

It is well understood that the generated binary will gain a hefty performance penalty where the external symbol jumps now cost at least three instructions each.

Also, this pull request does not address the same issue on the mips32 counterparts (due to being unable to test the changes thoroughly).

Should fix rust-lang#52108
bors added a commit to rust-lang-ci/rust that referenced this pull request May 31, 2023
…iaskrgr

Rollup of 5 pull requests

Successful merges:

 - rust-lang#111772 (Fix linkage for large binaries on mips64 platforms)
 - rust-lang#111975 (Stop normalizing so many different prefixes)
 - rust-lang#111979 (Respect CARGOFLAGS in bootstrap.py)
 - rust-lang#112089 (Add `--warnings warn` flag to `x.py`)
 - rust-lang#112103 (Bootstrap update to 1.71 beta)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit fd1c0d8 into rust-lang:master May 31, 2023
11 checks passed
@rustbot rustbot added this to the 1.72.0 milestone May 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The 1.27 rust-stable bootstrap build step fails on mips64
7 participants