Skip to content

Commit

Permalink
Add GraalVM for JDK 21 support.
Browse files Browse the repository at this point in the history
- no longer link against fdlibm on Linux post JDK 21
- add required --add-exports for GluonFeature
  • Loading branch information
kkriske committed Nov 12, 2023
1 parent b5eee27 commit 6a65d3b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, Gluon
* Copyright (c) 2021, 2023, Gluon
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -29,8 +29,6 @@

import com.oracle.svm.core.jdk.NativeLibrarySupport;
import com.oracle.svm.core.jdk.PlatformNativeLibrarySupport;
import com.oracle.svm.hosted.FeatureImpl.BeforeAnalysisAccessImpl;
import com.oracle.svm.hosted.c.NativeLibraries;
import org.graalvm.nativeimage.hosted.Feature;


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ public abstract class AbstractTargetConfiguration implements TargetConfiguration
"-H:+ReportExceptionStackTraces",
"-H:-DeadlockWatchdogExitOnTimeout",
"-H:DeadlockWatchdogInterval=0",
"-H:+RemoveSaturatedTypeFlows"
"-H:+RemoveSaturatedTypeFlows",
"--add-exports=org.graalvm.nativeimage.builder/com.oracle.svm.core.jdk=ALL-UNNAMED" // Required for GluonFeature
);
private static final List<String> verboseNativeImageArguments = Arrays.asList(
"-H:+PrintAnalysisCallTree",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ public class LinuxTargetConfiguration extends PosixTargetConfiguration {
"java", "nio", "zip", "net", "prefs", "j2pkcs11", "sunec", "extnet", "fdlibm",
"fontmanager", "javajpeg", "lcms", "awt_headless", "awt"
);
/**
* fdlibm no longer required, unsure since when
*/
private static final List<String> staticJavaLibs21 = Arrays.asList(
"java", "nio", "zip", "net", "prefs", "j2pkcs11", "sunec", "extnet",
"fontmanager", "javajpeg", "lcms", "awt_headless", "awt"
);

private static final List<String> staticJvmLibs = Arrays.asList(
"jvm", "libchelper"
Expand Down Expand Up @@ -232,7 +239,13 @@ List<String> getStaticJavaLibs() {
} catch (IOException ex) {
throw new RuntimeException ("No static java libs found, cannot continue");
}
return staticJavaLibs.stream()
List<String> libs;
if (javaVersion.getMajor() >= 21) {
libs = staticJavaLibs21;
} else {
libs = staticJavaLibs;
}
return libs.stream()
.map(lib -> javaStaticLibPath.resolve("lib" + lib + ".a").toString())
.collect(Collectors.toList());
}
Expand Down

0 comments on commit 6a65d3b

Please sign in to comment.