From 37ab2b678286cd4816edfc2ec32eb961388f4a65 Mon Sep 17 00:00:00 2001 From: Cyrill Leutwiler Date: Thu, 31 Oct 2024 12:07:39 +0100 Subject: [PATCH] declare immutable globals during in declare (#108) Signed-off-by: xermicus --- .../polkavm/context/function/runtime/entry.rs | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/crates/llvm-context/src/polkavm/context/function/runtime/entry.rs b/crates/llvm-context/src/polkavm/context/function/runtime/entry.rs index e43cb06..397434a 100644 --- a/crates/llvm-context/src/polkavm/context/function/runtime/entry.rs +++ b/crates/llvm-context/src/polkavm/context/function/runtime/entry.rs @@ -27,18 +27,6 @@ impl Entry { where D: Dependency + Clone, { - context.declare_global( - revive_runtime_api::immutable_data::GLOBAL_IMMUTABLE_DATA_POINTER, - context.word_type().array_type(0), - AddressSpace::Stack, - ); - - context.declare_global( - revive_runtime_api::immutable_data::GLOBAL_IMMUTABLE_DATA_SIZE, - context.xlen_type(), - AddressSpace::Stack, - ); - let calldata_type = context.array_type(context.byte_type(), Self::MAX_CALLDATA_SIZE); context.set_global( crate::polkavm::GLOBAL_CALLDATA_POINTER, @@ -195,6 +183,18 @@ where Some(inkwell::module::Linkage::External), )?; + context.declare_global( + revive_runtime_api::immutable_data::GLOBAL_IMMUTABLE_DATA_POINTER, + context.word_type().array_type(0), + AddressSpace::Stack, + ); + + context.declare_global( + revive_runtime_api::immutable_data::GLOBAL_IMMUTABLE_DATA_SIZE, + context.xlen_type(), + AddressSpace::Stack, + ); + Ok(()) }