]> git.lizzy.rs Git - rust.git/commitdiff
Remove start functions, use newlib instead of openlibm + ralloc
authorJeremy Soller <jackpot51@gmail.com>
Thu, 22 Dec 2016 23:13:14 +0000 (16:13 -0700)
committerJeremy Soller <jackpot51@gmail.com>
Thu, 22 Dec 2016 23:13:14 +0000 (16:13 -0700)
src/librustc_back/target/redox_base.rs
src/libstd/build.rs
src/libstd/lib.rs
src/libstd/rt.rs
src/libstd/sys/redox/mod.rs
src/libstd/sys/redox/rt.rs [deleted file]
src/libstd/sys/unix/mod.rs
src/libstd/sys/unix/rt.rs [deleted file]
src/libstd/sys/windows/mod.rs
src/libstd/sys/windows/rt.rs [deleted file]

index fc4c68276b65197c3c9d20efb50e1a8ed064c1ec..c804d283ba7572e236c3d307c98343c373afaa06 100644 (file)
@@ -27,12 +27,13 @@ pub fn opts() -> TargetOptions {
             // Always enable NX protection when it is available
             "-Wl,-z,noexecstack".to_string(),
 
-            // Do not link libc
-            "-nostdlib".to_string(),
-
             // Static link
             "-static".to_string()
         ],
+        late_link_args: vec![
+            "-lc".to_string(),
+            "-lm".to_string()
+        ],
         executables: true,
         relocation_model: "static".to_string(),
         disable_redzone: true,
@@ -40,8 +41,8 @@ pub fn opts() -> TargetOptions {
         target_family: Some("redox".to_string()),
         linker_is_gnu: true,
         no_default_libraries: true,
-        lib_allocation_crate: "ralloc".to_string(),
-        exe_allocation_crate: "ralloc".to_string(),
+        lib_allocation_crate: "alloc_system".to_string(),
+        exe_allocation_crate: "alloc_system".to_string(),
         has_elf_tls: true,
         panic_strategy: PanicStrategy::Abort,
         .. Default::default()
index b8f9b51172ade4673435244d8cb110f0d248f8f0..535cb7e136ce4a9c1fef8ecec064bc8ec1e36a85 100644 (file)
@@ -62,8 +62,6 @@ fn main() {
         println!("cargo:rustc-link-lib=magenta");
         println!("cargo:rustc-link-lib=mxio");
         println!("cargo:rustc-link-lib=launchpad"); // for std::process
-    } else if target.contains("redox") {
-        println!("cargo:rustc-link-lib=openlibm");
     }
 }
 
index 3c9e66a469cd87b58d01b3d2d95d64fdc1d29c29..414f25fa5eb33af7bfb54edd797601d9fc1bef0c 100644 (file)
 #![feature(unwind_attributes)]
 #![feature(vec_push_all)]
 #![feature(zero_one)]
-#![cfg_attr(target_os = "redox", feature(naked_functions))]
 #![cfg_attr(test, feature(update_panic_count))]
 
 // Explicitly import the prelude. The compiler uses this same unstable attribute
index 1f2b94239a86b93888a91fe13891f9dee6d95db0..185b7bbd7363389d2413222d33dda711da82d4fd 100644 (file)
 // Reexport some of our utilities which are expected by other crates.
 pub use panicking::{begin_panic, begin_panic_fmt, update_panic_count};
 
