summaryrefslogtreecommitdiffstats
path: root/tests/run-make
diff options
context:
space:
mode:
Diffstat (limited to 'tests/run-make')
-rw-r--r--tests/run-make/const_fn_mir/Makefile7
-rw-r--r--tests/run-make/coverage-llvmir/filecheck.testprog.txt6
-rw-r--r--tests/run-make/crate-hash-rustc-version/Makefile2
-rw-r--r--tests/run-make/dump-ice-to-disk/check.sh6
-rw-r--r--tests/run-make/emit-stack-sizes/foo.rs1
-rw-r--r--tests/run-make/intrinsic-unreachable/exit-ret.rs1
-rw-r--r--tests/run-make/intrinsic-unreachable/exit-unreachable.rs1
-rw-r--r--tests/run-make/issue-71519/Makefile8
-rw-r--r--tests/run-make/issue-71519/main.rs4
-rw-r--r--tests/run-make/issue-96498/Makefile8
-rw-r--r--tests/run-make/metadata-dep-info/Makefile6
-rw-r--r--tests/run-make/overwrite-input/Makefile10
-rw-r--r--tests/run-make/raw-dylib-alt-calling-convention/Makefile12
-rw-r--r--tests/run-make/raw-dylib-import-name-type/Makefile7
-rw-r--r--tests/run-make/raw-dylib-inline-cross-dylib/Makefile7
-rw-r--r--tests/run-make/raw-dylib-link-ordinal/Makefile7
-rw-r--r--tests/run-make/raw-dylib-stdcall-ordinal/Makefile7
-rw-r--r--tests/run-make/remap-path-prefix-dwarf/Makefile37
-rw-r--r--tests/run-make/remap-path-prefix/Makefile32
-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
-rw-r--r--tests/run-make/silly-file-names/Makefile12
-rw-r--r--tests/run-make/silly-file-names/silly-file-names.rs4
-rw-r--r--tests/run-make/silly-file-names/silly-file-names.run.stdout2
-rw-r--r--tests/run-make/split-debuginfo/Makefile64
-rw-r--r--tests/run-make/tools.mk22
-rw-r--r--tests/run-make/unknown-mod-stdin/Makefile11
-rw-r--r--tests/run-make/unknown-mod-stdin/unknown-mod.stderr1
-rw-r--r--tests/run-make/use-extern-for-plugins/Makefile17
-rw-r--r--tests/run-make/use-extern-for-plugins/bar.rs9
-rw-r--r--tests/run-make/use-extern-for-plugins/baz.rs8
-rw-r--r--tests/run-make/use-extern-for-plugins/foo.rs8
-rw-r--r--tests/run-make/wasm-override-linker/Makefile13
-rw-r--r--tests/run-make/wasm-override-linker/foo.rs6
-rw-r--r--tests/run-make/windows-safeseh/Makefile19
-rw-r--r--tests/run-make/windows-safeseh/bar.rs1
-rw-r--r--tests/run-make/windows-safeseh/baz.rs4
-rw-r--r--tests/run-make/windows-safeseh/foo.rs (renamed from tests/run-make/issue-96498/foo.rs)0
39 files changed, 310 insertions, 133 deletions
diff --git a/tests/run-make/const_fn_mir/Makefile b/tests/run-make/const_fn_mir/Makefile
index 6d72c1227..339944613 100644
--- a/tests/run-make/const_fn_mir/Makefile
+++ b/tests/run-make/const_fn_mir/Makefile
@@ -3,9 +3,4 @@ include ../tools.mk
all:
$(RUSTC) main.rs --emit=mir -o "$(TMPDIR)"/dump.mir
-
-ifdef RUSTC_BLESS_TEST
- cp "$(TMPDIR)"/dump.mir dump.mir
-else
- $(DIFF) dump.mir "$(TMPDIR)"/dump.mir
-endif
+ $(RUSTC_TEST_OP) "$(TMPDIR)"/dump.mir dump.mir
diff --git a/tests/run-make/coverage-llvmir/filecheck.testprog.txt b/tests/run-make/coverage-llvmir/filecheck.testprog.txt
index 9d63fabd7..8ab18da21 100644
--- a/tests/run-make/coverage-llvmir/filecheck.testprog.txt
+++ b/tests/run-make/coverage-llvmir/filecheck.testprog.txt
@@ -3,12 +3,12 @@
WINDOWS: $__llvm_profile_runtime_user = comdat any
-CHECK: @__covrec_{{[A-F0-9]+}}u = linkonce_odr hidden constant
-CHECK-SAME: section "[[INSTR_PROF_COVFUN]]"[[COMDAT_IF_SUPPORTED]], align 8
-
CHECK: @__llvm_coverage_mapping = private constant
CHECK-SAME: section "[[INSTR_PROF_COVMAP]]", align 8
+CHECK: @__covrec_{{[A-F0-9]+}}u = linkonce_odr hidden constant
+CHECK-SAME: section "[[INSTR_PROF_COVFUN]]"[[COMDAT_IF_SUPPORTED]], align 8
+
WINDOWS: @__llvm_profile_runtime = external{{.*}}global i32
CHECK: @__profc__R{{[a-zA-Z0-9_]+}}testprog14will_be_called = {{private|internal}} global
diff --git a/tests/run-make/crate-hash-rustc-version/Makefile b/tests/run-make/crate-hash-rustc-version/Makefile
index f1d2a3604..6bf504bf0 100644
--- a/tests/run-make/crate-hash-rustc-version/Makefile
+++ b/tests/run-make/crate-hash-rustc-version/Makefile
@@ -4,7 +4,7 @@ include ../tools.mk
# Ensure that crates compiled with different rustc versions cannot
# be dynamically linked.
-FLAGS := -Cprefer-dynamic -Zsymbol-mangling-version=v0
+FLAGS := -Cprefer-dynamic -Csymbol-mangling-version=v0
UNAME := $(shell uname)
ifeq ($(UNAME),Linux)
EXT=".so"
diff --git a/tests/run-make/dump-ice-to-disk/check.sh b/tests/run-make/dump-ice-to-disk/check.sh
index ab6f9ab60..ff6e4be35 100644
--- a/tests/run-make/dump-ice-to-disk/check.sh
+++ b/tests/run-make/dump-ice-to-disk/check.sh
@@ -11,6 +11,12 @@ export RUSTC_ICE=$TMPDIR
$RUSTC src/lib.rs -Z treat-err-as-bug=1 1>$TMPDIR/rust-test-default-set.log 2>&1
default_set=$(cat $TMPDIR/rustc-ice-*.txt | wc -l)
content=$(cat $TMPDIR/rustc-ice-*.txt)
+# Ensure that the ICE dump path doesn't contain `:` because they cause problems on Windows
+windows_safe=$(echo rustc-ice-*.txt | grep ':')
+if [ ! -z "$windows_safe" ]; then
+ exit 1
+fi
+
rm $TMPDIR/rustc-ice-*.txt
RUST_BACKTRACE=short $RUSTC src/lib.rs -Z treat-err-as-bug=1 1>$TMPDIR/rust-test-short.log 2>&1
short=$(cat $TMPDIR/rustc-ice-*.txt | wc -l)
diff --git a/tests/run-make/emit-stack-sizes/foo.rs b/tests/run-make/emit-stack-sizes/foo.rs
index ee51ae328..fd0b51205 100644
--- a/tests/run-make/emit-stack-sizes/foo.rs
+++ b/tests/run-make/emit-stack-sizes/foo.rs
@@ -1,3 +1,4 @@
#![crate_type = "lib"]
+#[inline(never)]
pub fn foo() {}
diff --git a/tests/run-make/intrinsic-unreachable/exit-ret.rs b/tests/run-make/intrinsic-unreachable/exit-ret.rs
index e7b9694d9..c8ba5b459 100644
--- a/tests/run-make/intrinsic-unreachable/exit-ret.rs
+++ b/tests/run-make/intrinsic-unreachable/exit-ret.rs
@@ -2,6 +2,7 @@
use std::arch::asm;
#[deny(unreachable_code)]
+#[inline(never)]
pub fn exit(n: usize) -> i32 {
unsafe {
// Pretend this asm is an exit() syscall.
diff --git a/tests/run-make/intrinsic-unreachable/exit-unreachable.rs b/tests/run-make/intrinsic-unreachable/exit-unreachable.rs
index ec85db733..75f893eb2 100644
--- a/tests/run-make/intrinsic-unreachable/exit-unreachable.rs
+++ b/tests/run-make/intrinsic-unreachable/exit-unreachable.rs
@@ -5,6 +5,7 @@ use std::arch::asm;
use std::intrinsics;
#[allow(unreachable_code)]
+#[inline(never)]
pub fn exit(n: usize) -> i32 {
unsafe {
// Pretend this asm is an exit() syscall.
diff --git a/tests/run-make/issue-71519/Makefile b/tests/run-make/issue-71519/Makefile
deleted file mode 100644
index 0ee83328b..000000000
--- a/tests/run-make/issue-71519/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-include ../tools.mk
-
-# ignore-msvc
-# needs-rust-lld
-# ignore-s390x lld does not yet support s390x as target
-all:
- RUSTC_LOG=rustc_codegen_ssa::back::link=info $(RUSTC) -Z gcc-ld=lld -C link-args=-Wl,-v main.rs 2> $(TMPDIR)/output.txt
- $(CGREP) -e "^LLD [0-9]+\.[0-9]+\.[0-9]+" < $(TMPDIR)/output.txt
diff --git a/tests/run-make/issue-71519/main.rs b/tests/run-make/issue-71519/main.rs
deleted file mode 100644
index f8d09e897..000000000
--- a/tests/run-make/issue-71519/main.rs
+++ /dev/null
@@ -1,4 +0,0 @@
-// test linking using cc with rust-lld injected into search path as ld
-// see rust-lang/rust#71519 for more info
-
-fn main() {}
diff --git a/tests/run-make/issue-96498/Makefile b/tests/run-make/issue-96498/Makefile
deleted file mode 100644
index efdd328c6..000000000
--- a/tests/run-make/issue-96498/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-# only-windows
-# needs-rust-lld
-
-include ../tools.mk
-
-# Ensure that LLD can link
-all:
- $(RUSTC) -C linker=rust-lld foo.rs
diff --git a/tests/run-make/metadata-dep-info/Makefile b/tests/run-make/metadata-dep-info/Makefile
index f9043f214..d48cbe0f2 100644
--- a/tests/run-make/metadata-dep-info/Makefile
+++ b/tests/run-make/metadata-dep-info/Makefile
@@ -1,11 +1,5 @@
include ../tools.mk
-ifdef RUSTC_BLESS_TEST
- RUSTC_TEST_OP = cp
-else
- RUSTC_TEST_OP = $(DIFF)
-endif
-
all:
$(RUSTC) --emit=metadata,dep-info --crate-type lib dash-separated.rs -C extra-filename=_something-extra
# Strip TMPDIR since it is a machine specific absolute path
diff --git a/tests/run-make/overwrite-input/Makefile b/tests/run-make/overwrite-input/Makefile
index c62b5aab1..721bf62b2 100644
--- a/tests/run-make/overwrite-input/Makefile
+++ b/tests/run-make/overwrite-input/Makefile
@@ -3,11 +3,5 @@ include ../tools.mk
all:
$(RUSTC) main.rs -o main.rs 2> $(TMPDIR)/file.stderr || echo "failed successfully"
$(RUSTC) main.rs -o . 2> $(TMPDIR)/folder.stderr || echo "failed successfully"
-
-ifdef RUSTC_BLESS_TEST
- cp "$(TMPDIR)"/file.stderr file.stderr
- cp "$(TMPDIR)"/folder.stderr folder.stderr
-else
- $(DIFF) file.stderr "$(TMPDIR)"/file.stderr
- $(DIFF) folder.stderr "$(TMPDIR)"/folder.stderr
-endif
+ $(RUSTC_TEST_OP) "$(TMPDIR)"/file.stderr file.stderr
+ $(RUSTC_TEST_OP) "$(TMPDIR)"/folder.stderr folder.stderr
diff --git a/tests/run-make/raw-dylib-alt-calling-convention/Makefile b/tests/run-make/raw-dylib-alt-calling-convention/Makefile
index 1744c431f..14d23a5d2 100644
--- a/tests/run-make/raw-dylib-alt-calling-convention/Makefile
+++ b/tests/run-make/raw-dylib-alt-calling-convention/Makefile
@@ -16,17 +16,9 @@ else
endif
"$(TMPDIR)"/driver > "$(TMPDIR)"/output.txt
-ifdef RUSTC_BLESS_TEST
- cp "$(TMPDIR)"/output.txt output.txt
-else
- $(DIFF) output.txt "$(TMPDIR)"/output.txt
-endif
+ $(RUSTC_TEST_OP) "$(TMPDIR)"/output.txt output.txt
ifdef IS_MSVC
"$(TMPDIR)"/driver true > "$(TMPDIR)"/output.msvc.txt
-ifdef RUSTC_BLESS_TEST
- cp "$(TMPDIR)"/output.msvc.txt output.msvc.txt
-else
- $(DIFF) output.msvc.txt "$(TMPDIR)"/output.msvc.txt
-endif
+ $(RUSTC_TEST_OP) "$(TMPDIR)"/output.msvc.txt output.msvc.txt
endif
diff --git a/tests/run-make/raw-dylib-import-name-type/Makefile b/tests/run-make/raw-dylib-import-name-type/Makefile
index 671523298..901d3e861 100644
--- a/tests/run-make/raw-dylib-import-name-type/Makefile
+++ b/tests/run-make/raw-dylib-import-name-type/Makefile
@@ -14,9 +14,4 @@ else
$(CC) "$(TMPDIR)"/extern.obj extern.gnu.def --no-leading-underscore -shared -o "$(TMPDIR)"/extern.dll
endif
"$(TMPDIR)"/driver > "$(TMPDIR)"/output.txt
-
-ifdef RUSTC_BLESS_TEST
- cp "$(TMPDIR)"/output.txt output.txt
-else
- $(DIFF) output.txt "$(TMPDIR)"/output.txt
-endif
+ $(RUSTC_TEST_OP) "$(TMPDIR)"/output.txt output.txt
diff --git a/tests/run-make/raw-dylib-inline-cross-dylib/Makefile b/tests/run-make/raw-dylib-inline-cross-dylib/Makefile
index 6d1d04bfd..195b5fda5 100644
--- a/tests/run-make/raw-dylib-inline-cross-dylib/Makefile
+++ b/tests/run-make/raw-dylib-inline-cross-dylib/Makefile
@@ -27,9 +27,4 @@ else
$(CC) "$(TMPDIR)"/extern_2.obj -shared -o "$(TMPDIR)"/extern_2.dll
endif
$(call RUN,driver) > "$(TMPDIR)"/output.txt
-
-ifdef RUSTC_BLESS_TEST
- cp "$(TMPDIR)"/output.txt output.txt
-else
- $(DIFF) output.txt "$(TMPDIR)"/output.txt
-endif
+ $(RUSTC_TEST_OP) "$(TMPDIR)"/output.txt output.txt
diff --git a/tests/run-make/raw-dylib-link-ordinal/Makefile b/tests/run-make/raw-dylib-link-ordinal/Makefile
index 374a0b59d..49e959cdb 100644
--- a/tests/run-make/raw-dylib-link-ordinal/Makefile
+++ b/tests/run-make/raw-dylib-link-ordinal/Makefile
@@ -14,9 +14,4 @@ else
$(CC) "$(TMPDIR)"/exporter.obj exporter.def -shared -o "$(TMPDIR)"/exporter.dll
endif
"$(TMPDIR)"/driver > "$(TMPDIR)"/output.txt
-
-ifdef RUSTC_BLESS_TEST
- cp "$(TMPDIR)"/output.txt output.txt
-else
- $(DIFF) output.txt "$(TMPDIR)"/output.txt
-endif
+ $(RUSTC_TEST_OP) "$(TMPDIR)"/output.txt output.txt
diff --git a/tests/run-make/raw-dylib-stdcall-ordinal/Makefile b/tests/run-make/raw-dylib-stdcall-ordinal/Makefile
index 178c15ab3..70e4de62c 100644
--- a/tests/run-make/raw-dylib-stdcall-ordinal/Makefile
+++ b/tests/run-make/raw-dylib-stdcall-ordinal/Makefile
@@ -15,9 +15,4 @@ else
$(CC) "$(TMPDIR)"/exporter.obj exporter-gnu.def -shared -o "$(TMPDIR)"/exporter.dll
endif
"$(TMPDIR)"/driver > "$(TMPDIR)"/actual_output.txt
-
-ifdef RUSTC_BLESS_TEST
- cp "$(TMPDIR)"/actual_output.txt expected_output.txt
-else
- $(DIFF) expected_output.txt "$(TMPDIR)"/actual_output.txt
-endif
+ $(RUSTC_TEST_OP) "$(TMPDIR)"/actual_output.txt expected_output.txt
diff --git a/tests/run-make/remap-path-prefix-dwarf/Makefile b/tests/run-make/remap-path-prefix-dwarf/Makefile
index c9ede1b60..8905a00ea 100644
--- a/tests/run-make/remap-path-prefix-dwarf/Makefile
+++ b/tests/run-make/remap-path-prefix-dwarf/Makefile
@@ -3,17 +3,26 @@
# ignore-windows
+include ../tools.mk
+
SRC_DIR := $(abspath .)
SRC_DIR_PARENT := $(abspath ..)
-include ../tools.mk
+ifeq ($(UNAME),Darwin)
+ DEBUGINFOOPTS := -Csplit-debuginfo=off
+else
+ DEBUGINFOOPTS :=
+endif
all: \
abs_input_outside_working_dir \
rel_input_remap_working_dir \
+ rel_input_remap_working_dir_scope \
rel_input_remap_working_dir_parent \
rel_input_remap_working_dir_child \
+ rel_input_remap_working_dir_diagnostics \
abs_input_inside_working_dir \
+ abs_input_inside_working_dir_scope \
abs_input_outside_working_dir
# The compiler is called with an *ABSOLUTE PATH* as input, and that absolute path *is* within
@@ -27,6 +36,17 @@ abs_input_inside_working_dir:
# No weird duplication of remapped components (see #78479)
"$(LLVM_BIN_DIR)"/llvm-dwarfdump $(TMPDIR)/abs_input_inside_working_dir.rlib | $(CGREP) -v "REMAPPED/REMAPPED"
+# The compiler is called with an *ABSOLUTE PATH* as input, and that absolute path *is* within
+# the working directory of the compiler. We are remapping the path that contains `src`.
+abs_input_inside_working_dir_scope:
+ # We explicitly switch to a directory that *is* a prefix of the directory our
+ # source code is contained in.
+ cd $(SRC_DIR) && $(RUSTC) $(SRC_DIR)/src/quux.rs -o "$(TMPDIR)/abs_input_inside_working_dir_scope.rlib" -Cdebuginfo=2 --remap-path-prefix $(SRC_DIR)=REMAPPED -Zremap-path-scope=object $(DEBUGINFOOPTS)
+ # We expect the path to the main source file to be remapped.
+ "$(LLVM_BIN_DIR)"/llvm-dwarfdump $(TMPDIR)/abs_input_inside_working_dir_scope.rlib | $(CGREP) "REMAPPED/src/quux.rs"
+ # No weird duplication of remapped components (see #78479)
+ "$(LLVM_BIN_DIR)"/llvm-dwarfdump $(TMPDIR)/abs_input_inside_working_dir_scope.rlib | $(CGREP) -v "REMAPPED/REMAPPED"
+
# The compiler is called with an *ABSOLUTE PATH* as input, and that absolute path is *not* within
# the working directory of the compiler. We are remapping both the path that contains `src` and
# the working directory to the same thing. This setup corresponds to a workaround that is needed
@@ -52,6 +72,21 @@ rel_input_remap_working_dir:
# No weird duplication of remapped components (see #78479)
"$(LLVM_BIN_DIR)"/llvm-dwarfdump "$(TMPDIR)/rel_input_remap_working_dir.rlib" | $(CGREP) -v "REMAPPED/REMAPPED"
+# The compiler is called with a *RELATIVE PATH* as input. We are remapping the working directory of
+# the compiler, which naturally is an implicit prefix of our relative input path. Debuginfo will
+# expand the relative path to an absolute path and we expect the working directory to be remapped
+# in that expansion.
+rel_input_remap_working_dir_scope:
+ cd $(SRC_DIR) && $(RUSTC) src/quux.rs -o "$(TMPDIR)/rel_input_remap_working_dir_scope.rlib" -Cdebuginfo=2 --remap-path-prefix "$(SRC_DIR)=REMAPPED" -Zremap-path-scope=object $(DEBUGINFOOPTS)
+ "$(LLVM_BIN_DIR)"/llvm-dwarfdump "$(TMPDIR)/rel_input_remap_working_dir_scope.rlib" | $(CGREP) "REMAPPED/src/quux.rs"
+ # No weird duplication of remapped components (see #78479)
+ "$(LLVM_BIN_DIR)"/llvm-dwarfdump "$(TMPDIR)/rel_input_remap_working_dir_scope.rlib" | $(CGREP) -v "REMAPPED/REMAPPED"
+
+rel_input_remap_working_dir_diagnostics:
+ cd $(SRC_DIR) && $(RUSTC) src/quux.rs -o "$(TMPDIR)/rel_input_remap_working_dir_scope.rlib" -Cdebuginfo=2 --remap-path-prefix "$(SRC_DIR)=REMAPPED" -Zremap-path-scope=diagnostics $(DEBUGINFOOPTS)
+ "$(LLVM_BIN_DIR)"/llvm-dwarfdump "$(TMPDIR)/rel_input_remap_working_dir_scope.rlib" | $(CGREP) -v "REMAPPED/src/quux.rs"
+ "$(LLVM_BIN_DIR)"/llvm-dwarfdump "$(TMPDIR)/rel_input_remap_working_dir_scope.rlib" | $(CGREP) -v "REMAPPED/REMAPPED"
+
# The compiler is called with a *RELATIVE PATH* as input. We are remapping a *SUB-DIRECTORY* of the
# compiler's working directory. This test makes sure that that directory is remapped even though it
# won't actually show up in this form in the compiler's SourceMap and instead is only constructed
diff --git a/tests/run-make/remap-path-prefix/Makefile b/tests/run-make/remap-path-prefix/Makefile
index 2a7378fdf..35f65240f 100644
--- a/tests/run-make/remap-path-prefix/Makefile
+++ b/tests/run-make/remap-path-prefix/Makefile
@@ -2,8 +2,38 @@ include ../tools.mk
# ignore-windows
+ifeq ($(UNAME),Darwin)
+ DEBUGINFOOPTS := -Csplit-debuginfo=off
+else
+ DEBUGINFOOPTS :=
+endif
+
+all: remap remap-with-scope
+
# Checks if remapping works if the remap-from string contains path to the working directory plus more
-all:
+remap:
$(RUSTC) --remap-path-prefix $$PWD/auxiliary=/the/aux --crate-type=lib --emit=metadata auxiliary/lib.rs
grep "/the/aux/lib.rs" $(TMPDIR)/liblib.rmeta || exit 1
! grep "$$PWD/auxiliary" $(TMPDIR)/liblib.rmeta || exit 1
+
+remap-with-scope:
+ $(RUSTC) --remap-path-prefix $$PWD/auxiliary=/the/aux -Zremap-path-scope=object $(DEBUGINFOOPTS) --crate-type=lib --emit=metadata auxiliary/lib.rs
+ grep "/the/aux/lib.rs" $(TMPDIR)/liblib.rmeta || exit 1
+ ! grep "$$PWD/auxiliary" $(TMPDIR)/liblib.rmeta || exit 1
+
+ $(RUSTC) --remap-path-prefix $$PWD/auxiliary=/the/aux -Zremap-path-scope=diagnostics $(DEBUGINFOOPTS) --crate-type=lib --emit=metadata auxiliary/lib.rs
+ ! grep "/the/aux/lib.rs" $(TMPDIR)/liblib.rmeta || exit 1
+ grep "$$PWD/auxiliary" $(TMPDIR)/liblib.rmeta || exit 1
+
+ $(RUSTC) --remap-path-prefix $$PWD/auxiliary=/the/aux -Zremap-path-scope=diagnostics,object $(DEBUGINFOOPTS) --crate-type=lib --emit=metadata auxiliary/lib.rs
+ grep "/the/aux/lib.rs" $(TMPDIR)/liblib.rmeta || exit 1
+ ! grep "$$PWD/auxiliary" $(TMPDIR)/liblib.rmeta || exit 1
+
+ $(RUSTC) --remap-path-prefix $$PWD/auxiliary=/the/aux -Zremap-path-scope=split-debuginfo $(DEBUGINFOOPTS) --crate-type=lib --emit=metadata auxiliary/lib.rs
+ ! grep "/the/aux/lib.rs" $(TMPDIR)/liblib.rmeta || exit 1
+ grep "$$PWD/auxiliary" $(TMPDIR)/liblib.rmeta || exit 1
+
+ # FIXME: We should test the split debuginfo files, but we don't currently a good infra for that
+ $(RUSTC) --remap-path-prefix $$PWD/auxiliary=/the/aux -Zremap-path-scope=split-debuginfo -Zunstable-options -Csplit-debuginfo=packed --crate-type=lib --emit=metadata auxiliary/lib.rs
+ grep "/the/aux/lib.rs" $(TMPDIR)/liblib.rmeta || exit 1
+ ! grep "$$PWD/auxiliary" $(TMPDIR)/liblib.rmeta || exit 1
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]
diff --git a/tests/run-make/silly-file-names/Makefile b/tests/run-make/silly-file-names/Makefile
new file mode 100644
index 000000000..e51266c08
--- /dev/null
+++ b/tests/run-make/silly-file-names/Makefile
@@ -0,0 +1,12 @@
+# ignore-cross-compile we need to execute the binary
+# ignore-windows we create files with < and > in their names
+
+include ../tools.mk
+
+all:
+ echo '"comes from a file with a name that begins with <"' > "$(TMPDIR)/<leading-lt"
+ echo '"comes from a file with a name that ends with >"' > "$(TMPDIR)/trailing-gt>"
+ cp silly-file-names.rs "$(TMPDIR)/silly-file-names.rs"
+ $(RUSTC) "$(TMPDIR)/silly-file-names.rs" -o "$(TMPDIR)/silly-file-names"
+ "$(TMPDIR)/silly-file-names" > "$(TMPDIR)/silly-file-names.run.stdout"
+ $(RUSTC_TEST_OP) "$(TMPDIR)/silly-file-names.run.stdout" silly-file-names.run.stdout
diff --git a/tests/run-make/silly-file-names/silly-file-names.rs b/tests/run-make/silly-file-names/silly-file-names.rs
new file mode 100644
index 000000000..a20082091
--- /dev/null
+++ b/tests/run-make/silly-file-names/silly-file-names.rs
@@ -0,0 +1,4 @@
+fn main() {
+ println!(include!("<leading-lt"));
+ println!(include!("trailing-gt>"));
+}
diff --git a/tests/run-make/silly-file-names/silly-file-names.run.stdout b/tests/run-make/silly-file-names/silly-file-names.run.stdout
new file mode 100644
index 000000000..fbc4c89e0
--- /dev/null
+++ b/tests/run-make/silly-file-names/silly-file-names.run.stdout
@@ -0,0 +1,2 @@
+comes from a file with a name that begins with <
+comes from a file with a name that ends with >
diff --git a/tests/run-make/split-debuginfo/Makefile b/tests/run-make/split-debuginfo/Makefile
index 71e014c1f..9e05c8dc1 100644
--- a/tests/run-make/split-debuginfo/Makefile
+++ b/tests/run-make/split-debuginfo/Makefile
@@ -104,7 +104,7 @@ packed-lto-single:
ls $(TMPDIR)/*.dwp && exit 1 || exit 0
rm $(TMPDIR)/libbaz.rlib
-packed-remapped: packed-remapped-split packed-remapped-single
+packed-remapped: packed-remapped-split packed-remapped-single packed-remapped-scope packed-remapped-wrong-scope
# - Debuginfo in `.dwo` files
# - `.o` and binary refer to remapped `.dwo` paths which do not exist
@@ -134,6 +134,36 @@ packed-remapped-single:
rm $(TMPDIR)/foo.dwp
rm $(TMPDIR)/$(call BIN,foo)
+# - Debuginfo in `.o` files
+# - `.o` and binary refer to remapped `.o` paths which do not exist
+# - `.o` deleted
+# - `.dwo` never created
+# - `.dwp` present
+packed-remapped-scope:
+ $(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=packed -C debuginfo=2 \
+ -Z split-dwarf-kind=single --remap-path-prefix $(TMPDIR)=/a \
+ -Z remap-path-scope=split-debuginfo-path foo.rs -g
+ objdump -Wi $(TMPDIR)/foo | grep DW_AT_GNU_dwo_name | (! grep $(TMPDIR)) || exit 1
+ ls $(TMPDIR)/*.o && exit 1 || exit 0
+ ls $(TMPDIR)/*.dwo && exit 1 || exit 0
+ rm $(TMPDIR)/foo.dwp
+ rm $(TMPDIR)/$(call BIN,foo)
+
+# - Debuginfo in `.o` files
+# - `.o` and binary refer to remapped `.o` paths which do not exist
+# - `.o` deleted
+# - `.dwo` never created
+# - `.dwp` present
+packed-remapped-wrong-scope:
+ $(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=packed -C debuginfo=2 \
+ -Z split-dwarf-kind=single --remap-path-prefix $(TMPDIR)=/a \
+ -Z remap-path-scope=macro foo.rs -g
+ objdump -Wi $(TMPDIR)/foo | grep DW_AT_GNU_dwo_name | (grep $(TMPDIR)) || exit 1
+ ls $(TMPDIR)/*.o && exit 1 || exit 0
+ ls $(TMPDIR)/*.dwo && exit 1 || exit 0
+ rm $(TMPDIR)/foo.dwp
+ rm $(TMPDIR)/$(call BIN,foo)
+
packed-crosscrate: packed-crosscrate-split packed-crosscrate-single
# - Debuginfo in `.dwo` files
@@ -230,7 +260,7 @@ unpacked-lto-single:
ls $(TMPDIR)/*.dwp && exit 1 || exit 0
rm $(TMPDIR)/libbaz.rlib
-unpacked-remapped: unpacked-remapped-split unpacked-remapped-single
+unpacked-remapped: unpacked-remapped-split unpacked-remapped-single unpacked-remapped-scope unpacked-remapped-wrong-scope
# - Debuginfo in `.dwo` files
# - `.o` and binary refer to remapped `.dwo` paths which do not exist
@@ -260,6 +290,36 @@ unpacked-remapped-single:
ls $(TMPDIR)/*.dwp && exit 1 || exit 0
rm $(TMPDIR)/$(call BIN,foo)
+# - Debuginfo in `.o` files
+# - `.o` and binary refer to remapped `.o` paths which do not exist
+# - `.o` present
+# - `.dwo` never created
+# - `.dwp` never created
+unpacked-remapped-scope:
+ $(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=unpacked -C debuginfo=2 \
+ -Z split-dwarf-kind=single --remap-path-prefix $(TMPDIR)=/a \
+ -Z remap-path-scope=split-debuginfo-path foo.rs -g
+ objdump -Wi $(TMPDIR)/foo | grep DW_AT_GNU_dwo_name | (! grep $(TMPDIR)) || exit 1
+ rm $(TMPDIR)/*.o
+ ls $(TMPDIR)/*.dwo && exit 1 || exit 0
+ ls $(TMPDIR)/*.dwp && exit 1 || exit 0
+ rm $(TMPDIR)/$(call BIN,foo)
+
+# - Debuginfo in `.o` files
+# - `.o` and binary refer to remapped `.o` paths which do not exist
+# - `.o` present
+# - `.dwo` never created
+# - `.dwp` never created
+unpacked-remapped-wrong-scope:
+ $(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=unpacked -C debuginfo=2 \
+ -Z split-dwarf-kind=single --remap-path-prefix $(TMPDIR)=/a \
+ -Z remap-path-scope=macro foo.rs -g
+ objdump -Wi $(TMPDIR)/foo | grep DW_AT_GNU_dwo_name | (grep $(TMPDIR)) || exit 1
+ rm $(TMPDIR)/*.o
+ ls $(TMPDIR)/*.dwo && exit 1 || exit 0
+ ls $(TMPDIR)/*.dwp && exit 1 || exit 0
+ rm $(TMPDIR)/$(call BIN,foo)
+
unpacked-crosscrate: unpacked-crosscrate-split unpacked-crosscrate-single
# - Debuginfo in `.dwo` files
diff --git a/tests/run-make/tools.mk b/tests/run-make/tools.mk
index 6121a91e9..1d4e91113 100644
--- a/tests/run-make/tools.mk
+++ b/tests/run-make/tools.mk
@@ -21,6 +21,28 @@ CGREP := "$(S)/src/etc/cat-and-grep.sh"
# diff with common flags for multi-platform diffs against text output
DIFF := diff -u --strip-trailing-cr
+# With RUSTC_TEST_OP you can elegantly support blessing of run-make tests. Do
+# like this in a Makefile recipe:
+#
+# "$(TMPDIR)"/your-test > "$(TMPDIR)"/your-test.run.stdout
+# $(RUSTC_TEST_OP) "$(TMPDIR)"/your-test.run.stdout your-test.run.stdout
+#
+# When running the test normally with
+#
+# ./x test tests/run-make/your-test
+#
+# the actual output will be diffed against the expected output. When running in
+# bless-mode with
+#
+# ./x test --bless tests/run-make/your-test
+#
+# the actual output will be blessed as the expected output.
+ifdef RUSTC_BLESS_TEST
+ RUSTC_TEST_OP = cp
+else
+ RUSTC_TEST_OP = $(DIFF)
+endif
+
# Some of the Rust CI platforms use `/bin/dash` to run `shell` script in
# Makefiles. Other platforms, including many developer platforms, default to
# `/bin/bash`. (In many cases, `make` is actually using `/bin/sh`, but `sh`
diff --git a/tests/run-make/unknown-mod-stdin/Makefile b/tests/run-make/unknown-mod-stdin/Makefile
index c19317653..313b0ba83 100644
--- a/tests/run-make/unknown-mod-stdin/Makefile
+++ b/tests/run-make/unknown-mod-stdin/Makefile
@@ -4,12 +4,5 @@ include ../tools.mk
all:
echo 'mod unknown;' | $(RUSTC) --crate-type rlib - >$(TMPDIR)/unknown-mod.stdout 2>$(TMPDIR)/unknown-mod.stderr || echo "failed successfully"
-
-# Bless like this: RUSTC_BLESS_TEST=1 ./x.py test tests/run-make/unknown-mod-stdin
-ifdef RUSTC_BLESS_TEST
- cp "$(TMPDIR)"/unknown-mod.stdout unknown-mod.stdout
- cp "$(TMPDIR)"/unknown-mod.stderr unknown-mod.stderr
-else
- $(DIFF) unknown-mod.stdout "$(TMPDIR)"/unknown-mod.stdout
- $(DIFF) unknown-mod.stderr "$(TMPDIR)"/unknown-mod.stderr
-endif
+ $(RUSTC_TEST_OP) "$(TMPDIR)"/unknown-mod.stdout unknown-mod.stdout
+ $(RUSTC_TEST_OP) "$(TMPDIR)"/unknown-mod.stderr unknown-mod.stderr
diff --git a/tests/run-make/unknown-mod-stdin/unknown-mod.stderr b/tests/run-make/unknown-mod-stdin/unknown-mod.stderr
index d7258fe4f..81ff83938 100644
--- a/tests/run-make/unknown-mod-stdin/unknown-mod.stderr
+++ b/tests/run-make/unknown-mod-stdin/unknown-mod.stderr
@@ -5,6 +5,7 @@ error[E0583]: file not found for module `unknown`
| ^^^^^^^^^^^^
|
= help: to create the module `unknown`, create file "unknown.rs" or "unknown/mod.rs"
+ = note: if there is a `mod unknown` elsewhere in the crate already, import it with `use crate::...` instead
error: aborting due to previous error
diff --git a/tests/run-make/use-extern-for-plugins/Makefile b/tests/run-make/use-extern-for-plugins/Makefile
deleted file mode 100644
index b8ec7e8dc..000000000
--- a/tests/run-make/use-extern-for-plugins/Makefile
+++ /dev/null
@@ -1,17 +0,0 @@
-include ../tools.mk
-
-# ignore-freebsd
-# ignore-openbsd
-# ignore-solaris
-
-HOST := $(shell $(RUSTC) -vV | grep 'host:' | sed 's/host: //')
-ifeq ($(findstring i686,$(HOST)),i686)
-TARGET := $(subst i686,x86_64,$(HOST))
-else
-TARGET := $(subst x86_64,i686,$(HOST))
-endif
-
-all:
- $(RUSTC) foo.rs -C extra-filename=-host
- $(RUSTC) bar.rs -C extra-filename=-targ --target $(TARGET)
- $(RUSTC) baz.rs --extern a=$(TMPDIR)/liba-targ.rlib --target $(TARGET)
diff --git a/tests/run-make/use-extern-for-plugins/bar.rs b/tests/run-make/use-extern-for-plugins/bar.rs
deleted file mode 100644
index 704d21203..000000000
--- a/tests/run-make/use-extern-for-plugins/bar.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-#![feature(no_core)]
-#![no_core]
-#![crate_type = "lib"]
-#![crate_name = "a"]
-
-#[macro_export]
-macro_rules! bar {
- () => ()
-}
diff --git a/tests/run-make/use-extern-for-plugins/baz.rs b/tests/run-make/use-extern-for-plugins/baz.rs
deleted file mode 100644
index 49a96a0c8..000000000
--- a/tests/run-make/use-extern-for-plugins/baz.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-#![feature(no_core)]
-#![no_core]
-#![crate_type = "lib"]
-
-#[macro_use]
-extern crate a;
-
-bar!();
diff --git a/tests/run-make/use-extern-for-plugins/foo.rs b/tests/run-make/use-extern-for-plugins/foo.rs
deleted file mode 100644
index dffdc0798..000000000
--- a/tests/run-make/use-extern-for-plugins/foo.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-#![no_std]
-#![crate_type = "lib"]
-#![crate_name = "a"]
-
-#[macro_export]
-macro_rules! foo {
- () => ()
-}
diff --git a/tests/run-make/wasm-override-linker/Makefile b/tests/run-make/wasm-override-linker/Makefile
new file mode 100644
index 000000000..52339f926
--- /dev/null
+++ b/tests/run-make/wasm-override-linker/Makefile
@@ -0,0 +1,13 @@
+# needs-matching-clang
+
+include ../tools.mk
+
+ifeq ($(TARGET),wasm32-unknown-unknown)
+all:
+ $(RUSTC) foo.rs --crate-type cdylib --target $(TARGET) -C linker=$(CLANG)
+else ifeq ($(TARGET),wasm64-unknown-unknown)
+all:
+ $(RUSTC) foo.rs --crate-type cdylib --target $(TARGET) -C linker=$(CLANG)
+else
+all:
+endif
diff --git a/tests/run-make/wasm-override-linker/foo.rs b/tests/run-make/wasm-override-linker/foo.rs
new file mode 100644
index 000000000..f4167a4fc
--- /dev/null
+++ b/tests/run-make/wasm-override-linker/foo.rs
@@ -0,0 +1,6 @@
+#![crate_type = "cdylib"]
+
+#[no_mangle]
+pub extern "C" fn add(a: i32, b: i32) -> i32 {
+ a + b
+}
diff --git a/tests/run-make/windows-safeseh/Makefile b/tests/run-make/windows-safeseh/Makefile
new file mode 100644
index 000000000..d6a403961
--- /dev/null
+++ b/tests/run-make/windows-safeseh/Makefile
@@ -0,0 +1,19 @@
+# only-windows
+# needs-rust-lld
+
+include ../tools.mk
+
+all: foo bar
+
+# Ensure that LLD can link when an .rlib contains a synthetic object
+# file referencing exported or used symbols.
+foo:
+ $(RUSTC) -C linker=rust-lld foo.rs
+
+# Ensure that LLD can link when /WHOLEARCHIVE: is used with an .rlib.
+# Previously, lib.rmeta was not marked as (trivially) SAFESEH-aware.
+bar: baz
+ $(RUSTC) -C linker=rust-lld -C link-arg=/WHOLEARCHIVE:libbaz.rlib bar.rs
+
+baz:
+ $(RUSTC) baz.rs
diff --git a/tests/run-make/windows-safeseh/bar.rs b/tests/run-make/windows-safeseh/bar.rs
new file mode 100644
index 000000000..f328e4d9d
--- /dev/null
+++ b/tests/run-make/windows-safeseh/bar.rs
@@ -0,0 +1 @@
+fn main() {}
diff --git a/tests/run-make/windows-safeseh/baz.rs b/tests/run-make/windows-safeseh/baz.rs
new file mode 100644
index 000000000..8d5b9dc5a
--- /dev/null
+++ b/tests/run-make/windows-safeseh/baz.rs
@@ -0,0 +1,4 @@
+#![crate_type = "rlib"]
+
+#[no_mangle]
+extern "C" fn baz() {}
diff --git a/tests/run-make/issue-96498/foo.rs b/tests/run-make/windows-safeseh/foo.rs
index 93ac3641b..93ac3641b 100644
--- a/tests/run-make/issue-96498/foo.rs
+++ b/tests/run-make/windows-safeseh/foo.rs