Strange thing with cross compiler

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
NeonLightions
Member
Member
Posts: 102
Joined: Wed Oct 20, 2021 6:00 pm
Location: Paraguay

Strange thing with cross compiler

Post by NeonLightions »

Hi,
Now I'm trying to develop 64-bit OS. But I got a strange thing when compiling: When I use x86_64-elf-gcc or x86_64-elf-ld, GRUB shown this error:
Image
When I change to system compiler, it's back to normal. Can anyone explain this for me?
User avatar
iansjack
Member
Member
Posts: 4703
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Strange thing with cross compiler

Post by iansjack »

Your image is broken, so we can't see the error message.

But, are you perhaps using some libc function?
Last edited by iansjack on Sat Dec 11, 2021 7:48 am, edited 1 time in total.
NeonLightions
Member
Member
Posts: 102
Joined: Wed Oct 20, 2021 6:00 pm
Location: Paraguay

Re: Strange thing with cross compiler

Post by NeonLightions »

iansjack wrote:Your image is broken.
I used grub-file --is-x86-multiboot2 to check the binary and there is no multiboot in binary file. So i don't think the image i broken.
User avatar
iansjack
Member
Member
Posts: 4703
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Strange thing with cross compiler

Post by iansjack »

The image you tried to post of the error message.
NeonLightions
Member
Member
Posts: 102
Joined: Wed Oct 20, 2021 6:00 pm
Location: Paraguay

Re: Strange thing with cross compiler

Post by NeonLightions »

iansjack wrote:The image you tried to post of the error message.
Oh,
It said: "Multiboot header not found"
User avatar
iansjack
Member
Member
Posts: 4703
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Strange thing with cross compiler

Post by iansjack »

It's impossible to say what the problem is without seeing your code, your linker file, and the exact commands you are using. Can you link to an on-line repository of your code. Something in this thread may help: viewtopic.php?f=1&t=33521
User avatar
deadmutex
Member
Member
Posts: 85
Joined: Wed Sep 28, 2005 11:00 pm

Re: Strange thing with cross compiler

Post by deadmutex »

Are you using multiboot or multiboot2?
NeonLightions
Member
Member
Posts: 102
Joined: Wed Oct 20, 2021 6:00 pm
Location: Paraguay

Re: Strange thing with cross compiler

Post by NeonLightions »

deadmutex wrote:Are you using multiboot or multiboot2?
I'm using multiboot2.
NeonLightions
Member
Member
Posts: 102
Joined: Wed Oct 20, 2021 6:00 pm
Location: Paraguay

Re: Strange thing with cross compiler

Post by NeonLightions »

iansjack wrote:It's impossible to say what the problem is without seeing your code, your linker file, and the exact commands you are using. Can you link to an on-line repository of your code. Something in this thread may help: viewtopic.php?f=1&t=33521
Here is my repo: https://github.com/NeonLightions/Amore-OS-x64. The header is at src/boot/grub/header.S, the _start function is at src/sys/_start.S and the linker is at scripts/linker.ld
Octocontrabass
Member
Member
Posts: 5563
Joined: Mon Mar 25, 2013 7:01 pm

Re: Strange thing with cross compiler

Post by Octocontrabass »

That's the wrong LD. Also, you might need to use "-z max-page-size=0x1000" to tell LD that it shouldn't add a bunch of padding to your kernel.
NeonLightions
Member
Member
Posts: 102
Joined: Wed Oct 20, 2021 6:00 pm
Location: Paraguay

Re: Strange thing with cross compiler

Post by NeonLightions »

Octocontrabass wrote:That's the wrong LD. Also, you might need to use "-z max-page-size=0x1000" to tell LD that it shouldn't add a bunch of padding to your kernel.
Thank you very much! Now I can use cross linker.
Post Reply