Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Comparing object files.

Status
Not open for further replies.

stucoxy

Programmer
Dec 2, 2002
1
GB
I am doing some minor cosmetic changes to my code and thought I would compare the object file sizes to see if I had broken anything. However, even if I change nothing some of my object files change size. Usually it's just a couple of files and only a couple of bites. Each time it is different object files that change and once all the files were identical sizes (but only once). Does anyone know why this is happening? I do a forced rebuild each time (-u) and have changed nothing between subsequent builds.
Is there a better way of comparing object files.

Thanks for your help.
 
It depends on whether you are re-linking fresh every time or doing an incremental link. On some linkers, the incremental link "removes" the symbol from the old object and adds the new symbol in. The removal is not physical: it just flags the symbol as unavailable.

Some compilers save the date and time the object files were created. That way, in the debugger, they can tell whether the object file they are looking at is out of date or not.

This doesn't help on binary file comparisons but you could do a non-binary comparison. Try od -x the two files and then doing a diff on the result. Something like

od -x oldbin > oldbin.txt
od -x newbin > newbin.txt
diff oldbin.txt newbin.txt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top