-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
data-layout error when running cargo build #1292
Comments
You need the same target spec change as rust-osdev/bootloader#420 LLVM recently changed the alignment of 128bit ints to match GCC and rustc updated to this too. The data layout (sizes and alignments of primitive types) needs to match between the target spec and what LLVM knows. |
@bjorn3 I tried updating the data-layout in the target file but ended up with the following error:
Target JSON:
|
|
Now the
Cargo bootimage version:
I am on the following part if that helps: |
I made this change not just to my x84_64-bootloader.json, but also to bootloader-0.9.24/x86_64-bootloader.json in .cargo. qemu does show up but the following way: Is this because of the UD2 instruction that's causing this? |
Thanks for the details! I think the ud2 instruction only happens with the v0.11 versions of the bootloader, the v0. 9 versions don't seem to be affected. I try to release a new v0.9 release today to fix the data layout error. Regarding the weird QEMU display: We already had a few reports of this, mostly by people on recent macOS versions. It seems to be a bug in QEMU because once you enter full-screen in QEMU, all content is visible. I'm not sure sure what causes the map error yet. Probably the default linker script in LLVM changed and it no longer pads sections to page boundaries. I'll look into it. |
I compile this entire project on my x86_64 linux with the same QEMU version (8.2.1) and it reports no such errors as I mentioned above. No data layout error as well (used the old data layout). I say this because my nightly rustc compiler was outdated on my x86 system (compiled successfully with that). I run "rustup update" and re-compiled this project. And now it throws the same error all over again. Even QEMU displays:
Could it be an issue with rustc? Also could you help me explain how did we reach this address 0x416000 ? Because I had a peak into the bootloader-0.9.2/src/main.rs and at line number 95: According to that error: My assumption is we are trying to map the kernel again to a different address? Please do correct me if I am wong. I am new to all these concepts. |
This issue should be fixed with rust-osdev/bootloader#422. |
Thank you so much for the fix! Great tutorial by the way, enjoying every post! |
Thanks :) |
When trying to
cargo build
with the x86_64-blog_os.json file, I get the following error:If I change the data-layout in the json file to the default layout, it compiles, but then when I run
cargo bootimage
the error comes back:Why is this happening?
The text was updated successfully, but these errors were encountered: