LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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



Reply
 
Search this Thread
Old 11-20-2008, 01:17 PM   #1
jackall
LQ Newbie
 
Registered: Nov 2008
Posts: 2

Rep: Reputation: 0
.c.asm.obj.exe


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..
 
Old 11-20-2008, 01:46 PM   #2
johnsfine
Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,144

Rep: Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127
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.
 
Old 11-20-2008, 09:16 PM   #3
jackall
LQ Newbie
 
Registered: Nov 2008
Posts: 2

Original Poster
Rep: Reputation: 0
Thank you johnsfine..

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”
... is very illuminating.

Thank you.
Regards...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
samba compatibility with microsoft srvtools.exe (usrmgr.exe and srvmgr.exe) checkmate3001 Linux - Software 1 09-06-2008 06:08 AM
ASM x32 vs ASM x64 Tegramon Programming 3 02-27-2008 03:26 PM
SETUP.EXE/autorun.exe don't run in wine mst3kman Linux - Games 3 01-22-2006 03:20 PM
looking for a .obj files viewer aizkorri Linux - Software 0 09-19-2003 06:23 AM
Using Shared Obj implicitly ugenn Programming 0 04-15-2002 10:14 AM


All times are GMT -5. The time now is 09:48 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration