8066474: Remove the lib/ directory from Linux and Solaris images
Reviewed-by: tbell, ihse, kvn
This commit is contained in:
parent
78e6980e1a
commit
6d271f4386
@ -124,15 +124,14 @@ fi
|
|||||||
|
|
||||||
# We will set the LD_LIBRARY_PATH as follows:
|
# We will set the LD_LIBRARY_PATH as follows:
|
||||||
# o $JVMPATH (directory portion only)
|
# o $JVMPATH (directory portion only)
|
||||||
# o $JRE/lib/$ARCH
|
# o $JRE/lib
|
||||||
# followed by the user's previous effective LD_LIBRARY_PATH, if
|
# followed by the user's previous effective LD_LIBRARY_PATH, if
|
||||||
# any.
|
# any.
|
||||||
JRE=$JDK
|
JRE=$JDK
|
||||||
JAVA_HOME=$JDK
|
JAVA_HOME=$JDK
|
||||||
export JAVA_HOME
|
export JAVA_HOME
|
||||||
|
|
||||||
ARCH=@@LIBARCH@@
|
SBP=${MYDIR}:${JRE}/lib
|
||||||
SBP=${MYDIR}:${JRE}/lib/${ARCH}
|
|
||||||
|
|
||||||
|
|
||||||
# Set up a suitable LD_LIBRARY_PATH or DYLD_LIBRARY_PATH
|
# Set up a suitable LD_LIBRARY_PATH or DYLD_LIBRARY_PATH
|
||||||
|
@ -547,11 +547,7 @@ void os::init_system_properties_values() {
|
|||||||
if (pslash != NULL) {
|
if (pslash != NULL) {
|
||||||
pslash = strrchr(buf, '/');
|
pslash = strrchr(buf, '/');
|
||||||
if (pslash != NULL) {
|
if (pslash != NULL) {
|
||||||
*pslash = '\0'; // Get rid of /<arch>.
|
*pslash = '\0'; // Get rid of /lib.
|
||||||
pslash = strrchr(buf, '/');
|
|
||||||
if (pslash != NULL) {
|
|
||||||
*pslash = '\0'; // Get rid of /lib.
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Arguments::set_java_home(buf);
|
Arguments::set_java_home(buf);
|
||||||
|
@ -218,9 +218,6 @@ bool os::have_special_privileges() {
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Cpu architecture string
|
|
||||||
static char cpu_arch[] = HOTSPOT_LIB_ARCH;
|
|
||||||
|
|
||||||
|
|
||||||
// pid_t gettid()
|
// pid_t gettid()
|
||||||
//
|
//
|
||||||
@ -263,7 +260,7 @@ void os::init_system_properties_values() {
|
|||||||
//
|
//
|
||||||
// Obtain the JAVA_HOME value from the location of libjvm.so.
|
// Obtain the JAVA_HOME value from the location of libjvm.so.
|
||||||
// This library should be located at:
|
// This library should be located at:
|
||||||
// <JAVA_HOME>/jre/lib/<arch>/{client|server}/libjvm.so.
|
// <JAVA_HOME>/lib/{client|server}/libjvm.so.
|
||||||
//
|
//
|
||||||
// If "/jre/lib/" appears at the right place in the path, then we
|
// If "/jre/lib/" appears at the right place in the path, then we
|
||||||
// assume libjvm.so is installed in a JDK and we use this path.
|
// assume libjvm.so is installed in a JDK and we use this path.
|
||||||
@ -329,11 +326,7 @@ void os::init_system_properties_values() {
|
|||||||
if (pslash != NULL) {
|
if (pslash != NULL) {
|
||||||
pslash = strrchr(buf, '/');
|
pslash = strrchr(buf, '/');
|
||||||
if (pslash != NULL) {
|
if (pslash != NULL) {
|
||||||
*pslash = '\0'; // Get rid of /<arch>.
|
*pslash = '\0'; // Get rid of /lib.
|
||||||
pslash = strrchr(buf, '/');
|
|
||||||
if (pslash != NULL) {
|
|
||||||
*pslash = '\0'; // Get rid of /lib.
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Arguments::set_java_home(buf);
|
Arguments::set_java_home(buf);
|
||||||
@ -360,9 +353,9 @@ void os::init_system_properties_values() {
|
|||||||
// That's +1 for the colon and +1 for the trailing '\0'.
|
// That's +1 for the colon and +1 for the trailing '\0'.
|
||||||
char *ld_library_path = (char *)NEW_C_HEAP_ARRAY(char,
|
char *ld_library_path = (char *)NEW_C_HEAP_ARRAY(char,
|
||||||
strlen(v) + 1 +
|
strlen(v) + 1 +
|
||||||
sizeof(SYS_EXT_DIR) + sizeof("/lib/") + strlen(cpu_arch) + sizeof(DEFAULT_LIBPATH) + 1,
|
sizeof(SYS_EXT_DIR) + sizeof("/lib/") + sizeof(DEFAULT_LIBPATH) + 1,
|
||||||
mtInternal);
|
mtInternal);
|
||||||
sprintf(ld_library_path, "%s%s" SYS_EXT_DIR "/lib/%s:" DEFAULT_LIBPATH, v, v_colon, cpu_arch);
|
sprintf(ld_library_path, "%s%s" SYS_EXT_DIR "/lib:" DEFAULT_LIBPATH, v, v_colon);
|
||||||
Arguments::set_library_path(ld_library_path);
|
Arguments::set_library_path(ld_library_path);
|
||||||
FREE_C_HEAP_ARRAY(char, ld_library_path);
|
FREE_C_HEAP_ARRAY(char, ld_library_path);
|
||||||
}
|
}
|
||||||
@ -2310,7 +2303,7 @@ void os::jvm_path(char *buf, jint buflen) {
|
|||||||
|
|
||||||
if (Arguments::sun_java_launcher_is_altjvm()) {
|
if (Arguments::sun_java_launcher_is_altjvm()) {
|
||||||
// Support for the java launcher's '-XXaltjvm=<path>' option. Typical
|
// Support for the java launcher's '-XXaltjvm=<path>' option. Typical
|
||||||
// value for buf is "<JAVA_HOME>/jre/lib/<arch>/<vmtype>/libjvm.so".
|
// value for buf is "<JAVA_HOME>/jre/lib/<vmtype>/libjvm.so".
|
||||||
// If "/jre/lib/" appears at the right place in the string, then
|
// If "/jre/lib/" appears at the right place in the string, then
|
||||||
// assume we are installed in a JDK and we're done. Otherwise, check
|
// assume we are installed in a JDK and we're done. Otherwise, check
|
||||||
// for a JAVA_HOME environment variable and fix up the path so it
|
// for a JAVA_HOME environment variable and fix up the path so it
|
||||||
@ -2346,9 +2339,9 @@ void os::jvm_path(char *buf, jint buflen) {
|
|||||||
len = strlen(buf);
|
len = strlen(buf);
|
||||||
assert(len < buflen, "Ran out of buffer room");
|
assert(len < buflen, "Ran out of buffer room");
|
||||||
jrelib_p = buf + len;
|
jrelib_p = buf + len;
|
||||||
snprintf(jrelib_p, buflen-len, "/jre/lib/%s", cpu_arch);
|
snprintf(jrelib_p, buflen-len, "/jre/lib");
|
||||||
if (0 != access(buf, F_OK)) {
|
if (0 != access(buf, F_OK)) {
|
||||||
snprintf(jrelib_p, buflen-len, "/lib/%s", cpu_arch);
|
snprintf(jrelib_p, buflen-len, "/lib");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 == access(buf, F_OK)) {
|
if (0 == access(buf, F_OK)) {
|
||||||
|
@ -534,13 +534,12 @@ void os::init_system_properties_values() {
|
|||||||
#define SYS_EXT_DIR "/usr/jdk/packages"
|
#define SYS_EXT_DIR "/usr/jdk/packages"
|
||||||
#define EXTENSIONS_DIR "/lib/ext"
|
#define EXTENSIONS_DIR "/lib/ext"
|
||||||
|
|
||||||
char cpu_arch[12];
|
|
||||||
// Buffer that fits several sprintfs.
|
// Buffer that fits several sprintfs.
|
||||||
// Note that the space for the colon and the trailing null are provided
|
// Note that the space for the colon and the trailing null are provided
|
||||||
// by the nulls included by the sizeof operator.
|
// by the nulls included by the sizeof operator.
|
||||||
const size_t bufsize =
|
const size_t bufsize =
|
||||||
MAX3((size_t)MAXPATHLEN, // For dll_dir & friends.
|
MAX3((size_t)MAXPATHLEN, // For dll_dir & friends.
|
||||||
sizeof(SYS_EXT_DIR) + sizeof("/lib/") + strlen(cpu_arch), // invariant ld_library_path
|
sizeof(SYS_EXT_DIR) + sizeof("/lib/"), // invariant ld_library_path
|
||||||
(size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + sizeof(SYS_EXT_DIR) + sizeof(EXTENSIONS_DIR)); // extensions dir
|
(size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + sizeof(SYS_EXT_DIR) + sizeof(EXTENSIONS_DIR)); // extensions dir
|
||||||
char *buf = (char *)NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
|
char *buf = (char *)NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
|
||||||
|
|
||||||
@ -561,11 +560,7 @@ void os::init_system_properties_values() {
|
|||||||
if (pslash != NULL) {
|
if (pslash != NULL) {
|
||||||
pslash = strrchr(buf, '/');
|
pslash = strrchr(buf, '/');
|
||||||
if (pslash != NULL) {
|
if (pslash != NULL) {
|
||||||
*pslash = '\0'; // Get rid of /<arch>.
|
*pslash = '\0'; // Get rid of /lib.
|
||||||
pslash = strrchr(buf, '/');
|
|
||||||
if (pslash != NULL) {
|
|
||||||
*pslash = '\0'; // Get rid of /lib.
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Arguments::set_java_home(buf);
|
Arguments::set_java_home(buf);
|
||||||
@ -623,21 +618,8 @@ void os::init_system_properties_values() {
|
|||||||
// However, to prevent the proliferation of improperly built native
|
// However, to prevent the proliferation of improperly built native
|
||||||
// libraries, the new path component /usr/jdk/packages is added here.
|
// libraries, the new path component /usr/jdk/packages is added here.
|
||||||
|
|
||||||
// Determine the actual CPU architecture.
|
|
||||||
sysinfo(SI_ARCHITECTURE, cpu_arch, sizeof(cpu_arch));
|
|
||||||
#ifdef _LP64
|
|
||||||
// If we are a 64-bit vm, perform the following translations:
|
|
||||||
// sparc -> sparcv9
|
|
||||||
// i386 -> amd64
|
|
||||||
if (strcmp(cpu_arch, "sparc") == 0) {
|
|
||||||
strcat(cpu_arch, "v9");
|
|
||||||
} else if (strcmp(cpu_arch, "i386") == 0) {
|
|
||||||
strcpy(cpu_arch, "amd64");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Construct the invariant part of ld_library_path.
|
// Construct the invariant part of ld_library_path.
|
||||||
sprintf(common_path, SYS_EXT_DIR "/lib/%s", cpu_arch);
|
sprintf(common_path, SYS_EXT_DIR "/lib");
|
||||||
|
|
||||||
// Struct size is more than sufficient for the path components obtained
|
// Struct size is more than sufficient for the path components obtained
|
||||||
// through the dlinfo() call, so only add additional space for the path
|
// through the dlinfo() call, so only add additional space for the path
|
||||||
@ -2076,18 +2058,9 @@ void os::jvm_path(char *buf, jint buflen) {
|
|||||||
// Look for JAVA_HOME in the environment.
|
// Look for JAVA_HOME in the environment.
|
||||||
char* java_home_var = ::getenv("JAVA_HOME");
|
char* java_home_var = ::getenv("JAVA_HOME");
|
||||||
if (java_home_var != NULL && java_home_var[0] != 0) {
|
if (java_home_var != NULL && java_home_var[0] != 0) {
|
||||||
char cpu_arch[12];
|
|
||||||
char* jrelib_p;
|
char* jrelib_p;
|
||||||
int len;
|
int len;
|
||||||
sysinfo(SI_ARCHITECTURE, cpu_arch, sizeof(cpu_arch));
|
|
||||||
#ifdef _LP64
|
|
||||||
// If we are on sparc running a 64-bit vm, look in jre/lib/sparcv9.
|
|
||||||
if (strcmp(cpu_arch, "sparc") == 0) {
|
|
||||||
strcat(cpu_arch, "v9");
|
|
||||||
} else if (strcmp(cpu_arch, "i386") == 0) {
|
|
||||||
strcpy(cpu_arch, "amd64");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
// Check the current module name "libjvm.so".
|
// Check the current module name "libjvm.so".
|
||||||
p = strrchr(buf, '/');
|
p = strrchr(buf, '/');
|
||||||
assert(strstr(p, "/libjvm") == p, "invalid library name");
|
assert(strstr(p, "/libjvm") == p, "invalid library name");
|
||||||
@ -2098,9 +2071,9 @@ void os::jvm_path(char *buf, jint buflen) {
|
|||||||
len = strlen(buf);
|
len = strlen(buf);
|
||||||
assert(len < buflen, "Ran out of buffer space");
|
assert(len < buflen, "Ran out of buffer space");
|
||||||
jrelib_p = buf + len;
|
jrelib_p = buf + len;
|
||||||
snprintf(jrelib_p, buflen-len, "/jre/lib/%s", cpu_arch);
|
snprintf(jrelib_p, buflen-len, "/jre/lib");
|
||||||
if (0 != access(buf, F_OK)) {
|
if (0 != access(buf, F_OK)) {
|
||||||
snprintf(jrelib_p, buflen-len, "/lib/%s", cpu_arch);
|
snprintf(jrelib_p, buflen-len, "/lib");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 == access(buf, F_OK)) {
|
if (0 == access(buf, F_OK)) {
|
||||||
|
@ -415,13 +415,8 @@ PHONY_LIST += sanitytest
|
|||||||
# Set up the directory in which the jvm directories live (client/, server/, etc.)
|
# Set up the directory in which the jvm directories live (client/, server/, etc.)
|
||||||
ifeq ($(PLATFORM),windows)
|
ifeq ($(PLATFORM),windows)
|
||||||
JVMS_DIR := $(PRODUCT_HOME)/bin
|
JVMS_DIR := $(PRODUCT_HOME)/bin
|
||||||
else ifeq ($(PLATFORM),bsd)
|
|
||||||
JVMS_DIR := $(PRODUCT_HOME)/lib
|
|
||||||
else
|
else
|
||||||
# The jvms live in the architecture directory (amd64, sparcv9,
|
JVMS_DIR := $(PRODUCT_HOME)/lib
|
||||||
# etc.). By using a wildcard there's no need to figure out the exact
|
|
||||||
# name of that directory.
|
|
||||||
JVMS_DIR := $(PRODUCT_HOME)/lib/*
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Use the existance of a directory as a sign that jvm variant is available
|
# Use the existance of a directory as a sign that jvm variant is available
|
||||||
|
@ -42,7 +42,7 @@ then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
LD_LIBRARY_PATH=.:${TESTJAVA}/jre/lib/${VM_CPU}/${VM_TYPE}:${TESTJAVA}/lib/${VM_CPU}/${VM_TYPE}:/usr/lib:$LD_LIBRARY_PATH
|
LD_LIBRARY_PATH=.:${TESTJAVA}/lib/${VM_TYPE}:/usr/lib:$LD_LIBRARY_PATH
|
||||||
export LD_LIBRARY_PATH
|
export LD_LIBRARY_PATH
|
||||||
|
|
||||||
# Run the test for a java and native overflow
|
# Run the test for a java and native overflow
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -66,7 +66,7 @@ void handleError(char *messageTitle, char *messageBody) {
|
|||||||
// method to load the dynamic library libjvm
|
// method to load the dynamic library libjvm
|
||||||
void loadJVM() {
|
void loadJVM() {
|
||||||
char lib[PATH_MAX];
|
char lib[PATH_MAX];
|
||||||
snprintf(lib, sizeof (lib), "%s/lib/sparcv9/server/libjvm.so", path);
|
snprintf(lib, sizeof (lib), "%s/lib/server/libjvm.so", path);
|
||||||
handle = dlopen(lib, RTLD_LAZY);
|
handle = dlopen(lib, RTLD_LAZY);
|
||||||
if (!handle) {
|
if (!handle) {
|
||||||
handleError(dlerror(), "2");
|
handleError(dlerror(), "2");
|
||||||
|
Loading…
Reference in New Issue
Block a user