From e4f9eebe3a95275f934fb009008e7205beabd1e9 Mon Sep 17 00:00:00 2001 From: Alan Egerton Date: Thu, 29 Apr 2021 09:28:29 +0100 Subject: [PATCH] Expose new `JITModule::read_got_entry` function --- cranelift/jit/src/backend.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cranelift/jit/src/backend.rs b/cranelift/jit/src/backend.rs index 26768ffc74..4389455d8d 100644 --- a/cranelift/jit/src/backend.rs +++ b/cranelift/jit/src/backend.rs @@ -285,6 +285,13 @@ impl JITModule { } } + /// Returns the given function's entry in the Global Offset Table. + /// + /// Panics if there's no entry in the table for the given function. + pub fn read_got_entry(&self, func_id: FuncId) -> *const u8 { + unsafe { *self.function_got_entries[func_id].unwrap().as_ptr() } + } + fn get_got_address(&self, name: &ir::ExternalName) -> *const u8 { match *name { ir::ExternalName::User { .. } => {