Skip to content

MonoVM: add back dllmap support for macOS #43204

Closed

Description

@rolfbjarne

Description

dllmap support is enabled for iOS (Xamarin.iOS) targets:

runtime/src/mono/configure.ac

Lines 1420 to 1422 in c5b6881

if test "x$enable_monodroid" = "xno" -a "x$enable_monotouch" = "xno"; then
mono_feature_disable_dllmap='yes' # FIXME: the mobile products use this
fi

this is needed for macOS (Xamarin.Mac) as well, because we use it for the exact same purpose (redirect calls to objc_msgSend to our own implementations).

Example disassembly that shows that it's disabled (calls to mono_dll_insert asserts) on macOS:

$ otool -vVt -p _mono_dllmap_insert ./microsoft.netcore.app.runtime.ios-x64/5.0.0-rc.2.20475.5/runtimes/ios-x64/native/libmonosgen-2.0.dylib
./microsoft.netcore.app.runtime.ios-x64/5.0.0-rc.2.20475.5/runtimes/ios-x64/native/libmonosgen-2.0.dylib:
(__TEXT,__text) section
_mono_dllmap_insert:
00000000001cdda2	pushq	%rbp
00000000001cdda3	movq	%rsp, %rbp
00000000001cdda6	popq	%rbp
00000000001cdda7	jmp	_mono_dllmap_insert_internal
$ otool -vVt -p _mono_dllmap_insert ./microsoft.netcore.app.runtime.mono.osx-x64/5.0.0-rc.2.20475.5/runtimes/osx-x64/native/libcoreclr.dylib
./microsoft.netcore.app.runtime.mono.osx-x64/5.0.0-rc.2.20475.5/runtimes/osx-x64/native/libcoreclr.dylib:
(__TEXT,__text) section
_mono_dllmap_insert:
000000000022d430	pushq	%rbp
000000000022d431	movq	%rsp, %rbp
000000000022d434	leaq	0x103e97(%rip), %rdi ## literal pool for: "/Users/runner/work/1/s/src/mono/mono/metadata/native-library.c"
000000000022d43b	movl	$0x112, %esi
000000000022d440	callq	_mono_assertion_message_unreachable
000000000022d445	nopw	%cs:(%rax,%rax)
000000000022d44f	nop

Activity

  1. added
    untriaged
    on Oct 9, 2020
  2. Dotnet-GitSync-Bot commented on Oct 9, 2020

    @Dotnet-GitSync-Bot
    Collaborator

    I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

  3. added and removed
    untriaged
    on Oct 9, 2020
  4. added this to the 6.0.0 milestone on Oct 9, 2020
  5. CoffeeFlux commented on Oct 9, 2020

    @CoffeeFlux
    Contributor

    Given we have no alternative for symbol remapping, I'm fine with this. PR in a bit.

    We are, however, still going to have to figure out how to extend our loader callbacks to work properly with AOT on mobile, and ideally whatever we add would also cover this functionality.

  6. marek-safar commented on Oct 26, 2020

    @marek-safar
    Contributor

    I don't think we should do it and instead think about .net core compatible alternatives

  7. CoffeeFlux commented on Oct 26, 2020

    @CoffeeFlux
    Contributor

    The problem is that I've gotten a large amount of pushback at the idea of adding more generic symbol remapping functionality.

    Unless Xamarin.Mac wants to break compatibility with a long-established pattern they need some method to accomplish symbol remapping. If we're willing to commit to solving this problem more generically for net6 I'd be thrilled, but otherwise I don't see a good alternative to just giving them dllmap.

  8. rolfbjarne commented on Mar 24, 2021

    @rolfbjarne
    MemberAuthor

    Using PINVOKE_OVERRIDE seems to work, so I'm closing this.

  9. ghost locked as resolved and limited conversation to collaborators on Apr 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions