re PR libgcj/30999 (support for GCC4.0's fvisibility option in JNIEXPORT macro)
authorJan Nijtmans <nijtmans@users.sourceforge.net>
Thu, 28 Jun 2007 19:35:25 +0000 (19:35 +0000)
committerTom Tromey <tromey@gcc.gnu.org>
Thu, 28 Jun 2007 19:35:25 +0000 (19:35 +0000)
2007-06-28  Jan Nijtmans  <nijtmans@users.sourceforge.net>

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
libjava/include/jni_md.h

index 5189d15f2bacf50074d28ffebd33e166c168e8d6..c6db9fb941324733c8e8a989e3c9c61e38e708c4 100644 (file)
@@ -1,3 +1,10 @@
+2007-06-28  Jan Nijtmans  <nijtmans@users.sourceforge.net>
+
+       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  <a.tobler@schweiz.org>
 
        * testsuite/libjava.jvmti/jvmti-interp.exp (gij_jvmti_test_one): Pass
index 6ea90ab4c36d6e2af43d83967680d9c5faf18e11..f806bac517989c3638c7ac21db18d1d152160387 100644 (file)
@@ -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__ */