Define JNIEXPORT as visibility default with GCC? (original) (raw)
Jeremy Manson jeremymanson at google.com
Mon Feb 11 18:26:07 UTC 2013
- Previous message: hg: jdk8/tl/jdk: 8007420: add test for 6805864 to com/sun/jdi, add test for 7182152 to java/lang/instrument
- Next message: Define JNIEXPORT as visibility default with GCC?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi folks,
Pardon if this has come up before; a quick search didn't indicate anything, but the mailing list archives are kind of hard to search.
I wonder if it makes sense to define JNIEXPORT as meaning attribute ((visibility ("default"))) when compiling with gcc. Currently, anyone building JNI code with -fvisibility=hidden and a stock Oracle JDK is at a loss: their JNI exports will be hidden along with everything else.
I notice that both IcedTea and OS X have made this change independently, and it has been added to Hotspot's JNIEXPORT definition (so HS can be built with -fvisibility=hidden), but the change isn't present in the latest JDK8 bits:
http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/933742f4bb4c/src/solaris/javavm/export/jni_md.h
The workaround is pretty ugly: people who want to use -fvisibility=hidden have to redefine JNIEXPORT. Upstream, it would be a pretty simple change to jni_md.h, along the lines of:
#if defined(GNUC) && GNUC >= 4 #define JNIEXPORT attribute ((visibility ("default"))) #else #define JNIEXPORT #endif
Any thoughts?
Jeremy
- Previous message: hg: jdk8/tl/jdk: 8007420: add test for 6805864 to com/sun/jdi, add test for 7182152 to java/lang/instrument
- Next message: Define JNIEXPORT as visibility default with GCC?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]