Skip to content

Add Windows ThinLTO arguments#747

Open
dzbarsky wants to merge 1 commit into
bazelbuild:mainfrom
dzbarsky:zbarsky/win-lto
Open

Add Windows ThinLTO arguments#747
dzbarsky wants to merge 1 commit into
bazelbuild:mainfrom
dzbarsky:zbarsky/win-lto

Conversation

@dzbarsky

@dzbarsky dzbarsky commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Windows rule-based toolchains currently reuse ELF LLD ThinLTO plugin options and /dev/null, which are not valid for LLD's COFF driver or Windows backend actions. This change selects the LLD COFF ThinLTO options, uses /start-lib and /end-lib for object-file groups, and uses NUL for indexless Windows backend actions.

This allows Windows toolchains that use LLD and provide supports_start_end_lib to enable rules_cc distributed ThinLTO.

Use LLD COFF ThinLTO options and /start-lib groups for Windows targets. Use NUL for indexless Windows backend actions.
@dzbarsky dzbarsky changed the title [codex] Add Windows ThinLTO arguments Add Windows ThinLTO arguments Jun 11, 2026
@dzbarsky dzbarsky marked this pull request as ready for review June 11, 2026 15:40
else:
# An empty input indicates not to perform cross-module optimization.
build_variables["thinlto_index"] = "/dev/null"
build_variables["thinlto_index"] = (

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lilygorsheneva would you mind taking a peek at this one? This is all net-new behavior for windows that has never worked so hopefully it shouldn't be dangerous for google-internal usage.

All the other bits we can vendor into our toolchain module but this part is impossible to change externally, and while we can carry a patch, bzlmod rule mean every single consumer of our toolchain would also need to carry a patch, which is a huge pain.

Would be amazing to get this landed and a new rules_cc release cut, if possible! 🙏

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok we found a pretty hacky way to workaround this but would still be good to move back to upstream!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant