mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-21 20:26:41 +00:00
Remove env_sha3 symbol reference in evmjit shared library to be build with no unresolved symbols
This commit is contained in:
parent
5152596cbd
commit
84b6251181
2 changed files with 16 additions and 15 deletions
|
|
@ -4,13 +4,14 @@ project(evmjit)
|
||||||
|
|
||||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||||
|
|
||||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||||
else ()
|
else()
|
||||||
set(CMAKE_CXX_FLAGS "-std=c++11 -Wall -Wno-unknown-pragmas -Wextra -fPIC")
|
set(CMAKE_CXX_FLAGS "-std=c++11 -Wall -Wno-unknown-pragmas -Wextra -fPIC")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(APPLE)
|
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
set(CMAKE_SHARED_LINKER_FLAGS "-undefined dynamic_lookup")
|
# Do not allow unresovled symbols in shared library (default on linux)
|
||||||
|
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# LLVM
|
# LLVM
|
||||||
|
|
|
||||||
|
|
@ -26,9 +26,6 @@
|
||||||
#define DEBUG_ENV_OPTION(name) (std::getenv(#name) != nullptr)
|
#define DEBUG_ENV_OPTION(name) (std::getenv(#name) != nullptr)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
extern "C" void env_sha3(dev::eth::jit::byte const* _begin, uint64_t _size, std::array<dev::eth::jit::byte, 32>* o_hash);
|
|
||||||
|
|
||||||
namespace dev
|
namespace dev
|
||||||
{
|
{
|
||||||
namespace eth
|
namespace eth
|
||||||
|
|
@ -57,14 +54,17 @@ ReturnCode runEntryFunc(EntryFuncPtr _mainFunc, Runtime* _runtime)
|
||||||
|
|
||||||
std::string codeHash(bytes const& _code)
|
std::string codeHash(bytes const& _code)
|
||||||
{
|
{
|
||||||
std::array<byte, 32> binHash;
|
uint32_t hash = 0;
|
||||||
env_sha3(_code.data(), _code.size(), &binHash);
|
for (auto b : _code)
|
||||||
|
{
|
||||||
std::ostringstream os;
|
hash += b;
|
||||||
for (auto i: binHash)
|
hash += (hash << 10);
|
||||||
os << std::hex << std::setfill('0') << std::setw(2) << (int)(std::make_unsigned<decltype(i)>::type)i;
|
hash ^= (hash >> 6);
|
||||||
|
}
|
||||||
return os.str();
|
hash += (hash << 3);
|
||||||
|
hash ^= (hash >> 11);
|
||||||
|
hash += (hash << 15);
|
||||||
|
return std::to_string(hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue