OSDev.org

The Place to Start for Operating System Developers
It is currently Wed Apr 24, 2024 7:44 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: Strange thing with cross compiler
PostPosted: Sat Dec 11, 2021 7:19 am 
Offline
Member
Member

Joined: Wed Oct 20, 2021 6:00 pm
Posts: 102
Location: Paraguay
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?


Top
 Profile  
 
 Post subject: Re: Strange thing with cross compiler
PostPosted: Sat Dec 11, 2021 7:46 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4594
Location: Chichester, UK
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.

Top
 Profile  
 
 Post subject: Re: Strange thing with cross compiler
PostPosted: Sat Dec 11, 2021 7:48 am 
Offline
Member
Member

Joined: Wed Oct 20, 2021 6:00 pm
Posts: 102
Location: Paraguay
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.


Top
 Profile  
 
 Post subject: Re: Strange thing with cross compiler
PostPosted: Sat Dec 11, 2021 7:49 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4594
Location: Chichester, UK
The image you tried to post of the error message.


Top
 Profile  
 
 Post subject: Re: Strange thing with cross compiler
PostPosted: Sat Dec 11, 2021 7:53 am 
Offline
Member
Member

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

Oh,
It said: "Multiboot header not found"


Top
 Profile  
 
 Post subject: Re: Strange thing with cross compiler
PostPosted: Sat Dec 11, 2021 8:52 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4594
Location: Chichester, UK
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


Top
 Profile  
 
 Post subject: Re: Strange thing with cross compiler
PostPosted: Sat Dec 11, 2021 11:06 am 
Offline
Member
Member
User avatar

Joined: Wed Sep 28, 2005 11:00 pm
Posts: 85
Are you using multiboot or multiboot2?


Top
 Profile  
 
 Post subject: Re: Strange thing with cross compiler
PostPosted: Sat Dec 11, 2021 7:20 pm 
Offline
Member
Member

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

I'm using multiboot2.


Top
 Profile  
 
 Post subject: Re: Strange thing with cross compiler
PostPosted: Sat Dec 11, 2021 7:21 pm 
Offline
Member
Member

Joined: Wed Oct 20, 2021 6:00 pm
Posts: 102
Location: Paraguay
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


Top
 Profile  
 
 Post subject: Re: Strange thing with cross compiler
PostPosted: Sat Dec 11, 2021 7:46 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5144
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.


Top
 Profile  
 
 Post subject: Re: Strange thing with cross compiler
PostPosted: Sun Dec 12, 2021 6:41 am 
Offline
Member
Member

Joined: Wed Oct 20, 2021 6:00 pm
Posts: 102
Location: Paraguay
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], darkavengr, Google [Bot], Yahoo [Bot] and 213 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group