diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2016-01-21 15:36:25 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2016-02-11 11:12:32 -0800 |
| commit | eac0a8bc3070e45047fff57e7b024a059289a36d (patch) | |
| tree | cbcaa9dc371f2b11fe2e9b9d3ee7a3f7a9cfdb8e /src/libstd/sys | |
| parent | 4da4970767ae8fc2e3b6d0c280312bb0f4efeed6 (diff) | |
| download | rust-eac0a8bc3070e45047fff57e7b024a059289a36d.tar.gz rust-eac0a8bc3070e45047fff57e7b024a059289a36d.zip | |
bootstrap: Add directives to not double-link libs
Have all Cargo-built crates pass `--cfg cargobuild` and then add appropriate `#[cfg]` definitions to all crates to avoid linking anything if this is passed. This should help allow libstd to compile with both the makefiles and with Cargo.
Diffstat (limited to 'src/libstd/sys')
| -rw-r--r-- | src/libstd/sys/common/gnu/libbacktrace.rs | 2 | ||||
| -rw-r--r-- | src/libstd/sys/common/unwind/gcc.rs | 3 | ||||
| -rw-r--r-- | src/libstd/sys/unix/os.rs | 3 | ||||
| -rw-r--r-- | src/libstd/sys/windows/c.rs | 3 |
4 files changed, 9 insertions, 2 deletions
diff --git a/src/libstd/sys/common/gnu/libbacktrace.rs b/src/libstd/sys/common/gnu/libbacktrace.rs index f8463388384..8b3cb04030c 100644 --- a/src/libstd/sys/common/gnu/libbacktrace.rs +++ b/src/libstd/sys/common/gnu/libbacktrace.rs @@ -40,7 +40,7 @@ pub fn print(w: &mut Write, idx: isize, addr: *mut libc::c_void, errnum: libc::c_int); enum backtrace_state {} #[link(name = "backtrace", kind = "static")] - #[cfg(not(test))] + #[cfg(all(not(test), not(cargobuild)))] extern {} extern { diff --git a/src/libstd/sys/common/unwind/gcc.rs b/src/libstd/sys/common/unwind/gcc.rs index 12cd07a4f4f..7cf9e2a54bd 100644 --- a/src/libstd/sys/common/unwind/gcc.rs +++ b/src/libstd/sys/common/unwind/gcc.rs @@ -252,6 +252,9 @@ pub mod eh_frame_registry { // See also: rtbegin.rs, `unwind` module. #[link(name = "gcc_eh")] + #[cfg(not(cargobuild))] + extern {} + extern { fn __register_frame_info(eh_frame_begin: *const u8, object: *mut u8); fn __deregister_frame_info(eh_frame_begin: *const u8, object: *mut u8); diff --git a/src/libstd/sys/unix/os.rs b/src/libstd/sys/unix/os.rs index 9def3adc303..b6a0bd84409 100644 --- a/src/libstd/sys/unix/os.rs +++ b/src/libstd/sys/unix/os.rs @@ -339,7 +339,6 @@ pub fn args() -> Args { pub fn args() -> Args { use mem; - #[link(name = "objc")] extern { fn sel_registerName(name: *const libc::c_uchar) -> Sel; fn objc_msgSend(obj: NsId, sel: Sel, ...) -> NsId; @@ -347,6 +346,8 @@ pub fn args() -> Args { } #[link(name = "Foundation", kind = "framework")] + #[link(name = "objc")] + #[cfg(not(cargobuild))] extern {} type Sel = *const libc::c_void; diff --git a/src/libstd/sys/windows/c.rs b/src/libstd/sys/windows/c.rs index 6e8090a2235..9fdeb0aef14 100644 --- a/src/libstd/sys/windows/c.rs +++ b/src/libstd/sys/windows/c.rs @@ -966,6 +966,9 @@ pub enum EXCEPTION_DISPOSITION { #[link(name = "userenv")] #[link(name = "shell32")] #[link(name = "advapi32")] +#[cfg(not(cargobuild))] +extern {} + extern "system" { pub fn WSAStartup(wVersionRequested: WORD, lpWSAData: LPWSADATA) -> c_int; |
