I'm probably doing something wrong, being a newbie. Could you please help me out?
I've written a simple Hello World program in C called hello.c, and ran the following command:
gcc -S hello.c
That produced hello.s
. Then I used that file with GNU assembler, as
:
as hello.s
Which produced a non-executable a.out
, which still needs to be linked, I understand?
I try to link it by using ld
, like so:
ld a.out
But get the following error:
a.out: file not recognized: File truncated
And ld
deletes my file.
This is an x86 Ubuntu system. What am I doing wrong? Many thanks!