Skip to content

Map *-windows-gnullvm targets to *-windows-gnu for clang - #3505

Merged
emilio merged 1 commit into
rust-lang:mainfrom
rvandermeulen:windows-gnullvm-target
Sep 27, 2026
Merged

emilio merged 1 commit into
rust-lang:mainfrom
rvandermeulen:windows-gnullvm-target

Conversation

@rvandermeulen

Copy link
Copy Markdown
Contributor

Clang doesn't know the gnullvm environment: --target=x86_64-pc-windows-gnullvm fails with error: version 'llvm' in target triple 'x86_64-pc-windows-gnullvm' is invalid. When a build script cross-compiles to a gnullvm target, find_effective_target takes TARGET and passes it to libclang unchanged, so binding generation fails. Native gnullvm builds aren't affected because no --target is added when host and target match.

The gnullvm targets use the same clang triple as their gnu counterparts (rustc's own llvm-target for them is *-pc-windows-gnu, and cc-rs maps them the same way), so rust_to_clang_target now rewrites the environment the way it already does for Apple, RISC-V and ESP-IDF targets.

Clang does not know the gnullvm environment and rejects the triple ("version 'llvm' in target triple
is invalid"), so a build script cross-compiling to a gnullvm target failed as soon as bindgen passed
--target. The gnullvm targets use the same clang triple as their gnu counterparts.

@mati865 mati865 left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approving as windows-gnullvm targets maintainer, still needs rust-bindgen maintainer review.

Interesting that nobody has reported it until now. Thanks for the fix!

View changes since this review

@emilio

emilio commented Sep 27, 2026

Copy link
Copy Markdown
Contributor

Can't test this myself right now but code wise looks good.

@emilio
emilio added this pull request to the merge queue Sep 27, 2026
Merged via the queue into rust-lang:main with commit 2829d9a Sep 27, 2026
52 checks passed
@rvandermeulen
rvandermeulen deleted the windows-gnullvm-target branch September 27, 2026 23:00
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.

3 participants