I learning assembly language, and I have used 'nasm' to compile my .asm file called 'my_program' to a .o file using this command here:
nasm -f elf32 my_program.asm -o my_program.o
As far as I am concerned, this works fine, as a .o file is created. I then do this command:
ld my_program.o -o my_program
Instead of creating a unix executable like it should, this warning/error appears:
ld: warning: platform not specified
ld: warning: -arch not specified
ld: warning: No platform min-version specified on command line
ld: warning: ignoring file my_program.o, building for -unknown but attempting to link with file built for unknown-unsupported file format ( 0x7F 0x45 0x4C 0x46 0x01 0x01 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 )
Undefined symbols for architecture unknown:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture unknown
Does anyone have any clue why this is happening? Here is the assembly code in the .asm file if it helps (I am just following a tutorial):
global _start
_start:
mov eax, 1
mov ebx, 42
int 0x80