From 9fbba7b2eeabd073f9518f2dbd50f4eabb621c67 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sat, 16 Nov 2013 02:02:07 -0800 Subject: [PATCH] Statically link librustrt to libstd This commit alters the build process of the compiler to build a static librustrt.a instead of a dynamic version. This means that we can stop distributing librustrt as well as default linking against it in the compiler. This also means that if you attempt to build rust code without libstd, it will no longer work if there are any landing pads in play. The reason for this is that LLVM and rustc will emit calls to the various upcalls in librustrt used to manage exception handling. In theory we could split librustrt into librustrt and librustupcall. We would then distribute librustupcall and link to it for all programs using landing pads, but I would rather see just one librustrt artifact and simplify the build process. The major benefit of doing this is that building a static rust library for use in embedded situations all of a sudden just became a whole lot more feasible. Closes #3361 --- Makefile.in | 2 +- mk/install.mk | 6 --- mk/rt.mk | 6 +-- src/etc/snapshot.py | 4 -- src/libstd/rtdeps.rs | 8 ++- src/rt/rustrt.def.in | 51 ------------------- .../anon-extern-mod-cross-crate-1.rs | 5 +- .../auxiliary/extern-crosscrate-source.rs | 1 + src/test/auxiliary/foreign_lib.rs | 1 + .../run-pass/anon-extern-mod-cross-crate-2.rs | 3 ++ src/test/run-pass/anon-extern-mod.rs | 2 +- src/test/run-pass/c-stack-as-value.rs | 1 + src/test/run-pass/extern-call-deep.rs | 1 + src/test/run-pass/extern-call-deep2.rs | 1 + src/test/run-pass/extern-call-indirect.rs | 1 + src/test/run-pass/extern-call-scrub.rs | 1 + src/test/run-pass/extern-pass-TwoU16s.rs | 1 + src/test/run-pass/extern-pass-TwoU32s.rs | 1 + src/test/run-pass/extern-pass-TwoU64s.rs | 1 + src/test/run-pass/extern-pass-TwoU8s.rs | 1 + src/test/run-pass/extern-pass-char.rs | 1 + src/test/run-pass/extern-pass-double.rs | 1 + src/test/run-pass/extern-pass-u32.rs | 1 + src/test/run-pass/extern-pass-u64.rs | 1 + src/test/run-pass/extern-return-TwoU16s.rs | 1 + src/test/run-pass/extern-return-TwoU32s.rs | 1 + src/test/run-pass/extern-return-TwoU64s.rs | 1 + src/test/run-pass/extern-return-TwoU8s.rs | 1 + src/test/run-pass/extern-stress.rs | 1 + src/test/run-pass/extern-yield.rs | 1 + src/test/run-pass/foreign-call-no-runtime.rs | 1 + src/test/run-pass/foreign-dupe.rs | 4 +- src/test/run-pass/foreign-no-abi.rs | 1 + src/test/run-pass/invoke-external-foreign.rs | 3 ++ src/test/run-pass/static-mut-foreign.rs | 2 +- src/test/run-pass/struct-return.rs | 2 +- 36 files changed, 46 insertions(+), 75 deletions(-) delete mode 100644 src/rt/rustrt.def.in diff --git a/Makefile.in b/Makefile.in index 73400610f67..b575312c03b 100644 --- a/Makefile.in +++ b/Makefile.in @@ -222,7 +222,7 @@ GENERATED := define DEF_LIBS -CFG_RUNTIME_$(1) :=$(call CFG_LIB_NAME_$(1),rustrt) +CFG_RUNTIME_$(1) :=$(call CFG_STATIC_LIB_NAME_$(1),rustrt) CFG_RUSTLLVM_$(1) :=$(call CFG_LIB_NAME_$(1),rustllvm) CFG_STDLIB_$(1) :=$(call CFG_LIB_NAME_$(1),std) CFG_EXTRALIB_$(1) :=$(call CFG_LIB_NAME_$(1),extra) diff --git a/mk/install.mk b/mk/install.mk index d8208003b7b..7d6c0ea5264 100644 --- a/mk/install.mk +++ b/mk/install.mk @@ -88,7 +88,6 @@ install-target-$(1)-host-$(2): LIB_SOURCE_DIR=$$(TL$(1)$(2)) install-target-$(1)-host-$(2): LIB_DESTIN_DIR=$$(PTL$(1)$(2)) install-target-$(1)-host-$(2): $$(TSREQ$$(ISTAGE)_T_$(1)_H_$(2)) $$(SREQ$$(ISTAGE)_T_$(1)_H_$(2)) $$(Q)$$(call MK_INSTALL_DIR,$$(PTL$(1)$(2))) - $$(Q)$$(call INSTALL_LIB,$$(CFG_RUNTIME_$(1))) $$(Q)$$(call INSTALL_LIB,$$(STDLIB_GLOB_$(1))) $$(Q)$$(call INSTALL_LIB,$$(EXTRALIB_GLOB_$(1))) $$(Q)$$(call INSTALL_LIB,$$(LIBRUSTUV_GLOB_$(1))) @@ -101,7 +100,6 @@ install-target-$(1)-host-$(2): LIB_SOURCE_DIR=$$(TL$(1)$(2)) install-target-$(1)-host-$(2): LIB_DESTIN_DIR=$$(PTL$(1)$(2)) install-target-$(1)-host-$(2): $$(CSREQ$$(ISTAGE)_T_$(1)_H_$(2)) $$(Q)$$(call MK_INSTALL_DIR,$$(PTL$(1)$(2))) - $$(Q)$$(call INSTALL_LIB,$$(CFG_RUNTIME_$(1))) $$(Q)$$(call INSTALL_LIB,$$(CFG_RUSTLLVM_$(1))) $$(Q)$$(call INSTALL_LIB,$$(STDLIB_GLOB_$(1))) $$(Q)$$(call INSTALL_LIB,$$(EXTRALIB_GLOB_$(1))) @@ -153,7 +151,6 @@ install-host: $(CSREQ$(ISTAGE)_T_$(CFG_BUILD_)_H_$(CFG_BUILD_)) $(Q)$(call INSTALL_LIB,$(LIBSYNTAX_GLOB_$(CFG_BUILD))) $(Q)$(call INSTALL_LIB,$(LIBRUSTPKG_GLOB_$(CFG_BUILD))) $(Q)$(call INSTALL_LIB,$(LIBRUSTDOC_GLOB_$(CFG_BUILD))) - $(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_RUNTIME_$(CFG_BUILD))) $(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_RUSTLLVM_$(CFG_BUILD))) $(Q)$(call INSTALL,$(S)/man,$(CFG_MANDIR)/man1,rustc.1) $(Q)$(call INSTALL,$(S)/man,$(CFG_MANDIR)/man1,rustdoc.1) @@ -170,7 +167,6 @@ uninstall: $(Q)rm -f $(PHB)/rustpkg$(X_$(CFG_BUILD)) $(Q)rm -f $(PHB)/rustdoc$(X_$(CFG_BUILD)) $(Q)rm -f $(PHL)/$(CFG_RUSTLLVM_$(CFG_BUILD)) - $(Q)rm -f $(PHL)/$(CFG_RUNTIME_$(CFG_BUILD)) $(Q)for i in \ $(call HOST_LIB_FROM_HL_GLOB,$(STDLIB_GLOB_$(CFG_BUILD))) \ $(call HOST_LIB_FROM_HL_GLOB,$(STDLIB_RGLOB_$(CFG_BUILD))) \ @@ -238,7 +234,6 @@ endif define INSTALL_RUNTIME_TARGET_N install-runtime-target-$(1)-host-$(2): $$(TSREQ$$(ISTAGE)_T_$(1)_H_$(2)) $$(SREQ$$(ISTAGE)_T_$(1)_H_$(2)) $(Q)$(call ADB_SHELL,mkdir,$(CFG_RUNTIME_PUSH_DIR)) - $(Q)$(call ADB_PUSH,$$(TL$(1)$(2))/$$(CFG_RUNTIME_$(1)),$(CFG_RUNTIME_PUSH_DIR)) $(Q)$(call ADB_PUSH,$$(TL$(1)$(2))/$$(STDLIB_GLOB_$(1)),$(CFG_RUNTIME_PUSH_DIR)) $(Q)$(call ADB_PUSH,$$(TL$(1)$(2))/$$(EXTRALIB_GLOB_$(1)),$(CFG_RUNTIME_PUSH_DIR)) $(Q)$(call ADB_PUSH,$$(TL$(1)$(2))/$$(LIBRUSTUV_GLOB_$(1)),$(CFG_RUNTIME_PUSH_DIR)) @@ -247,7 +242,6 @@ endef define INSTALL_RUNTIME_TARGET_CLEANUP_N install-runtime-target-$(1)-cleanup: $(Q)$(call ADB,remount) - $(Q)$(call ADB_SHELL,rm,$(CFG_RUNTIME_PUSH_DIR)/$(CFG_RUNTIME_$(1))) $(Q)$(call ADB_SHELL,rm,$(CFG_RUNTIME_PUSH_DIR)/$(STDLIB_GLOB_$(1))) $(Q)$(call ADB_SHELL,rm,$(CFG_RUNTIME_PUSH_DIR)/$(EXTRALIB_GLOB_$(1))) $(Q)$(call ADB_SHELL,rm,$(CFG_RUNTIME_PUSH_DIR)/$(LIBRUSTUV_GLOB_$(1))) diff --git a/mk/rt.mk b/mk/rt.mk index cc22d5781a6..f27ed8714f4 100644 --- a/mk/rt.mk +++ b/mk/rt.mk @@ -121,11 +121,9 @@ $$(RT_BUILD_DIR_$(1)_$(2))/arch/$$(HOST_$(1))/libmorestack.a: $$(MORESTACK_OBJS_ @$$(call E, link: $$@) $$(Q)$(AR_$(1)) rcs $$@ $$^ -$$(RT_BUILD_DIR_$(1)_$(2))/$(CFG_RUNTIME_$(1)): $$(RUNTIME_OBJS_$(1)_$(2)) $$(MKFILE_DEPS) \ - $$(RUNTIME_DEF_$(1)_$(2)) +$$(RT_BUILD_DIR_$(1)_$(2))/$(CFG_RUNTIME_$(1)): $$(RUNTIME_OBJS_$(1)_$(2)) $$(MKFILE_DEPS) @$$(call E, link: $$@) - $$(Q)$$(call CFG_LINK_CXX_$(1),$$@, $$(RUNTIME_OBJS_$(1)_$(2)) \ - $$(CFG_LIBUV_LINK_FLAGS_$(1)),$$(RUNTIME_DEF_$(1)_$(2)),$$(CFG_RUNTIME_$(1))) + $$(Q)$(AR_$(1)) rcs $$@ $$(RUNTIME_OBJS_$(1)_$(2)) # These could go in rt.mk or rustllvm.mk, they're needed for both. diff --git a/src/etc/snapshot.py b/src/etc/snapshot.py index 99193d905f8..03ada0eef18 100644 --- a/src/etc/snapshot.py +++ b/src/etc/snapshot.py @@ -31,7 +31,6 @@ snapshot_files = { "lib/librustc-*.so", "lib/libsyntax-*.so", "lib/librustuv-*.so", - "lib/librustrt.so", "lib/librustllvm.so"], "macos": ["bin/rustc", "lib/libstd-*.dylib", @@ -39,7 +38,6 @@ snapshot_files = { "lib/librustc-*.dylib", "lib/libsyntax-*.dylib", "lib/librustuv-*.dylib", - "lib/librustrt.dylib", "lib/librustllvm.dylib"], "winnt": ["bin/rustc.exe", "bin/std-*.dll", @@ -47,7 +45,6 @@ snapshot_files = { "bin/rustc-*.dll", "bin/syntax-*.dll", "bin/rustuv-*.dll", - "bin/rustrt.dll", "bin/rustllvm.dll"], "freebsd": ["bin/rustc", "lib/libstd-*.so", @@ -55,7 +52,6 @@ snapshot_files = { "lib/librustc-*.so", "lib/libsyntax-*.so", "lib/librustuv-*.so", - "lib/librustrt.so", "lib/librustllvm.so"] } diff --git a/src/libstd/rtdeps.rs b/src/libstd/rtdeps.rs index 761d630f771..ba4f120f626 100644 --- a/src/libstd/rtdeps.rs +++ b/src/libstd/rtdeps.rs @@ -13,7 +13,7 @@ //! necessary for running libstd. // All platforms need to link to rustrt -#[link(name = "rustrt")] +#[link(name = "rustrt", kind = "static")] extern {} // LLVM implements the `frem` instruction as a call to `fmod`, which lives in @@ -26,6 +26,7 @@ extern {} #[link(name = "dl")] #[link(name = "m")] #[link(name = "pthread")] +#[link(name = "stdc++")] extern {} #[cfg(target_os = "android")] @@ -45,4 +46,9 @@ extern {} #[cfg(target_os = "macos")] #[link(name = "pthread")] +#[link(name = "stdc++")] +extern {} + +#[cfg(stage0)] +#[link_args = "-lstdc++"] extern {} diff --git a/src/rt/rustrt.def.in b/src/rt/rustrt.def.in deleted file mode 100644 index 2a3e687ee55..00000000000 --- a/src/rt/rustrt.def.in +++ /dev/null @@ -1,51 +0,0 @@ -rust_dbg_abi_1 -rust_dbg_abi_2 -rust_dbg_static_mut -rust_dbg_static_mut_check_four -rust_get_time -rust_tzset -rust_gmtime -rust_localtime -rust_timegm -rust_mktime -rust_precise_time_ns -rust_list_dir_val -rust_list_dir_wfd_size -rust_list_dir_wfd_fp_buf -rust_unset_sigprocmask -rust_env_pairs -rust_win32_rand_acquire -rust_win32_rand_gen -rust_win32_rand_release -upcall_rust_personality -upcall_reset_stack_limit -rust_dbg_call -rust_dbg_do_nothing -tdefl_compress_mem_to_heap -tinfl_decompress_mem_to_heap -rust_swap_registers -rust_readdir -rust_opendir -rust_dbg_extern_identity_u32 -rust_dbg_extern_identity_u64 -rust_dbg_extern_identity_TwoU8s -rust_dbg_extern_identity_TwoU16s -rust_dbg_extern_identity_TwoU32s -rust_dbg_extern_identity_TwoU64s -rust_dbg_extern_identity_TwoDoubles -rust_dbg_extern_return_TwoU8s -rust_dbg_extern_return_TwoU16s -rust_dbg_extern_return_TwoU32s -rust_dbg_extern_return_TwoU64s -rust_dbg_extern_identity_double -rust_dbg_extern_identity_u8 -rust_try -rust_begin_unwind -rust_valgrind_stack_register -rust_valgrind_stack_deregister -rust_running_on_valgrind -rust_get_num_cpus -rust_get_test_int -rust_pthread_mutex_t_size -rust_pthread_cond_t_size -rust_crit_section_size diff --git a/src/test/auxiliary/anon-extern-mod-cross-crate-1.rs b/src/test/auxiliary/anon-extern-mod-cross-crate-1.rs index ca9c6eb79f9..01a90f1ad44 100644 --- a/src/test/auxiliary/anon-extern-mod-cross-crate-1.rs +++ b/src/test/auxiliary/anon-extern-mod-cross-crate-1.rs @@ -8,14 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[link_name = "rustrt"]; -#[link(name = "anonexternmod", - vers = "0.1")]; +#[link(name = "anonexternmod", vers = "0.1")]; #[crate_type = "lib"]; use std::libc; extern { + #[link(name = "rustrt")] pub fn rust_get_test_int() -> libc::intptr_t; } diff --git a/src/test/auxiliary/extern-crosscrate-source.rs b/src/test/auxiliary/extern-crosscrate-source.rs index e77efce7f58..89317a45171 100644 --- a/src/test/auxiliary/extern-crosscrate-source.rs +++ b/src/test/auxiliary/extern-crosscrate-source.rs @@ -18,6 +18,7 @@ use std::libc; pub mod rustrt { use std::libc; + #[link(name = "rustrt")] extern { pub fn rust_dbg_call(cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t, data: libc::uintptr_t) diff --git a/src/test/auxiliary/foreign_lib.rs b/src/test/auxiliary/foreign_lib.rs index d67e329b04e..4705d13cd96 100644 --- a/src/test/auxiliary/foreign_lib.rs +++ b/src/test/auxiliary/foreign_lib.rs @@ -13,6 +13,7 @@ pub mod rustrt { use std::libc; + #[link(name = "rustrt")] extern { fn rust_get_test_int() -> libc::intptr_t; } diff --git a/src/test/run-pass/anon-extern-mod-cross-crate-2.rs b/src/test/run-pass/anon-extern-mod-cross-crate-2.rs index a9c6141c18b..65421227054 100644 --- a/src/test/run-pass/anon-extern-mod-cross-crate-2.rs +++ b/src/test/run-pass/anon-extern-mod-cross-crate-2.rs @@ -14,6 +14,9 @@ extern mod anonexternmod; use anonexternmod::rust_get_test_int; +#[link(name = "rustrt")] // we have explicitly chosen to require this +extern {} + pub fn main() { unsafe { rust_get_test_int(); diff --git a/src/test/run-pass/anon-extern-mod.rs b/src/test/run-pass/anon-extern-mod.rs index 3323aa4e2cd..7e05bcc1fd2 100644 --- a/src/test/run-pass/anon-extern-mod.rs +++ b/src/test/run-pass/anon-extern-mod.rs @@ -10,7 +10,7 @@ use std::libc; -#[link_name = "rustrt"] +#[link(name = "rustrt")] extern { fn rust_get_test_int() -> libc::intptr_t; } diff --git a/src/test/run-pass/c-stack-as-value.rs b/src/test/run-pass/c-stack-as-value.rs index f8d30a9a667..d590c35d9e2 100644 --- a/src/test/run-pass/c-stack-as-value.rs +++ b/src/test/run-pass/c-stack-as-value.rs @@ -11,6 +11,7 @@ mod rustrt { use std::libc; + #[link(name = "rustrt")] extern { pub fn rust_get_test_int() -> libc::intptr_t; } diff --git a/src/test/run-pass/extern-call-deep.rs b/src/test/run-pass/extern-call-deep.rs index f55be369b57..e3b727fafd3 100644 --- a/src/test/run-pass/extern-call-deep.rs +++ b/src/test/run-pass/extern-call-deep.rs @@ -13,6 +13,7 @@ use std::libc; mod rustrt { use std::libc; + #[link(name = "rustrt")] extern { pub fn rust_dbg_call(cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t, data: libc::uintptr_t) diff --git a/src/test/run-pass/extern-call-deep2.rs b/src/test/run-pass/extern-call-deep2.rs index 5bda762a68b..00ac0bfa118 100644 --- a/src/test/run-pass/extern-call-deep2.rs +++ b/src/test/run-pass/extern-call-deep2.rs @@ -14,6 +14,7 @@ use std::task; mod rustrt { use std::libc; + #[link(name = "rustrt")] extern { pub fn rust_dbg_call(cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t, data: libc::uintptr_t) diff --git a/src/test/run-pass/extern-call-indirect.rs b/src/test/run-pass/extern-call-indirect.rs index 6222b681dc9..c49d589572c 100644 --- a/src/test/run-pass/extern-call-indirect.rs +++ b/src/test/run-pass/extern-call-indirect.rs @@ -13,6 +13,7 @@ use std::libc; mod rustrt { use std::libc; + #[link(name = "rustrt")] extern { pub fn rust_dbg_call(cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t, data: libc::uintptr_t) diff --git a/src/test/run-pass/extern-call-scrub.rs b/src/test/run-pass/extern-call-scrub.rs index 548336962f5..0044f0f468f 100644 --- a/src/test/run-pass/extern-call-scrub.rs +++ b/src/test/run-pass/extern-call-scrub.rs @@ -18,6 +18,7 @@ use std::task; mod rustrt { use std::libc; + #[link(name = "rustrt")] extern { pub fn rust_dbg_call(cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t, data: libc::uintptr_t) diff --git a/src/test/run-pass/extern-pass-TwoU16s.rs b/src/test/run-pass/extern-pass-TwoU16s.rs index bb6a68dfda4..c224a2f1f05 100644 --- a/src/test/run-pass/extern-pass-TwoU16s.rs +++ b/src/test/run-pass/extern-pass-TwoU16s.rs @@ -18,6 +18,7 @@ struct TwoU16s { one: u16, two: u16 } +#[link(name = "rustrt")] extern { pub fn rust_dbg_extern_identity_TwoU16s(v: TwoU16s) -> TwoU16s; } diff --git a/src/test/run-pass/extern-pass-TwoU32s.rs b/src/test/run-pass/extern-pass-TwoU32s.rs index 3389c56c83b..592d42c65d1 100644 --- a/src/test/run-pass/extern-pass-TwoU32s.rs +++ b/src/test/run-pass/extern-pass-TwoU32s.rs @@ -16,6 +16,7 @@ struct TwoU32s { one: u32, two: u32 } +#[link(name = "rustrt")] extern { pub fn rust_dbg_extern_identity_TwoU32s(v: TwoU32s) -> TwoU32s; } diff --git a/src/test/run-pass/extern-pass-TwoU64s.rs b/src/test/run-pass/extern-pass-TwoU64s.rs index 033359f85fa..d2520f32c7b 100644 --- a/src/test/run-pass/extern-pass-TwoU64s.rs +++ b/src/test/run-pass/extern-pass-TwoU64s.rs @@ -18,6 +18,7 @@ struct TwoU64s { one: u64, two: u64 } +#[link(name = "rustrt")] extern { pub fn rust_dbg_extern_identity_TwoU64s(v: TwoU64s) -> TwoU64s; } diff --git a/src/test/run-pass/extern-pass-TwoU8s.rs b/src/test/run-pass/extern-pass-TwoU8s.rs index 8757f9593f7..5548b8a7d39 100644 --- a/src/test/run-pass/extern-pass-TwoU8s.rs +++ b/src/test/run-pass/extern-pass-TwoU8s.rs @@ -18,6 +18,7 @@ struct TwoU8s { one: u8, two: u8 } +#[link(name = "rustrt")] extern { pub fn rust_dbg_extern_identity_TwoU8s(v: TwoU8s) -> TwoU8s; } diff --git a/src/test/run-pass/extern-pass-char.rs b/src/test/run-pass/extern-pass-char.rs index 0cdfaf29a05..85d0463fe72 100644 --- a/src/test/run-pass/extern-pass-char.rs +++ b/src/test/run-pass/extern-pass-char.rs @@ -10,6 +10,7 @@ // Test a function that takes/returns a u8. +#[link(name = "rustrt")] extern { pub fn rust_dbg_extern_identity_u8(v: u8) -> u8; } diff --git a/src/test/run-pass/extern-pass-double.rs b/src/test/run-pass/extern-pass-double.rs index cb0a061a7ab..2d35fe6043e 100644 --- a/src/test/run-pass/extern-pass-double.rs +++ b/src/test/run-pass/extern-pass-double.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[link(name = "rustrt")] extern { pub fn rust_dbg_extern_identity_double(v: f64) -> f64; } diff --git a/src/test/run-pass/extern-pass-u32.rs b/src/test/run-pass/extern-pass-u32.rs index aa54f014046..5ff3353a8c0 100644 --- a/src/test/run-pass/extern-pass-u32.rs +++ b/src/test/run-pass/extern-pass-u32.rs @@ -10,6 +10,7 @@ // Test a function that takes/returns a u32. +#[link(name = "rustrt")] extern { pub fn rust_dbg_extern_identity_u32(v: u32) -> u32; } diff --git a/src/test/run-pass/extern-pass-u64.rs b/src/test/run-pass/extern-pass-u64.rs index 7c39080a568..b94c57a7a66 100644 --- a/src/test/run-pass/extern-pass-u64.rs +++ b/src/test/run-pass/extern-pass-u64.rs @@ -10,6 +10,7 @@ // Test a call to a function that takes/returns a u64. +#[link(name = "rustrt")] extern { pub fn rust_dbg_extern_identity_u64(v: u64) -> u64; } diff --git a/src/test/run-pass/extern-return-TwoU16s.rs b/src/test/run-pass/extern-return-TwoU16s.rs index ba671a1c494..45efbbb2785 100644 --- a/src/test/run-pass/extern-return-TwoU16s.rs +++ b/src/test/run-pass/extern-return-TwoU16s.rs @@ -12,6 +12,7 @@ struct TwoU16s { one: u16, two: u16 } +#[link(name = "rustrt")] extern { pub fn rust_dbg_extern_return_TwoU16s() -> TwoU16s; } diff --git a/src/test/run-pass/extern-return-TwoU32s.rs b/src/test/run-pass/extern-return-TwoU32s.rs index 90562f0f6b1..8258ee623ab 100644 --- a/src/test/run-pass/extern-return-TwoU32s.rs +++ b/src/test/run-pass/extern-return-TwoU32s.rs @@ -12,6 +12,7 @@ struct TwoU32s { one: u32, two: u32 } +#[link(name = "rustrt")] extern { pub fn rust_dbg_extern_return_TwoU32s() -> TwoU32s; } diff --git a/src/test/run-pass/extern-return-TwoU64s.rs b/src/test/run-pass/extern-return-TwoU64s.rs index b52808ea32d..d8b051f57a9 100644 --- a/src/test/run-pass/extern-return-TwoU64s.rs +++ b/src/test/run-pass/extern-return-TwoU64s.rs @@ -14,6 +14,7 @@ struct TwoU64s { one: u64, two: u64 } +#[link(name = "rustrt")] extern { pub fn rust_dbg_extern_return_TwoU64s() -> TwoU64s; } diff --git a/src/test/run-pass/extern-return-TwoU8s.rs b/src/test/run-pass/extern-return-TwoU8s.rs index 5d2fd140758..99dbd93fb7d 100644 --- a/src/test/run-pass/extern-return-TwoU8s.rs +++ b/src/test/run-pass/extern-return-TwoU8s.rs @@ -12,6 +12,7 @@ struct TwoU8s { one: u8, two: u8 } +#[link(name = "rustrt")] extern { pub fn rust_dbg_extern_return_TwoU8s() -> TwoU8s; } diff --git a/src/test/run-pass/extern-stress.rs b/src/test/run-pass/extern-stress.rs index 6ef196ccd41..7c16ae74c4a 100644 --- a/src/test/run-pass/extern-stress.rs +++ b/src/test/run-pass/extern-stress.rs @@ -17,6 +17,7 @@ use std::task; mod rustrt { use std::libc; + #[link(name = "rustrt")] extern { pub fn rust_dbg_call(cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t, data: libc::uintptr_t) diff --git a/src/test/run-pass/extern-yield.rs b/src/test/run-pass/extern-yield.rs index 1d2f52d8c2e..a4ac197ac6a 100644 --- a/src/test/run-pass/extern-yield.rs +++ b/src/test/run-pass/extern-yield.rs @@ -14,6 +14,7 @@ use std::task; mod rustrt { use std::libc; + #[link(name = "rustrt")] extern { pub fn rust_dbg_call(cb: extern "C" fn (libc::uintptr_t) -> libc::uintptr_t, data: libc::uintptr_t) diff --git a/src/test/run-pass/foreign-call-no-runtime.rs b/src/test/run-pass/foreign-call-no-runtime.rs index 283efa2ac7c..ee54423a97d 100644 --- a/src/test/run-pass/foreign-call-no-runtime.rs +++ b/src/test/run-pass/foreign-call-no-runtime.rs @@ -2,6 +2,7 @@ use std::cast; use std::libc; use std::unstable::run_in_bare_thread; +#[link(name = "rustrt")] extern { fn rust_dbg_call(cb: extern "C" fn(libc::uintptr_t), data: libc::uintptr_t) -> libc::uintptr_t; diff --git a/src/test/run-pass/foreign-dupe.rs b/src/test/run-pass/foreign-dupe.rs index 66d3bda30e6..260b1f272c2 100644 --- a/src/test/run-pass/foreign-dupe.rs +++ b/src/test/run-pass/foreign-dupe.rs @@ -14,7 +14,7 @@ mod rustrt1 { use std::libc; - #[link_name = "rustrt"] + #[link(name = "rustrt")] extern { pub fn rust_get_test_int() -> libc::intptr_t; } @@ -23,7 +23,7 @@ mod rustrt1 { mod rustrt2 { use std::libc; - #[link_name = "rustrt"] + #[link(name = "rustrt")] extern { pub fn rust_get_test_int() -> libc::intptr_t; } diff --git a/src/test/run-pass/foreign-no-abi.rs b/src/test/run-pass/foreign-no-abi.rs index 0702d49cfc1..eef45532265 100644 --- a/src/test/run-pass/foreign-no-abi.rs +++ b/src/test/run-pass/foreign-no-abi.rs @@ -13,6 +13,7 @@ mod rustrt { use std::libc; + #[link(name = "rustrt")] extern { pub fn rust_get_test_int() -> libc::intptr_t; } diff --git a/src/test/run-pass/invoke-external-foreign.rs b/src/test/run-pass/invoke-external-foreign.rs index 7e79311c5ad..6850e9d9bd2 100644 --- a/src/test/run-pass/invoke-external-foreign.rs +++ b/src/test/run-pass/invoke-external-foreign.rs @@ -17,6 +17,9 @@ extern mod foreign_lib; +#[link(name = "rustrt")] // we have explicitly chosen to require this +extern {} + pub fn main() { unsafe { let _foo = foreign_lib::rustrt::rust_get_test_int(); diff --git a/src/test/run-pass/static-mut-foreign.rs b/src/test/run-pass/static-mut-foreign.rs index bdfc747c8bc..0afe01bf7ed 100644 --- a/src/test/run-pass/static-mut-foreign.rs +++ b/src/test/run-pass/static-mut-foreign.rs @@ -14,7 +14,7 @@ use std::libc; -#[nolink] +#[link(name = "rustrt")] extern { static mut rust_dbg_static_mut: libc::c_int; pub fn rust_dbg_static_mut_check_four(); diff --git a/src/test/run-pass/struct-return.rs b/src/test/run-pass/struct-return.rs index 324186021b8..e2fe7a96016 100644 --- a/src/test/run-pass/struct-return.rs +++ b/src/test/run-pass/struct-return.rs @@ -16,7 +16,7 @@ pub struct Floats { a: f64, b: u8, c: f64 } mod rustrt { use super::{Floats, Quad}; - #[nolink] + #[link(name = "rustrt")] extern { pub fn rust_dbg_abi_1(q: Quad) -> Quad; pub fn rust_dbg_abi_2(f: Floats) -> Floats;