OSDev.org https://forum.osdev.org/ |
|
Can't build kernel on one computer, but can on another. https://forum.osdev.org/viewtopic.php?f=13&t=32724 |
Page 1 of 1 |
Author: | j4cobgarby [ Sun Jan 28, 2018 10:04 am ] |
Post subject: | Can't build kernel on one computer, but can on another. |
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. |
Author: | iansjack [ Sun Jan 28, 2018 12:45 pm ] |
Post subject: | Re: Can't build kernel on one computer, but can on another. |
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. |
Page 1 of 1 | All times are UTC - 6 hours |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |