Repository: rust
Issue: Tracking Issue for enabling the `linker-messages` lint by default
Labels: A-linkage,A-lints,T-compiler,C-tracking-issue,A-linkers,L-linker_messages

This is a tracking issue for the `linker-messages` lint.

### About tracking issues

Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however *not* meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
Discussion comments will get marked as off-topic or deleted.
Repeated discussions on the tracking issue may lead to the tracking issue getting locked.

### Steps
<!--
Include each step required to complete the feature. Typically this is a PR
implementing a feature, followed by a PR that stabilises the feature. However
for larger features an implementation could be broken up into multiple PRs.
-->

- [ ] Allow the lint by default until it's less noisy: https://github.com/rust-lang/rust/pull/136098
- [ ] Split the lint into `linker-info` and `linker-messages`. The former should be allow by default, and should contain things we know aren't actually an issue (at least not enough to warn by default). The latter includes everything else. See below for a detailed list of known linker warnings.
- [ ] Do a crater run to see if there's any other noisy output we should silence. This unfortunately will only give us info about x64 linux gnu, but it's better than nothing. Maybe we can do a few runs, one with each of ld, lld, mold, and ld.gold.
- [ ] Make `linker-messages` warn by default again.

Ideally, I would also like to post-process these messages and add more context about why they happen. For example, the MACOSX_DEPLOYMENT_TARGET warning should contain context about what a deployment target *is* and how it gets set. We could even go so far as to map back from symbol names and object files to the original Span and crate that caused a warning.

---

### Known Warnings (should be silenced)

- [ ] MacOS LD: "ignoring duplicate libraries" (e.g. https://github.com/rust-lang/rust/issues/136086#issue-2811347151). This should just be silenced, it doesn't indicate anything is wrong.
- [ ] MacOS LD: "built for newer 'macOS' version than being linked". This is tracked by https://github.com/rust-lang/rust/issues/136113 and should be silenced until that issue is resolved.
- [ ] Windows MSVC link.exe: "Creating library ...". This should just be silenced, it's a progress message that can't be disabled.
- [ ] Windows GNU LD: "corrupt .drectve at end of def file" and "-exclude-symbols:'...' unrecognized". This indicates LD is older than binutils 2.40 and LLVM is 15 or newer (https://github.com/rust-lang/rust/issues/112368), which is common on the default GitHub Actions 2022 image. In practice it does not cause issues, so it should be silenced (as long as we are sure binutils is older than 2.40).
- [ ] wasm32-unknown-unknown LLD: "archive member '...' is neither Wasm object file nor LLVM bitcode". This is tracked by https://github.com/rust-lang/rust/issues/132802 and should be silenced until that issue is resolved.
- [ ] i686-uefi lld: "section name .debug_frame is longer than 8 characters" (https://github.com/rust-lang/rust/pull/119286#issuecomment-2612746162). @nicholasbishop has [volunteered](https://github.com/rust-lang/rust/pull/119286#issuecomment-2614110755) to investigate this (nicholas, have you filed an issue upstream yet?)

### Known Warnings (should *not* be silenced)

- [ ] powerpc64 GNU LD: "bss-plt forced due to '...'.o (https://github.com/rust-lang/rust/issues/136096#issuecomment-2615051447). This seems like a real issue?
- [ ] macOS ld: "cannot export hidden symbol compiler_builtins::'...'" (https://github.com/rust-lang/rust/pull/119286#issuecomment-2372510636). this seems like a real issue, and only appears when building compiler_builtins from source.
- [ ] macOS ld: "cannot export hidden symbol ___llvm_profile_filename" [when building tests/ui/issues/issue-85461.rs](https://github.com/rust-lang/rust/pull/119286#issuecomment-2372510636)
- [ ] x64 linux GNU ld: "relocation in read-only section \`.rodata.global.c'" and "creating DT_TEXTREL in a shared object" [when building rustc_codegen_gcc](https://github.com/rust-lang/rust/pull/119286#issuecomment-2509868641)
- [ ] macOS ld: "search path 'target/debug/build/libz-sys-ae8c893dbe111c55/out/lib64' not found" (https://github.com/rust-lang/cmake-rs/pull/232#issuecomment-2615598342)
- [ ] macOS ld: "directory not found for option '-L...'" (https://github.com/rust-lang/rust/pull/133138#issuecomment-2614309777)

[stabilization-guide]: https://rustc-dev-guide.rust-lang.org/stabilization_guide.html#stabilization-pr
[doc-guide]: https://rustc-dev-guide.rust-lang.org/stabilization_guide.html#documentation-prs
[nightly-style-procedure]: https://github.com/rust-lang/style-team/blob/main/nightly-style-procedure.md 
[Style Guide]: https://github.com/rust-lang/rust/tree/master/src/doc/style-guide

### Unresolved Questions

- Is there any other noisy output we should silence?
- Can we find a way to do a crater run for non-linux platforms?

### Implementation history

- Initial implementation: https://github.com/rust-lang/rust/pull/119286
- Report of it being too noisy: https://github.com/rust-lang/rust/issues/136086
- Downgraded to allow by default: https://github.com/rust-lang/rust/pull/136098

@rustbot label L-linker_messages T-compiler A-linkage