Enable -Zfunction-sections by default for *-windows-{gnu,cygwin} by wesleywiser · Pull Request #148669 · rust-lang/rust (original) (raw)

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

@wesleywiser

The comment here was a bit misleading, #13846 was about an LLVM assertion that failed when -Zfunction-sections was enabled. However, that bug has been fixed for a long time and the actual issue was that older ld versions would not correctly link binaries (see #75604 for the prior attempt at this change). This bug was fixed in version 2.32 of binutils and Rust now ships binutils 2.42 as of #119229 so we can remove this workaround!

@wesleywiser

The comment here was a bit misleading, rust-lang#13846 was about an LLVM assertion that failed when -Zfunction-sections was enabled. However, that bug has been fixed for a long time and the actual issue was that older ld versions would not correctly link binaries (see rust-lang#75604 for the prior attempt at this change). This bug was fixed in version 2.32 of binutils and Rust now ships binutils 2.42 as of rust-lang#119229 so we can remove this workaround!

@rustbot rustbot added S-waiting-on-author

Status: This is awaiting some action (such as code changes or more information) from the author.

T-compiler

Relevant to the compiler team, which will review and decide on the PR/issue.

labels

Nov 7, 2025

@rust-log-analyzer

This comment has been minimized.

@wesleywiser

@bors try jobs=x86_64-mingw-1,x86_64-mingw-2

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request

Nov 7, 2025

@rust-bors

…try>

Enable -Zfunction-sections by default for *-windows-{gnu,cygwin}

try-job: x86_64-mingw-1 try-job: x86_64-mingw-2

@rust-log-analyzer

This comment has been minimized.

@rust-bors

@wesleywiser

…-{gnu,cygwin}`"

This reverts commit e23a5fc.

@wesleywiser

@bors try jobs=x86_64-mingw-1,x86_64-mingw-2

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request

Nov 8, 2025

@rust-bors

…try>

Enable -Zfunction-sections by default for *-windows-{gnu,cygwin}

try-job: x86_64-mingw-1 try-job: x86_64-mingw-2

@rust-bors

☀️ Try build successful (CI)
Build commit: 63e4cbf (63e4cbf99d7fffa8992085764a640100c6a68dbf, parent: 87f9dcd5e28a301fce81515bd4bea792444dcf29)

@mati865

I don't know whether it still triggers an assertion because Rust doesn't build do LLVM build with assertions enabled for Windows GNU. The assertion is probably gone because functions sections work fine with Clang+LLD (gnullvm targets are built with function sections).
My comment on that issue was short-lived, some of the issues were fixed, but new ones popped up. AFAICT, this still doesn't fully work with trunk versions of GCC and Binutils.

Labels

S-waiting-on-author

Status: This is awaiting some action (such as code changes or more information) from the author.

T-compiler

Relevant to the compiler team, which will review and decide on the PR/issue.