about summary refs log tree commit diff
path: root/src/test/run-make
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-10-24 21:24:49 +0000
committerbors <bors@rust-lang.org>2015-10-24 21:24:49 +0000
commitd2f41bd5be70544411e5ed42bcdb201e6ab25eb2 (patch)
treea255d623883249746dcbe70fd7206a4f99c4fe1c /src/test/run-make
parent8d86d1a4e17239361ecebced0d5dd246efa95512 (diff)
parenta1c8431f82ccc7a6b4f9f2af59ad545e3caa3db6 (diff)
downloadrust-d2f41bd5be70544411e5ed42bcdb201e6ab25eb2.tar.gz
rust-d2f41bd5be70544411e5ed42bcdb201e6ab25eb2.zip
Auto merge of #29151 - wthrowe:linker-output-ICE, r=alexcrichton
I suspect this won't work on Windows, but let's be optimistic and try it before disabling.
Diffstat (limited to 'src/test/run-make')
-rw-r--r--src/test/run-make/linker-output-non-utf8/Makefile24
-rw-r--r--src/test/run-make/linker-output-non-utf8/exec.rs16
-rw-r--r--src/test/run-make/linker-output-non-utf8/library.rs20
3 files changed, 60 insertions, 0 deletions
diff --git a/src/test/run-make/linker-output-non-utf8/Makefile b/src/test/run-make/linker-output-non-utf8/Makefile
new file mode 100644
index 00000000000..98fe83f45e4
--- /dev/null
+++ b/src/test/run-make/linker-output-non-utf8/Makefile
@@ -0,0 +1,24 @@
+-include ../tools.mk
+
+# Make sure we don't ICE if the linker prints a non-UTF-8 error message.
+
+ifdef IS_WINDOWS
+# ignore windows
+
+# This does not work in its current form on windows, possibly due to
+# gcc bugs or something about valid Windows paths.  See issue #29151
+# for more information.
+all:
+
+else
+
+# The zzz it to allow humans to tab complete or glob this thing.
+bad_dir := $(TMPDIR)/zzz$$'\xff'
+
+all:
+	$(RUSTC) library.rs
+	mkdir $(bad_dir)
+	mv $(TMPDIR)/liblibrary.a $(bad_dir)
+	LIBRARY_PATH=$(bad_dir) $(RUSTC) exec.rs 2>&1 | grep this_symbol_not_defined
+
+endif
diff --git a/src/test/run-make/linker-output-non-utf8/exec.rs b/src/test/run-make/linker-output-non-utf8/exec.rs
new file mode 100644
index 00000000000..1c03eb479fd
--- /dev/null
+++ b/src/test/run-make/linker-output-non-utf8/exec.rs
@@ -0,0 +1,16 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#[link(name="library")]
+extern "C" {
+    fn foo();
+}
+
+fn main() { unsafe { foo(); } }
diff --git a/src/test/run-make/linker-output-non-utf8/library.rs b/src/test/run-make/linker-output-non-utf8/library.rs
new file mode 100644
index 00000000000..194be26424a
--- /dev/null
+++ b/src/test/run-make/linker-output-non-utf8/library.rs
@@ -0,0 +1,20 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![crate_type = "staticlib"]
+
+extern "C" {
+    fn this_symbol_not_defined();
+}
+
+#[no_mangle]
+pub extern "C" fn foo() {
+    unsafe { this_symbol_not_defined(); }
+}