2433 if (strncmp(p, "/jre/lib/", 9) != 0) { |
2433 if (strncmp(p, "/jre/lib/", 9) != 0) { |
2434 // Look for JAVA_HOME in the environment. |
2434 // Look for JAVA_HOME in the environment. |
2435 char* java_home_var = ::getenv("JAVA_HOME"); |
2435 char* java_home_var = ::getenv("JAVA_HOME"); |
2436 if (java_home_var != NULL && java_home_var[0] != 0) { |
2436 if (java_home_var != NULL && java_home_var[0] != 0) { |
2437 char cpu_arch[12]; |
2437 char cpu_arch[12]; |
|
2438 char* jrelib_p; |
|
2439 int len; |
2438 sysinfo(SI_ARCHITECTURE, cpu_arch, sizeof(cpu_arch)); |
2440 sysinfo(SI_ARCHITECTURE, cpu_arch, sizeof(cpu_arch)); |
2439 #ifdef _LP64 |
2441 #ifdef _LP64 |
2440 // If we are on sparc running a 64-bit vm, look in jre/lib/sparcv9. |
2442 // If we are on sparc running a 64-bit vm, look in jre/lib/sparcv9. |
2441 if (strcmp(cpu_arch, "sparc") == 0) { |
2443 if (strcmp(cpu_arch, "sparc") == 0) { |
2442 strcat(cpu_arch, "v9"); |
2444 strcat(cpu_arch, "v9"); |
2448 p = strrchr(buf, '/'); |
2450 p = strrchr(buf, '/'); |
2449 assert(strstr(p, "/libjvm") == p, "invalid library name"); |
2451 assert(strstr(p, "/libjvm") == p, "invalid library name"); |
2450 p = strstr(p, "_g") ? "_g" : ""; |
2452 p = strstr(p, "_g") ? "_g" : ""; |
2451 |
2453 |
2452 realpath(java_home_var, buf); |
2454 realpath(java_home_var, buf); |
2453 sprintf(buf + strlen(buf), "/jre/lib/%s", cpu_arch); |
2455 // determine if this is a legacy image or modules image |
|
2456 // modules image doesn't have "jre" subdirectory |
|
2457 len = strlen(buf); |
|
2458 jrelib_p = buf + len; |
|
2459 snprintf(jrelib_p, buflen-len, "/jre/lib/%s", cpu_arch); |
|
2460 if (0 != access(buf, F_OK)) { |
|
2461 snprintf(jrelib_p, buflen-len, "/lib/%s", cpu_arch); |
|
2462 } |
|
2463 |
2454 if (0 == access(buf, F_OK)) { |
2464 if (0 == access(buf, F_OK)) { |
2455 // Use current module name "libjvm[_g].so" instead of |
2465 // Use current module name "libjvm[_g].so" instead of |
2456 // "libjvm"debug_only("_g")".so" since for fastdebug version |
2466 // "libjvm"debug_only("_g")".so" since for fastdebug version |
2457 // we should have "libjvm.so" but debug_only("_g") adds "_g"! |
2467 // we should have "libjvm.so" but debug_only("_g") adds "_g"! |
2458 // It is used when we are choosing the HPI library's name |
2468 // It is used when we are choosing the HPI library's name |
2459 // "libhpi[_g].so" in hpi::initialize_get_interface(). |
2469 // "libhpi[_g].so" in hpi::initialize_get_interface(). |
2460 sprintf(buf + strlen(buf), "/hotspot/libjvm%s.so", p); |
2470 len = strlen(buf); |
|
2471 snprintf(buf + len, buflen-len, "/hotspot/libjvm%s.so", p); |
2461 } else { |
2472 } else { |
2462 // Go back to path of .so |
2473 // Go back to path of .so |
2463 realpath((char *)dlinfo.dli_fname, buf); |
2474 realpath((char *)dlinfo.dli_fname, buf); |
2464 } |
2475 } |
2465 } |
2476 } |