You are not logged in.

#1 2017-10-13 19:03:36

edens
Member
Registered: 2017-05-27
Posts: 2

Issue with i686-elf-gcc from AUR generating ELF 64-bit object files

Hi

I've installed the i686-elf-binutils 2.29-2 and i686-elf-gcc 7.2.0-1 cross compiler for i686-elf target
but when I try to compile using it I get x86_64 or 64 bit ELF object files.
I'm not really sure what is going on, isn't i686 suppose to be 32 bit arch resulting in 32 bit ELF object files?

here are the commands I'm using:

i686-elf-gcc -std=gnu99 -ffreestanding -c start.s -o start.o
i686-elf-gcc -std=gnu99 -ffreestanding -c kernel.c -o kernel.o

then when linking I get an error:

i686-elf-gcc -ffreestanding -nostdlib -g -T linker.ld start.o kernel.o -o mykernel.elf -lgcc

results in:

start.o: file not recognized: File format not recognized
collect2: error: ld returned 1 exit status

and I assume it's because i686-elf-gcc generated 64 bit object files for some unknown reason:

file start.o; file kernel.o

results in:

start.o: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped
kernel.o: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped

Adding the -m32 flag has no effect.
I'm really confused and not sure what is wrong.
I appreciate any help in advance.

Offline

#2 2018-04-17 09:51:09

colatkinson
Member
Registered: 2014-12-30
Posts: 1

Re: Issue with i686-elf-gcc from AUR generating ELF 64-bit object files

Sorry if this post is too old, but I recently came across the same issue. Does anyone know of a solution?

Offline

Board footer

Powered by FluxBB