Replace the type of global variables instead of replacing them

This commit is contained in:
Antoni Boucher 2024-07-02 09:54:01 -04:00
parent 606196b0cf
commit cd014cda8c
3 changed files with 5 additions and 11 deletions

4
Cargo.lock generated
View File

@ -80,7 +80,7 @@ dependencies = [
[[package]]
name = "gccjit"
version = "2.0.0"
source = "git+https://github.com/rust-lang/gccjit.rs#f1545d7c2c13e42d78eaac8032d49ab8f7d43b6e"
source = "git+https://github.com/rust-lang/gccjit.rs#328cb1b414f67dfa15162ba7a55ed01931f1b219"
dependencies = [
"gccjit_sys",
]
@ -88,7 +88,7 @@ dependencies = [
[[package]]
name = "gccjit_sys"
version = "0.1.0"
source = "git+https://github.com/rust-lang/gccjit.rs#f1545d7c2c13e42d78eaac8032d49ab8f7d43b6e"
source = "git+https://github.com/rust-lang/gccjit.rs#328cb1b414f67dfa15162ba7a55ed01931f1b219"
dependencies = [
"libc",
]

View File

@ -1 +1 @@
272d0ccced960394fe6ff2b40b01610208cb4940
341be3b7d7ac6976cfed8ed59da3573c040d0776

View File

@ -82,17 +82,11 @@ fn codegen_static(&self, def_id: DefId) {
};
let is_thread_local = attrs.flags.contains(CodegenFnAttrFlags::THREAD_LOCAL);
let mut global = self.get_static_inner(def_id, val_llty);
let global = self.get_static_inner(def_id, val_llty);
#[cfg(feature = "master")]
if global.to_rvalue().get_type() != val_llty {
let instance = Instance::mono(self.tcx, def_id);
self.instances.borrow_mut().remove(&instance);
global.remove();
let name = self.tcx.symbol_name(instance).name;
self.globals.borrow_mut().remove(name);
global = self.get_static_inner(def_id, val_llty);
global.to_rvalue().set_type(val_llty);
}
set_global_alignment(self, global, alloc.align);