Skip to content

Tracking Issue for enabling the linker-messages lint by default #136096

Closed

Description

@jyn514

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

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)

Known Warnings (should not be silenced)

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

@rustbot label L-linker_messages T-compiler A-linkage E-medium E-help-wanted E-mentor

Activity

  1. added
    C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFC
    on Jan 26, 2025
  2. changed the title [-]Tracking Issue for enabling the `linker-warnings` lint by default[/-] [+]Tracking Issue for enabling the `linker-messages` lint by default[/+] on Jan 26, 2025
  3. added
    A-linkageArea: linking into static, shared libraries and binaries
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on Jan 26, 2025
  4. added
    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.
    A-linkersArea: linkers... you gotta love linkers
    on Jan 26, 2025
  5. ehuss commented on Jan 26, 2025

    @ehuss
    Contributor

    Why should "built for newer 'macOS' version than being linked" be silenced? My instinct is that indicates libraries are being built with the wrong macos deployment target.

    cc #136113

  6. ehuss commented on Jan 26, 2025

    @ehuss
    Contributor

    windows-gnu generates a large amount of warnings. On a simple hello-world, it looks like:

    warning: linker stderr: Warning: corrupt .drectve at end of def file␍
             Warning: .drectve `-exclude-symbols:"_ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17h327fee2a44a3bd76E" ' unrecognized␍
             Warning: .drectve `-exclude-symbols:_ZN4core3ops8function6FnOnce9call_once17h4937986b238ad4e8E ' unrecognized␍
             Warning: corrupt .drectve at end of def file␍
             Warning: corrupt .drectve at end of def file␍
             Warning: .drectve `-exclude-symbols:_ZN3std2rt10lang_start17h03b3de1902cb95bfE ' unrecognized␍
             Warning: corrupt .drectve at end of def file␍
             Warning: corrupt .drectve at end of def file␍
             Warning: corrupt .drectve at end of def file␍
      |
      = note: `#[warn(linker_messages)]` on by default
    

    Might be good to know why it does that.

  7. jyn514 commented on Jan 26, 2025

    @jyn514
    MemberAuthor

    @ehuss what version of gnu ld do you have installed? that looks like #119286 (comment), which was fixed by updating the toolchain in #119229

  8. jyn514 commented on Jan 26, 2025

    @jyn514
    MemberAuthor

    Why should "built for newer 'macOS' version than being linked" be silenced? My instinct is that indicates libraries are being built with the wrong macos deployment target.

    i do not know much about macos linking. what can go wrong if you have mismatched deployment targets?

  9. kpreid commented on Jan 26, 2025

    @kpreid
    Contributor

    wasm32-unknown-unknown cdylib builds are emitting warnings from compiler_builtins. More info in #136109.

    warning: linker stderr: rust-lld: /Users/kpreid/.rustup/toolchains/nightly-2025-01-26-aarch64-apple-darwin/lib/rustlib/wasm32-unknown-unknown/lib/libcompiler_builtins-cef32f9876d137b7.rlib: archive member '45c91108d938afe8-absvdi2.o' is neither Wasm object file nor LLVM bitcode
             rust-lld: /Users/kpreid/.rustup/toolchains/nightly-2025-01-26-aarch64-apple-darwin/lib/rustlib/wasm32-unknown-unknown/lib/libcompiler_builtins-cef32f9876d137b7.rlib: archive member '45c91108d938afe8-absvsi2.o' is neither Wasm object file nor LLVM bitcode
             rust-lld: /Users/kpreid/.rustup/toolchains/nightly-2025-01-26-aarch64-apple-darwin/lib/rustlib/wasm32-unknown-unknown/lib/libcompiler_builtins-cef32f9876d137b7.rlib: archive member '45c91108d938afe8-absvti2.o' is neither Wasm object file nor LLVM bitcode
    ...
  10. ehuss commented on Jan 27, 2025

    @ehuss
    Contributor

    @ehuss what version of gnu ld do you have installed? that looks like #119286 (comment), which was fixed by updating the toolchain in #119229

    Looks like I had a relatively old version of ld on my system. However, the default GitHub Actions 2022 image seems to be affected. It looks like it has GNU Binutils 2.39. 2025 has binutils 2.42 which I think should work? Or maybe it can be upgraded with chocolatey?

  11. jyn514 commented on Jan 27, 2025

    @jyn514
    MemberAuthor

    @ehuss cool, sounds like it’s the same root cause. given that it seems harmless in practice, i will change rustc to filter it out of the lint (i.e. put it in linker-info, not linker-messages).

    @kpreid do you happen to know who maintains the wasm32-unknown target?

  12. kpreid commented on Jan 27, 2025

    @kpreid
    Contributor

    @kpreid do you happen to know who maintains the wasm32-unknown target?

    I am not in the loop here, but I believe the answer is “nobody”. Quote from Jubilee on Zulip in 2023:

    I think wasm32-unknown-unknown predates the current policy re: requiring enrolled target maintainers and thus has none to which that task is formally delegated. Or at least no one's been written down.

    Perhaps @daxpedda could help out here; they at least work on wasm-bindgen and so have a reason to care about wasm toolchain behaviors.

  13. 24 remaining items

  14. added a commit that references this issue on Feb 25, 2026
  15. added a commit that references this issue on Mar 7, 2026
  16. added a commit that references this issue on Mar 7, 2026
  17. jyn514 commented on Mar 20, 2026

    @jyn514
    MemberAuthor

    As discussed on zulip, this probably needs more discussion before -D warnings starts applying to it. I suggested that we might be able to change the force-warn infrastructure to still allow allowing/denying individual lints, but not to have them affected by -D warnings.

    In the meantime, I'm going to add a note: force-warn that says that some of the linker output was hidden.

  18. added a commit that references this issue on Apr 9, 2026
  19. added 4 commits that reference this issue on Apr 29, 2026
  20. jyn514 commented on May 2, 2026

    @jyn514
    MemberAuthor

    this merged in #153968 ! i'm going to leave the tracking issue open for a ~week just in case we end up reverting it again.

  21. mati865 commented on Jun 24, 2026

    @mati865
    Member

    One week definitely has passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-linkageArea: linking into static, shared libraries and binariesA-linkersArea: linkers... you gotta love linkersA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCE-help-wantedCall for participation: Help is requested to fix this issue.E-mediumCall for participation: Medium difficulty. Experience needed to fix: Intermediate.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.L-linker_messagesLint: linker_messagesT-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