Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 73c0db0

Browse files
committed
Rustup to rustc 1.53.0-nightly (132b4e5 2021-04-13)
1 parent 607ed91 commit 73c0db0

File tree

8 files changed

+84
-82
lines changed

8 files changed

+84
-82
lines changed

build_sysroot/Cargo.lock

Lines changed: 14 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build_sysroot/prepare_sysroot_src.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ popd
3232
git clone https://github.com/rust-lang/compiler-builtins.git || echo "rust-lang/compiler-builtins has already been cloned"
3333
pushd compiler-builtins
3434
git checkout -- .
35-
git checkout 0.1.39
35+
git checkout 0.1.40
3636
git apply ../../crate_patches/000*-compiler-builtins-*.patch
3737
popd
3838

crate_patches/0001-compiler-builtins-Remove-rotate_left-from-Int.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ index 06054c8..3bea17b 100644
1717
fn wrapping_shr(self, other: u32) -> Self;
1818
- fn rotate_left(self, other: u32) -> Self;
1919
fn overflowing_add(self, other: Self) -> (Self, bool);
20-
fn aborting_div(self, other: Self) -> Self;
21-
fn aborting_rem(self, other: Self) -> Self;
20+
fn leading_zeros(self) -> u32;
21+
}
2222
@@ -209,10 +208,6 @@ macro_rules! int_impl_common {
2323
<Self>::wrapping_shr(self, other)
2424
}

rust-toolchain

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[toolchain]
2-
channel = "nightly-2021-04-07"
2+
channel = "nightly-2021-04-14"
33
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]

src/base.rs

Lines changed: 6 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -744,85 +744,15 @@ fn codegen_stmt<'tcx>(
744744
| StatementKind::AscribeUserType(..) => {}
745745

