Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8257620

Do not use objc_msgSend_stret to get macOS version

XMLWordPrintable

    • b03
    • os_x

        https://github.com/openjdk/jdk/blob/master/src/java.base/macosx/native/libjava/java_props_macosx.c#L241

        As described by comment, [NSProcessInfo operatingSystemVersion] is available in macOS 10.9, but it not available in the SDK for that version. To overcome that, objc_msgSend_stret is used.

        This code can be rewritten in pure ObjC with proper type checks.

        It's also necessary for macOS/AArch64 port, where objc_msgSend_stret is not available and compiler produces a message below.

        /Users/akozlov/zulu16/src/java.base/macosx/native/libjava/java_props_macosx.c:241:79: error: 'objc_msgSend_stret' is unavailable: not available in arm64
                OSVerStruct (*procInfoFn)(id rec, SEL sel) = (OSVerStruct(*)(id, SEL))objc_msgSend_stret;
                                                                                      ^
        /Users/akozlov/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.0.sdk/usr/include/objc/message.h:123:1: note: 'objc_msgSend_stret' has been explicitly marked unavailable here
        objc_msgSend_stret(void /* id self, SEL op, ... */ )

              akozlov Anton Kozlov
              akozlov Anton Kozlov
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated:
                Resolved: