So in a 32bit environment i compile a ".c" file.
A.c and get A.o
I save A.o .
Suppose A.c has a variable like
int a // i change this to long a;
After the change i compile and get another A.o.
Now when i do " cmp A.o A.o " , i can see that these files differ. Now my question can i find out what exactly changed by comparing ".o" files.
I am getting the assembly code out and doing a diff, but i cant make head and tails of it. Can someone suggest a smarter way.
I try to answer to this question. Object files can be compared directly with a binary hex editor. What you obtain in this way is not human readable as an object file is mostly machine code (it has also symbols for the linker when it's not yet linked). I find this method useful only to check little things (like code version and build date for firmwares). I think that an understanding of significant changes can only be achieved disassembling the object file. Fortunately there are tools around that do this job like objdump
for linux and for unix, assembler is not straightforward sometimes but at least it is human readable. Assuming that you are using a linux machine you can run the following command:
objdump -d yourobjectfile1 > out1
objdump -d yourobjectfile2 > out2
and than compare the results. You will discover that a little change in the c code can result in a big readjustment of the assembly code, so as for an experiment I suggest you to work with something of the level of helloworld.c
Other suggestions
gcc -g -c -fverbose-asm myfile.c; objdump -d -M intel -S ass.o > main.s
List item