Skip to content

Commit 93fd739

Browse files
committedNov 27, 2023
- Fix build failure caused by missing 'IsStaticJDK' declaration in awt_LoadLibrary.c.
- Fix erroneous dlsym call in jdk.jdwp.agent/unix/native/libjdwp/linker_md.c. Tested the change by running: bin/javastatic -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=0 HelloWorld
1 parent 135b202 commit 93fd739

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed
 

‎src/java.desktop/unix/native/libawt/awt/awt_LoadLibrary.c

+3
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ JNIEXPORT jboolean JNICALL AWTIsHeadless() {
9898
#define HEADLESS_PATH "/libawt_headless.so"
9999
#endif
100100

101+
typedef jboolean (*JLI_IsStaticJDK_t)();
102+
static JLI_IsStaticJDK_t IsStaticJDK = NULL;
103+
101104
jint
102105
AWT_OnLoad(JavaVM *vm, void *reserved)
103106
{

‎src/jdk.jdwp.agent/unix/native/libjdwp/linker_md.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,11 @@ void * dbgsysFindLibraryEntry(void *handle, const char *name)
129129
return dlsym(handle, name);
130130
}
131131

132+
typedef jboolean (*JLI_IsStaticJDK_t)();
133+
132134
jboolean dbgsysIsStaticJDK()
133135
{
134-
return dlsym(NULL, "IsStaticJDK") != NULL;
136+
// JLI_IsStaticJDK is defined by libjli. Check if it is statically linked.
137+
JLI_IsStaticJDK_t IsStaticJDK = (JLI_IsStaticJDK_t)dlsym(RTLD_DEFAULT, "JLI_IsStaticJDK");
138+
return (IsStaticJDK != NULL) && (IsStaticJDK)();
135139
}

0 commit comments

Comments
 (0)
Please sign in to comment.