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

bootstrap: Disable initial-exec TLS model on powerpc #85807

Merged
merged 1 commit into from
Aug 6, 2021

Conversation

glaubitz
Copy link
Contributor

Fixes #81334.

@rust-highfive
Copy link
Collaborator

r? @Mark-Simulacrum

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 29, 2021
@glaubitz
Copy link
Contributor Author

Please note: I have not fully tested this change yet. So please don't merge it yet although I'm sure it's correct.

@@ -1237,6 +1237,7 @@ impl<'a> Builder<'a> {
// efficient initial-exec TLS model. This doesn't work with `dlopen`,
// so we can't use it by default in general, but we can use it for tools
// and our own internal libraries.
#[cfg(not(target_arch = "powerpc"))]
Copy link
Contributor

Choose a reason for hiding this comment

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

I think cfg! macro would be nicer here.

Copy link
Member

Choose a reason for hiding this comment

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

Hm, I'm surprised to see cfg here at all; I'd expect this to check target.contains("powerpc") or so...

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe cfg would be wrong when cross-compiling - since "target" here refers to the target of bootstrap which would be the host (native) platform?

Copy link
Contributor

@infinity0 infinity0 May 29, 2021

Choose a reason for hiding this comment

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

@glaubitz try && !target.triple.startswith("powerpc-") instead

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. I'm testing the change now on a real PowerPC machine to see if it actually works.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The change as suggested by @infinity0 works fine and fixes the problem on 32-bit PowerPC.

But please feel free to use a different approach if anyone has a better idea. I don't insist on my particular approach.

@Aaron1011
Copy link
Member

If this TLS mode is completely unsupported on powerpc, then I think we should emit an error whenver someone tries to specify it on the command line. Otherwise, anyone else using -Ztls-model will run to this issue. This could be done in a follow-up PR.

@Mark-Simulacrum Mark-Simulacrum added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 29, 2021
@glaubitz glaubitz force-pushed the powerpc-disable-initial-exec-tls branch from c4b54f3 to 674e27e Compare May 31, 2021 08:17
@rust-log-analyzer

This comment has been minimized.

@glaubitz glaubitz force-pushed the powerpc-disable-initial-exec-tls branch from 674e27e to 283619c Compare May 31, 2021 08:21
@glaubitz
Copy link
Contributor Author

If this TLS mode is completely unsupported on powerpc, then I think we should emit an error whenver someone tries to specify it on the command line. Otherwise, anyone else using -Ztls-model will run to this issue. This could be done in a follow-up PR.

Is there some sort of feature matrix that Rust is carrying internally for every architecture where this information could be stored as a flag? I would guess this bug could affect the upcoming m68k port as well.

Plus, such a feature matrix could be used to determine whether a certain test is run or not. Currently, all tests seem to be checking per architecture rather than per feature.

@petrochenkov
Copy link
Contributor

petrochenkov commented May 31, 2021

If this TLS mode is completely unsupported on powerpc, then I think we should emit an error whenver someone tries to specify it on the command line.

This mode is an optimization hint, if an "initial-exec" hint is useless for a given target (like e.g. TLS models not generally mapping on Windows-based target), then it should be demoted to a weaker hint.
If initial-exec not being supported on powerpc is just some LLVM bug, then it can be demoted to a weaker mode as well, until the bug is fixed.
I'm not sure why LLVM doesn't currently reset initial-exec TLS mode to something acceptable on powerpc, it does that for other targets.

@joelpalmer joelpalmer added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 15, 2021
@crlf0710
Copy link
Member

crlf0710 commented Jul 4, 2021

@glaubitz Ping from triage, what's next steps here?

@bstrie
Copy link
Contributor

bstrie commented Jul 21, 2021

@glaubitz Are you intending to add anything more to this PR, or shall I tag this for review?

@glaubitz
Copy link
Contributor Author

@bkaestner I don't have any strong preference, the fix works for me. Feel free to merge it as-is or replace it with a better solution.

@bkaestner
Copy link
Contributor

@bkaestner I don't have any strong preference, the fix works for me. Feel free to merge it as-is or replace it with a better solution.

@bstrie I believe this message was meant for you.

@glaubitz
Copy link
Contributor Author

Oops, sorry. Two people starting with "@b" in the thread and I just had only one coffee this morning :).

@glaubitz
Copy link
Contributor Author

@glaubitz Are you intending to add anything more to this PR, or shall I tag this for review?

I don't want to add anything else. Could you tag this for review? Thanks!

@glaubitz
Copy link
Contributor Author

glaubitz commented Aug 4, 2021

r? @Mark-Simulacrum

@bstrie bstrie added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 4, 2021
@Mark-Simulacrum
Copy link
Member

Filed #87821 to track the automatic reduction or error, but for now let's @bors r+

@bors
Copy link
Contributor

bors commented Aug 6, 2021

📌 Commit 283619c has been approved by Mark-Simulacrum

@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 Aug 6, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 6, 2021
Rollup of 7 pull requests

Successful merges:

 - rust-lang#85807 (bootstrap: Disable initial-exec TLS model on powerpc)
 - rust-lang#87761 (Fix overflow in rustc happening if the `err_count()` is reduced in a stage.)
 - rust-lang#87775 (Add hint for unresolved associated trait items if the trait has a single item)
 - rust-lang#87779 (Remove special case for statement `NodeId` assignment)
 - rust-lang#87787 (Use `C-unwind` ABI for `__rust_start_panic` in `panic_abort`)
 - rust-lang#87809 (Fix typo in the ptr documentation)
 - rust-lang#87816 (Sync rustc_codegen_cranelift)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 352ad62 into rust-lang:master Aug 6, 2021
@rustbot rustbot added this to the 1.56.0 milestone Aug 6, 2021
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Many tests failing with "Couldn't compile the test" on 32-bit PowerPC with 1.49 beta