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

Consider switching to new x86_64-unknown-none target #1068

Open
Aaron1011 opened this issue Dec 29, 2021 · 6 comments
Open

Consider switching to new x86_64-unknown-none target #1068

Aaron1011 opened this issue Dec 29, 2021 · 6 comments

Comments

@Aaron1011
Copy link
Contributor

Rust recently added a Tier-3 x86_64-unknown-none target: rust-lang/rust#89062

I believe it should be possible to use this target instead of the custom x86_64-blog_os.json target. It's designed to support bare-metal x86_64 code (like operating systems), and the target definition looks almost identical to x86_64-blog_os.json. It should be possible to address any differences via -C flags.

@thejpster
Copy link

Stablised today in 1.58

@phil-opp
Copy link
Owner

Awesome! I'll try to switch the blog to it when I have some time. I think we are still having some problems with loading PIC code in the bootloader crate (rust-osdev/bootloader#206 (comment)), but this might be avoidable using -C flags as @Aaron1011 mentioned.

@ethindp
Copy link

ethindp commented Jan 14, 2022

I should note that I have tried using -C relocation-model=pie with no success, and -C relocation-model=static is a bit of a ridiculous idea IMO.

@bjorn3
Copy link
Contributor

bjorn3 commented Jan 14, 2022

Why is -Crelocation-model=static rediculous? That is the relocation model currently used by blog os.

@ethindp
Copy link

ethindp commented Jan 15, 2022

@bjorn3 Really? I didn't know that. I assumed that it used PIE. No wonder my change to have it use PIE didn't work. As for it being ridiculous, I guess I look at it from a security standpoint: if the relocation model is static it means that once you know where the kernel has been loaded into memory, you instantly can determine where all the variables are and all that trivially. I didn't know that static was the relocation model that blog_os used though. PIC will be pretty nice to have, and same for ASLR once its added.

@phil-opp
Copy link
Owner

Quick update: This will be part of the upcoming third edition. It is now even a Tier 2 target, which means that it's installable through rustup, so -Zbuild-std is no longer necessary.

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

No branches or pull requests

5 participants