about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOneirical <manchot@videotron.ca>2024-06-14 11:10:29 -0400
committerOneirical <manchot@videotron.ca>2024-07-08 09:58:55 -0400
commitcf9e7a975d4a64ad60669a9764e64400710c7e67 (patch)
tree88236fc295b043842e7071999419ccae25ca5223
parent59a4f02f836f74c4cf08f47d76c9f6069a2f8276 (diff)
downloadrust-cf9e7a975d4a64ad60669a9764e64400710c7e67.tar.gz
rust-cf9e7a975d4a64ad60669a9764e64400710c7e67.zip
rewrite std-core-cycle to rmake
-rw-r--r--src/tools/tidy/src/allowed_run_make_makefiles.txt1
-rw-r--r--tests/run-make/std-core-cycle/Makefile17
-rw-r--r--tests/run-make/std-core-cycle/rmake.rs28
3 files changed, 28 insertions, 18 deletions
diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt
index 31cb32d349a..c527161aa9a 100644
--- a/src/tools/tidy/src/allowed_run_make_makefiles.txt
+++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt
@@ -142,7 +142,6 @@ run-make/static-dylib-by-default/Makefile
 run-make/static-extern-type/Makefile
 run-make/staticlib-blank-lib/Makefile
 run-make/staticlib-dylib-linkage/Makefile
-run-make/std-core-cycle/Makefile
 run-make/symbol-mangling-hashed/Makefile
 run-make/symbol-visibility/Makefile
 run-make/symbols-include-type-name/Makefile
diff --git a/tests/run-make/std-core-cycle/Makefile b/tests/run-make/std-core-cycle/Makefile
deleted file mode 100644
index 5ed6be905df..00000000000
--- a/tests/run-make/std-core-cycle/Makefile
+++ /dev/null
@@ -1,17 +0,0 @@
-# ignore-cross-compile
-include ../tools.mk
-
-ifeq ($(UNAME),Darwin)
-FLAGS :=
-else
-ifdef IS_WINDOWS
-FLAGS :=
-else
-FLAGS := -C link-args=-Wl,--no-undefined
-endif
-endif
-
-all:
-	$(RUSTC) bar.rs
-	$(RUSTC) foo.rs $(FLAGS)
-	$(RUSTC) foo.rs $(FLAGS) -C panic=abort
diff --git a/tests/run-make/std-core-cycle/rmake.rs b/tests/run-make/std-core-cycle/rmake.rs
new file mode 100644
index 00000000000..0f63c3f7ce4
--- /dev/null
+++ b/tests/run-make/std-core-cycle/rmake.rs
@@ -0,0 +1,28 @@
+// In some cases, linking libraries with GNU used to fail due to how
+// `std` and `core` possess a circular dependency with one another, and
+// how the linker could not go back through its symbol processing to resolve
+// the circular link. #49316 fixed this, and this test reproduces a minimal
+// version of one such linking attempt which used to fail.
+// See https://github.com/rust-lang/rust/issues/18807
+
+//@ ignore-cross-compile
+
+use run_make_support::{is_darwin, is_windows, rustc};
+
+fn main() {
+    rustc().input("bar.rs").run();
+
+    let mut rustc_foo = rustc();
+    rustc_foo.input("foo.rs");
+    let mut rustc_foo_panic = rustc();
+    rustc_foo_panic.input("foo.rs").panic("abort");
+
+    if !is_darwin() && !is_windows() {
+        rustc_foo.arg("-Clink-args=-Wl,--no-undefined");
+        rustc_foo_panic.arg("-Clink-args=-Wl,--no-undefined");
+    }
+
+    rustc_foo.run();
+    rustc_foo_panic.run();
+}
+