rust-lang / rust-lang/rust

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

Open
#145,872 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-discussion T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is named. Start by locating the compiler/linker path that creates symbols.o and handles --print link-args, then trace when its temporary directory is removed. Done means the object is placed under the target folder, retained, and usable when rerunning the printed linker command.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.