From c9640b919d6b96fc42820f7876292c3af260f030 Mon Sep 17 00:00:00 2001 From: Jan Nijtmans Date: Thu, 28 Jun 2007 19:35:25 +0000 Subject: [PATCH] re PR libgcj/30999 (support for GCC4.0's fvisibility option in JNIEXPORT macro) 2007-06-28 Jan Nijtmans PR libgcj/30999: * jni_md.h: Add the possibility to compile jni code with. -fvisibility=hidden. This causes all symbols to be hidden except the JNI functions which need to be exported. From-SVN: r126090 --- libjava/ChangeLog | 7 +++++++ libjava/include/jni_md.h | 23 +++++++++++++---------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 5189d15f2ba..c6db9fb9413 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,10 @@ +2007-06-28 Jan Nijtmans + + PR libgcj/30999: + * jni_md.h: Add the possibility to compile jni code with. + -fvisibility=hidden. This causes all symbols to be hidden + except the JNI functions which need to be exported. + 2007-06-28 Andreas Tobler * testsuite/libjava.jvmti/jvmti-interp.exp (gij_jvmti_test_one): Pass diff --git a/libjava/include/jni_md.h b/libjava/include/jni_md.h index 6ea90ab4c36..f806bac5179 100644 --- a/libjava/include/jni_md.h +++ b/libjava/include/jni_md.h @@ -124,6 +124,19 @@ typedef uint16_t jchar; #define JNICALL __stdcall +#else /* !( _WIN32 || __WIN32__ || WIN32) */ + +#define JNIIMPORT +#if defined(__GNUC__) && __GNUC__ > 3 +#define JNIEXPORT __attribute__ ((visibility("default"))) +#else +#define JNIEXPORT +#endif + +#define JNICALL + +#endif /* !( _WIN32 || __WIN32__ || WIN32) */ + /* These defines apply to symbols in libgcj */ #ifdef __GCJ_DLL__ # ifdef __GCJ_JNI_IMPL__ @@ -135,14 +148,4 @@ typedef uint16_t jchar; # define _CLASSPATH_JNIIMPEXP #endif /* __GCJ_DLL__ */ -#else /* !( _WIN32 || __WIN32__ || WIN32) */ - -#define JNIIMPORT -#define JNIEXPORT -#define JNICALL -#define _CLASSPATH_JNIIMPEXP - -#endif /* !( _WIN32 || __WIN32__ || WIN32) */ - - #endif /* __GCJ_JNI_MD_H__ */ -- 2.30.2