Skip to content

Commit

Permalink
Merge pull request #903 from AntelopeIO/fix-llvm789
Browse files Browse the repository at this point in the history
[1.0.3] fix building with LLVM 7, 8, and 9
  • Loading branch information
spoonincode authored Oct 8, 2024
2 parents 9a1d68b + 8ea2acf commit bc2bee9
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions libraries/chain/webassembly/runtimes/eos-vm-oc/LLVMJIT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,14 +305,19 @@ namespace LLVMJIT

unsigned num_functions_stack_size_found = 0;
for(const auto& stacksizes : jitModule->unitmemorymanager->stack_sizes) {
llvm::DataExtractor ds(llvm::ArrayRef(stacksizes.data(), stacksizes.size()), true, 8);
llvm::DataExtractor::Cursor c(0);

while(!ds.eof(c)) {
ds.getAddress(c);
WAVM_ASSERT_THROW(!!c);
const uint64_t stack_size = ds.getULEB128(c);
WAVM_ASSERT_THROW(!!c);
#if LLVM_VERSION_MAJOR < 10
using de_offset_t = uint32_t;
#else
using de_offset_t = uint64_t;
#endif
llvm::DataExtractor ds(llvm::StringRef(reinterpret_cast<const char*>(stacksizes.data()), stacksizes.size()), true, 8);
de_offset_t offset = 0;

while(ds.isValidOffsetForAddress(offset)) {
ds.getAddress(&offset);
const de_offset_t offset_before_read = offset;
const uint64_t stack_size = ds.getULEB128(&offset);
WAVM_ASSERT_THROW(offset_before_read != offset);

++num_functions_stack_size_found;
if(stack_size > stack_size_limit)
Expand Down

0 comments on commit bc2bee9

Please sign in to comment.