diff --git a/jdk/make/lib/ServiceabilityLibraries.gmk b/jdk/make/lib/ServiceabilityLibraries.gmk index d95fc7e36b1..ef4234b0dd0 100644 --- a/jdk/make/lib/ServiceabilityLibraries.gmk +++ b/jdk/make/lib/ServiceabilityLibraries.gmk @@ -203,7 +203,6 @@ BUILD_LIBRARIES += $(BUILD_LIBJSDT) ########################################################################################## LIBINSTRUMENT_SRC := $(JDK_TOPDIR)/src/share/instrument \ - $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/io \ $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/instrument LIBINSTRUMENT_FILES := \ @@ -218,9 +217,8 @@ LIBINSTRUMENT_FILES := \ JavaExceptions.c \ PathCharsValidator.c \ Reentrancy.c \ - Utilities.c \ - canonicalize_md.c - + Utilities.c + LIBINSTRUMENT_DIR := $(JDK_OUTPUTDIR)/objs/libinstrument LIBINSTRUMENT_CFLAGS := $(CFLAGS_JDKLIB) \ -I$(JDK_TOPDIR)/src/share/instrument \ @@ -239,6 +237,8 @@ ifeq ($(OPENJDK_TARGET_OS), windows) LIBINSTRUMENT_CFLAGS := $(filter-out -MD, $(LIBINSTRUMENT_CFLAGS)) # equivalent of strcasecmp is stricmp on Windows LIBINSTRUMENT_CFLAGS += -Dstrcasecmp=stricmp +else + LIBINSTRUMENT_LDFLAGS_SUFFIX := -ljava endif $(eval $(call SetupNativeCompilation,BUILD_LIBINSTRUMENT, \ diff --git a/jdk/src/share/instrument/FileSystemSupport.h b/jdk/src/share/instrument/FileSystemSupport.h index f618ee79bad..66e56b44e4f 100644 --- a/jdk/src/share/instrument/FileSystemSupport.h +++ b/jdk/src/share/instrument/FileSystemSupport.h @@ -65,9 +65,3 @@ int isAbsolute(const char * path); * Resolve the child pathname string against the parent. */ char* resolve(const char* parent, const char* child); - -/** - * Convert a pathname to canonical form. - * -- compiled in from src//native/java/io/canonicalize_md.c - */ -int canonicalize(char *original, char *resolved, int len); diff --git a/jdk/src/share/instrument/InvocationAdapter.c b/jdk/src/share/instrument/InvocationAdapter.c index 878adeced8c..f3639533dd6 100644 --- a/jdk/src/share/instrument/InvocationAdapter.c +++ b/jdk/src/share/instrument/InvocationAdapter.c @@ -669,6 +669,13 @@ appendClassPath( JPLISAgent* agent, jplis_assert((void*)res != (void*)NULL); \ } +/** + * Convert a pathname to canonical form. + * This method is exported from libjava. + */ +extern int +Canonicalize(JNIEnv *unused, char *orig, char *out, int len); + /* * This function takes the value of the Boot-Class-Path attribute, @@ -790,7 +797,8 @@ appendBootClassPath( JPLISAgent* agent, char* resolved; if (!haveBasePath) { - if (canonicalize((char*)jarfile, canonicalPath, sizeof(canonicalPath)) != 0) { + /* Use NULL as the JNIEnv since we know that Canonicalize does not use it. */ + if (Canonicalize(NULL, (char*)jarfile, canonicalPath, sizeof(canonicalPath)) != 0) { fprintf(stderr, "WARNING: unable to canonicalize %s\n", jarfile); free(path); continue; diff --git a/jdk/src/share/native/common/jni_util.c b/jdk/src/share/native/common/jni_util.c index 6837dd67983..2955e0f1aa7 100644 --- a/jdk/src/share/native/common/jni_util.c +++ b/jdk/src/share/native/common/jni_util.c @@ -834,12 +834,12 @@ JNU_ReleaseStringPlatformChars(JNIEnv *env, jstring jstr, const char *str) /* * Export the platform dependent path canonicalization so that * VM can find it when loading system classes. - * + * This function is also used by the instrumentation agent. */ extern int canonicalize(char *path, const char *out, int len); JNIEXPORT int -Canonicalize(JNIEnv *env, char *orig, char *out, int len) +Canonicalize(JNIEnv *unused, char *orig, char *out, int len) { /* canonicalize an already natived path */ return canonicalize(orig, out, len);