Assembly

While a student, I learned a bit of assembly as part of degree.  I never had a strong feeling about it.  I wasn’t particularly interested in it as it just wasn’t something I thought I would do. I didn’t see the point of it.  I know of its existence, knew what it meant.  It gave me a sense of the different parts of how a computer works.  I just never really thought I would ever want to write code in it.  So I chalked it up to one of those courses I had to take and left it at that.

In the SPO600 course, we look at how code can behave when it hits the machine level.  Two programs compiled on different processors will generate different assembly.  I knew that when you write C code, the compilation happens in essentially 3 phases

preprocessor –> compilation –> linking

I knew that what came out of preprocessor was still basically C.  What came out of compilation was an object file, and linking puts it all together.

I did not know how to look the object files though until now.

To stop the compilation after compilation phase you use the -c flag which brings you .o

For both the executable and the object file you can look at the assembly by using:

objdump -d <file>

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s