Merge pull request #1300 from bjorn3/rename_build_to_dist

Rename the build/ directory to dist/
This commit is contained in:
bjorn3 2022-11-29 12:20:09 +01:00 committed by GitHub
commit 70ba23b109
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 51 additions and 46 deletions

View File

@ -111,7 +111,7 @@ jobs:
./y.rs test ./y.rs test
- name: Package prebuilt cg_clif - name: Package prebuilt cg_clif
run: tar cvfJ cg_clif.tar.xz build run: tar cvfJ cg_clif.tar.xz dist
- name: Upload prebuilt cg_clif - name: Upload prebuilt cg_clif
if: matrix.env.TARGET_TRIPLE != 'x86_64-pc-windows-gnu' if: matrix.env.TARGET_TRIPLE != 'x86_64-pc-windows-gnu'
@ -213,7 +213,7 @@ jobs:
- name: Package prebuilt cg_clif - name: Package prebuilt cg_clif
# don't use compression as xzip isn't supported by tar on windows and bzip2 hangs # don't use compression as xzip isn't supported by tar on windows and bzip2 hangs
run: tar cvf cg_clif.tar build run: tar cvf cg_clif.tar dist
- name: Upload prebuilt cg_clif - name: Upload prebuilt cg_clif
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3

1
.gitignore vendored
View File

@ -14,5 +14,6 @@ perf.data.old
/build_sysroot/sysroot_src /build_sysroot/sysroot_src
/build_sysroot/compiler-builtins /build_sysroot/compiler-builtins
/build_sysroot/rustc_version /build_sysroot/rustc_version
/dist
/rust /rust
/download /download

View File

@ -37,7 +37,7 @@ Assuming `$cg_clif_dir` is the directory you cloned this repo into and you follo
In the directory with your project (where you can do the usual `cargo build`), run: In the directory with your project (where you can do the usual `cargo build`), run:
```bash ```bash
$ $cg_clif_dir/build/cargo-clif build $ $cg_clif_dir/dist/cargo-clif build
``` ```
This will build your project with rustc_codegen_cranelift instead of the usual LLVM backend. This will build your project with rustc_codegen_cranelift instead of the usual LLVM backend.

View File

