diff options
| author | antoyo <antoyo@users.noreply.github.com> | 2024-12-11 13:28:13 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-11 13:28:13 -0500 |
| commit | eb87eab2925e1c80fe43284718bda59a47338e78 (patch) | |
| tree | 1b709202f0e91f30d4daabf3d547a9a84712371c | |
| parent | 9e90bed67dfdeab53c6c8189d639f1216a90e679 (diff) | |
| parent | ba97c7f4186ea326780a24ddb8b2301228106744 (diff) | |
| download | rust-eb87eab2925e1c80fe43284718bda59a47338e78.tar.gz rust-eb87eab2925e1c80fe43284718bda59a47338e78.zip | |
Merge pull request #577 from rust-lang/fix/lld
Use casts instead of bitcast between pointers and integers to fix issues when using the lld linker
| -rw-r--r-- | libgccjit.version | 2 | ||||
| -rw-r--r-- | src/builder.rs | 4 | ||||
| -rw-r--r-- | src/common.rs | 4 | ||||
| -rw-r--r-- | src/consts.rs | 1 |
4 files changed, 5 insertions, 6 deletions
diff --git a/libgccjit.version b/libgccjit.version index c06aa36b900..ff58accec1d 100644 --- a/libgccjit.version +++ b/libgccjit.version @@ -1 +1 @@ -e1857fe179e92fd565a0a55c90e8e1deba917e03 +45648c2edd4ecd862d9f08196d3d6c6ccba79f07 diff --git a/src/builder.rs b/src/builder.rs index 97a1a175f20..098058f54ca 100644 --- a/src/builder.rs +++ b/src/builder.rs @@ -1244,13 +1244,13 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> { } fn ptrtoint(&mut self, value: RValue<'gcc>, dest_ty: Type<'gcc>) -> RValue<'gcc> { - let usize_value = self.cx.const_bitcast(value, self.cx.type_isize()); + let usize_value = self.cx.context.new_cast(None, value, self.cx.type_isize()); self.intcast(usize_value, dest_ty, false) } fn inttoptr(&mut self, value: RValue<'gcc>, dest_ty: Type<'gcc>) -> RValue<'gcc> { let usize_value = self.intcast(value, self.cx.type_isize(), false); - self.cx.const_bitcast(usize_value, dest_ty) + self.cx.context.new_cast(None, usize_value, dest_ty) } fn bitcast(&mut self, value: RValue<'gcc>, dest_ty: Type<'gcc>) -> RValue<'gcc> { diff --git a/src/common.rs b/src/common.rs index 7a456e1c5d6..c849d833d73 100644 --- a/src/common.rs +++ b/src/common.rs @@ -231,10 +231,10 @@ impl<'gcc, 'tcx> ConstMethods<'tcx> for CodegenCx<'gcc, 'tcx> { } }; let ptr_type = base_addr.get_type(); - let base_addr = self.const_bitcast(base_addr, self.usize_type); + let base_addr = self.context.new_cast(None, base_addr, self.usize_type); let offset = self.context.new_rvalue_from_long(self.usize_type, offset.bytes() as i64); - let ptr = self.const_bitcast(base_addr + offset, ptr_type); + let ptr = self.context.new_cast(None, base_addr + offset, ptr_type); if !matches!(layout.primitive(), Pointer(_)) { self.const_bitcast(ptr.dereference(None).to_rvalue(), ty) } else { diff --git a/src/consts.rs b/src/consts.rs index 483b2355c52..38a626bf73f 100644 --- a/src/consts.rs +++ b/src/consts.rs @@ -402,7 +402,6 @@ fn check_and_apply_linkage<'gcc, 'tcx>( // TODO(antoyo): set linkage. 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 } else { // Generate an external declaration. |
