Better libcore building instructions and rustup

This commit is contained in:
bjorn3 2018-07-19 18:41:37 +02:00
parent 75d8fefc18
commit 85eaa2c0c9
6 changed files with 249 additions and 298 deletions

View file

@ -1,6 +1,6 @@
From cc175e6a3f59c7fe1523fd441214e0303f8fee80 Mon Sep 17 00:00:00 2001
From a26747487d398af360dc16344b1f9d2b367720c9 Mon Sep 17 00:00:00 2001
From: bjorn3 <bjorn3@users.noreply.github.com>
Date: Sat, 30 Jun 2018 12:30:30 +0200
Date: Thu, 19 Jul 2018 18:26:56 +0200
Subject: [PATCH] Disable stdsimd in libcore
---
@ -8,10 +8,10 @@ Subject: [PATCH] Disable stdsimd in libcore
1 file changed, 2 insertions(+)
diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs
index 40caee8554..f038d155a1 100644
index bbe6ae8619..bdeb6ce426 100644
--- a/src/libcore/lib.rs
+++ b/src/libcore/lib.rs
@@ -240,6 +240,7 @@ macro_rules! test_v256 { ($item:item) => {}; }
@@ -238,6 +238,7 @@ macro_rules! test_v256 { ($item:item) => {}; }
macro_rules! test_v512 { ($item:item) => {}; }
#[allow(unused_macros)]
macro_rules! vector_impl { ($([$f:ident, $($args:tt)*]),*) => { $($f!($($args)*);)* } }
@ -19,11 +19,11 @@ index 40caee8554..f038d155a1 100644
#[path = "../stdsimd/coresimd/mod.rs"]
#[allow(missing_docs, missing_debug_implementations, dead_code, unused_imports)]
#[unstable(feature = "stdsimd", issue = "48556")]
@@ -252,3 +253,4 @@ pub use coresimd::simd;
@@ -250,3 +251,4 @@ pub use coresimd::simd;
#[stable(feature = "simd_arch", since = "1.27.0")]
#[cfg(not(stage0))]
pub use coresimd::arch;
+*/
--
2.15.2 (Apple Git-101.1)
--
2.11.0

File diff suppressed because it is too large Load diff

View file

@ -23,11 +23,8 @@ $ rustc -Zcodegen-backend=$(pwd)/target/debug/librustc_codegen_cranelift.so my_c
## Building libcore
```bash
$ git clone https://github.com/rust-lang/rust.git
$ cd rust
$ git apply ../0001-Disable-stdsimd-in-libcore.patch
$ git apply ../0002-Disable-u128-and-i128-in-libcore.patch
$ cd ../
$ rustup component add rust-src
$ ./prepare_libcore.sh
$ ./build.sh
```

View file

@ -1,4 +1,4 @@
cargo build || exit 1
rustc -Zcodegen-backend=$(pwd)/target/debug/librustc_codegen_cranelift.so example.rs --crate-type lib -Og
rustc -Zcodegen-backend=$(pwd)/target/debug/librustc_codegen_cranelift.so ./rust/src/libcore/lib.rs --crate-type lib -Og
rustc -Zcodegen-backend=$(pwd)/target/debug/librustc_codegen_cranelift.so ./target/libcore/src/libcore/lib.rs --crate-type lib -Og

11
prepare_libcore.sh Executable file
View file

@ -0,0 +1,11 @@
#!/bin/bash --verbose
SRC_DIR="target/libcore"
rm -rf $SRC_DIR &&
mkdir -p $SRC_DIR/src &&
cp -r $(dirname $(rustup which rustc))/../lib/rustlib/src/rust/src/libcore $SRC_DIR/src/libcore || (echo "Please install rust-src component"; exit 1)
cd $SRC_DIR || exit 1
git init || exit 1
git add . || exit 1
git commit -m "Initial commit" -q || exit 1
git apply ../../000*.patch || exit 1
echo "Successfully prepared libcore for building"

View file

@ -59,7 +59,6 @@ pub fn trans_mono_item<'a, 'tcx: 'a>(cx: &mut CodegenCx<'a, 'tcx, CurrentBackend
}
MonoItem::Static(def_id) => cx.tcx.sess.err(&format!("Unimplemented static mono item {:?}", def_id)),
MonoItem::GlobalAsm(node_id) => cx.tcx.sess.err(&format!("Unimplemented global asm mono item {:?}", node_id)),
MonoItem::CustomSection(def_id) => cx.tcx.sess.err(&format!("Unimplemented custom section mono item {:?}", def_id)),
}
}