Repository navigation
fix(dotnet): preserve C identifier underscores in native matching - #685
Closed
rudycelekli wants to merge 1 commit into
Closed
rudycelekli wants to merge 1 commit into
rudycelekli wants to merge 1 commit into
Conversation
Signed-off-by: RudyCelekli <[email protected]>
morluto
approved these changes
Oct 6, 2026
morluto
left a comment
Owner
There was a problem hiding this comment.
Approve: Mach-O-only single-underscore strip with managed spelling preserved fixes the open_native vs _open_native collapse on both sides. Both crossed cases covered by conformance tests, existing decorations flow through unchanged. Checks green.
Owner
|
Superseded by #705, which cherry-picks this change (plus 13 sibling fixes) onto current main with conflict resolution and regenerated catalogs. Closing to keep one reviewable merge unit. |
Owner
|
Thanks, @rudycelekli, for your work on “fix(dotnet): preserve C identifier underscores in native matching.” I appreciate your contribution to REA. |
3 tasks
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
Managed/native symbol matching removes all leading underscores from both the managed declaration and native name. This collapses distinct C identifiers. A declaration
open_nativecan be linked to a Mach-O export__open_native, which actually corresponds to C_open_native. The reverse raw-equality shortcut would be wrong too: declaration_open_nativemust not match export_open_native, which corresponds to Copen_native.Change
Preserve the managed declaration spelling. Remove exactly one ABI underscore from Mach-O export names for candidate comparison; do not apply that normalization to function-dossier names. Existing declared decorations and exact-name evidence behavior remain intact.
Verification
Two owned C dylibs compiled with the host clang provide actual controls:
open_native_open_nativeopen_native(Mach-O_open_native)_open_native(Mach-O__open_native)The workflow uses owned PE P/Invoke declarations with exact spelling, actual filesystem target resolution, the public
ManagedStaticProvider, realNativeMacOSProvider/xcrun inspection, and authenticated Evidence. Before the fix, the crossed names are incorrectly inferred; after it, all four controls agree with the native loader observations.npm run checktasks pass with Node 24.18.0 and the exact lock.npm run verify:managed: all 11 source-owned static-format scenarios pass; optional operator manifest/ILSpy verification is unconfigured and not claimed.The actual native loader controls validate these C export names. Static candidate matching still does not prove CLR binding, marshaling, managed call reachability, or target execution.
AI assistance was used for investigation, implementation, tests, description and independent patch review. Actual provider proof and its limits are stated above.