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

Add TargetOption::force_pic_relocation_model and use it for mips64 #49508

Closed

Conversation

draganmladjenovic
Copy link
Contributor

Makes mips64 gnu targets use PIC relocation model regardless of what user specifies. See #49421.

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @michaelwoerister (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 30, 2018
@nagisa
Copy link
Member

nagisa commented Mar 31, 2018

Forcing some option regardless of what user specifies is not a well behaved thing to do regardless of the intention.

User specification should take precedence over everything else, potentially emitting an error if the option cannot be possibly honoured – and reloc-model=static can.

@draganmladjenovic
Copy link
Contributor Author

@nagisa Hi, sorry for the late replay. I agree on this. It can be confusing if a compiler ignores an option w/o even emitting a warning. You already have something like this in form of crt_static_respected target option. I have no strong opinion about this issue, but it kinda looks like an breaking change form LLVM 4 behavior. Then again I don't have a full picture of what is the common use case of user choosing other relocation model (static) other that target's default (pic), if there is one : producing ET_EXEC binaries, static c libraries ? In the end I can submit the PR to disable those tests (#49421) on mips64 targets.

…VM TargetMachine.

This allows user specified relocation_model to affect type of linking output.
@michaelwoerister
Copy link
Member

r? @japaric

@bors
Copy link
Contributor

bors commented Apr 7, 2018

☔ The latest upstream changes (presumably #49753) made this pull request unmergeable. Please resolve the merge conflicts.

@pietroalbini pietroalbini added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Apr 16, 2018
@pietroalbini
Copy link
Member

Ping from triage! Can @japaric or someone else from @rust-lang/compiler review this?

@nagisa
Copy link
Member

nagisa commented Apr 16, 2018

Okay, so, in my opinion we should just disable the test for MIPS here and honour what the user explicitly specifies on the command line.

Adding an option to specifically not honour the user does not seem right.

@estebank
Copy link
Contributor

@nagisa I would add to that a warning/error when targeting mips64_unknown_linux_gnuabi64 and get_reloc_model(sess) != llvm::RelocMode::PIC .

@nagisa
Copy link
Member

nagisa commented Apr 17, 2018 via email

@estebank
Copy link
Contributor

@nagisa depends on how bad the actual linking error is. If we can easily avoid an error that no one understands by preempting it in rustc, I think it is a clear win, but I say this without knowing what the current output is.

@nagisa
Copy link
Member

nagisa commented Apr 17, 2018

Currently the linker for MIPS crashes, but even outside that, relocation model mismatches yield fairly unhelpful errors and they are unhelpful universally (that is, unhelpful outside of MIPS too).

Alas, it is not possible to implement nicer errors properly without implementing a linker ourselves (or using a different linker) and a warning is even less feasible due to multiple models being used widely.

@pietroalbini pietroalbini assigned nagisa and unassigned japaric Apr 23, 2018
@pietroalbini
Copy link
Member

Ping from triage @nagisa! What's the status of this PR?

@draganmladjenovic
Copy link
Contributor Author

@pietroalbini, @nagisa I will submit the new PR to disable the failing relocation_model tests. Closing this then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. 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.

8 participants