@ -14,7 +14,7 @@ static ABI_CAFE: CargoProject = CargoProject::git(&ABI_CAFE_REPO, ".");
pub(crate) fn run( pub(crate) fn run(
channel: &str, channel: &str,
sysroot_kind: SysrootKind, sysroot_kind: SysrootKind,
target_dir: &Path, dist_dir: &Path,
cg_clif_dylib: &Path, cg_clif_dylib: &Path,
host_triple: &str, host_triple: &str,
target_triple: &str, target_triple: &str,
@ -33,7 +33,7 @@ pub(crate) fn run(
build_sysroot::build_sysroot( build_sysroot::build_sysroot(
channel, channel,
sysroot_kind, sysroot_kind,
target_dir, dist_dir,
cg_clif_dylib, cg_clif_dylib,
host_triple, host_triple,
target_triple, target_triple,

View File

@ -9,21 +9,21 @@ use super::SysrootKind;
pub(crate) fn build_sysroot( pub(crate) fn build_sysroot(
channel: &str, channel: &str,
sysroot_kind: SysrootKind, sysroot_kind: SysrootKind,
target_dir: &Path, dist_dir: &Path,
cg_clif_dylib_src: &Path, cg_clif_dylib_src: &Path,
host_triple: &str, host_triple: &str,
target_triple: &str, target_triple: &str,
) { ) {
eprintln!("[BUILD] sysroot {:?}", sysroot_kind); eprintln!("[BUILD] sysroot {:?}", sysroot_kind);
if target_dir.exists() { if dist_dir.exists() {
fs::remove_dir_all(target_dir).unwrap(); fs::remove_dir_all(dist_dir).unwrap();
} }
fs::create_dir_all(target_dir.join("bin")).unwrap(); fs::create_dir_all(dist_dir.join("bin")).unwrap();
fs::create_dir_all(target_dir.join("lib")).unwrap(); fs::create_dir_all(dist_dir.join("lib")).unwrap();
// Copy the backend // Copy the backend
let cg_clif_dylib_path = target_dir let cg_clif_dylib_path = dist_dir
.join(if cfg!(windows) { .join(if cfg!(windows) {
// Windows doesn't have rpath support, so the cg_clif dylib needs to be next to the // Windows doesn't have rpath support, so the cg_clif dylib needs to be next to the
// binaries. // binaries.
@ -42,14 +42,14 @@ pub(crate) fn build_sysroot(
build_cargo_wrapper_cmd build_cargo_wrapper_cmd
.arg(PathBuf::from("scripts").join(format!("{wrapper}.rs"))) .arg(PathBuf::from("scripts").join(format!("{wrapper}.rs")))
.arg("-o") .arg("-o")
.arg(target_dir.join(wrapper_name)) .arg(dist_dir.join(wrapper_name))
.arg("-g"); .arg("-g");
spawn_and_wait(build_cargo_wrapper_cmd); spawn_and_wait(build_cargo_wrapper_cmd);
} }
let default_sysroot = super::rustc_info::get_default_sysroot(); let default_sysroot = super::rustc_info::get_default_sysroot();
let rustlib = target_dir.join("lib").join("rustlib"); let rustlib = dist_dir.join("lib").join("rustlib");
let host_rustlib_lib = rustlib.join(host_triple).join("lib"); let host_rustlib_lib = rustlib.join(host_triple).join("lib");
let target_rustlib_lib = rustlib.join(target_triple).join("lib"); let target_rustlib_lib = rustlib.join(target_triple).join("lib");
fs::create_dir_all(&host_rustlib_lib).unwrap(); fs::create_dir_all(&host_rustlib_lib).unwrap();
@ -114,7 +114,7 @@ pub(crate) fn build_sysroot(
SysrootKind::Clif => { SysrootKind::Clif => {
build_clif_sysroot_for_triple( build_clif_sysroot_for_triple(
channel, channel,
target_dir, dist_dir,
host_triple, host_triple,
&cg_clif_dylib_path, &cg_clif_dylib_path,
None, None,
@ -129,7 +129,7 @@ pub(crate) fn build_sysroot(
}; };
build_clif_sysroot_for_triple( build_clif_sysroot_for_triple(
channel, channel,
target_dir, dist_dir,
target_triple, target_triple,
&cg_clif_dylib_path, &cg_clif_dylib_path,
linker, linker,
@ -142,7 +142,7 @@ pub(crate) fn build_sysroot(
let file = file.unwrap().path(); let file = file.unwrap().path();
let filename = file.file_name().unwrap().to_str().unwrap(); let filename = file.file_name().unwrap().to_str().unwrap();
if filename.contains("std-") && !filename.contains(".rlib") { if filename.contains("std-") && !filename.contains(".rlib") {
try_hard_link(&file, target_dir.join("lib").join(file.file_name().unwrap())); try_hard_link(&file, dist_dir.join("lib").join(file.file_name().unwrap()));
} }
} }
} }
@ -153,7 +153,7 @@ static STANDARD_LIBRARY: CargoProject = CargoProject::local("build_sysroot");
fn build_clif_sysroot_for_triple( fn build_clif_sysroot_for_triple(
channel: &str, channel: &str,
target_dir: &Path, dist_dir: &Path,
triple: &str, triple: &str,
cg_clif_dylib_path: &Path, cg_clif_dylib_path: &Path,
linker: Option<&str>, linker: Option<&str>,
@ -189,7 +189,7 @@ fn build_clif_sysroot_for_triple(
// Build sysroot // Build sysroot
let mut rustflags = "-Zforce-unstable-if-unmarked -Cpanic=abort".to_string(); let mut rustflags = "-Zforce-unstable-if-unmarked -Cpanic=abort".to_string();
rustflags.push_str(&format!(" -Zcodegen-backend={}", cg_clif_dylib_path.to_str().unwrap())); rustflags.push_str(&format!(" -Zcodegen-backend={}", cg_clif_dylib_path.to_str().unwrap()));
rustflags.push_str(&format!(" --sysroot={}", target_dir.to_str().unwrap())); rustflags.push_str(&format!(" --sysroot={}", dist_dir.to_str().unwrap()));
if channel == "release" { if channel == "release" {
rustflags.push_str(" -Zmir-opt-level=3"); rustflags.push_str(" -Zmir-opt-level=3");
} }
@ -221,7 +221,7 @@ fn build_clif_sysroot_for_triple(
}; };
try_hard_link( try_hard_link(
entry.path(), entry.path(),
target_dir.join("lib").join("rustlib").join(triple).join("lib").join(entry.file_name()), dist_dir.join("lib").join("rustlib").join(triple).join("lib").join(entry.file_name()),
); );
} }
} }

View File

@ -17,10 +17,10 @@ fn usage() {
eprintln!("Usage:"); eprintln!("Usage:");
eprintln!(" ./y.rs prepare"); eprintln!(" ./y.rs prepare");
eprintln!( eprintln!(
" ./y.rs build [--debug] [--sysroot none|clif|llvm] [--target-dir DIR] [--no-unstable-features]" " ./y.rs build [--debug] [--sysroot none|clif|llvm] [--dist-dir DIR] [--no-unstable-features]"
); );
eprintln!( eprintln!(
" ./y.rs test [--debug] [--sysroot none|clif|llvm] [--target-dir DIR] [--no-unstable-features]" " ./y.rs test [--debug] [--sysroot none|clif|llvm] [--dist-dir DIR] [--no-unstable-features]"
); );
} }
@ -75,15 +75,15 @@ pub fn main() {
} }
}; };
let mut target_dir = PathBuf::from("build"); let mut dist_dir = PathBuf::from("dist");
let mut channel = "release"; let mut channel = "release";
let mut sysroot_kind = SysrootKind::Clif; let mut sysroot_kind = SysrootKind::Clif;
let mut use_unstable_features = true; let mut use_unstable_features = true;
while let Some(arg) = args.next().as_deref() { while let Some(arg) = args.next().as_deref() {
match arg { match arg {
"--target-dir" => { "--dist-dir" => {
target_dir = PathBuf::from(args.next().unwrap_or_else(|| { dist_dir = PathBuf::from(args.next().unwrap_or_else(|| {
arg_error!("--target-dir requires argument"); arg_error!("--dist-dir requires argument");
})) }))
} }
"--debug" => channel = "debug", "--debug" => channel = "debug",
@ -101,7 +101,7 @@ pub fn main() {
arg => arg_error!("Unexpected argument {}", arg), arg => arg_error!("Unexpected argument {}", arg),
} }
} }
target_dir = std::env::current_dir().unwrap().join(target_dir); dist_dir = std::env::current_dir().unwrap().join(dist_dir);
let host_triple = if let Ok(host_triple) = std::env::var("HOST_TRIPLE") { let host_triple = if let Ok(host_triple) = std::env::var("HOST_TRIPLE") {
host_triple host_triple
@ -128,7 +128,7 @@ pub fn main() {
tests::run_tests( tests::run_tests(
channel, channel,
sysroot_kind, sysroot_kind,
&target_dir, &dist_dir,
&cg_clif_dylib, &cg_clif_dylib,
&host_triple, &host_triple,
&target_triple, &target_triple,
@ -137,7 +137,7 @@ pub fn main() {
abi_cafe::run( abi_cafe::run(
channel, channel,
sysroot_kind, sysroot_kind,
&target_dir, &dist_dir,
&cg_clif_dylib, &cg_clif_dylib,
&host_triple, &host_triple,
&target_triple, &target_triple,
@ -147,7 +147,7 @@ pub fn main() {
build_sysroot::build_sysroot( build_sysroot::build_sysroot(
channel, channel,
sysroot_kind, sysroot_kind,
&target_dir, &dist_dir,
&cg_clif_dylib, &cg_clif_dylib,
&host_triple, &host_triple,
&target_triple, &target_triple,

View File

@ -274,7 +274,7 @@ const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[
eprintln!("[BENCH COMPILE] ebobby/simple-raytracer"); eprintln!("[BENCH COMPILE] ebobby/simple-raytracer");
let cargo_clif = env::current_dir() let cargo_clif = env::current_dir()
.unwrap() .unwrap()
.join("build") .join("dist")
.join(get_wrapper_file_name("cargo-clif", "bin")); .join(get_wrapper_file_name("cargo-clif", "bin"));
let source_dir = SIMPLE_RAYTRACER.source_dir(); let source_dir = SIMPLE_RAYTRACER.source_dir();
let manifest_path = SIMPLE_RAYTRACER.manifest_path(); let manifest_path = SIMPLE_RAYTRACER.manifest_path();
@ -432,7 +432,7 @@ const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[
pub(crate) fn run_tests( pub(crate) fn run_tests(
channel: &str, channel: &str,
sysroot_kind: SysrootKind, sysroot_kind: SysrootKind,
target_dir: &Path, dist_dir: &Path,
cg_clif_dylib: &Path, cg_clif_dylib: &Path,
host_triple: &str, host_triple: &str,
target_triple: &str, target_triple: &str,
@ -443,7 +443,7 @@ pub(crate) fn run_tests(
build_sysroot::build_sysroot( build_sysroot::build_sysroot(
channel, channel,
SysrootKind::None, SysrootKind::None,
&target_dir, &dist_dir,
cg_clif_dylib, cg_clif_dylib,
&host_triple, &host_triple,
&target_triple, &target_triple,
@ -462,7 +462,7 @@ pub(crate) fn run_tests(
build_sysroot::build_sysroot( build_sysroot::build_sysroot(
channel, channel,
sysroot_kind, sysroot_kind,
&target_dir, &dist_dir,
cg_clif_dylib, cg_clif_dylib,
&host_triple, &host_triple,
&target_triple, &target_triple,
@ -503,11 +503,11 @@ impl TestRunner {
target_triple.contains("x86_64") && is_native && !host_triple.contains("windows"); target_triple.contains("x86_64") && is_native && !host_triple.contains("windows");
let mut rustc_clif = root_dir.clone(); let mut rustc_clif = root_dir.clone();
rustc_clif.push("build"); rustc_clif.push("dist");
rustc_clif.push(get_wrapper_file_name("rustc-clif", "bin")); rustc_clif.push(get_wrapper_file_name("rustc-clif", "bin"));
let mut rustdoc_clif = root_dir.clone(); let mut rustdoc_clif = root_dir.clone();
rustdoc_clif.push("build"); rustdoc_clif.push("dist");
rustdoc_clif.push(get_wrapper_file_name("rustdoc-clif", "bin")); rustdoc_clif.push(get_wrapper_file_name("rustdoc-clif", "bin"));
let mut rustflags = env::var("RUSTFLAGS").ok().unwrap_or("".to_string()); let mut rustflags = env::var("RUSTFLAGS").ok().unwrap_or("".to_string());

View File

@ -2,9 +2,9 @@
set -e set -e
rm -rf build_sysroot/{sysroot_src/,target/,compiler-builtins/,rustc_version} rm -rf build_sysroot/{sysroot_src/,target/,compiler-builtins/,rustc_version}
rm -rf target/ build/ perf.data{,.old} y.bin rm -rf target/ dist/ perf.data{,.old} y.bin
rm -rf download/ rm -rf download/
# Kept for now in case someone updates their checkout of cg_clif before running clean_all.sh # Kept for now in case someone updates their checkout of cg_clif before running clean_all.sh
# FIXME remove at some point in the future # FIXME remove at some point in the future
rm -rf rand/ regex/ simple-raytracer/ portable-simd/ abi-checker/ abi-cafe/ rm -rf rand/ regex/ simple-raytracer/ portable-simd/ abi-checker/ abi-cafe/ build/

View File

@ -9,7 +9,7 @@ Assuming `$cg_clif_dir` is the directory you cloned this repo into and you follo
In the directory with your project (where you can do the usual `cargo build`), run: In the directory with your project (where you can do the usual `cargo build`), run:
```bash ```bash
$ $cg_clif_dir/build/cargo-clif build $ $cg_clif_dir/dist/cargo-clif build
``` ```
This will build your project with rustc_codegen_cranelift instead of the usual LLVM backend. This will build your project with rustc_codegen_cranelift instead of the usual LLVM backend.
@ -19,7 +19,7 @@ This will build your project with rustc_codegen_cranelift instead of the usual L
> You should prefer using the Cargo method. > You should prefer using the Cargo method.
```bash ```bash
$ $cg_clif_dir/build/rustc-clif my_crate.rs $ $cg_clif_dir/dist/rustc-clif my_crate.rs
``` ```
## Jit mode ## Jit mode
@ -32,20 +32,20 @@ In jit mode cg_clif will immediately execute your code without creating an execu
> The jit mode will probably need cargo integration to make this possible. > The jit mode will probably need cargo integration to make this possible.
```bash ```bash
$ $cg_clif_dir/build/cargo-clif jit $ $cg_clif_dir/dist/cargo-clif jit
``` ```
or or
```bash ```bash
$ $cg_clif_dir/build/rustc-clif -Zunstable-features -Cllvm-args=mode=jit -Cprefer-dynamic my_crate.rs $ $cg_clif_dir/dist/rustc-clif -Zunstable-features -Cllvm-args=mode=jit -Cprefer-dynamic my_crate.rs
``` ```
There is also an experimental lazy jit mode. In this mode functions are only compiled once they are There is also an experimental lazy jit mode. In this mode functions are only compiled once they are
first called. first called.
```bash ```bash
$ $cg_clif_dir/build/cargo-clif lazy-jit $ $cg_clif_dir/dist/cargo-clif lazy-jit
``` ```
## Shell ## Shell
@ -54,7 +54,7 @@ These are a few functions that allow you to easily run rust code from the shell
```bash ```bash
function jit_naked() { function jit_naked() {
echo "$@" | $cg_clif_dir/build/rustc-clif - -Zunstable-features -Cllvm-args=mode=jit -Cprefer-dynamic echo "$@" | $cg_clif_dir/dist/rustc-clif - -Zunstable-features -Cllvm-args=mode=jit -Cprefer-dynamic
} }
function jit() { function jit() {

View File

@ -2,7 +2,7 @@
#![forbid(unsafe_code)]/* This line is ignored by bash #![forbid(unsafe_code)]/* This line is ignored by bash
# This block is ignored by rustc # This block is ignored by rustc
pushd $(dirname "$0")/../ pushd $(dirname "$0")/../
RUSTC="$(pwd)/build/rustc-clif" RUSTC="$(pwd)/dist/rustc-clif"
popd popd
PROFILE=$1 OUTPUT=$2 exec $RUSTC -Zunstable-options -Cllvm-args=mode=jit -Cprefer-dynamic $0 PROFILE=$1 OUTPUT=$2 exec $RUSTC -Zunstable-options -Cllvm-args=mode=jit -Cprefer-dynamic $0
#*/ #*/

View File

@ -36,7 +36,7 @@ changelog-seen = 2
ninja = false ninja = false
[build] [build]
rustc = "$(pwd)/../build/rustc-clif" rustc = "$(pwd)/../dist/rustc-clif"
cargo = "$(rustup which cargo)" cargo = "$(rustup which cargo)"
full-bootstrap = true full-bootstrap = true
local-rebuild = true local-rebuild = true

View File

@ -89,7 +89,7 @@ rm src/test/ui/consts/issue-33537.rs # same
# doesn't work due to the way the rustc test suite is invoked. # doesn't work due to the way the rustc test suite is invoked.
# should work when using ./x.py test the way it is intended # should work when using ./x.py test the way it is intended
# ============================================================ # ============================================================
rm -r src/test/run-make/emit-shared-files # requires the rustdoc executable in build/bin/ rm -r src/test/run-make/emit-shared-files # requires the rustdoc executable in dist/bin/
rm -r src/test/run-make/unstable-flag-required # same rm -r src/test/run-make/unstable-flag-required # same
rm -r src/test/run-make/rustdoc-* # same rm -r src/test/run-make/rustdoc-* # same
rm -r src/test/run-make/issue-88756-default-output # same rm -r src/test/run-make/issue-88756-default-output # same

View File

@ -16,6 +16,10 @@ pub(crate) fn codegen_aarch64_llvm_intrinsic_call<'tcx>(
// llvm.aarch64.neon.sqshl.v*i* // llvm.aarch64.neon.sqshl.v*i*
match intrinsic { match intrinsic {
"llvm.aarch64.isb" => {
fx.bcx.ins().fence();
}
_ if intrinsic.starts_with("llvm.aarch64.neon.abs.v") => { _ if intrinsic.starts_with("llvm.aarch64.neon.abs.v") => {
intrinsic_args!(fx, args => (a); intrinsic); intrinsic_args!(fx, args => (a); intrinsic);