From 1376c5a617be5c25655d0d7cb63e3beaa5a6e026 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:20:39 +0200 Subject: Merging upstream version 1.70.0+dfsg1. Signed-off-by: Daniel Baumann --- tests/run-make/lto-no-link-whole-rlib/Makefile | 9 +++++++++ tests/run-make/lto-no-link-whole-rlib/bar.c | 3 +++ tests/run-make/lto-no-link-whole-rlib/foo.c | 3 +++ tests/run-make/lto-no-link-whole-rlib/lib1.rs | 10 ++++++++++ tests/run-make/lto-no-link-whole-rlib/lib2.rs | 12 ++++++++++++ tests/run-make/lto-no-link-whole-rlib/main.rs | 7 +++++++ 6 files changed, 44 insertions(+) create mode 100644 tests/run-make/lto-no-link-whole-rlib/Makefile create mode 100644 tests/run-make/lto-no-link-whole-rlib/bar.c create mode 100644 tests/run-make/lto-no-link-whole-rlib/foo.c create mode 100644 tests/run-make/lto-no-link-whole-rlib/lib1.rs create mode 100644 tests/run-make/lto-no-link-whole-rlib/lib2.rs create mode 100644 tests/run-make/lto-no-link-whole-rlib/main.rs (limited to 'tests/run-make/lto-no-link-whole-rlib') 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); +} -- cgit v1.2.3