Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to make executable from assembly language?(in emacs)

Could somebody tell me how to make executable from assembly language? my environment is Ubuntu + Emacs + GCC for learning purpose, I wrote some C code(hello.c) and convert it to assembly (hello.s)

and I want to make an executable file from an assembly written file.

I tried

M-x compile

gcc hello.c -S

to make assembly from C code

and

M-x compile

as hello.s 

to make executable file

but there's only a.out file and it isn't able to execute

so I tried

as hello.s -o aaa

but file "aaa" is not executable

like image 796
kim taeyun Avatar asked Mar 15 '11 04:03

kim taeyun


1 Answers

The output of as is an object file. To make it executable you need to link it with ld but you will also need to link in any objects it depends on, which if the source was generated from gcc, will at least include libc, as well as probably some other object files.

like image 85
bdk Avatar answered Oct 20 '22 20:10

bdk