OSDev.org

The Place to Start for Operating System Developers
It is currently Mon Nov 29, 2021 7:54 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Can't build kernel on one computer, but can on another.
PostPosted: Sun Jan 28, 2018 10:04 am 
Offline
Member
Member

Joined: Fri Jan 26, 2018 11:43 am
Posts: 58
I have a main desktop computer, and an laptop. They're both running the exact same operating system (manjaro linux), and I have the exact same cross compiler installed (i686-elf-gcc, from the AUR).

My problem only occurs when building on my laptop.

My makefile runs a few commands to compile my kernel. It first assembles the main assembly, which works fine.

It then tries to compile the main C file, with the following command:
Code:
i686-elf-gcc -c kern.c -o build/kern.o -std=gnu99 -ffreestanding -O2 -Wall -Wextra


For some reason, this doesn't work, and throws the following error:

Code:
/tmp/ccLtKHxr.s: Assembler messages:
/tmp/ccLtKHxr.s:52: Error: invalid instruction suffix for `push'
/tmp/ccLtKHxr.s:55: Error: invalid instruction suffix for `push'
/tmp/ccLtKHxr.s:57: Error: register save offset not a multiple of 8
/tmp/ccLtKHxr.s:74: Error: invalid instruction suffix for `pop'
/tmp/ccLtKHxr.s:78: Error: invalid instruction suffix for `pop'
/tmp/ccLtKHxr.s:99: Error: invalid instruction suffix for `push'
/tmp/ccLtKHxr.s:102: Error: invalid instruction suffix for `push'
/tmp/ccLtKHxr.s:104: Error: register save offset not a multiple of 8
/tmp/ccLtKHxr.s:185: Error: invalid instruction suffix for `push'
/tmp/ccLtKHxr.s:194: Error: invalid instruction suffix for `pop'
/tmp/ccLtKHxr.s:197: Error: invalid instruction suffix for `pop'
make: *** [Makefile:4: all] Error 1


First of all, I'm not really sure why these are assembler messages. I know that somewhere down the line my C code will be assembled, but it seems odd to me.
It also seems weird that it compiles fine on my main computer, but not my laptop.

I can provide the source files if necessary, but it's difficult to find a relevant piece of code. The entire source is available at https://github.com/j4cobgarby/atomic-kernel, if that helps.


Top
 Profile  
 
 Post subject: Re: Can't build kernel on one computer, but can on another.
PostPosted: Sun Jan 28, 2018 12:45 pm 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4272
Location: Chichester, UK
It sounds to me as if there is a mismatch between C compiler and assembler (i.e. using a 64-bit assembler with a 32-bit compiler). Whatever you may think, the Linux installations are not identical. Try using the -v switch with GCC to see exactly what commands are being executed.


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 10 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