about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAntoni Boucher <bouanto@zoho.com>2023-03-02 17:15:57 -0500
committerAntoni Boucher <bouanto@zoho.com>2023-03-02 17:15:57 -0500
commitb4f83c6ed817bc42b1ea2e2c582488cfe5f6f1da (patch)
treef5c2ad57b736234c800ebed9374e0ae4fe5b7ffe
parentd8b5a3eaa927c0b8730d3fb3e4cd0731bbe48813 (diff)
downloadrust-b4f83c6ed817bc42b1ea2e2c582488cfe5f6f1da.tar.gz
rust-b4f83c6ed817bc42b1ea2e2c582488cfe5f6f1da.zip
Fix error
-rw-r--r--patches/0024-core-Disable-portable-simd-test.patch32
-rw-r--r--src/common.rs2
-rw-r--r--src/consts.rs9
3 files changed, 6 insertions, 37 deletions
diff --git a/patches/0024-core-Disable-portable-simd-test.patch b/patches/0024-core-Disable-portable-simd-test.patch
deleted file mode 100644
index 7ea0eebe6a1..00000000000
--- a/patches/0024-core-Disable-portable-simd-test.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From f845df4056f5ba16b9f5bd703460c4ac40ea03b9 Mon Sep 17 00:00:00 2001
-From: Antoni Boucher <bouanto@zoho.com>
-Date: Fri, 26 Aug 2022 20:38:58 -0400
-Subject: [PATCH] Edit
-
----
- library/core/tests/lib.rs | 2 --
- 1 file changed, 2 deletions(-)
-
-diff --git a/library/core/tests/lib.rs b/library/core/tests/lib.rs
-index 59510d3..179bf26 100644
---- a/library/core/tests/lib.rs
-+++ b/library/core/tests/lib.rs
-@@ -77,7 +77,6 @@
- #![feature(unwrap_infallible)]
- #![feature(result_into_ok_or_err)]
- #![feature(pointer_byte_offsets)]
--#![feature(portable_simd)]
- #![feature(ptr_metadata)]
- #![feature(once_cell)]
- #![feature(option_result_contains)]
-@@ -135,7 +134,6 @@ mod pin;
- mod pin_macro;
- mod ptr;
- mod result;
--mod simd;
- mod slice;
- mod str;
- mod str_lossy;
--- 
-2.26.2.7.g19db9cfb68.dirty
-
diff --git a/src/common.rs b/src/common.rs
index 12c0b392323..617c7e8640a 100644
--- a/src/common.rs
+++ b/src/common.rs
@@ -241,7 +241,7 @@ impl<'gcc, 'tcx> ConstMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
         let value =
             if layout.size == Size::ZERO {
                 let value = self.const_usize(alloc.inner().align.bytes());
-                self.context.new_cast(None, value, ty)
+                self.const_bitcast(value, ty)
             }
             else {
                 let init = const_alloc_to_gcc(self, alloc);
diff --git a/src/consts.rs b/src/consts.rs
index b651b60924f..86a7f78de27 100644
--- a/src/consts.rs
+++ b/src/consts.rs
@@ -341,7 +341,7 @@ pub fn codegen_static_initializer<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, def_id
 
 fn check_and_apply_linkage<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, attrs: &CodegenFnAttrs, ty: Ty<'tcx>, sym: &str) -> LValue<'gcc> {
     let is_tls = attrs.flags.contains(CodegenFnAttrFlags::THREAD_LOCAL);
-    let llty = cx.layout_of(ty).gcc_type(cx);
+    let gcc_type = cx.layout_of(ty).gcc_type(cx);
     if let Some(linkage) = attrs.import_linkage {
         // Declare a symbol `foo` with the desired linkage.
         let global1 = cx.declare_global_with_linkage(&sym, cx.type_i8(), base::global_linkage_to_gcc(linkage));
@@ -354,9 +354,10 @@ fn check_and_apply_linkage<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, attrs: &Codeg
         // zero.
         let mut real_name = "_rust_extern_with_linkage_".to_string();
         real_name.push_str(&sym);
-        let global2 = cx.define_global(&real_name, llty, is_tls, attrs.link_section);
+        let global2 = cx.define_global(&real_name, gcc_type, is_tls, attrs.link_section);
         // TODO(antoyo): set linkage.
-        global2.global_set_initializer_rvalue(global1.get_address(None));
+        let value = cx.const_ptrcast(global1.get_address(None), gcc_type);
+        global2.global_set_initializer_rvalue(value);
         // TODO(antoyo): use global_set_initializer() when it will work.
         global2
     }
@@ -370,6 +371,6 @@ fn check_and_apply_linkage<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, attrs: &Codeg
         // don't do this then linker errors can be generated where the linker
         // complains that one object files has a thread local version of the
         // symbol and another one doesn't.
-        cx.declare_global(&sym, llty, GlobalKind::Imported, is_tls, attrs.link_section)
+        cx.declare_global(&sym, gcc_type, GlobalKind::Imported, is_tls, attrs.link_section)
     }
 }