Skip to content

Commit 022a80b

Browse files
PavelKopylakiramenai
authored andcommitted
[EraVM] Use full keccak256 hash value for linker symbols
EF compiler uses only 18 bytes of the keccak256 hash value when hashing linker symbols. Probably it's done to limit size of unlinked contracts by increasing collision probability. But this doesn't seem to make a big sense, so lets use full hash values. Anyway, this doesn't affect size of executable bytecode.
1 parent a58b8f5 commit 022a80b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

llvm/lib/Target/EraVM/MCTargetDesc/EraVMMCTargetDesc.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,12 @@ EraVM::analyzeEncodedOpcode(unsigned EncodedOpcode, EncodedOperandMode &SrcMode,
128128
}
129129

130130
// Returs the string of the following format:
131-
// '__$KECCAK256(SymName.substr(0, 34))$__'
131+
// '__$KECCAK256(SymName)$__'
132132
std::string EraVM::getLinkerSymbolHash(StringRef SymName) {
133133
std::array<uint8_t, 32> Hash = KECCAK::KECCAK_256(SymName);
134134
SmallString<72> HexHash;
135135
toHex(Hash, /*LowerCase*/ true, HexHash);
136-
return (Twine("__$") + HexHash.substr(0, 34) + "$__").str();
136+
return (Twine("__$") + HexHash + "$__").str();
137137
}
138138

139139
// Returns concatenation of the Name with the SubIdx.

0 commit comments

Comments
 (0)