Define JNIEXPORT as visibility default with GCC?
jeremymanson at google.com
Mon Feb 11 10:26:07 PST 2013
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
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")))
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the hotspot-runtime-dev