From b4f83c6ed817bc42b1ea2e2c582488cfe5f6f1da Mon Sep 17 00:00:00 2001 From: Antoni Boucher Date: Thu, 2 Mar 2023 17:15:57 -0500 Subject: [PATCH] Fix error --- ...0024-core-Disable-portable-simd-test.patch | 32 ------------------- src/common.rs | 2 +- src/consts.rs | 9 +++--- 3 files changed, 6 insertions(+), 37 deletions(-) delete mode 100644 patches/0024-core-Disable-portable-simd-test.patch 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 -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 @@ fn from_const_alloc(&self, layout: TyAndLayout<'tcx>, alloc: ConstAllocation<'tc 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) } }