提交 e02b7391 编写于 作者: C coleenp

6588413: Use -fvisibility=hidden for gcc compiles

Summary: Add option for gcc 4 and above, define JNIEXPORT and JNIIMPORT to visibility=default, add for jio_snprintf and others since -fvisibility=hidden overrides --version-script definitions.
Reviewed-by: kamg, never
上级 4994604f
......@@ -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
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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
......
......@@ -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;
......
......@@ -29,11 +29,6 @@
#include <signal.h>
/*
* 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
......
......@@ -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.
//
......
......@@ -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) {
......
......@@ -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,
......
......@@ -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,
......
......@@ -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,
......
......@@ -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();
......
......@@ -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
......
......@@ -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.
......
......@@ -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);
......
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册