Skip to content

Commit 910eb3b

Browse files
committed
Fix no-link-with-link-args by introducing another normalization.
1 parent ad3c422 commit 910eb3b

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

src/test/ui/nolink-with-link-args.nll.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
error: linking with `ld` failed: exit code: 1
22
|
3-
= note: "ld" "-L" "$BUILD_DIR/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "$TEST_BUILD_DIR/nolink-with-link-args.nll/a.nolink_with_link_args0-317d481089b8c8fe83113de504472633.rs.rcgu.o" "$TEST_BUILD_DIR/nolink-with-link-args.nll/a.nolink_with_link_args1-317d481089b8c8fe83113de504472633.rs.rcgu.o" "-o" "$TEST_BUILD_DIR/nolink-with-link-args.nll/a" "--gc-sections" "-pie" "-zrelro" "-znow" "-O1" "-L" "$BUILD_DIR/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "$TEST_BUILD_DIR/nolink-with-link-args.nll/auxiliary" "-L" "$BUILD_DIR/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--start-group" "-L" "$BUILD_DIR/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-lstd-41f43a30bc296e4f" "--end-group" "-Bstatic" "$BUILD_DIR/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-ce73107aecc35a63.rlib" "-Bdynamic" "-ldl" "-lrt" "-lpthread" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-lutil" "-Wl,-rpath,$ORIGIN/../../../stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-rpath,/home/david/projects/rust/workdirs/rust1/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,--enable-new-dtags" "aFdEfSeVEEE"
3+
= note: "ld" "-L" "$BUILD_DIR/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "$TEST_BUILD_DIR/nolink-with-link-args.nll/a.nolink_with_link_args0-317d481089b8c8fe83113de504472633.rs.rcgu.o" "$TEST_BUILD_DIR/nolink-with-link-args.nll/a.nolink_with_link_args1-317d481089b8c8fe83113de504472633.rs.rcgu.o" "-o" "$TEST_BUILD_DIR/nolink-with-link-args.nll/a" "--gc-sections" "-pie" "-zrelro" "-znow" "-O1" "-L" "$BUILD_DIR/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "$TEST_BUILD_DIR/nolink-with-link-args.nll/auxiliary" "-L" "$BUILD_DIR/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--start-group" "-L" "$BUILD_DIR/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-lstd-XXXXXXXXXXXXXXXX" "--end-group" "-Bstatic" "$BUILD_DIR/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-XXXXXXXXXXXXXXXX.rlib" "-Bdynamic" "-ldl" "-lrt" "-lpthread" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-lutil" "-Wl,-rpath,$ORIGIN/../../../stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-rpath,$LIB_DIR/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,--enable-new-dtags" "aFdEfSeVEEE"
44
= note: ld: unrecognized option '-Wl,-rpath,$ORIGIN/../../../stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib'
55
ld: use the --help option for usage information
66

src/test/ui/nolink-with-link-args.rs

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// normalize-stderr-test: "-lstd-[\d\w]{16}" -> "-lstd-XXXXXXXXXXXXXXXX"
12+
// normalize-stderr-test: "builtins-[\d\w]{16}.rlib" -> "builtins-XXXXXXXXXXXXXXXX.rlib"
13+
1114
// error-pattern:aFdEfSeVEE
1215
// compile-flags: -Z linker-flavor=ld
1316

src/test/ui/nolink-with-link-args.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
error: linking with `ld` failed: exit code: 1
22
|
3-
= note: "ld" "-L" "$BUILD_DIR/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "$TEST_BUILD_DIR/nolink-with-link-args/a.nolink_with_link_args0-317d481089b8c8fe83113de504472633.rs.rcgu.o" "$TEST_BUILD_DIR/nolink-with-link-args/a.nolink_with_link_args1-317d481089b8c8fe83113de504472633.rs.rcgu.o" "-o" "$TEST_BUILD_DIR/nolink-with-link-args/a" "--gc-sections" "-pie" "-zrelro" "-znow" "-O1" "-L" "$BUILD_DIR/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "$TEST_BUILD_DIR/nolink-with-link-args/auxiliary" "-L" "$BUILD_DIR/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--start-group" "-L" "$BUILD_DIR/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-lstd-41f43a30bc296e4f" "--end-group" "-Bstatic" "$BUILD_DIR/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-ce73107aecc35a63.rlib" "-Bdynamic" "-ldl" "-lrt" "-lpthread" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-lutil" "-Wl,-rpath,$ORIGIN/../../../stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-rpath,/home/david/projects/rust/workdirs/rust1/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,--enable-new-dtags" "aFdEfSeVEEE"
3+
= note: "ld" "-L" "$BUILD_DIR/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "$TEST_BUILD_DIR/nolink-with-link-args/a.nolink_with_link_args0-317d481089b8c8fe83113de504472633.rs.rcgu.o" "$TEST_BUILD_DIR/nolink-with-link-args/a.nolink_with_link_args1-317d481089b8c8fe83113de504472633.rs.rcgu.o" "-o" "$TEST_BUILD_DIR/nolink-with-link-args/a" "--gc-sections" "-pie" "-zrelro" "-znow" "-O1" "-L" "$BUILD_DIR/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "$TEST_BUILD_DIR/nolink-with-link-args/auxiliary" "-L" "$BUILD_DIR/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--start-group" "-L" "$BUILD_DIR/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-lstd-XXXXXXXXXXXXXXXX" "--end-group" "-Bstatic" "$BUILD_DIR/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-XXXXXXXXXXXXXXXX.rlib" "-Bdynamic" "-ldl" "-lrt" "-lpthread" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-lutil" "-Wl,-rpath,$ORIGIN/../../../stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-rpath,$LIB_DIR/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,--enable-new-dtags" "aFdEfSeVEEE"
44
= note: ld: unrecognized option '-Wl,-rpath,$ORIGIN/../../../stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib'
55
ld: use the --help option for usage information
66

src/tools/compiletest/src/runtest.rs

+5
Original file line numberDiff line numberDiff line change
@@ -2927,6 +2927,11 @@ impl<'test> TestCx<'test> {
29272927
// eg. /home/user/rust/build
29282928
normalized = normalized.replace(&parent_build_dir.to_str().unwrap(), "$BUILD_DIR");
29292929

2930+
// Paths into lib directory.
2931+
let mut lib_dir = parent_build_dir.parent().unwrap().to_path_buf();
2932+
lib_dir.push("lib");
2933+
normalized = normalized.replace(&lib_dir.to_str().unwrap(), "$LIB_DIR");
2934+
29302935
if json {
29312936
// escaped newlines in json strings should be readable
29322937
// in the stderr files. There's no point int being correct,

0 commit comments

Comments
 (0)