Mixing 32 Bit and 64 Bit Assembler
Posted: Tue Jan 12, 2016 2:19 am
Hey,
I'm working on porting my operating system to the x64 architecture. I'm following the articles in the wiki for switching to long mode. I use gas for assembly code. The cross compile tool chain is set-up correctly. I compile the 32 bit bootstrap with the following command:
Thanks.
I'm working on porting my operating system to the x64 architecture. I'm following the articles in the wiki for switching to long mode. I use gas for assembly code. The cross compile tool chain is set-up correctly. I compile the 32 bit bootstrap with the following command:
But then the linkage fails with the following error:x86_64-elf-as --32 -o CMakeFiles/myOS.elf.dir/src/arch/x64/pc/boot.S.o /home/nils/code/osdev/myOS/src/arch/x64/pc/boot.S
Obviously the linker complains that it can't build 32bit code into my the binary... How can I fix this? And why is this a problem?/usr/bin/cc -T ../././src//arch/x64/pc/layout.ld -N -ffreestanding -nostdlib CMakeFiles/schlemmiOS.elf.dir/src/arch/x64/pc/boot.S.o -o schlemmiOS.elf
/usr/bin/ld: i386 architecture of input file `CMakeFiles/schlemmiOS.elf.dir/src/arch/x64/pc/boot.S.o' is incompatible with i386:x86-64 output
Thanks.