This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: compile checksums?
On Sep 8, 2009, at 5:33 AM, Paul Boyle wrote:
Hi,
Hopefully someone on this thread can help me. Every time I compile any
source code that includes 'iostream' is results in different
assembler. Does anyone know what the underline reason for this is? Is
this a known characteristic, or is there a known way of working around
this? I need to develop a mechanism to guarantee that builds from
source code generate identical binaries and was planing to use the
binaries' checksum, but this characteristic is preventing this.
I've tried this different versions of libstdc and am getting similar
results.
libstdc++-4.1.2-42.el5
libstdc++-3.4.6-8
I've reduced the code to the most trivial example possible to
demonstrate what I am seeing; only including the iostream header.
[pcb@alpha Tmp]$ echo "#include <iostream>" > sum.cpp ; g++ -S sum.cpp
; sum sum.s
27435 7
[pcb@alpha Tmp]$ echo "#include <iostream>" > sum.cpp ; g++ -S sum.cpp
; sum sum.s
64411 7
[pcb@alpha Tmp]$ echo "#include <iostream>" > sum.cpp ; g++ -S sum.cpp
; sum sum.s
52977 7
You aren't diffing the binaries, though; you're diffing the generated
assembler source. Which appears to be encoding the names differently.
However, aren't the (stripped) binaries identical? The non-stripped
binaries would have the debug info in them, which would differ.
An example diff is as follows:
200,201c200,201
< .type _GLOBAL__I_sum.cpp_9D2164D3_
40537BE5, @function
< _GLOBAL__I_sum.cpp_9D2164D3_40537BE5:
---
.type _GLOBAL__I_sum.cpp_9D2164D3_D6DB2116, @function
_GLOBAL__I_sum.cpp_9D2164D3_D6DB2116:
218c218
< .size _GLOBAL__I_sum.cpp_9D2164D3_40537BE5,
.-_GLOBAL__I_sum.cpp_9D2164D3_40537BE5
---
.size _GLOBAL__I_sum.cpp_9D2164D3_D6DB2116, .-
_GLOBAL__I_sum.cpp_9D2164D3_D6DB2116
221c221
< .long _GLOBAL__I_sum.cpp_9D2164D3_40537BE5
---
.long _GLOBAL__I_sum.cpp_9D2164D3_D6DB2116
Thanks,
--
Ned Konz
Seattle, WA
360-629-1091
http://bike-nomad.com