Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Iam new to this forum; so, bear with me in case I have trespassed to an elite area.
I have no background as a developer or a coder; but ‘am an enthusiastic amateur interested in rce. ‘am slightly familiar with DevC++ compiler and Borland command line compiler bcc32 both of which I've used for compilation. Also I can make out the bare basics of asm.
Now, I will come right to the point I need help.
I can write a few lines of source in ‘C’, and instead of using a compiler to get an exe file out of it, straight away, I want to get the various intermediate files like pre-assembly file, .obj file, asm file and finally an .exe file with the help of a linker. All these steps I want to do manually one by one so that I can get a clearer picture of these various processes involved in compilation.
Please give me a few tips in this context…like tools needed etc …
Thank you.
Regards..
With Linux/GNU software ".asm" files don't normally use the extension .asm and they aren't in the same format as Windows .asm files (I think they use .s).
Similarly, ".obj" files are .o and the format is different.
Similarly, ".exe" files have no conventional extension and the format is different.
So if you keep calling things ".obj file, asm file and finally an .exe file" you will get confused.
The GCC compiler package includes everything you need. It is probably already installed in your Linux system. Read its documentation for switches that determine what operation it will do and what output it will generate.
It doesn't normally compile through assembly, but it can be told to. It can be told to do each step individually.
gcc is actually a control program, not the compiler/assembler/linker. Based on the input files and the switches, it runs the compiler and/or assembler and/or linker. It also has a switch to tell it to display the commands it uses for the programs it runs.
If you want to play with the compile/assemble/link programs individually, the easiest way to find out how is to use gcc with the switches to use assembly (rather than compile directly to a .o file) and to show you the commands it uses to run the compiler, assembler and linker.
The information you have provided on the file format in Linux is very helpful.
Especially your additional explanation on gcc that ...
Quote:
“It doesn't normally compile through assembly, but it can be told to. It can be told to do each step individually.
Gcc is actually a control program, not the compiler/assembler/linker. Based on the input files and the switches, it runs the compiler and/or assembler and/or linker. It also has a switch to tell it to display the commands it uses for the programs it runs”
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.