about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/builder.rs
diff options
context:
space:
mode:
authorThe Miri Cronjob Bot <miri@cron.bot>2025-01-31 05:04:21 +0000
committerThe Miri Cronjob Bot <miri@cron.bot>2025-01-31 05:04:21 +0000
commit7f414f9c39d8079f7c88bbdafb4d6e3a4ecea92c (patch)
tree4456a4c6935a4d4679096be97804aabe767709ca /compiler/rustc_codegen_llvm/src/builder.rs
parentdc3677587798df6b0bc6bfa78ea908efded39466 (diff)
parent9734ebb9be2ad760385555e36bb0d065e726d6f5 (diff)
downloadrust-7f414f9c39d8079f7c88bbdafb4d6e3a4ecea92c.tar.gz
rust-7f414f9c39d8079f7c88bbdafb4d6e3a4ecea92c.zip
Merge from rustc
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/builder.rs')
-rw-r--r--compiler/rustc_codegen_llvm/src/builder.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_llvm/src/builder.rs b/compiler/rustc_codegen_llvm/src/builder.rs
index d2de62b17f0..2d007416263 100644
--- a/compiler/rustc_codegen_llvm/src/builder.rs
+++ b/compiler/rustc_codegen_llvm/src/builder.rs
@@ -1325,7 +1325,9 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
 impl<'ll> StaticBuilderMethods for Builder<'_, 'll, '_> {
     fn get_static(&mut self, def_id: DefId) -> &'ll Value {
         // Forward to the `get_static` method of `CodegenCx`
-        self.cx().get_static(def_id)
+        let s = self.cx().get_static(def_id);
+        // Cast to default address space if globals are in a different addrspace
+        self.cx().const_pointercast(s, self.type_ptr())
     }
 }