-// Reexport the start module on platforms that provide it
-#[unstable(feature = "sys_rt", issue="0")]
-pub use sys::rt::*;
-
 #[cfg(not(test))]
 #[lang = "start"]
 fn lang_start(main: *const u8, argc: isize, argv: *const *const u8) -> isize {
index a8dbac28fb655522566d87077487fb0d392cf073..5982bdd6549ca46a131810c60a4305851bc9a493 100644 (file)
@@ -30,7 +30,6 @@
 pub mod pipe;
 pub mod process;
 pub mod rand;
-pub mod rt;
 pub mod rwlock;
 pub mod stack_overflow;
 pub mod stdio;
diff --git a/src/libstd/sys/redox/rt.rs b/src/libstd/sys/redox/rt.rs
deleted file mode 100644 (file)
index 0e85498..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-//! Defintion of functions like _start for the linker
-
-use sys::syscall::exit;
-
-#[unstable(feature = "sys_rt", issue = "0")]
-#[no_mangle]
-#[naked]
-#[cfg(target_arch = "x86")]
-pub unsafe fn _start() {
-    asm!("push esp
-        call _start_stack
-        pop esp"
-        :
-        :
-        : "memory"
-        : "intel", "volatile");
-    let _ = exit(0);
-}
-
-#[unstable(feature = "sys_rt", issue = "0")]
-#[no_mangle]
-#[naked]
-#[cfg(target_arch = "x86_64")]
-pub unsafe fn _start() {
-    asm!("mov rdi, rsp
-        and rsp, 0xFFFFFFFFFFFFFFF0
-        call _start_stack"
-        :
-        :
-        : "memory"
-        : "intel", "volatile");
-    let _ = exit(0);
-}
-
-#[unstable(feature = "sys_rt", issue = "0")]
-#[no_mangle]
-pub unsafe extern "C" fn _start_stack(stack: *const usize){
-    extern "C" {
-        fn main(argc: usize, argv: *const *const u8) -> usize;
-    }
-
-    let argc = *stack as usize;
-    let argv = stack.offset(1) as *const *const u8;
-    let _ = exit(main(argc, argv));
-}
-
-/// Memcpy
-///
-/// Copy N bytes of memory from one location to another.
-#[unstable(feature = "sys_rt", issue = "0")]
-#[no_mangle]
-pub unsafe extern fn memcpy(dest: *mut u8, src: *const u8,
-                            n: usize) -> *mut u8 {
-    let mut i = 0;
-    while i < n {
-        *((dest as usize + i) as *mut u8) = *((src as usize + i) as *const u8);
-        i += 1;
-    }
-
-    dest
-}
-
-/// Memmove
-///
-/// Copy N bytes of memory from src to dest. The memory areas may overlap.
-#[unstable(feature = "sys_rt", issue = "0")]
-#[no_mangle]
-pub unsafe extern fn memmove(dest: *mut u8, src: *const u8,
-                             n: usize) -> *mut u8 {
-    if src < dest as *const u8 {
-        let mut i = n;
-        while i != 0 {
-            i -= 1;
-            *((dest as usize + i) as *mut u8) = *((src as usize + i) as *const u8);
-        }
-    } else {
-        let mut i = 0;
-        while i < n {
-            *((dest as usize + i) as *mut u8) = *((src as usize + i) as *const u8);
-            i += 1;
-        }
-    }
-
-    dest
-}
-
-/// Memset
-///
-/// Fill a block of memory with a specified value.
-#[unstable(feature = "sys_rt", issue = "0")]
-#[no_mangle]
-pub unsafe extern fn memset(dest: *mut u8, c: i32, n: usize) -> *mut u8 {
-    let mut i = 0;
-    while i < n {
-        *((dest as usize + i) as *mut u8) = c as u8;
-        i += 1;
-    }
-
-    dest
-}
-
-/// Memcmp
-///
-/// Compare two blocks of memory.
-#[unstable(feature = "sys_rt", issue = "0")]
-#[no_mangle]
-pub unsafe extern fn memcmp(s1: *const u8, s2: *const u8, n: usize) -> i32 {
-    let mut i = 0;
-
-    while i < n {
-        let a = *((s1 as usize + i) as *const u8);
-        let b = *((s2 as usize + i) as *const u8);
-        if a != b {
-            return a as i32 - b as i32
-        }
-        i += 1;
-    }
-
-    0
-}
index 5e14b392bdc2cffbdbd53ae8ac2512aecd17c27f..fd7dc17cccd8cbf36d3a24684215adebeb41326f 100644 (file)
@@ -50,7 +50,6 @@
 pub mod pipe;
 pub mod process;
 pub mod rand;
-pub mod rt;
 pub mod rwlock;
 pub mod stack_overflow;
 pub mod thread;
diff --git a/src/libstd/sys/unix/rt.rs b/src/libstd/sys/unix/rt.rs
deleted file mode 100644 (file)
index 188e31c..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-//! Stub for placing functions like _start for the linker
index 52d256630a5e9b7bb706b9a92c81a1273c82581d..defc41c5f46a38ccc33954d99bf265a6b111e635 100644 (file)
@@ -36,7 +36,6 @@
 pub mod pipe;
 pub mod process;
 pub mod rand;
-pub mod rt;
 pub mod rwlock;
 pub mod stack_overflow;
 pub mod thread;
diff --git a/src/libstd/sys/windows/rt.rs b/src/libstd/sys/windows/rt.rs
deleted file mode 100644 (file)
index 188e31c..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-//! Stub for placing functions like _start for the linker