about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOneirical <manchot@videotron.ca>2024-05-28 13:33:14 -0400
committerOneirical <manchot@videotron.ca>2024-06-12 09:44:21 -0400
commit59acd234575b0283a6e00ec2e9d8be5f1b2f782d (patch)
tree6232bd744997693ac2babd01d5cb32b7e2634190
parent80408e0649b29915ad5258367b67c70a91e6b043 (diff)
downloadrust-59acd234575b0283a6e00ec2e9d8be5f1b2f782d.tar.gz
rust-59acd234575b0283a6e00ec2e9d8be5f1b2f782d.zip
port symlinked-rlib to rmake
-rw-r--r--src/tools/tidy/src/allowed_run_make_makefiles.txt1
-rw-r--r--tests/run-make/symlinked-extern/Makefile12
-rw-r--r--tests/run-make/symlinked-extern/rmake.rs1
-rw-r--r--tests/run-make/symlinked-rlib/Makefile10
-rw-r--r--tests/run-make/symlinked-rlib/rmake.rs16
5 files changed, 17 insertions, 23 deletions
diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt
index 4adfd52b2b3..dc1310afde9 100644
--- a/src/tools/tidy/src/allowed_run_make_makefiles.txt
+++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt
@@ -229,7 +229,6 @@ run-make/symbol-mangling-hashed/Makefile
 run-make/symbol-visibility/Makefile
 run-make/symbols-include-type-name/Makefile
 run-make/symlinked-libraries/Makefile
-run-make/symlinked-rlib/Makefile
 run-make/sysroot-crates-are-unstable/Makefile
 run-make/target-cpu-native/Makefile
 run-make/target-specs/Makefile
diff --git a/tests/run-make/symlinked-extern/Makefile b/tests/run-make/symlinked-extern/Makefile
deleted file mode 100644
index 28c764b84e8..00000000000
--- a/tests/run-make/symlinked-extern/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-# ignore-cross-compile
-include ../tools.mk
-
-# ignore-windows
-# `ln` is actually `cp` on msys.
-
-all:
-	$(RUSTC) foo.rs
-	mkdir -p $(TMPDIR)/other
-	ln -nsf $(TMPDIR)/libfoo.rlib $(TMPDIR)/other
-	$(RUSTC) bar.rs -L $(TMPDIR)
-	$(RUSTC) baz.rs --extern foo=$(TMPDIR)/other/libfoo.rlib  -L $(TMPDIR)
diff --git a/tests/run-make/symlinked-extern/rmake.rs b/tests/run-make/symlinked-extern/rmake.rs
index 124f1cef849..a54989661dc 100644
--- a/tests/run-make/symlinked-extern/rmake.rs
+++ b/tests/run-make/symlinked-extern/rmake.rs
@@ -3,6 +3,7 @@
 // using the --extern option to rustc, which could lead to rustc thinking
 // that it encountered two different versions of a crate, when it's
 // actually the same version found through different paths.
+// See https://github.com/rust-lang/rust/pull/16505
 
 // This test checks that --extern and symlinks together
 // can result in successful compilation.
diff --git a/tests/run-make/symlinked-rlib/Makefile b/tests/run-make/symlinked-rlib/Makefile
deleted file mode 100644
index a8565f683c3..00000000000
--- a/tests/run-make/symlinked-rlib/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
-# ignore-cross-compile
-include ../tools.mk
-
-# ignore-windows
-# `ln` is actually `cp` on msys.
-
-all:
-	$(RUSTC) foo.rs --crate-type=rlib -o $(TMPDIR)/foo.xxx
-	ln -nsf $(TMPDIR)/foo.xxx $(TMPDIR)/libfoo.rlib
-	$(RUSTC) bar.rs -L $(TMPDIR)
diff --git a/tests/run-make/symlinked-rlib/rmake.rs b/tests/run-make/symlinked-rlib/rmake.rs
new file mode 100644
index 00000000000..d451c62a2f3
--- /dev/null
+++ b/tests/run-make/symlinked-rlib/rmake.rs
@@ -0,0 +1,16 @@
+// Rustc did not recognize libraries which were symlinked
+// to files having extension other than .rlib. This was fixed
+// in #32828. This test creates a symlink to "foo.xxx", which has
+// an unusual file extension, and checks that rustc can successfully
+// use it as an rlib library.
+// See https://github.com/rust-lang/rust/pull/32828
+
+//@ ignore-cross-compile
+
+use run_make_support::{create_symlink, rustc, tmp_dir};
+
+fn main() {
+    rustc().input("foo.rs").crate_type("rlib").output(tmp_dir().join("foo.xxx")).run();
+    create_symlink(tmp_dir().join("foo.xxx"), tmp_dir().join("libfoo.rlib"));
+    rustc().input("bar.rs").library_search_path(tmp_dir());
+}