746746
StatementKind::LlvmInlineAsm(asm) => {
747-
use rustc_span::symbol::Symbol;
748-
let LlvmInlineAsm { asm, outputs, inputs } = &**asm;
749-
let rustc_hir::LlvmInlineAsmInner {
750-
asm: asm_code, // Name
751-
outputs: output_names, // Vec<LlvmInlineAsmOutput>
752-
inputs: input_names, // Vec<Name>
753-
clobbers, // Vec<Name>
754-
volatile, // bool
755-
alignstack, // bool
756-
dialect: _,
757-
asm_str_style: _,
758-
} = asm;
759-
match asm_code.as_str().trim() {
747+
match asm.asm.asm.as_str().trim() {
760748
"" => {
761749
// Black box
762750
}
763-
"mov %rbx, %rsi\n cpuid\n xchg %rbx, %rsi" => {
764-
assert_eq!(input_names, &[Symbol::intern("{eax}"), Symbol::intern("{ecx}")]);
765-
assert_eq!(output_names.len(), 4);
766-
for (i, c) in (&["={eax}", "={esi}", "={ecx}", "={edx}"]).iter().enumerate() {
767-
assert_eq!(&output_names[i].constraint.as_str(), c);
768-
assert!(!output_names[i].is_rw);
769-
assert!(!output_names[i].is_indirect);
770-
}
771-
772-
assert_eq!(clobbers, &[]);
773-
774-
assert!(!volatile);
775-
assert!(!alignstack);
776-
777-
assert_eq!(inputs.len(), 2);
778-
let leaf = codegen_operand(fx, &inputs[0].1).load_scalar(fx); // %eax
779-
let subleaf = codegen_operand(fx, &inputs[1].1).load_scalar(fx); // %ecx
780-
781-
let (eax, ebx, ecx, edx) =
782-
crate::intrinsics::codegen_cpuid_call(fx, leaf, subleaf);
783-
784-
assert_eq!(outputs.len(), 4);
785-
codegen_place(fx, outputs[0])
786-
.write_cvalue(fx, CValue::by_val(eax, fx.layout_of(fx.tcx.types.u32)));
787-
codegen_place(fx, outputs[1])
788-
.write_cvalue(fx, CValue::by_val(ebx, fx.layout_of(fx.tcx.types.u32)));
789-
codegen_place(fx, outputs[2])
790-
.write_cvalue(fx, CValue::by_val(ecx, fx.layout_of(fx.tcx.types.u32)));
791-
codegen_place(fx, outputs[3])
792-
.write_cvalue(fx, CValue::by_val(edx, fx.layout_of(fx.tcx.types.u32)));
793-
}
794-
"xgetbv" => {
795-
assert_eq!(input_names, &[Symbol::intern("{ecx}")]);
796-
797-
assert_eq!(output_names.len(), 2);
798-
for (i, c) in (&["={eax}", "={edx}"]).iter().enumerate() {
799-
assert_eq!(&output_names[i].constraint.as_str(), c);
800-
assert!(!output_names[i].is_rw);
801-
assert!(!output_names[i].is_indirect);
802-
}
803-
804-
assert_eq!(clobbers, &[]);
805-
806-
assert!(!volatile);
807-
assert!(!alignstack);
808-
809-
crate::trap::trap_unimplemented(fx, "_xgetbv arch intrinsic is not supported");
810-
}
811-
// ___chkstk, ___chkstk_ms and __alloca are only used on Windows
812-
_ if fx.tcx.symbol_name(fx.instance).name.starts_with("___chkstk") => {
813-
crate::trap::trap_unimplemented(fx, "Stack probes are not supported");
814-
}
815-
_ if fx.tcx.symbol_name(fx.instance).name == "__alloca" => {
816-
crate::trap::trap_unimplemented(fx, "Alloca is not supported");
817-
}
818-
// Used in sys::windows::abort_internal
819-
"int $$0x29" => {
820-
crate::trap::trap_unimplemented(fx, "Windows abort");
821-
}
822-
_ => fx
823-
.tcx
824-
.sess
825-
.span_fatal(stmt.source_info.span, "Inline assembly is not supported"),
751+
_ => fx.tcx.sess.span_fatal(
752+
stmt.source_info.span,
753+
"Legacy `llvm_asm!` inline assembly is not supported. \
754+
Try using the new `asm!` instead.",
755+
),
826756
}
827757
}
828758
StatementKind::Coverage { .. } => fx.tcx.sess.fatal("-Zcoverage is unimplemented"),

src/inline_asm.rs

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,64 @@ pub(crate) fn codegen_inline_asm<'tcx>(
2424
let true_ = fx.bcx.ins().iconst(types::I32, 1);
2525
fx.bcx.ins().trapnz(true_, TrapCode::User(1));
2626
return;
27+
} else if template[0] == InlineAsmTemplatePiece::String("mov rsi, rbx".to_string())
28+
&& template[1] == InlineAsmTemplatePiece::String("\n".to_string())
29+
&& template[2] == InlineAsmTemplatePiece::String("cpuid".to_string())
30+
&& template[3] == InlineAsmTemplatePiece::String("\n".to_string())
31+
&& template[4] == InlineAsmTemplatePiece::String("xchg rsi, rbx".to_string())
32+
{
33+
assert_eq!(operands.len(), 4);
34+
let (leaf, eax_place) = match operands[0] {
35+
InlineAsmOperand::InOut { reg, late: true, ref in_value, out_place } => {
36+
let reg = expect_reg(reg);
37+
assert_eq!(reg, InlineAsmReg::X86(X86InlineAsmReg::ax));
38+
(
39+
crate::base::codegen_operand(fx, in_value).load_scalar(fx),
40+
crate::base::codegen_place(fx, out_place.unwrap()),
41+
)
42+
}
43+
_ => unreachable!(),
44+
};
45+
let ebx_place = match operands[1] {
46+
InlineAsmOperand::Out { reg, late: true, place } => {
47+
let reg = expect_reg(reg);
48+
assert_eq!(reg, InlineAsmReg::X86(X86InlineAsmReg::si));
49+
crate::base::codegen_place(fx, place.unwrap())
50+
}
51+
_ => unreachable!(),
52+
};
53+
let (sub_leaf, ecx_place) = match operands[2] {
54+
InlineAsmOperand::InOut { reg, late: true, ref in_value, out_place } => {
55+
let reg = expect_reg(reg);
56+
assert_eq!(reg, InlineAsmReg::X86(X86InlineAsmReg::cx));
57+
(
58+
crate::base::codegen_operand(fx, in_value).load_scalar(fx),
59+
crate::base::codegen_place(fx, out_place.unwrap()),
60+
)
61+
}
62+
_ => unreachable!(),
63+
};
64+
let edx_place = match operands[3] {
65+
InlineAsmOperand::Out { reg, late: true, place } => {
66+
let reg = expect_reg(reg);
67+
assert_eq!(reg, InlineAsmReg::X86(X86InlineAsmReg::dx));
68+
crate::base::codegen_place(fx, place.unwrap())
69+
}
70+
_ => unreachable!(),
71+
};
72+
73+
let (eax, ebx, ecx, edx) = crate::intrinsics::codegen_cpuid_call(fx, leaf, sub_leaf);
74+
75+
eax_place.write_cvalue(fx, CValue::by_val(eax, fx.layout_of(fx.tcx.types.u32)));
76+
ebx_place.write_cvalue(fx, CValue::by_val(ebx, fx.layout_of(fx.tcx.types.u32)));
77+
ecx_place.write_cvalue(fx, CValue::by_val(ecx, fx.layout_of(fx.tcx.types.u32)));
78+
edx_place.write_cvalue(fx, CValue::by_val(edx, fx.layout_of(fx.tcx.types.u32)));
79+
return;
80+
} else if fx.tcx.symbol_name(fx.instance).name.starts_with("___chkstk") {
81+
// ___chkstk, ___chkstk_ms and __alloca are only used on Windows
82+
crate::trap::trap_unimplemented(fx, "Stack probes are not supported");
83+
} else if fx.tcx.symbol_name(fx.instance).name == "__alloca" {
84+
crate::trap::trap_unimplemented(fx, "Alloca is not supported");
2785
}
2886

2987
let mut slot_size = Size::from_bytes(0);

src/intrinsics/cpuid.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use crate::prelude::*;
88
pub(crate) fn codegen_cpuid_call<'tcx>(
99
fx: &mut FunctionCx<'_, '_, 'tcx>,
1010
leaf: Value,
11-
_subleaf: Value,
11+
_sub_leaf: Value,
1212
) -> (Value, Value, Value, Value) {
1313
let leaf_0 = fx.bcx.create_block();
1414
let leaf_1 = fx.bcx.create_block();

src/linkage.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ pub(crate) fn get_clif_linkage(
1313
(RLinkage::External, Visibility::Default) => Linkage::Export,
1414
(RLinkage::Internal, Visibility::Default) => Linkage::Local,
1515
(RLinkage::External, Visibility::Hidden) => Linkage::Hidden,
16+
(RLinkage::WeakAny, Visibility::Default) => Linkage::Preemptible,
1617
_ => panic!("{:?} = {:?} {:?}", mono_item, linkage, visibility),
1718
}
1819
}

0 commit comments

Comments
 (0)