summaryrefslogtreecommitdiffstats
path: root/tests/run-make/target-specs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/run-make/target-specs')
-rw-r--r--tests/run-make/target-specs/Makefile11
-rw-r--r--tests/run-make/target-specs/definitely-not-builtin-target.json7
-rw-r--r--tests/run-make/target-specs/foo.rs24
-rw-r--r--tests/run-make/target-specs/mismatching-data-layout.json6
-rw-r--r--tests/run-make/target-specs/my-awesome-platform.json11
-rw-r--r--tests/run-make/target-specs/my-incomplete-platform.json10
-rw-r--r--tests/run-make/target-specs/my-invalid-platform.json1
-rw-r--r--tests/run-make/target-specs/my-x86_64-unknown-linux-gnu-platform.json12
8 files changed, 82 insertions, 0 deletions
diff --git a/tests/run-make/target-specs/Makefile b/tests/run-make/target-specs/Makefile
new file mode 100644
index 000000000..a33f5368e
--- /dev/null
+++ b/tests/run-make/target-specs/Makefile
@@ -0,0 +1,11 @@
+include ../tools.mk
+all:
+ $(RUSTC) foo.rs --target=my-awesome-platform.json --crate-type=lib --emit=asm
+ $(CGREP) -v morestack < $(TMPDIR)/foo.s
+ $(RUSTC) foo.rs --target=my-invalid-platform.json 2>&1 | $(CGREP) "Error loading target specification"
+ $(RUSTC) foo.rs --target=my-incomplete-platform.json 2>&1 | $(CGREP) 'Field llvm-target'
+ RUST_TARGET_PATH=. $(RUSTC) foo.rs --target=my-awesome-platform --crate-type=lib --emit=asm
+ RUST_TARGET_PATH=. $(RUSTC) foo.rs --target=my-x86_64-unknown-linux-gnu-platform --crate-type=lib --emit=asm
+ $(RUSTC) -Z unstable-options --target=my-awesome-platform.json --print target-spec-json > $(TMPDIR)/test-platform.json && $(RUSTC) -Z unstable-options --target=$(TMPDIR)/test-platform.json --print target-spec-json | diff -q $(TMPDIR)/test-platform.json -
+ $(RUSTC) foo.rs --target=definitely-not-builtin-target 2>&1 | $(CGREP) 'may not set is_builtin'
+ $(RUSTC) foo.rs --target=mismatching-data-layout --crate-type=lib
diff --git a/tests/run-make/target-specs/definitely-not-builtin-target.json b/tests/run-make/target-specs/definitely-not-builtin-target.json
new file mode 100644
index 000000000..b36fa993d
--- /dev/null
+++ b/tests/run-make/target-specs/definitely-not-builtin-target.json
@@ -0,0 +1,7 @@
+{
+ "arch": "x86_64",
+ "is-builtin": true,
+ "data-layout": "e-m:e-i64:64-f80:128-n8:16:32:64-S128",
+ "llvm-target": "x86_64-unknown-unknown-gnu",
+ "target-pointer-width": "64"
+}
diff --git a/tests/run-make/target-specs/foo.rs b/tests/run-make/target-specs/foo.rs
new file mode 100644
index 000000000..22939e879
--- /dev/null
+++ b/tests/run-make/target-specs/foo.rs
@@ -0,0 +1,24 @@
+#![feature(lang_items, no_core, auto_traits)]
+#![no_core]
+
+#[lang = "copy"]
+trait Copy {}
+
+#[lang = "sized"]
+trait Sized {}
+
+#[lang = "freeze"]
+auto trait Freeze {}
+
+#[lang = "start"]
+fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize {
+ 0
+}
+
+extern "C" {
+ fn _foo() -> [u8; 16];
+}
+
+fn _main() {
+ let _a = unsafe { _foo() };
+}
diff --git a/tests/run-make/target-specs/mismatching-data-layout.json b/tests/run-make/target-specs/mismatching-data-layout.json
new file mode 100644
index 000000000..d12caaad1
--- /dev/null
+++ b/tests/run-make/target-specs/mismatching-data-layout.json
@@ -0,0 +1,6 @@
+{
+ "arch": "x86_64",
+ "data-layout": "e-m:e-i64:16:32:64",
+ "llvm-target": "x86_64-unknown-unknown-gnu",
+ "target-pointer-width": "64"
+}
diff --git a/tests/run-make/target-specs/my-awesome-platform.json b/tests/run-make/target-specs/my-awesome-platform.json
new file mode 100644
index 000000000..00de3de05
--- /dev/null
+++ b/tests/run-make/target-specs/my-awesome-platform.json
@@ -0,0 +1,11 @@
+{
+ "data-layout": "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-f80:32-n8:16:32-S128",
+ "linker-flavor": "gcc",
+ "llvm-target": "i686-unknown-linux-gnu",
+ "target-endian": "little",
+ "target-pointer-width": "32",
+ "target-c-int-width": "32",
+ "arch": "x86",
+ "os": "linux",
+ "morestack": false
+}
diff --git a/tests/run-make/target-specs/my-incomplete-platform.json b/tests/run-make/target-specs/my-incomplete-platform.json
new file mode 100644
index 000000000..ceaa25cdf
--- /dev/null
+++ b/tests/run-make/target-specs/my-incomplete-platform.json
@@ -0,0 +1,10 @@
+{
+ "data-layout": "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32",
+ "linker-flavor": "gcc",
+ "target-endian": "little",
+ "target-pointer-width": "32",
+ "target-c-int-width": "32",
+ "arch": "x86",
+ "os": "foo",
+ "morestack": false
+}
diff --git a/tests/run-make/target-specs/my-invalid-platform.json b/tests/run-make/target-specs/my-invalid-platform.json
new file mode 100644
index 000000000..3feac45b7
--- /dev/null
+++ b/tests/run-make/target-specs/my-invalid-platform.json
@@ -0,0 +1 @@
+wow this json is really broke!
diff --git a/tests/run-make/target-specs/my-x86_64-unknown-linux-gnu-platform.json b/tests/run-make/target-specs/my-x86_64-unknown-linux-gnu-platform.json
new file mode 100644
index 000000000..6d5e964ed
--- /dev/null
+++ b/tests/run-make/target-specs/my-x86_64-unknown-linux-gnu-platform.json
@@ -0,0 +1,12 @@
+{
+ "pre-link-args": {"gcc": ["-m64"]},
+ "data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128",
+ "linker-flavor": "gcc",
+ "llvm-target": "x86_64-unknown-linux-gnu",
+ "target-endian": "little",
+ "target-pointer-width": "64",
+ "target-c-int-width": "32",
+ "arch": "x86_64",
+ "os": "linux",
+ "morestack": false
+}