diff options
| author | mark <markm@cs.wisc.edu> | 2020-08-27 22:58:48 -0500 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2020-08-30 18:45:07 +0300 |
| commit | 9e5f7d5631b8f4009ac1c693e585d4b7108d4275 (patch) | |
| tree | 158a05eb3f204a8e72939b58427d0c2787a4eade /compiler/rustc | |
| parent | db534b3ac286cf45688c3bbae6aa6e77439e52d2 (diff) | |
| download | rust-9e5f7d5631b8f4009ac1c693e585d4b7108d4275.tar.gz rust-9e5f7d5631b8f4009ac1c693e585d4b7108d4275.zip | |
mv compiler to compiler/
Diffstat (limited to 'compiler/rustc')
| -rw-r--r-- | compiler/rustc/Cargo.toml | 25 | ||||
| -rw-r--r-- | compiler/rustc/src/main.rs | 31 |
2 files changed, 56 insertions, 0 deletions
diff --git a/compiler/rustc/Cargo.toml b/compiler/rustc/Cargo.toml new file mode 100644 index 00000000000..4340d50f845 --- /dev/null +++ b/compiler/rustc/Cargo.toml @@ -0,0 +1,25 @@ +[package] +authors = ["The Rust Project Developers"] +name = "rustc-main" +version = "0.0.0" +edition = '2018' + +[[bin]] +name = "rustc_binary" +path = "src/main.rs" + +[dependencies] +rustc_driver = { path = "../rustc_driver" } + +# Make sure rustc_codegen_ssa ends up in the sysroot, because this +# crate is intended to be used by codegen backends, which may not be in-tree. +rustc_codegen_ssa = { path = "../rustc_codegen_ssa" } + +[dependencies.jemalloc-sys] +version = '0.3.0' +optional = true +features = ['unprefixed_malloc_on_supported_platforms'] + +[features] +jemalloc = ['jemalloc-sys'] +llvm = ['rustc_driver/llvm'] diff --git a/compiler/rustc/src/main.rs b/compiler/rustc/src/main.rs new file mode 100644 index 00000000000..6bc5aa6382c --- /dev/null +++ b/compiler/rustc/src/main.rs @@ -0,0 +1,31 @@ +fn main() { + // Pull in jemalloc when enabled. + // + // Note that we're pulling in a static copy of jemalloc which means that to + // pull it in we need to actually reference its symbols for it to get + // linked. The two crates we link to here, std and rustc_driver, are both + // dynamic libraries. That means to pull in jemalloc we need to actually + // reference allocation symbols one way or another (as this file is the only + // object code in the rustc executable). + #[cfg(feature = "jemalloc-sys")] + { + use std::os::raw::{c_int, c_void}; + + #[used] + static _F1: unsafe extern "C" fn(usize, usize) -> *mut c_void = jemalloc_sys::calloc; + #[used] + static _F2: unsafe extern "C" fn(*mut *mut c_void, usize, usize) -> c_int = + jemalloc_sys::posix_memalign; + #[used] + static _F3: unsafe extern "C" fn(usize, usize) -> *mut c_void = jemalloc_sys::aligned_alloc; + #[used] + static _F4: unsafe extern "C" fn(usize) -> *mut c_void = jemalloc_sys::malloc; + #[used] + static _F5: unsafe extern "C" fn(*mut c_void, usize) -> *mut c_void = jemalloc_sys::realloc; + #[used] + static _F6: unsafe extern "C" fn(*mut c_void) = jemalloc_sys::free; + } + + rustc_driver::set_sigpipe_handler(); + rustc_driver::main() +} |
