Skip to content

Commit 2aec422

Browse files
committed
Sync from rust 8e62bfd311791bfd9dca886abdfbab07ec54d8b4
2 parents 878f319 + 10cc2ea commit 2aec422

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

src/constant.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,10 @@ fn data_id_for_static(
321321
// `extern_with_linkage_foo` will instead be initialized to
322322
// zero.
323323

324-
let ref_name = format!("_rust_extern_with_linkage_{}", symbol_name);
324+
let ref_name = format!(
325+
"_rust_extern_with_linkage_{:016x}_{symbol_name}",
326+
tcx.stable_crate_id(LOCAL_CRATE)
327+
);
325328
let ref_data_id = module.declare_data(&ref_name, Linkage::Local, false, false).unwrap();
326329
let mut data = DataDescription::new();
327330
data.set_align(align);

src/intrinsics/mod.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -971,7 +971,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
971971

972972
let layout = amount.layout();
973973
match layout.ty.kind() {
974-
ty::Uint(_) | ty::Int(_) | ty::RawPtr(..) => {}
974+
ty::Uint(_) | ty::Int(_) => {}
975975
_ => {
976976
report_atomic_type_validation_error(fx, intrinsic, source_info.span, layout.ty);
977977
return Ok(());
@@ -984,7 +984,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
984984
let old =
985985
fx.bcx.ins().atomic_rmw(ty, MemFlags::trusted(), AtomicRmwOp::Add, ptr, amount);
986986

987-
let old = CValue::by_val(old, layout);
987+
let old = CValue::by_val(old, ret.layout());
988988
ret.write_cvalue(fx, old);
989989
}
990990
sym::atomic_xsub => {
@@ -993,7 +993,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
993993

994994
let layout = amount.layout();
995995
match layout.ty.kind() {
996-
ty::Uint(_) | ty::Int(_) | ty::RawPtr(..) => {}
996+
ty::Uint(_) | ty::Int(_) => {}
997997
_ => {
998998
report_atomic_type_validation_error(fx, intrinsic, source_info.span, layout.ty);
999999
return Ok(());
@@ -1006,7 +1006,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
10061006
let old =
10071007
fx.bcx.ins().atomic_rmw(ty, MemFlags::trusted(), AtomicRmwOp::Sub, ptr, amount);
10081008

1009-
let old = CValue::by_val(old, layout);
1009+
let old = CValue::by_val(old, ret.layout());
10101010
ret.write_cvalue(fx, old);
10111011
}
10121012
sym::atomic_and => {
@@ -1015,7 +1015,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
10151015

10161016
let layout = src.layout();
10171017
match layout.ty.kind() {
1018-
ty::Uint(_) | ty::Int(_) | ty::RawPtr(..) => {}
1018+
ty::Uint(_) | ty::Int(_) => {}
10191019
_ => {
10201020
report_atomic_type_validation_error(fx, intrinsic, source_info.span, layout.ty);
10211021
return Ok(());
@@ -1027,7 +1027,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
10271027

10281028
let old = fx.bcx.ins().atomic_rmw(ty, MemFlags::trusted(), AtomicRmwOp::And, ptr, src);
10291029

1030-
let old = CValue::by_val(old, layout);
1030+
let old = CValue::by_val(old, ret.layout());
10311031
ret.write_cvalue(fx, old);
10321032
}
10331033
sym::atomic_or => {
@@ -1036,7 +1036,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
10361036

10371037
let layout = src.layout();
10381038
match layout.ty.kind() {
1039-
ty::Uint(_) | ty::Int(_) | ty::RawPtr(..) => {}
1039+
ty::Uint(_) | ty::Int(_) => {}
10401040
_ => {
10411041
report_atomic_type_validation_error(fx, intrinsic, source_info.span, layout.ty);
10421042
return Ok(());
@@ -1048,7 +1048,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
10481048

10491049
let old = fx.bcx.ins().atomic_rmw(ty, MemFlags::trusted(), AtomicRmwOp::Or, ptr, src);
10501050

1051-
let old = CValue::by_val(old, layout);
1051+
let old = CValue::by_val(old, ret.layout());
10521052
ret.write_cvalue(fx, old);
10531053
}
10541054
sym::atomic_xor => {
@@ -1057,7 +1057,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
10571057

10581058
let layout = src.layout();
10591059
match layout.ty.kind() {
1060-
ty::Uint(_) | ty::Int(_) | ty::RawPtr(..) => {}
1060+
ty::Uint(_) | ty::Int(_) => {}
10611061
_ => {
10621062
report_atomic_type_validation_error(fx, intrinsic, source_info.span, layout.ty);
10631063
return Ok(());
@@ -1069,7 +1069,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
10691069

10701070
let old = fx.bcx.ins().atomic_rmw(ty, MemFlags::trusted(), AtomicRmwOp::Xor, ptr, src);
10711071

1072-
let old = CValue::by_val(old, layout);
1072+
let old = CValue::by_val(old, ret.layout());
10731073
ret.write_cvalue(fx, old);
10741074
}
10751075
sym::atomic_nand => {
@@ -1078,7 +1078,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
10781078

10791079
let layout = src.layout();
10801080
match layout.ty.kind() {
1081-
ty::Uint(_) | ty::Int(_) | ty::RawPtr(..) => {}
1081+
ty::Uint(_) | ty::Int(_) => {}
10821082
_ => {
10831083
report_atomic_type_validation_error(fx, intrinsic, source_info.span, layout.ty);
10841084
return Ok(());
@@ -1090,7 +1090,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
10901090

10911091
let old = fx.bcx.ins().atomic_rmw(ty, MemFlags::trusted(), AtomicRmwOp::Nand, ptr, src);
10921092

1093-
let old = CValue::by_val(old, layout);
1093+
let old = CValue::by_val(old, ret.layout());
10941094
ret.write_cvalue(fx, old);
10951095
}
10961096
sym::atomic_max => {

0 commit comments

Comments
 (0)