Skip to content

Conversation

@JohanEngelen
Copy link
Member

This reverts #4415. The mangling of lambdas has been fixed (and is now stable and cannot clash with other modules anymore), so there is no longer a need for internal linkage. This allows merging of identical lambdas again (multiple instantiations).

This also fixes an instantiation bug, where the lambda's emission is sometimes culled because the frontend knows it is already instantiated in another module, but because of internal linkage it cannot resolve the symbol during linking (thus resulting in a missing symbol during linking).

This reverts ldc-developers#4415. The mangling of lambdas has been fixed (and is now stable and cannot clash with other modules anymore), so there is no longer a need for internal linkage. This allows merging of identical lambdas again (multiple instantiations).

This also fixes an instantiation bug, where the lambda's emission is sometimes culled because the frontend knows it is already instantiated in another module, but because of internal linkage it cannot resolve the symbol during linking (thus resulting in a missing symbol during linking).
@JohanEngelen JohanEngelen requested a review from kinke January 19, 2026 21:29
@kinke
Copy link
Member

kinke commented Jan 20, 2026

Should be fine if you trust the stable mangles. ;) - Modulo test adaptations.

This also fixes an instantiation bug, where the lambda's emission is sometimes culled because the frontend knows it is already instantiated in another module

That sounds like an interesting bug on our side though, as emitting function/delegate literals into each referencing object file is our responsibility (not added to Module members).

@JohanEngelen
Copy link
Member Author

@ljmf00 Perhaps you can dustmite the libwtracer.a build, to create a testcase? I have not been able to create a testcase by some ideas that I had (imported modules, ...)
Details: compile with LDC v1.38.0-weka9 (nota bene, -weka10 has the issue fixed; or with LDC v.1.38.0 vanilla), libwtracer.a contains a reference (declare, does not define) to symbol _D3std4conv__T6toImplTiTkZQmFkZ20__dgliteral_L561_C17MFNaNbNfZC6object9Throwable. Phobos binary does not export that symbol with LDC v1.38.0-weka9 (because internal linkage), so it should have been emitted into libwtracer.a.

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.

2 participants