1

When I compile a simple test.cpp file twice using xlC compiler on AIX:

xlC_r test.cpp -o test1
xlC_r test.cpp -o test2

Then test1 and test2 are diffrent! They have diffrent md5sum.

But when I do the same on linux (with g++ of course instead of xlc) then test1 and test2 are the same...

Anybody please could tell me why this strange behavior happens in AIX??

Thanks

Morad
  • 2,761
  • 21
  • 29
  • Datestamps in the executable? Randomized names of some kind? You really need to compare the actual files more closely (all sections, disassembly, etc.) – Some programmer dude Dec 31 '13 at 14:55
  • Maybe you can try to do a binary diff on them? They could contain some kind of unique id, for example, or the order of the contained functions could be different – user1781290 Dec 31 '13 at 14:56

2 Answers2

2

Yes, the compiler stores a timestamp in each object file that it creates. As of Version 12.1 of the compiler, one can specify the option -qnotimestamps when compiling to suppress the storing of timestamps.

Dwayne Moore
  • 376
  • 1
  • 2
  • The user is looking at final executables. Aren't there timestamps also in the executable format itself? i.e. I thought doing two links would also produce two slightly different files. – pedz Jan 01 '14 at 14:58
  • I tried to use -qnotimestamps but still the binaries are diffrent – Morad Jan 01 '14 at 16:10
  • Try using the dump command to dump a text version of the XCOFF executables and compare those--should help narrow down the differences. – TheDuke Jan 23 '14 at 08:06
0

Maybe it includes a timestamp in the compiled program. You could try and find where they differ by saving an octal or headecimal dump of each program and comparing the results. Many UNIX variants provide the od and diff programs which you could use, but I don't know if they are available under AIX.

Nicola Musatti
  • 17,834
  • 2
  • 46
  • 55