I am refactoring C++ code, removing using namespace std;
and adding std::
to strings, vectors, etc. I want the output to be indentical binary-wise, but cmp
gives diffs even for minimal changes. I resorted to disassembling using otool
but am encountering weird offsets in addresses.
E.g. with this change
diff --git a/src/core_read.cpp b/src/core_read.cpp
@@ -26,7 +26,7 @@ CScript ParseScript(const std::string& s)
{
CScript result;
- static map<string, opcodetype> mapOpNames;
+ static std::map<string, opcodetype> mapOpNames;
if (mapOpNames.empty())
{
otool -XVt
gives an odd address offset:
bench_bitcoin.s:
8c8
< movq 0x392f7b(%rip), %rbx ## literal pool symbol address: ___stack_chk_guard
---
> movq 0x392f8b(%rip), %rbx ## literal pool symbol address: ___stack_chk_guard
19c19
< jne 0x100003fa9
---
> jne 0x100003f99
25c25
< callq 0x100229c44 ## symbol stub for: ___stack_chk_fail
---
> callq 0x100229c34 ## symbol stub for: ___stack_chk_fail
33c33
< movq 0x392f2b(%rip), %rbx ## literal pool symbol address: ___stack_chk_guard
---
> movq 0x392f3b(%rip), %rbx ## literal pool symbol address: ___stack_chk_guard
[…]
It literally shifts all addies +/-0x10. Is there a way to prevent this? Why is it happening in the first place?
Reverting the above change and recompiling gives the original addresses, so it's probably not a matter of "randomness" in address selection.
Aucun commentaire:
Enregistrer un commentaire