From f4c222f7a3f21fd3fdc5df28f344988c103d17fa Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Tue, 12 Nov 2013 06:21:17 -0800 Subject: [PATCH] rt: Namespace all C functions under rust_ --- src/libextra/time.rs | 8 ++++---- src/libstd/rt/basic.rs | 4 ++-- src/libstd/rt/context.rs | 12 ++++++------ src/rt/arch/arm/_context.S | 4 ++-- src/rt/arch/i386/_context.S | 4 ++-- src/rt/arch/mips/_context.S | 8 ++++---- src/rt/arch/x86_64/_context.S | 4 ++-- src/rt/rust_builtin.cpp | 6 +++--- src/rt/rustrt.def.in | 6 +++--- 9 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/libextra/time.rs b/src/libextra/time.rs index c79c21f0bf6..1bef864d114 100644 --- a/src/libextra/time.rs +++ b/src/libextra/time.rs @@ -21,8 +21,8 @@ pub mod rustrt { use super::Tm; extern { - pub fn get_time(sec: &mut i64, nsec: &mut i32); - pub fn precise_time_ns(ns: &mut u64); + pub fn rust_get_time(sec: &mut i64, nsec: &mut i32); + pub fn rust_precise_time_ns(ns: &mut u64); pub fn rust_tzset(); pub fn rust_gmtime(sec: i64, nsec: i32, result: &mut Tm); pub fn rust_localtime(sec: i64, nsec: i32, result: &mut Tm); @@ -66,7 +66,7 @@ pub fn get_time() -> Timespec { unsafe { let mut sec = 0i64; let mut nsec = 0i32; - rustrt::get_time(&mut sec, &mut nsec); + rustrt::rust_get_time(&mut sec, &mut nsec); return Timespec::new(sec, nsec); } } @@ -79,7 +79,7 @@ pub fn get_time() -> Timespec { pub fn precise_time_ns() -> u64 { unsafe { let mut ns = 0u64; - rustrt::precise_time_ns(&mut ns); + rustrt::rust_precise_time_ns(&mut ns); ns } } diff --git a/src/libstd/rt/basic.rs b/src/libstd/rt/basic.rs index 42ecbf5dc78..e8f6c4055a0 100644 --- a/src/libstd/rt/basic.rs +++ b/src/libstd/rt/basic.rs @@ -241,11 +241,11 @@ impl Drop for BasicPausible { fn time() -> Time { extern { - fn get_time(sec: &mut i64, nsec: &mut i32); + fn rust_get_time(sec: &mut i64, nsec: &mut i32); } let mut sec = 0; let mut nsec = 0; - unsafe { get_time(&mut sec, &mut nsec) } + unsafe { rust_get_time(&mut sec, &mut nsec) } Time { sec: sec as u64, nsec: nsec as u64 } } diff --git a/src/libstd/rt/context.rs b/src/libstd/rt/context.rs index fcc30ded954..6fcc8e32111 100644 --- a/src/libstd/rt/context.rs +++ b/src/libstd/rt/context.rs @@ -59,7 +59,7 @@ impl Context { // which we will then modify to call the given function when restored let mut regs = new_regs(); unsafe { - swap_registers(transmute_mut_region(&mut *regs), transmute_region(&*regs)); + rust_swap_registers(transmute_mut_region(&mut *regs), transmute_region(&*regs)); }; initialize_call_frame(&mut *regs, fp, argp, sp); @@ -104,8 +104,8 @@ impl Context { // stack limit in the OS-specified TLS slot. This also means that // we cannot call any more rust functions after record_stack_bounds // returns because they would all likely fail due to the limit being - // invalid for the current task. Lucky for us `swap_registers` is a - // C function so we don't have to worry about that! + // invalid for the current task. Lucky for us `rust_swap_registers` + // is a C function so we don't have to worry about that! match in_context.stack_bounds { Some((lo, hi)) => record_stack_bounds(lo, hi), // If we're going back to one of the original contexts or @@ -113,13 +113,13 @@ impl Context { // the stack limit to 0 to make morestack never fail None => record_stack_bounds(0, uint::max_value), } - swap_registers(out_regs, in_regs) + rust_swap_registers(out_regs, in_regs) } } } extern { - fn swap_registers(out_regs: *mut Registers, in_regs: *Registers); + fn rust_swap_registers(out_regs: *mut Registers, in_regs: *Registers); } // Register contexts used in various architectures @@ -142,7 +142,7 @@ extern { // // These structures/functions are roughly in-sync with the source files inside // of src/rt/arch/$arch. The only currently used function from those folders is -// the `swap_registers` function, but that's only because for now segmented +// the `rust_swap_registers` function, but that's only because for now segmented // stacks are disabled. #[cfg(target_arch = "x86")] diff --git a/src/rt/arch/arm/_context.S b/src/rt/arch/arm/_context.S index 7227c15cc47..4ab463d968e 100644 --- a/src/rt/arch/arm/_context.S +++ b/src/rt/arch/arm/_context.S @@ -12,8 +12,8 @@ .align #endif -.globl swap_registers -swap_registers: +.globl rust_swap_registers +rust_swap_registers: str r0, [r0, #0] str r3, [r0, #12] str r4, [r0, #16] diff --git a/src/rt/arch/i386/_context.S b/src/rt/arch/i386/_context.S index e2e4ffe35b4..6b79a82e4ac 100644 --- a/src/rt/arch/i386/_context.S +++ b/src/rt/arch/i386/_context.S @@ -21,9 +21,9 @@ The registers_t variable is in (%esp) */ #if defined(__APPLE__) || defined(_WIN32) -#define SWAP_REGISTERS _swap_registers +#define SWAP_REGISTERS _rust_swap_registers #else -#define SWAP_REGISTERS swap_registers +#define SWAP_REGISTERS rust_swap_registers #endif // swap_registers(registers_t *oregs, registers_t *regs) diff --git a/src/rt/arch/mips/_context.S b/src/rt/arch/mips/_context.S index 6d8207d97d0..cfe77cc3045 100644 --- a/src/rt/arch/mips/_context.S +++ b/src/rt/arch/mips/_context.S @@ -4,11 +4,11 @@ #endif .text -.globl swap_registers +.globl rust_swap_registers .align 2 .set nomips16 -.ent swap_registers -swap_registers: +.ent rust_swap_registers +rust_swap_registers: .set noreorder .set nomacro .set noat @@ -85,4 +85,4 @@ swap_registers: jr $31 nop -.end swap_registers +.end rust_swap_registers diff --git a/src/rt/arch/x86_64/_context.S b/src/rt/arch/x86_64/_context.S index a53b1c2d737..74f20650f30 100644 --- a/src/rt/arch/x86_64/_context.S +++ b/src/rt/arch/x86_64/_context.S @@ -55,9 +55,9 @@ First four arguments: */ #if defined(__APPLE__) -#define SWAP_REGISTERS _swap_registers +#define SWAP_REGISTERS _rust_swap_registers #else -#define SWAP_REGISTERS swap_registers +#define SWAP_REGISTERS rust_swap_registers #endif // swap_registers(registers_t *oregs, registers_t *regs) diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp index 4c1c6a7202a..7d75d557bf7 100644 --- a/src/rt/rust_builtin.cpp +++ b/src/rt/rust_builtin.cpp @@ -168,7 +168,7 @@ extern "C" CDECL FILE* rust_get_stderr() {return stderr;} #if defined(__WIN32__) extern "C" CDECL void -get_time(int64_t *sec, int32_t *nsec) { +rust_get_time(int64_t *sec, int32_t *nsec) { FILETIME fileTime; GetSystemTimeAsFileTime(&fileTime); @@ -187,7 +187,7 @@ get_time(int64_t *sec, int32_t *nsec) { } #else extern "C" CDECL void -get_time(int64_t *sec, int32_t *nsec) { +rust_get_time(int64_t *sec, int32_t *nsec) { #ifdef __APPLE__ struct timeval tv; gettimeofday(&tv, NULL); @@ -205,7 +205,7 @@ get_time(int64_t *sec, int32_t *nsec) { const int64_t ns_per_s = 1000000000LL; extern "C" CDECL void -precise_time_ns(uint64_t *ns) { +rust_precise_time_ns(uint64_t *ns) { #ifdef __APPLE__ uint64_t time = mach_absolute_time(); diff --git a/src/rt/rustrt.def.in b/src/rt/rustrt.def.in index 1f440047d4e..49b6ebce284 100644 --- a/src/rt/rustrt.def.in +++ b/src/rt/rustrt.def.in @@ -2,13 +2,13 @@ rust_dbg_abi_1 rust_dbg_abi_2 rust_dbg_static_mut rust_dbg_static_mut_check_four -get_time +rust_get_time rust_tzset rust_gmtime rust_localtime rust_timegm rust_mktime -precise_time_ns +rust_precise_time_ns rust_path_is_dir rust_path_is_dir_u16 rust_path_exists @@ -43,7 +43,7 @@ rust_signal_little_lock rust_wait_little_lock tdefl_compress_mem_to_heap tinfl_decompress_mem_to_heap -swap_registers +rust_swap_registers rust_readdir rust_opendir rust_dbg_extern_identity_u32