Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
12bc409
Get rid of build-powerpc64le-toolchain.sh
Gelbpunkt Jul 4, 2025
57d989b
Fixed the ABI parameter inconsistency issue in debug.rs for the riscv…
Jun 3, 2025
64bec0f
Fix tests/ui/abi/debug.rs to cross-compile for riscv64
workingjubilee Jul 5, 2025
db0b491
Fix short linker error output
ia0 Jul 5, 2025
c42a9ac
move `stable_mir` back to its own crate and move `rustc_internal` to …
makai410 Jul 5, 2025
7775166
interpret: rename StackPopCleanup
RalfJung Jul 6, 2025
4bdd671
Update run-make test
ia0 Jul 6, 2025
a40274d
Dont resolve instance of root in mir_callgraph_cyclic
compiler-errors Jul 6, 2025
627cefa
remove `rustc_smir` from tests
makai410 Jul 6, 2025
8d5eb6b
mbe: Simplify compile_declarative_macro by factoring out some variables
joshtriplett Jul 6, 2025
87cd178
mbe: Factor out a helper to check an LHS
joshtriplett Jul 6, 2025
493cdf2
mbe: Factor out a helper to check for unexpected EOF in definition
joshtriplett Jul 6, 2025
ef0465a
mbe: Clarify comments about error handling in `compile_declarative_ma…
joshtriplett Jul 7, 2025
22342b0
doc(std): clarify `NonZero<T>` usage limitation in doc comment
xizheyin Jun 28, 2025
cdbdd8a
Reverse comparison order
ia0 Jul 7, 2025
2765bd4
std: fix typo in `std::path`
xizheyin Jul 7, 2025
1eff043
rustc_codegen_llvm: Remove reference to non-existing `no_landing_pads()`
Enselic Jul 7, 2025
aa364ca
compiler: Deduplicate `must_emit_unwind_tables()` comments
Enselic Jul 7, 2025
9adbf62
Disable download-rustc for library profile
Noratrieb Jul 7, 2025
979d7b2
Add change tracker entry for disabling `download-rustc` temporarily
jieyouxu Jul 7, 2025
0742569
Rollup merge of #143130 - xizheyin:142966, r=ibraheemdev
jieyouxu Jul 7, 2025
9c6ef43
Rollup merge of #143415 - Gelbpunkt:cleanup-dist-ppc64le-toolchain, r…
jieyouxu Jul 7, 2025
fc13c96
Rollup merge of #143464 - workingjubilee:make-debug-rs-cross-compile,…
jieyouxu Jul 7, 2025
4ba4b5f
Rollup merge of #143482 - ia0:fix, r=fee1-dead
jieyouxu Jul 7, 2025
02aa4ff
Rollup merge of #143524 - makai410:smir-move-back, r=oli-obk
jieyouxu Jul 7, 2025
eed5594
Rollup merge of #143528 - RalfJung:stack-pop-cleanup, r=oli-obk
jieyouxu Jul 7, 2025
b6015a6
Rollup merge of #143551 - compiler-errors:root-sub, r=cjgillot
jieyouxu Jul 7, 2025
4be8c49
Rollup merge of #143558 - joshtriplett:mbe-refactors, r=SparrowLii
jieyouxu Jul 7, 2025
e366f16
Rollup merge of #143563 - xizheyin:fix-typo, r=joshtriplett
jieyouxu Jul 7, 2025
0938cb7
Rollup merge of #143564 - Enselic:must_emit_unwind_tables-comment, r=…
jieyouxu Jul 7, 2025
364dbd6
Rollup merge of #143577 - Noratrieb:Noratrieb-patch-4, r=Kobzol
jieyouxu Jul 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions compiler/rustc_codegen_ssa/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ impl<G: EmissionGuarantee> Diagnostic<'_, G> for LinkingFailed<'_> {
} else if arg.as_encoded_bytes().ends_with(b".rlib") {
let rlib_path = Path::new(&arg);
let dir = rlib_path.parent().unwrap();
let filename = rlib_path.file_name().unwrap().to_owned();
let filename = rlib_path.file_stem().unwrap().to_owned();
if let Some(ArgGroup::Rlibs(parent, rlibs)) = args.last_mut() {
if parent == dir {
rlibs.push(filename);
Expand All @@ -471,7 +471,7 @@ impl<G: EmissionGuarantee> Diagnostic<'_, G> for LinkingFailed<'_> {
args.push(ArgGroup::Regular(arg));
}
}
let crate_hash = regex::bytes::Regex::new(r"-[0-9a-f]+\.rlib$").unwrap();
let crate_hash = regex::bytes::Regex::new(r"-[0-9a-f]+").unwrap();
self.command.args(args.into_iter().map(|arg_group| {
match arg_group {
// SAFETY: we are only matching on ASCII, not any surrogate pairs, so any replacements we do will still be valid.
Expand All @@ -494,7 +494,11 @@ impl<G: EmissionGuarantee> Diagnostic<'_, G> for LinkingFailed<'_> {
Err(_) => false,
};
let mut arg = dir.into_os_string();
arg.push("/{");
arg.push("/");
let needs_braces = rlibs.len() >= 2;
if needs_braces {
arg.push("{");
}
let mut first = true;
for mut rlib in rlibs {
if !first {
Expand All @@ -513,7 +517,10 @@ impl<G: EmissionGuarantee> Diagnostic<'_, G> for LinkingFailed<'_> {
}
arg.push(rlib);
}
arg.push("}.rlib");
if needs_braces {
arg.push("}");
}
arg.push(".rlib");
arg
}
}
Expand Down
2 changes: 2 additions & 0 deletions tests/run-make/linker-warning/bar.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#[repr(C)]
pub struct Bar(u32);
2 changes: 2 additions & 0 deletions tests/run-make/linker-warning/foo.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#[repr(C)]
pub struct Foo(u32);
11 changes: 10 additions & 1 deletion tests/run-make/linker-warning/main.rs
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
fn main() {}
unsafe extern "C" {
#[cfg(only_foo)]
fn does_not_exist(p: *const u8) -> *const foo::Foo;
#[cfg(not(only_foo))]
fn does_not_exist(p: *const bar::Bar) -> *const foo::Foo;
}

fn main() {
let _ = unsafe { does_not_exist(core::ptr::null()) };
}
12 changes: 10 additions & 2 deletions tests/run-make/linker-warning/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ fn run_rustc() -> Rustc {
.arg("-Clink-self-contained=-linker")
.arg("-Zunstable-options")
.arg("-Wlinker-messages")
.args(["--extern", "foo", "--extern", "bar"])
.output("main")
.linker("./fake-linker");
if run_make_support::target() == "x86_64-unknown-linux-gnu" {
Expand All @@ -21,8 +22,10 @@ fn run_rustc() -> Rustc {
}

fn main() {
// first, compile our linker
// first, compile our linker and our dependencies
rustc().arg("fake-linker.rs").output("fake-linker").run();
rustc().arg("foo.rs").crate_type("rlib").run();
rustc().arg("bar.rs").crate_type("rlib").run();

// Run rustc with our fake linker, and make sure it shows warnings
let warnings = run_rustc().link_arg("run_make_warn").run();
Expand All @@ -48,7 +51,8 @@ fn main() {
let out = run_rustc().link_arg("run_make_error").run_fail();
out.assert_stderr_contains("fake-linker")
.assert_stderr_contains("object files omitted")
.assert_stderr_contains_regex(r"\{")
.assert_stderr_contains("/{libfoo,libbar}.rlib\"")
.assert_stderr_contains("-*}.rlib\"")
.assert_stderr_not_contains(r".rcgu.o")
.assert_stderr_not_contains_regex(r"lib(/|\\\\)libstd");

Expand All @@ -68,6 +72,10 @@ fn main() {
.run();
}

// Make sure a single dependency doesn't use brace expansion.
let out1 = run_rustc().cfg("only_foo").link_arg("run_make_error").run_fail();
out1.assert_stderr_contains("fake-linker").assert_stderr_contains("/libfoo.rlib\"");

// Make sure we show linker warnings even across `-Z no-link`
rustc()
.arg("-Zno-link")
Expand Down
2 changes: 1 addition & 1 deletion tests/run-make/linker-warning/short-error.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
error: linking with `./fake-linker` failed: exit status: 1
|
= note: "./fake-linker" "-m64" "/symbols.o" "<2 object files omitted>" "-Wl,--as-needed" "-Wl,-Bstatic" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib/{libstd-*,libpanic_unwind-*,libobject-*,libmemchr-*,libaddr2line-*,libgimli-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libminiz_oxide-*,libadler2-*,libunwind-*,libcfg_if-*,liblibc-*,librustc_std_workspace_core-*,liballoc-*,libcore-*,libcompiler_builtins-*}.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-L" "/raw-dylibs" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/build-root/test/run-make/linker-warning/rmake_out" "-L" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "main" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs" "run_make_error"
= note: "./fake-linker" "-m64" "/symbols.o" "<2 object files omitted>" "-Wl,--as-needed" "-Wl,-Bstatic" "/build-root/test/run-make/linker-warning/rmake_out/{libfoo,libbar}.rlib" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib/{libstd-*,libpanic_unwind-*,libobject-*,libmemchr-*,libaddr2line-*,libgimli-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libminiz_oxide-*,libadler2-*,libunwind-*,libcfg_if-*,liblibc-*,librustc_std_workspace_core-*,liballoc-*,libcore-*,libcompiler_builtins-*}.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-L" "/raw-dylibs" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/build-root/test/run-make/linker-warning/rmake_out" "-L" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "main" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs" "run_make_error"
= note: some arguments are omitted. use `--verbose` to show all linker arguments
= note: error: baz

Expand Down