Skip to content

Conversation

@mati865
Copy link
Member

@mati865 mati865 commented Dec 18, 2025

This is a backport of llvm#171680 to address rust-lang/rust#149813.

I didn't ask upstream for backporting because LLVM 21.1.8 was just made and based on the previous tags and https://llvm.org/docs/HowToReleaseLLVM.html, it's likely going to be the final patch release for version 21.

I think the change should be safe, it impacts only MinGW mode of LLD's COFF backend when LLD is not called by Clang or GCC.
The only breakage I could expect is when somebody uses LLD in MinGW mode (by calling ld.lld with Windows emulation or lld-link with internal -lldmingw") and MSVC libraries instead of mingw-w64. I don't know if such a setup is even possible, but IMO that would be acceptable breakage due to reliance on a bug that this change fixes.

@dianqk
Copy link
Member

dianqk commented Dec 18, 2025

Could you use git cherry-pick -x 2824225d27cc6706bf89408b1c8fda62ad3f0a3f to link the origin patch?

Previously, LLD would always set the implicit entry point for DLLs to
the symbol that is prefixed with an underscore. However, mingw-w64
defines it without that underscore.

This change fixes that by adding a special branch for MinGW. Also, it
simplifies tests that use MinGW style DLL entry symbol by skipping the
entry point argument.

Note, tests that use MSVC style DLL entry symbol and LLD in MinGW mode,
will now require using explicit entry point. I believe this is sensible.
When an explicit entry point is passed, i.e. LLD is called by Clang or
GCC, there will be no observable difference.

Fixes llvm#171441

(cherry picked from commit 2824225)
@mati865
Copy link
Member Author

mati865 commented Dec 18, 2025

Sorry, should've followed the docs. Used git cherry-pick -x 2824225d27cc6706bf89408b1c8fda62ad3f0a3f this time.

@dianqk dianqk merged commit 00d23d1 into rust-lang:rustc/21.1-2025-08-01 Dec 19, 2025
4 of 5 checks passed
@mati865 mati865 deleted the lld-mingw-backport branch December 19, 2025 01:41
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