0

I'm trying to accomplish an exercise, which goal is to print a message without C standard library, using own nasm code instead. I've successfully compiled two .asm and one .c file with following commands

nasm -f elf start.asm
nasm -f elf calls.asm
gcc -Wall -c greet.c

all good, but when I try to link all of the objective files with

ld start.o calls.o greet.o -o greet

it says

ld: i386 architecture of input file 'start.o' is incompatible with i386:x86-64 output
ld: i386 architecture of input file 'calls.o' is incompatible with i386:x86-64 output

I've tried using following command instead

ld -m elf_i386 start.o calls.o greet.o -o greet

but no good

ld: i386:x86-64 architecture of input file 'greet.o' is incompatible with i386 output

Please help. I'm using Ubuntu 19.10 (Virtual Machine), NASM ver. 2.14.02, GCC ver. 9.2.1 20191008.

Weather Vane
  • 33,872
  • 7
  • 36
  • 56

0 Answers0