Assembly file errors when using i686-elf-gcc cross-compiler
Posted: Fri Apr 20, 2018 9:28 am
I compiled a cross-compiler for my Mac (macOS 10.13.3 High Sierra) targeting i686-elf using the tutorial on the wiki. When trying to compile my kernel's main c file (I neglected to make a cross-compiler before starting on my OS) with make VERBOSE=1 I get the following:
All google searches have yielded nothing and I'm really confused.
Below is the output from i686-elf-gcc -v-> Compiling src/kernel/kmain.c
mkdir -p build/obj/kernel
i686-elf-gcc -std=gnu99 -Isrc/inc -nostdlib -ffreestanding -lgcc -Wall -Wextra -Werror -Wno-unused-parameter -Wno-unused-variable -c src/kernel/kmain.c -o build/obj/kernel/kmain.o
/var/folders/2t/xt0gv1y9783gf_wwtyp3_y_00000gn/T//ccS8Jmd5.s:6:9: error: invalid alignment value
.align 32
^
/var/folders/2t/xt0gv1y9783gf_wwtyp3_y_00000gn/T//ccS8Jmd5.s:7:2: error: unknown directive
.type driver_ifc, @object
^
/var/folders/2t/xt0gv1y9783gf_wwtyp3_y_00000gn/T//ccS8Jmd5.s:8:2: error: unknown directive
.size driver_ifc, 64
^
/var/folders/2t/xt0gv1y9783gf_wwtyp3_y_00000gn/T//ccS8Jmd5.s:26:18: error: unexpected token in '.section' directive
.section .rodata
^
/var/folders/2t/xt0gv1y9783gf_wwtyp3_y_00000gn/T//ccS8Jmd5.s:33:2: error: unknown directive
.type kmain, @function
^
/var/folders/2t/xt0gv1y9783gf_wwtyp3_y_00000gn/T//ccS8Jmd5.s:37:2: error: instruction requires: Not 64-bit mode
pushl %ebp
^
/var/folders/2t/xt0gv1y9783gf_wwtyp3_y_00000gn/T//ccS8Jmd5.s:61:2: error: instruction requires: Not 64-bit mode
pushl -20(%ebp)
^
/var/folders/2t/xt0gv1y9783gf_wwtyp3_y_00000gn/T//ccS8Jmd5.s:62:2: error: instruction requires: Not 64-bit mode
pushl -12(%ebp)
^
/var/folders/2t/xt0gv1y9783gf_wwtyp3_y_00000gn/T//ccS8Jmd5.s:67:2: error: instruction requires: Not 64-bit mode
pushl $50
^
/var/folders/2t/xt0gv1y9783gf_wwtyp3_y_00000gn/T//ccS8Jmd5.s:72:2: error: instruction requires: Not 64-bit mode
pushl $.LC0
^
/var/folders/2t/xt0gv1y9783gf_wwtyp3_y_00000gn/T//ccS8Jmd5.s:78:2: error: instruction requires: Not 64-bit mode
pushl %eax
^
/var/folders/2t/xt0gv1y9783gf_wwtyp3_y_00000gn/T//ccS8Jmd5.s:82:2: error: instruction requires: Not 64-bit mode
pushl $.LC1
^
/var/folders/2t/xt0gv1y9783gf_wwtyp3_y_00000gn/T//ccS8Jmd5.s:90:2: error: instruction requires: Not 64-bit mode
pushl -16(%ebp)
^
/var/folders/2t/xt0gv1y9783gf_wwtyp3_y_00000gn/T//ccS8Jmd5.s:102:2: error: unknown directive
.size kmain, .-kmain
^
make: *** [build/obj/kernel/kmain.o] Error 1
And here is the repohttps://github.com/SamTebbs33/jaqUsing built-in specs.
COLLECT_GCC=i686-elf-gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/i686-elf/7.3.0/lto-wrapper
Target: i686-elf
Configured with: ../gcc-7.3.0/configure --target=i686-elf --prefix=/usr/local --disable-nls --enable-languages=c,c++ --without-headers
Thread model: single
gcc version 7.3.0 (GCC)
All google searches have yielded nothing and I'm really confused.