diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2017-06-03 14:54:08 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2017-07-05 14:37:01 -0700 |
| commit | 695dee063bcd40f154bb27b7beafcb3d4dd775ac (patch) | |
| tree | 8ac64f40091434e679b4221343dce7447c4f1236 /src/test/run-make | |
| parent | 4c225c4d1732537aff63dd97c2b7ac681fd3d188 (diff) | |
| download | rust-695dee063bcd40f154bb27b7beafcb3d4dd775ac.tar.gz rust-695dee063bcd40f154bb27b7beafcb3d4dd775ac.zip | |
rustc: Implement the #[global_allocator] attribute
This PR is an implementation of [RFC 1974] which specifies a new method of defining a global allocator for a program. This obsoletes the old `#![allocator]` attribute and also removes support for it. [RFC 1974]: https://github.com/rust-lang/rfcs/pull/197 The new `#[global_allocator]` attribute solves many issues encountered with the `#![allocator]` attribute such as composition and restrictions on the crate graph itself. The compiler now has much more control over the ABI of the allocator and how it's implemented, allowing much more freedom in terms of how this feature is implemented. cc #27389
Diffstat (limited to 'src/test/run-make')
| -rw-r--r-- | src/test/run-make/no-duplicate-libs/Makefile | 4 | ||||
| -rw-r--r-- | src/test/run-make/no-duplicate-libs/bar.c | 15 | ||||
| -rw-r--r-- | src/test/run-make/no-duplicate-libs/bar.rs | 25 | ||||
| -rw-r--r-- | src/test/run-make/no-duplicate-libs/foo.c | 11 | ||||
| -rw-r--r-- | src/test/run-make/no-duplicate-libs/foo.rs | 25 | ||||
| -rw-r--r-- | src/test/run-make/no-duplicate-libs/main.rs | 6 |
6 files changed, 30 insertions, 56 deletions
diff --git a/src/test/run-make/no-duplicate-libs/Makefile b/src/test/run-make/no-duplicate-libs/Makefile index 3f6a28c251a..13d8366c60a 100644 --- a/src/test/run-make/no-duplicate-libs/Makefile +++ b/src/test/run-make/no-duplicate-libs/Makefile @@ -4,9 +4,7 @@ ifdef IS_MSVC # FIXME(#27979) all: else -all: - $(RUSTC) foo.rs - $(RUSTC) bar.rs +all: $(call STATICLIB,foo) $(call STATICLIB,bar) $(RUSTC) main.rs $(call RUN,main) endif diff --git a/src/test/run-make/no-duplicate-libs/bar.c b/src/test/run-make/no-duplicate-libs/bar.c new file mode 100644 index 00000000000..b9dcd0f5e5e --- /dev/null +++ b/src/test/run-make/no-duplicate-libs/bar.c @@ -0,0 +1,15 @@ +// Copyright 2017 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. + +extern void foo(); + +void bar() { + foo(); +} diff --git a/src/test/run-make/no-duplicate-libs/bar.rs b/src/test/run-make/no-duplicate-libs/bar.rs deleted file mode 100644 index cb1c88689a8..00000000000 --- a/src/test/run-make/no-duplicate-libs/bar.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2014 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. - -#![feature(lang_items, alloc_system, compiler_builtins_lib)] -#![crate_type = "dylib"] -#![no_std] - -extern crate alloc_system; -extern crate compiler_builtins; - -#[no_mangle] -pub extern fn bar() {} - -#[lang = "eh_personality"] fn eh_personality() {} -#[lang = "eh_unwind_resume"] fn eh_unwind_resume() {} -#[lang = "panic_fmt"] fn panic_fmt() -> ! { loop {} } -#[no_mangle] pub extern fn rust_eh_register_frames () {} -#[no_mangle] pub extern fn rust_eh_unregister_frames () {} diff --git a/src/test/run-make/no-duplicate-libs/foo.c b/src/test/run-make/no-duplicate-libs/foo.c new file mode 100644 index 00000000000..906cd5682b8 --- /dev/null +++ b/src/test/run-make/no-duplicate-libs/foo.c @@ -0,0 +1,11 @@ +// Copyright 2017 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. + +void foo() {} diff --git a/src/test/run-make/no-duplicate-libs/foo.rs b/src/test/run-make/no-duplicate-libs/foo.rs deleted file mode 100644 index 214fb156c2d..00000000000 --- a/src/test/run-make/no-duplicate-libs/foo.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2014 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. - -#![feature(lang_items, alloc_system, compiler_builtins_lib)] -#![no_std] -#![crate_type = "dylib"] - -extern crate alloc_system; -extern crate compiler_builtins; - -#[no_mangle] -pub extern fn foo() {} - -#[lang = "eh_personality"] fn eh_personality() {} -#[lang = "eh_unwind_resume"] fn eh_unwind_resume() {} -#[lang = "panic_fmt"] fn panic_fmt() -> ! { loop {} } -#[no_mangle] pub extern fn rust_eh_register_frames () {} -#[no_mangle] pub extern fn rust_eh_unregister_frames () {} diff --git a/src/test/run-make/no-duplicate-libs/main.rs b/src/test/run-make/no-duplicate-libs/main.rs index 12ddce34582..824946fe9c2 100644 --- a/src/test/run-make/no-duplicate-libs/main.rs +++ b/src/test/run-make/no-duplicate-libs/main.rs @@ -8,9 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[link(name = "foo")] -#[link(name = "bar")] -#[link(name = "foo")] +#[link(name = "foo")] // linker should drop this library, no symbols used +#[link(name = "bar")] // symbol comes from this library +#[link(name = "foo")] // now linker picks up `foo` b/c `bar` library needs it extern { fn bar(); } |
