summaryrefslogtreecommitdiffstats
path: root/tests/run-make/rust-lld-custom-target
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
commitef24de24a82fe681581cc130f342363c47c0969a (patch)
tree0d494f7e1a38b95c92426f58fe6eaa877303a86c /tests/run-make/rust-lld-custom-target
parentReleasing progress-linux version 1.74.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-ef24de24a82fe681581cc130f342363c47c0969a.tar.xz
rustc-ef24de24a82fe681581cc130f342363c47c0969a.zip
Merging upstream version 1.75.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/run-make/rust-lld-custom-target')
-rw-r--r--tests/run-make/rust-lld-custom-target/Makefile7
-rw-r--r--tests/run-make/rust-lld-custom-target/custom-target.json57
-rw-r--r--tests/run-make/rust-lld-custom-target/lib.rs9
3 files changed, 73 insertions, 0 deletions
diff --git a/tests/run-make/rust-lld-custom-target/Makefile b/tests/run-make/rust-lld-custom-target/Makefile
new file mode 100644
index 000000000..007493ab0
--- /dev/null
+++ b/tests/run-make/rust-lld-custom-target/Makefile
@@ -0,0 +1,7 @@
+include ../tools.mk
+
+# needs-rust-lld
+# only-x86_64-unknown-linux-gnu
+all:
+ RUSTC_LOG=rustc_codegen_ssa::back::link=info $(RUSTC) --crate-type cdylib --target custom-target.json -Clink-args=-Wl,-v lib.rs 2> $(TMPDIR)/output.txt
+ $(CGREP) -e "^LLD [0-9]+\.[0-9]+\.[0-9]+" < $(TMPDIR)/output.txt
diff --git a/tests/run-make/rust-lld-custom-target/custom-target.json b/tests/run-make/rust-lld-custom-target/custom-target.json
new file mode 100644
index 000000000..7828a99f2
--- /dev/null
+++ b/tests/run-make/rust-lld-custom-target/custom-target.json
@@ -0,0 +1,57 @@
+{
+ "arch": "x86_64",
+ "cpu": "x86-64",
+ "crt-static-respected": true,
+ "data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128",
+ "dynamic-linking": true,
+ "env": "gnu",
+ "has-rpath": true,
+ "has-thread-local": true,
+ "link-self-contained": {
+ "components": [
+ "linker"
+ ]
+ },
+ "linker-flavor": "gnu-lld-cc",
+ "llvm-target": "x86_64-unknown-linux-gnu",
+ "max-atomic-width": 64,
+ "os": "linux",
+ "plt-by-default": false,
+ "position-independent-executables": true,
+ "pre-link-args": {
+ "gnu-cc": [
+ "-m64"
+ ],
+ "gnu-lld-cc": [
+ "-m64"
+ ]
+ },
+ "relro-level": "full",
+ "stack-probes": {
+ "kind": "inline-or-call",
+ "min-llvm-version-for-inline": [
+ 16,
+ 0,
+ 0
+ ]
+ },
+ "static-position-independent-executables": true,
+ "supported-sanitizers": [
+ "address",
+ "cfi",
+ "leak",
+ "memory",
+ "thread",
+ "safestack"
+ ],
+ "supported-split-debuginfo": [
+ "packed",
+ "unpacked",
+ "off"
+ ],
+ "supports-xray": true,
+ "target-family": [
+ "unix"
+ ],
+ "target-pointer-width": "64"
+}
diff --git a/tests/run-make/rust-lld-custom-target/lib.rs b/tests/run-make/rust-lld-custom-target/lib.rs
new file mode 100644
index 000000000..d8f5e3108
--- /dev/null
+++ b/tests/run-make/rust-lld-custom-target/lib.rs
@@ -0,0 +1,9 @@
+// Test linking using `cc` with `rust-lld`, using a custom target with features described in MCP 510
+// see https://github.com/rust-lang/compiler-team/issues/510 for more info:
+//
+// Starting from the `x86_64-unknown-linux-gnu` target spec, we add the following options:
+// - a linker-flavor using lld via a C compiler
+// - the self-contained linker component is enabled
+
+#![feature(no_core)]
+#![no_core]