Quoting Dave Carrigan ([EMAIL PROTECTED]):
> Max Bian <[EMAIL PROTECTED]> writes:
> 
> > I was testing a code beautifier (indent) on one of my C code.  After I
> > generated a "beautified" C code, I compiled it with m68k-palmos-gcc with "-c"
> > switch.  I compared the two .o files from the old and new code with GNU diff
> > 2.7.  They are different.  Surprising?  Maybe not.  
> 
> I think that the coff format stores a date inside the object file. A
> better approach may be to disassemble the code and diff that:
> 
>   m68k-palmos-objdump --disassemble file.o > file.1.asm
>   beautify file.c
>   make file.o
>   m68k-palmos-objdump --disassemble file.o > file.2.asm
>   diff -u file.1.asm file.2.asm

Or you can just strip off the first 8 bytes of the file that contain
the part of the COFF header containing the timestamp and then compare
the two:

  $ m68k-palmos-gcc -Wall -O2 -c -o tools1.o tools.c
  $ m68k-palmos-gcc -Wall -O2 -c -o tools2.o tools.c
  $ cmp -s tools1.o tools2.o || echo different
  different
  $ cut -c9- tools1.o > t1
  $ cut -c9- tools2.o > t2
  $ cmp -s t1 t2 && echo same
  same

James

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to