diff --git a/classpath/jni-util.h b/classpath/jni-util.h index cbf33feda9..c1dde192b9 100644 --- a/classpath/jni-util.h +++ b/classpath/jni-util.h @@ -16,16 +16,26 @@ #include "string.h" #undef JNIEXPORT + #if (defined __MINGW32__) || (defined _MSC_VER) # define PLATFORM_WINDOWS # define PATH_SEPARATOR ';' -# define JNIEXPORT __declspec(dllexport) __attribute__ ((externally_visible)) -#else +# ifdef __MINGW32__ +# define JNIEXPORT __declspec(dllexport) \ + __attribute__ ((externally_visible)) +# else // not __MINGW32__ +# define JNIEXPORT __declspec(dllexport) +# endif // not __MINGW32__ +#else // not (defined __MINGW32__) || (defined _MSC_VER) # define PLATFORM_POSIX # define PATH_SEPARATOR ':' -# define JNIEXPORT __attribute__ ((visibility("default"))) \ +# ifdef __APPLE__ +# define JNIEXPORT __attribute__ ((visibility("default"))) +# else // not __APPLE__ +# define JNIEXPORT __attribute__ ((visibility("default"))) \ __attribute__ ((externally_visible)) -#endif +# endif // not __APPLE__ +#endif // not (defined __MINGW32__) || (defined _MSC_VER) #ifdef _MSC_VER diff --git a/src/boot.cpp b/src/boot.cpp index c2980dc48e..a6be292ab7 100644 --- a/src/boot.cpp +++ b/src/boot.cpp @@ -27,12 +27,21 @@ extern "C" void __cxa_pure_virtual(void) { abort(); } #ifdef BOOT_IMAGE #if (defined __MINGW32__) || (defined _MSC_VER) -# define EXPORT __declspec(dllexport) __attribute__ ((externally_visible)) +# ifdef __MINGW32__ +# define EXPORT __declspec(dllexport) __attribute__ ((externally_visible)) +# else // not __MINGW32__ +# define EXPORT __declspec(dllexport) +# endif // not __MINGW32__ # define SYMBOL(x) binary_bootimage_bin_##x -#else -# define EXPORT __attribute__ ((visibility("default"))) __attribute__ ((externally_visible)) +#else // not (defined __MINGW32__) || (defined _MSC_VER) +# ifdef __APPLE__ +# define EXPORT __attribute__ ((visibility("default"))) +# else // not __APPLE__ +# define EXPORT __attribute__ ((visibility("default"))) \ + __attribute__ ((externally_visible)) +# endif // not __APPLE__ # define SYMBOL(x) _binary_bootimage_bin_##x -#endif +#endif // not (defined __MINGW32__) || (defined _MSC_VER) extern "C" { diff --git a/src/common.h b/src/common.h index 0257237c5f..b090efd9f8 100644 --- a/src/common.h +++ b/src/common.h @@ -92,10 +92,15 @@ typedef uint64_t uintptr_t; #ifdef PLATFORM_WINDOWS # define JNIEXPORT __declspec(dllexport) __attribute__ ((externally_visible)) # define PATH_SEPARATOR ';' -#else -# define JNIEXPORT __attribute__ ((visibility("default"))) __attribute__ ((externally_visible)) +#else // not PLATFORM_WINDOWS +# ifdef __APPLE__ +# define JNIEXPORT __attribute__ ((visibility("default"))) +# else // not __APPLE__ +# define JNIEXPORT __attribute__ ((visibility("default"))) \ + __attribute__ ((externally_visible)) +# endif // not __APPLE__ # define PATH_SEPARATOR ':' -#endif +#endif // not PLATFORM_WINDOWS #if (defined ARCH_x86_32) || (defined ARCH_powerpc) || (defined ARCH_arm) # define LD "ld"