diff --git a/make/linux/makefiles/gcc.make b/make/linux/makefiles/gcc.make index aa879b10fc3adbeba5aff987124b7bdecad8a485..04c407bce9e76c9349ba866b1df51893d01e66a1 100644 --- a/make/linux/makefiles/gcc.make +++ b/make/linux/makefiles/gcc.make @@ -75,6 +75,11 @@ CFLAGS += -fno-rtti CFLAGS += -fno-exceptions CFLAGS += -D_REENTRANT CFLAGS += -fcheck-new +# version 4 and above support fvisibility=hidden (matches jni_x86.h file) +# except 4.1.2 gives pointless warnings that can't be disabled (afaik) +ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0" +CFLAGS += -fvisibility=hidden +endif ARCHFLAG = $(ARCHFLAG/$(BUILDARCH)) ARCHFLAG/i486 = -m32 -march=i586 diff --git a/make/linux/makefiles/mapfile-vers-debug b/make/linux/makefiles/mapfile-vers-debug index a7ba4583ee95adaace462247b446b9eb5152a4e7..7022aba2e393a94d8f14b979e00a35d820f320cb 100644 --- a/make/linux/makefiles/mapfile-vers-debug +++ b/make/linux/makefiles/mapfile-vers-debug @@ -262,14 +262,6 @@ SUNWprivate_1.1 { JVM_SetField; JVM_SetPrimitiveField; - # Needed for dropping VM into JDK 1.3.x, 1.4 - _JVM_native_threads; - jdk_sem_init; - jdk_sem_post; - jdk_sem_wait; - jdk_pthread_sigmask; - jdk_waitpid; - # debug JVM JVM_AccessVMBooleanFlag; JVM_AccessVMIntFlag; diff --git a/make/linux/makefiles/mapfile-vers-product b/make/linux/makefiles/mapfile-vers-product index 7f7e279aa2ff0b292eab416420f9b238ab923ac9..201252d2d298b67d1ee374a467f73e5a4c353061 100644 --- a/make/linux/makefiles/mapfile-vers-product +++ b/make/linux/makefiles/mapfile-vers-product @@ -262,14 +262,6 @@ SUNWprivate_1.1 { JVM_SetField; JVM_SetPrimitiveField; - # Needed for dropping VM into JDK 1.3.x, 1.4 - _JVM_native_threads; - jdk_sem_init; - jdk_sem_post; - jdk_sem_wait; - jdk_pthread_sigmask; - jdk_waitpid; - # miscellaneous functions jio_fprintf; jio_printf; diff --git a/src/cpu/sparc/vm/jni_sparc.h b/src/cpu/sparc/vm/jni_sparc.h index 9712dfc9d0dba2dc2f973e80362dd55cd0e829aa..2e177a8692e0eb9d892f2f57ab9b187df5410b84 100644 --- a/src/cpu/sparc/vm/jni_sparc.h +++ b/src/cpu/sparc/vm/jni_sparc.h @@ -23,8 +23,13 @@ * questions. */ -#define JNIEXPORT -#define JNIIMPORT +#if defined(__GNUC__) && (__GNUC__ >= 4) + #define JNIEXPORT __attribute__((visibility("default"))) + #define JNIIMPORT __attribute__((visibility("default"))) +#else + #define JNIEXPORT + #define JNIIMPORT +#endif #define JNICALL typedef int jint; diff --git a/src/cpu/x86/vm/jni_x86.h b/src/cpu/x86/vm/jni_x86.h index c6d322f2b24401fafb6a3a643020f31698465cb4..9715d0e3237f9671d5d7d3466ca5ad5291e3cc4e 100644 --- a/src/cpu/x86/vm/jni_x86.h +++ b/src/cpu/x86/vm/jni_x86.h @@ -27,10 +27,16 @@ #define _JAVASOFT_JNI_MD_H_ #if defined(SOLARIS) || defined(LINUX) + +#if defined(__GNUC__) && (__GNUC__ > 4) || (__GNUC__ == 4) && (__GNUC_MINOR__ > 2) + #define JNIEXPORT __attribute__((visibility("default"))) + #define JNIIMPORT __attribute__((visibility("default"))) +#else #define JNIEXPORT #define JNIIMPORT - #define JNICALL +#endif + #define JNICALL typedef int jint; #ifdef _LP64 diff --git a/src/cpu/zero/vm/jni_zero.h b/src/cpu/zero/vm/jni_zero.h index 0e21634dff6cc0a56311d3aa6887093dff99fb32..132a6bbb60df5f1762a2eaa953a07abdf3c01054 100644 --- a/src/cpu/zero/vm/jni_zero.h +++ b/src/cpu/zero/vm/jni_zero.h @@ -24,8 +24,14 @@ * questions. */ -#define JNIEXPORT -#define JNIIMPORT + +#if defined(__GNUC__) && (__GNUC__ >= 4) + #define JNIEXPORT __attribute__((visibility("default"))) + #define JNIIMPORT __attribute__((visibility("default"))) +#else + #define JNIEXPORT + #define JNIIMPORT +#endif #define JNICALL typedef int jint; diff --git a/src/os/linux/vm/jvm_linux.cpp b/src/os/linux/vm/jvm_linux.cpp index ea5bf2d36c73c1d3b876235d023008e534e5c955..6e305b80211f104647b5238fad5d69ce7dba661f 100644 --- a/src/os/linux/vm/jvm_linux.cpp +++ b/src/os/linux/vm/jvm_linux.cpp @@ -29,11 +29,6 @@ #include -/* - * FIXME: This is temporary hack to keep Linux Runtime.exec() - * code happy. See $JDK/src/linux/native/java/lang/UnixProcess_md.c - */ -int _JVM_native_threads = 1; // sun.misc.Signal /////////////////////////////////////////////////////////// // Signal code is mostly copied from classic vm, signals_md.c 1.4 98/08/23 diff --git a/src/os/linux/vm/os_linux.cpp b/src/os/linux/vm/os_linux.cpp index 5d34fc50c7d8b134255487f2d33f6f4e961ba9df..8f9c60cfd1d4c609e507ffae2de22e3190f21dad 100644 --- a/src/os/linux/vm/os_linux.cpp +++ b/src/os/linux/vm/os_linux.cpp @@ -2509,8 +2509,10 @@ char *os::scan_pages(char *start, char* end, page_info* page_expected, page_info return end; } -extern "C" void numa_warn(int number, char *where, ...) { } -extern "C" void numa_error(char *where) { } +// Something to do with the numa-aware allocator needs these symbols +extern "C" JNIEXPORT void numa_warn(int number, char *where, ...) { } +extern "C" JNIEXPORT void numa_error(char *where) { } +extern "C" JNIEXPORT int fork1() { return fork(); } // If we are running with libnuma version > 2, then we should @@ -3483,7 +3485,7 @@ bool os::is_interrupted(Thread* thread, bool clear_interrupted) { // Note that the VM will print warnings if it detects conflicting signal // handlers, unless invoked with the option "-XX:+AllowUserSignalHandlers". // -extern "C" int +extern "C" JNIEXPORT int JVM_handle_linux_signal(int signo, siginfo_t* siginfo, void* ucontext, int abort_if_unrecognized); @@ -4678,44 +4680,6 @@ void os::pause() { } } -extern "C" { - -/** - * NOTE: the following code is to keep the green threads code - * in the libjava.so happy. Once the green threads is removed, - * these code will no longer be needed. - */ -int -jdk_waitpid(pid_t pid, int* status, int options) { - return waitpid(pid, status, options); -} - -int -fork1() { - return fork(); -} - -int -jdk_sem_init(sem_t *sem, int pshared, unsigned int value) { - return sem_init(sem, pshared, value); -} - -int -jdk_sem_post(sem_t *sem) { - return sem_post(sem); -} - -int -jdk_sem_wait(sem_t *sem) { - return sem_wait(sem); -} - -int -jdk_pthread_sigmask(int how , const sigset_t* newmask, sigset_t* oldmask) { - return pthread_sigmask(how , newmask, oldmask); -} - -} // Refer to the comments in os_solaris.cpp park-unpark. // diff --git a/src/os/solaris/vm/os_solaris.cpp b/src/os/solaris/vm/os_solaris.cpp index 80c7c4d50581ac1b6e9aea2c23e090a4eb92f4ae..fad8d4466b5dba3ad0be1ef9b3eb45cdf82646c0 100644 --- a/src/os/solaris/vm/os_solaris.cpp +++ b/src/os/solaris/vm/os_solaris.cpp @@ -4221,7 +4221,9 @@ void os::os_exception_wrapper(java_call_t f, JavaValue* value, methodHandle* met // Note that the VM will print warnings if it detects conflicting signal // handlers, unless invoked with the option "-XX:+AllowUserSignalHandlers". // -extern "C" int JVM_handle_solaris_signal(int signo, siginfo_t* siginfo, void* ucontext, int abort_if_unrecognized); +extern "C" JNIEXPORT int +JVM_handle_solaris_signal(int signo, siginfo_t* siginfo, void* ucontext, + int abort_if_unrecognized); void signalHandler(int sig, siginfo_t* info, void* ucVoid) { diff --git a/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp b/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp index e759e7d8deae8d9719762b8d06327a83a6350bde..a9984d0e61563de986c745ad86136edc4f725d7f 100644 --- a/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp +++ b/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp @@ -542,7 +542,7 @@ inline static bool checkICMiss(sigcontext* uc, address* pc, address* stub) { return false; } -extern "C" int +extern "C" JNIEXPORT int JVM_handle_linux_signal(int sig, siginfo_t* info, void* ucVoid, diff --git a/src/os_cpu/linux_x86/vm/os_linux_x86.cpp b/src/os_cpu/linux_x86/vm/os_linux_x86.cpp index f657dfec2d6e217834fa5842a82ff299053ac637..b5e159076d5fc7f471f1b5ae179be02cb15ea568 100644 --- a/src/os_cpu/linux_x86/vm/os_linux_x86.cpp +++ b/src/os_cpu/linux_x86/vm/os_linux_x86.cpp @@ -216,7 +216,7 @@ extern "C" void FetchNPFI () ; extern "C" void FetchNResume () ; #endif // AMD64 -extern "C" int +extern "C" JNIEXPORT int JVM_handle_linux_signal(int sig, siginfo_t* info, void* ucVoid, diff --git a/src/os_cpu/linux_zero/vm/os_linux_zero.cpp b/src/os_cpu/linux_zero/vm/os_linux_zero.cpp index 40e15e2f4f808fa5f8276b0e6f4d954ff385f057..afeb60a93f46d91cc904f120a03c019fb2fb4a60 100644 --- a/src/os_cpu/linux_zero/vm/os_linux_zero.cpp +++ b/src/os_cpu/linux_zero/vm/os_linux_zero.cpp @@ -116,7 +116,7 @@ frame os::fetch_frame_from_context(void* ucVoid) { ShouldNotCallThis(); } -extern "C" int +extern "C" JNIEXPORT int JVM_handle_linux_signal(int sig, siginfo_t* info, void* ucVoid, diff --git a/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp b/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp index 3b83be3ebba6d97c7a144fa618fc9c5b028f3293..e9724f1cd8ef7451c464c889566af08c4281cff3 100644 --- a/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp +++ b/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp @@ -317,9 +317,9 @@ extern "C" void Fetch32Resume () ; extern "C" void FetchNPFI () ; extern "C" void FetchNResume () ; -extern "C" int JVM_handle_solaris_signal(int signo, siginfo_t* siginfo, void* ucontext, int abort_if_unrecognized); - -int JVM_handle_solaris_signal(int sig, siginfo_t* info, void* ucVoid, int abort_if_unrecognized) { +extern "C" JNIEXPORT int +JVM_handle_solaris_signal(int sig, siginfo_t* info, void* ucVoid, + int abort_if_unrecognized) { ucontext_t* uc = (ucontext_t*) ucVoid; Thread* t = ThreadLocalStorage::get_thread_slow(); diff --git a/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp b/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp index d9bb0eb58c3716b96a6e99431c4b446a986c80a8..2de4d6969bdd90bc44a63ca6b06d7d3d4ca356ea 100644 --- a/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp +++ b/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp @@ -365,8 +365,6 @@ bool os::is_allocatable(size_t bytes) { } -extern "C" int JVM_handle_solaris_signal(int signo, siginfo_t* siginfo, void* ucontext, int abort_if_unrecognized); - extern "C" void Fetch32PFI () ; extern "C" void Fetch32Resume () ; #ifdef AMD64 @@ -374,7 +372,9 @@ extern "C" void FetchNPFI () ; extern "C" void FetchNResume () ; #endif // AMD64 -int JVM_handle_solaris_signal(int sig, siginfo_t* info, void* ucVoid, int abort_if_unrecognized) { +extern "C" JNIEXPORT int +JVM_handle_solaris_signal(int sig, siginfo_t* info, void* ucVoid, + int abort_if_unrecognized) { ucontext_t* uc = (ucontext_t*) ucVoid; #ifndef AMD64 diff --git a/src/share/vm/prims/forte.cpp b/src/share/vm/prims/forte.cpp index c1cb55312634385fe34775b4f37ce4b1a37a70ec..3c48f01d2456a402f17085420247d26ea6eedd0a 100644 --- a/src/share/vm/prims/forte.cpp +++ b/src/share/vm/prims/forte.cpp @@ -520,6 +520,7 @@ static void forte_fill_call_trace_given_top(JavaThread* thd, // method_id - jmethodID of the method being executed extern "C" { +JNIEXPORT void AsyncGetCallTrace(ASGCT_CallTrace *trace, jint depth, void* ucontext) { // This is if'd out because we no longer use thread suspension. diff --git a/src/share/vm/prims/jvm.cpp b/src/share/vm/prims/jvm.cpp index 86851e686ee8d81df376b90c973d4d7cfa53e6cf..417052502ccc732d9166a32cd17e14d923233849 100644 --- a/src/share/vm/prims/jvm.cpp +++ b/src/share/vm/prims/jvm.cpp @@ -2585,7 +2585,7 @@ int jio_vfprintf(FILE* f, const char *fmt, va_list args) { } -int jio_printf(const char *fmt, ...) { +JNIEXPORT int jio_printf(const char *fmt, ...) { int len; va_list args; va_start(args, fmt); diff --git a/src/share/vm/prims/jvm.h b/src/share/vm/prims/jvm.h index ec8ca4049a6371d9776817776c710c07dacf1033..07097af3cc50d63e0cfc5c72fc7a4c1b189a2e04 100644 --- a/src/share/vm/prims/jvm.h +++ b/src/share/vm/prims/jvm.h @@ -1417,16 +1417,16 @@ JVM_GetHostName(char* name, int namelen); * BE CAREFUL! The following functions do not implement the * full feature set of standard C printf formats. */ -int +JNIEXPORT int jio_vsnprintf(char *str, size_t count, const char *fmt, va_list args); -int +JNIEXPORT int jio_snprintf(char *str, size_t count, const char *fmt, ...); -int +JNIEXPORT int jio_fprintf(FILE *, const char *fmt, ...); -int +JNIEXPORT int jio_vfprintf(FILE *, const char *fmt, va_list args);