about summary refs log tree commit diff
path: root/tests/run-make
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2024-06-06 19:57:36 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2024-07-02 11:43:17 +0300
commit565ddfb48ca2a3b24236c2b393ec14eb86d64a7a (patch)
treed0ff7f27e8bff918a376d2dfee45396350efb033 /tests/run-make
parent7d97c59438e933e86f557ed999da3b8dfc6855a7 (diff)
downloadrust-565ddfb48ca2a3b24236c2b393ec14eb86d64a7a.tar.gz
rust-565ddfb48ca2a3b24236c2b393ec14eb86d64a7a.zip
linker: Link dylib crates by path
Diffstat (limited to 'tests/run-make')
-rw-r--r--tests/run-make/dylib-soname/foo.rs1
-rw-r--r--tests/run-make/dylib-soname/rmake.rs19
2 files changed, 20 insertions, 0 deletions
diff --git a/tests/run-make/dylib-soname/foo.rs b/tests/run-make/dylib-soname/foo.rs
new file mode 100644
index 00000000000..6833f391999
--- /dev/null
+++ b/tests/run-make/dylib-soname/foo.rs
@@ -0,0 +1 @@
+pub fn something() {}
diff --git a/tests/run-make/dylib-soname/rmake.rs b/tests/run-make/dylib-soname/rmake.rs
new file mode 100644
index 00000000000..a0215a6906e
--- /dev/null
+++ b/tests/run-make/dylib-soname/rmake.rs
@@ -0,0 +1,19 @@
+// Checks that produced dylibs have a relative SONAME set, so they don't put "unmovable" full paths
+// into DT_NEEDED when used by a full path.
+
+//@ only-linux
+//@ ignore-cross-compile
+
+use run_make_support::regex::Regex;
+use run_make_support::{cmd, run_in_tmpdir, rustc};
+
+fn main() {
+    run_in_tmpdir(|| {
+        rustc().crate_name("foo").crate_type("dylib").input("foo.rs").run();
+        cmd("readelf")
+            .arg("-d")
+            .arg("libfoo.so")
+            .run()
+            .assert_stdout_contains("Library soname: [libfoo.so]");
+    });
+}