Handle 'lib' variants in ModuleNameVariations to generate DirectPInvokes#118285
Merged
jtschuster merged 8 commits intodotnet:mainfrom Aug 5, 2025
Merged
Handle 'lib' variants in ModuleNameVariations to generate DirectPInvokes#118285jtschuster merged 8 commits intodotnet:mainfrom
jtschuster merged 8 commits intodotnet:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes an issue where the ILC (ILCompiler) wasn't recognizing library names with the 'lib' prefix when generating DirectPInvokes. The fix enhances the ModuleNameVariations method to handle library name variations that include the common 'lib' prefix.
Key changes:
- Added logic to detect and handle the 'lib' prefix in library names
- Generate additional name variations by stripping the 'lib' prefix
- Handle cases where both 'lib' prefix and shared library extensions are present
Contributor
|
Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Member
|
Drop the lib prefixes in https://github.com/dotnet/runtime/blob/main/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets#L151 to make the msbuild targets simpler? |
jkotas
reviewed
Aug 1, 2025
…e.targets Co-authored-by: Jan Kotas <jkotas@microsoft.com>
jkotas
approved these changes
Aug 1, 2025
…ot during evaluation
jkotas
reviewed
Aug 4, 2025
jkotas
reviewed
Aug 4, 2025
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In ILC, when a DirectPInvokes item was prefixed with 'lib', it wouldn't recognize the library and wouldn't generate a direct pinvoke. There are a lot of places within the repo (and I assume other codebases) that use the 'lib' prefix in DirectPInvokes, so it seems to make more sense to handle that case rather than remove the prefix from all usages.
fixes #118284