diff --git a/compiler/mx.compiler/suite.py b/compiler/mx.compiler/suite.py index 0b88be84f158..d5f28c82ede6 100644 --- a/compiler/mx.compiler/suite.py +++ b/compiler/mx.compiler/suite.py @@ -2219,7 +2219,7 @@ ], "exports" : [ "* to com.oracle.graal.graal_enterprise,org.graalvm.nativeimage.pointsto,org.graalvm.nativeimage.builder,org.graalvm.nativeimage.llvm,com.oracle.svm.svm_enterprise,org.graalvm.nativeimage.base", - "org.graalvm.compiler.core.common to jdk.internal.vm.compiler.management,org.graalvm.nativeimage.agent.tracing", + "org.graalvm.compiler.core.common to jdk.internal.vm.compiler.management,org.graalvm.nativeimage.agent.tracing,org.graalvm.nativeimage.objectfile", "org.graalvm.compiler.debug to jdk.internal.vm.compiler.management,org.graalvm.nativeimage.objectfile", "org.graalvm.compiler.hotspot to jdk.internal.vm.compiler.management", "org.graalvm.compiler.nodes.graphbuilderconf to org.graalvm.nativeimage.driver", diff --git a/substratevm/src/com.oracle.svm.core.posix/src/com/oracle/svm/core/posix/PosixStat.java b/substratevm/src/com.oracle.svm.core.posix/src/com/oracle/svm/core/posix/PosixStat.java index dcedc3416c4e..4b739d15c9fa 100644 --- a/substratevm/src/com.oracle.svm.core.posix/src/com/oracle/svm/core/posix/PosixStat.java +++ b/substratevm/src/com.oracle.svm.core.posix/src/com/oracle/svm/core/posix/PosixStat.java @@ -45,7 +45,7 @@ public static boolean isOpen(int fd) { result = LinuxStat.fstat64(fd, stat); } else if (Platform.includedIn(Platform.DARWIN.class)) { DarwinStat.stat stat = StackValue.get(DarwinStat.stat.class); - result = DarwinStat.fstat(fd, stat); + result = DarwinStat.fstat_aarch64(fd, stat); } else { throw VMError.shouldNotReachHere("Unsupported platform"); } diff --git a/substratevm/src/com.oracle.svm.core.posix/src/com/oracle/svm/core/posix/headers/darwin/DarwinStat.java b/substratevm/src/com.oracle.svm.core.posix/src/com/oracle/svm/core/posix/headers/darwin/DarwinStat.java index 0890dfef134e..b85e9b3cf9f9 100644 --- a/substratevm/src/com.oracle.svm.core.posix/src/com/oracle/svm/core/posix/headers/darwin/DarwinStat.java +++ b/substratevm/src/com.oracle.svm.core.posix/src/com/oracle/svm/core/posix/headers/darwin/DarwinStat.java @@ -24,6 +24,9 @@ */ package com.oracle.svm.core.posix.headers.darwin; +import com.oracle.svm.core.util.VMError; +import org.graalvm.nativeimage.Platform; +import org.graalvm.nativeimage.Platforms; import org.graalvm.nativeimage.c.CContext; import org.graalvm.nativeimage.c.function.CFunction; import org.graalvm.nativeimage.c.struct.CField; @@ -53,10 +56,42 @@ public interface stat extends PointerBase { } @CFunction("fstat$INODE64") - public static native int fstat(int fd, stat buf); + @Platforms({Platform.DARWIN_AMD64.class}) + public static native int fstat_amd64(int fd, stat buf); + + @CFunction("fstat") + @Platforms({Platform.DARWIN_AARCH64.class}) + public static native int fstat_aarch64(int fd, stat buf); + + @Platforms(Platform.DARWIN.class) + public static int fstat(int fd, stat buf) { + if (Platform.includedIn(Platform.AMD64.class)) { + return fstat_amd64(fd, buf); + } else if (Platform.includedIn(Platform.AARCH64.class)) { + return fstat_aarch64(fd, buf); + } else { + throw VMError.shouldNotReachHere(); + } + } public static class NoTransitions { @CFunction(value = "fstat$INODE64", transition = CFunction.Transition.NO_TRANSITION) - public static native int fstat(int fd, stat buf); + @Platforms({Platform.DARWIN_AMD64.class}) + public static native int fstat_amd64(int fd, stat buf); + + @CFunction(value = "fstat", transition = CFunction.Transition.NO_TRANSITION) + @Platforms({Platform.DARWIN_AARCH64.class}) + public static native int fstat_aarch64(int fd, stat buf); + + @Platforms(Platform.DARWIN.class) + public static int fstat(int fd, stat buf) { + if (Platform.includedIn(Platform.AMD64.class)) { + return fstat_amd64(fd, buf); + } else if (Platform.includedIn(Platform.AARCH64.class)) { + return fstat_aarch64(fd, buf); + } else { + throw VMError.shouldNotReachHere(); + } + } } } diff --git a/substratevm/src/com.oracle.svm.truffle.nfi.posix/src/com/oracle/svm/truffle/nfi/posix/PosixTruffleNFIFeature.java b/substratevm/src/com.oracle.svm.truffle.nfi.posix/src/com/oracle/svm/truffle/nfi/posix/PosixTruffleNFIFeature.java index a8a421f40737..51f23a72306a 100644 --- a/substratevm/src/com.oracle.svm.truffle.nfi.posix/src/com/oracle/svm/truffle/nfi/posix/PosixTruffleNFIFeature.java +++ b/substratevm/src/com.oracle.svm.truffle.nfi.posix/src/com/oracle/svm/truffle/nfi/posix/PosixTruffleNFIFeature.java @@ -95,6 +95,7 @@ protected CCharPointer strdupImpl(CCharPointer src) { return PosixLibC.strdup(src); } + @Platforms(Platform.LINUX.class) private static PointerBase dlmopen(Lmid_t lmid, String filename, int mode) { try (CTypeConversion.CCharPointerHolder pathPin = CTypeConversion.toCString(filename)) { CCharPointer pathPtr = pathPin.get(); @@ -105,6 +106,7 @@ private static PointerBase dlmopen(Lmid_t lmid, String filename, int mode) { /** * A single linking namespace is created lazily and registered on the NFI context instance. */ + @Platforms(Platform.LINUX.class) private static PointerBase loadLibraryInNamespace(long nativeContext, String name, int mode) { assert (mode & isolatedNamespaceFlag) == 0; Target_com_oracle_truffle_nfi_backend_libffi_LibFFIContextLinux context = SubstrateUtil.cast(getContext(nativeContext), Target_com_oracle_truffle_nfi_backend_libffi_LibFFIContextLinux.class);