8066474: Remove the lib/ directory from Linux and Solaris images
Reviewed-by: tbell, ihse, kvn
--- a/hotspot/make/hotspot.script Fri Dec 02 11:07:27 2016 +0100
+++ b/hotspot/make/hotspot.script Mon Dec 05 17:57:43 2016 +0100
@@ -124,15 +124,14 @@
# We will set the LD_LIBRARY_PATH as follows:
# o $JVMPATH (directory portion only)
-# o $JRE/lib/$ARCH
+# o $JRE/lib
# followed by the user's previous effective LD_LIBRARY_PATH, if
# any.
JRE=$JDK
JAVA_HOME=$JDK
export JAVA_HOME
-ARCH=@@LIBARCH@@
-SBP=${MYDIR}:${JRE}/lib/${ARCH}
+SBP=${MYDIR}:${JRE}/lib
# Set up a suitable LD_LIBRARY_PATH or DYLD_LIBRARY_PATH
--- a/hotspot/src/os/aix/vm/os_aix.cpp Fri Dec 02 11:07:27 2016 +0100
+++ b/hotspot/src/os/aix/vm/os_aix.cpp Mon Dec 05 17:57:43 2016 +0100
@@ -547,11 +547,7 @@
if (pslash != NULL) {
pslash = strrchr(buf, '/');
if (pslash != NULL) {
- *pslash = '\0'; // Get rid of /<arch>.
- pslash = strrchr(buf, '/');
- if (pslash != NULL) {
- *pslash = '\0'; // Get rid of /lib.
- }
+ *pslash = '\0'; // Get rid of /lib.
}
}
Arguments::set_java_home(buf);
--- a/hotspot/src/os/linux/vm/os_linux.cpp Fri Dec 02 11:07:27 2016 +0100
+++ b/hotspot/src/os/linux/vm/os_linux.cpp Mon Dec 05 17:57:43 2016 +0100
@@ -218,9 +218,6 @@
#endif
#endif
-// Cpu architecture string
-static char cpu_arch[] = HOTSPOT_LIB_ARCH;
-
// pid_t gettid()
//
@@ -263,7 +260,7 @@
//
// Obtain the JAVA_HOME value from the location of libjvm.so.
// 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
// assume libjvm.so is installed in a JDK and we use this path.
@@ -329,11 +326,7 @@
if (pslash != NULL) {
pslash = strrchr(buf, '/');
if (pslash != NULL) {
- *pslash = '\0'; // Get rid of /<arch>.
- pslash = strrchr(buf, '/');
- if (pslash != NULL) {
- *pslash = '\0'; // Get rid of /lib.
- }
+ *pslash = '\0'; // Get rid of /lib.
}
}
Arguments::set_java_home(buf);
@@ -360,9 +353,9 @@
// That's +1 for the colon and +1 for the trailing '\0'.
char *ld_library_path = (char *)NEW_C_HEAP_ARRAY(char,
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);
- 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);
FREE_C_HEAP_ARRAY(char, ld_library_path);
}
@@ -2310,7 +2303,7 @@
if (Arguments::sun_java_launcher_is_altjvm()) {
// 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
// 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
@@ -2346,9 +2339,9 @@
len = strlen(buf);
assert(len < buflen, "Ran out of buffer room");
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)) {
- snprintf(jrelib_p, buflen-len, "/lib/%s", cpu_arch);
+ snprintf(jrelib_p, buflen-len, "/lib");
}
if (0 == access(buf, F_OK)) {
--- a/hotspot/src/os/solaris/vm/os_solaris.cpp Fri Dec 02 11:07:27 2016 +0100
+++ b/hotspot/src/os/solaris/vm/os_solaris.cpp Mon Dec 05 17:57:43 2016 +0100
@@ -534,13 +534,12 @@
#define SYS_EXT_DIR "/usr/jdk/packages"
#define EXTENSIONS_DIR "/lib/ext"
- char cpu_arch[12];
// Buffer that fits several sprintfs.
// Note that the space for the colon and the trailing null are provided
// by the nulls included by the sizeof operator.
const size_t bufsize =
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
char *buf = (char *)NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
@@ -561,11 +560,7 @@
if (pslash != NULL) {
pslash = strrchr(buf, '/');
if (pslash != NULL) {
- *pslash = '\0'; // Get rid of /<arch>.
- pslash = strrchr(buf, '/');
- if (pslash != NULL) {
- *pslash = '\0'; // Get rid of /lib.
- }
+ *pslash = '\0'; // Get rid of /lib.
}
}
Arguments::set_java_home(buf);
@@ -623,21 +618,8 @@
// However, to prevent the proliferation of improperly built native
// 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.
- 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
// through the dlinfo() call, so only add additional space for the path
@@ -2076,18 +2058,9 @@
// Look for JAVA_HOME in the environment.
char* java_home_var = ::getenv("JAVA_HOME");
if (java_home_var != NULL && java_home_var[0] != 0) {
- char cpu_arch[12];
char* jrelib_p;
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".
p = strrchr(buf, '/');
assert(strstr(p, "/libjvm") == p, "invalid library name");
@@ -2098,9 +2071,9 @@
len = strlen(buf);
assert(len < buflen, "Ran out of buffer space");
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)) {
- snprintf(jrelib_p, buflen-len, "/lib/%s", cpu_arch);
+ snprintf(jrelib_p, buflen-len, "/lib");
}
if (0 == access(buf, F_OK)) {
--- a/hotspot/test/Makefile Fri Dec 02 11:07:27 2016 +0100
+++ b/hotspot/test/Makefile Mon Dec 05 17:57:43 2016 +0100
@@ -415,13 +415,8 @@
# Set up the directory in which the jvm directories live (client/, server/, etc.)
ifeq ($(PLATFORM),windows)
JVMS_DIR := $(PRODUCT_HOME)/bin
-else ifeq ($(PLATFORM),bsd)
+else
JVMS_DIR := $(PRODUCT_HOME)/lib
-else
-# The jvms live in the architecture directory (amd64, sparcv9,
-# etc.). By using a wildcard there's no need to figure out the exact
-# name of that directory.
-JVMS_DIR := $(PRODUCT_HOME)/lib/*
endif
# Use the existance of a directory as a sign that jvm variant is available
--- a/hotspot/test/runtime/StackGuardPages/testme.sh Fri Dec 02 11:07:27 2016 +0100
+++ b/hotspot/test/runtime/StackGuardPages/testme.sh Mon Dec 05 17:57:43 2016 +0100
@@ -42,7 +42,7 @@
exit 0
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
# Run the test for a java and native overflow
--- a/hotspot/test/runtime/ThreadSignalMask/exeThreadSignalMask.c Fri Dec 02 11:07:27 2016 +0100
+++ b/hotspot/test/runtime/ThreadSignalMask/exeThreadSignalMask.c Mon Dec 05 17:57:43 2016 +0100
@@ -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.
*
* This code is free software; you can redistribute it and/or modify it
@@ -66,7 +66,7 @@
// method to load the dynamic library libjvm
void loadJVM() {
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);
if (!handle) {
handleError(dlerror(), "2");