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

[v0.9] Set relocation-model: static and panic-strategy: abort and fix .intel_syntax warnings #185

Merged
merged 4 commits into from
Aug 9, 2021

Conversation

vinc
Copy link

@vinc vinc commented Jul 16, 2021

Hello, I get some warnings on the 0.9.18 version when compiling MOROS (https://github.com/vinc/moros)

warning: avoid using `.intel_syntax`, Intel syntax is the default

And also

warning: target json file contains unused fields: panic, relocation_model

The fixes for intel_syntax and panic already exist for the main branch so I adapted them.

I also removed relocation_model from the JSON target file and tested it on my OS with Bosch, QEMU, and VirtualBox but not yet on real hardware so I'm unsure about that one.

Edit: I renamed the later to relocation-model to fix the warning thanks to @bjorn3 (see https://doc.rust-lang.org/rustc/codegen-options/index.html#relocation-model)

@vinc vinc changed the title Fix compilation warnings Fix compilation warnings on v0.9 branch Jul 16, 2021
Copy link
Contributor

@josephlr josephlr left a comment

Choose a reason for hiding this comment

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

I also ran into this bug (as a dependency for the blog_os project), this seems to resolve the issue.

@phil-opp
Copy link
Member

phil-opp commented Aug 9, 2021

Thanks a lot and sorry for the delay!

Does this mean that the relocation model option was ignored before? Or was it renamed on the rustc side?

@josephlr
Copy link
Contributor

josephlr commented Aug 9, 2021

Thanks a lot and sorry for the delay!

Does this mean that the relocation model option was ignored before? Or was it renamed on the rustc side?

I think it was being ignored, but that the the default (at least in this case) happened to be "static".

@phil-opp
Copy link
Member

phil-opp commented Aug 9, 2021

Hmm, from the rust source code it seems like the general default is pic: https://github.com/rust-lang/rust/blob/aadd6189ad5c81f50d942c584ed1c1b49892765f/compiler/rustc_target/src/spec/mod.rs#L1363. I haven't found anything yet that indicates that custom targets use static by default...

@josephlr
Copy link
Contributor

josephlr commented Aug 9, 2021

Hmm, from the rust source code it seems like the general default is pic: https://github.com/rust-lang/rust/blob/aadd6189ad5c81f50d942c584ed1c1b49892765f/compiler/rustc_target/src/spec/mod.rs#L1363. I haven't found anything yet that indicates that custom targets use static by default...

Oh ya, you're definitely right, I guess things were working because pic code will usually work in a static context.

@phil-opp
Copy link
Member

phil-opp commented Aug 9, 2021

Yeah, that's what I thought. So this PR (and #186) will effectively change the relocation model from pic to `static, which might have some side effects. I'm still fine with merging it, but we should keep this in mind in case we see any new bugs afterwards.

@phil-opp phil-opp merged commit a562ba9 into rust-osdev:v0.9-base Aug 9, 2021
@phil-opp phil-opp changed the title Fix compilation warnings on v0.9 branch [v0.9] Set relocation-model: static and panic-strategy: abort and fix .intel_syntax warnings Aug 9, 2021
phil-opp added a commit that referenced this pull request Aug 9, 2021
@phil-opp
Copy link
Member

phil-opp commented Aug 9, 2021

Published as v0.9.19.

phil-opp added a commit that referenced this pull request Aug 9, 2021
@ghost
Copy link

ghost commented Aug 10, 2021

@phil-opp Are you sure you have published 0.9.19 successfully? crates.io reports 0.9.18 as the latest version in the 0.9 branch. Could you please recheck and possibly republish?

@phil-opp
Copy link
Member

Sorry about that, should be fixed now!

@vinc
Copy link
Author

vinc commented Aug 11, 2021

The release is now available 🎉 Thanks 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants