diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:20:39 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:20:39 +0000 |
commit | 1376c5a617be5c25655d0d7cb63e3beaa5a6e026 (patch) | |
tree | 3bb8d61aee02bc7a15eab3f36e3b921afc2075d0 /tests/run-make/lto-no-link-whole-rlib | |
parent | Releasing progress-linux version 1.69.0+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-1376c5a617be5c25655d0d7cb63e3beaa5a6e026.tar.xz rustc-1376c5a617be5c25655d0d7cb63e3beaa5a6e026.zip |
Merging upstream version 1.70.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/run-make/lto-no-link-whole-rlib')
-rw-r--r-- | tests/run-make/lto-no-link-whole-rlib/Makefile | 9 | ||||
-rw-r--r-- | tests/run-make/lto-no-link-whole-rlib/bar.c | 3 | ||||
-rw-r--r-- | tests/run-make/lto-no-link-whole-rlib/foo.c | 3 | ||||
-rw-r--r-- | tests/run-make/lto-no-link-whole-rlib/lib1.rs | 10 | ||||
-rw-r--r-- | tests/run-make/lto-no-link-whole-rlib/lib2.rs | 12 | ||||
-rw-r--r-- | tests/run-make/lto-no-link-whole-rlib/main.rs | 7 |
6 files changed, 44 insertions, 0 deletions
diff --git a/tests/run-make/lto-no-link-whole-rlib/Makefile b/tests/run-make/lto-no-link-whole-rlib/Makefile new file mode 100644 index 000000000..3e82322e7 --- /dev/null +++ b/tests/run-make/lto-no-link-whole-rlib/Makefile @@ -0,0 +1,9 @@ +# ignore-cross-compile +include ../tools.mk + +all: $(call NATIVE_STATICLIB,foo) $(call NATIVE_STATICLIB,bar) + $(RUSTC) lib1.rs + $(RUSTC) lib2.rs + $(RUSTC) main.rs -Clto + $(call RUN,main) + diff --git a/tests/run-make/lto-no-link-whole-rlib/bar.c b/tests/run-make/lto-no-link-whole-rlib/bar.c new file mode 100644 index 000000000..b25011930 --- /dev/null +++ b/tests/run-make/lto-no-link-whole-rlib/bar.c @@ -0,0 +1,3 @@ +int foo() { + return 2; +} diff --git a/tests/run-make/lto-no-link-whole-rlib/foo.c b/tests/run-make/lto-no-link-whole-rlib/foo.c new file mode 100644 index 000000000..75010458e --- /dev/null +++ b/tests/run-make/lto-no-link-whole-rlib/foo.c @@ -0,0 +1,3 @@ +int foo() { + return 1; +} diff --git a/tests/run-make/lto-no-link-whole-rlib/lib1.rs b/tests/run-make/lto-no-link-whole-rlib/lib1.rs new file mode 100644 index 000000000..f70bb3382 --- /dev/null +++ b/tests/run-make/lto-no-link-whole-rlib/lib1.rs @@ -0,0 +1,10 @@ +#![crate_type = "rlib"] + +#[link(name = "foo", kind = "static")] +extern "C" { + fn foo() -> i32; +} + +pub fn foo1() -> i32 { + unsafe { foo() } +} diff --git a/tests/run-make/lto-no-link-whole-rlib/lib2.rs b/tests/run-make/lto-no-link-whole-rlib/lib2.rs new file mode 100644 index 000000000..2dec2a271 --- /dev/null +++ b/tests/run-make/lto-no-link-whole-rlib/lib2.rs @@ -0,0 +1,12 @@ +#![crate_type = "rlib"] + +extern crate lib1; + +#[link(name = "bar", kind = "static")] +extern "C" { + fn foo() -> i32; +} + +pub fn foo2() -> i32 { + unsafe { foo() } +} diff --git a/tests/run-make/lto-no-link-whole-rlib/main.rs b/tests/run-make/lto-no-link-whole-rlib/main.rs new file mode 100644 index 000000000..0c658808e --- /dev/null +++ b/tests/run-make/lto-no-link-whole-rlib/main.rs @@ -0,0 +1,7 @@ +extern crate lib1; +extern crate lib2; + +fn main() { + assert_eq!(lib1::foo1(), 2); + assert_eq!(lib2::foo2(), 2); +} |