Skip to content

Creating symbols.o in tmpdir makes it hard to debug linker errors #145872

@lrowe

Description

@lrowe

It's impossible to rerun a failing linker command (as printed by cargo rustc -- --print link-args) because the symbols.o file is created in a tmpdir that is subsequently deleted.

Current output

... cc "-m64" "/tmp/xxx/symbols.o" ...

Desired output

symbols.o should be created under the target folder and not removed.

Rationale and extra context

I had to use inotifywait to copy the file before it was deleted for subsequent investigation of why the linker failed in a project with C++ dependencies so I could begin debugging why the linker command was failing.

Rust Version

rustc 1.89.0 (29483883e 2025-08-04)
binary: rustc
commit-hash: 29483883eed69d5fb4db01964cdf2af4d86e9cb2
commit-date: 2025-08-04
host: x86_64-unknown-linux-gnu
release: 1.89.0
LLVM version: 20.1.7

Anything else?

Also --print link-args is hard to discover since most search results point to -Z print-link-args which was removed after stabilisation almost 6 years ago.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-discussionCategory: Discussion or questions that doesn't represent real issues.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions