diff --git a/classpath/java-nio.cpp b/classpath/java-nio.cpp index a7046f8957..66904a26ca 100644 --- a/classpath/java-nio.cpp +++ b/classpath/java-nio.cpp @@ -397,7 +397,7 @@ Java_java_nio_channels_SocketChannel_natFinishConnect(JNIEnv *e, } else if (einProgress(error)) { return false; } else if (error != 0) { - throwIOException(e); + throwIOException(e, errorString(e, error)); } return true; } diff --git a/classpath/java/lang/Thread.java b/classpath/java/lang/Thread.java index 2e494c850c..fec432b34e 100644 --- a/classpath/java/lang/Thread.java +++ b/classpath/java/lang/Thread.java @@ -186,7 +186,11 @@ public class Thread implements Runnable { } public StackTraceElement[] getStackTrace() { - return Throwable.resolveTrace(getStackTrace(peer)); + long p = peer; + if (p == 0) { + return new StackTraceElement[0]; + } + return Throwable.resolveTrace(getStackTrace(p)); } private static native Object getStackTrace(long peer); diff --git a/classpath/jni-util.h b/classpath/jni-util.h index d144e704db..cbf33feda9 100644 --- a/classpath/jni-util.h +++ b/classpath/jni-util.h @@ -19,11 +19,12 @@ #if (defined __MINGW32__) || (defined _MSC_VER) # define PLATFORM_WINDOWS # define PATH_SEPARATOR ';' -# define JNIEXPORT __declspec(dllexport) +# define JNIEXPORT __declspec(dllexport) __attribute__ ((externally_visible)) #else # define PLATFORM_POSIX # define PATH_SEPARATOR ':' -# define JNIEXPORT __attribute__ ((visibility("default"))) +# define JNIEXPORT __attribute__ ((visibility("default"))) \ + __attribute__ ((externally_visible)) #endif #ifdef _MSC_VER diff --git a/src/boot.cpp b/src/boot.cpp index e313b6c553..c2980dc48e 100644 --- a/src/boot.cpp +++ b/src/boot.cpp @@ -27,10 +27,10 @@ extern "C" void __cxa_pure_virtual(void) { abort(); } #ifdef BOOT_IMAGE #if (defined __MINGW32__) || (defined _MSC_VER) -# define EXPORT __declspec(dllexport) +# define EXPORT __declspec(dllexport) __attribute__ ((externally_visible)) # define SYMBOL(x) binary_bootimage_bin_##x #else -# define EXPORT __attribute__ ((visibility("default"))) +# define EXPORT __attribute__ ((visibility("default"))) __attribute__ ((externally_visible)) # define SYMBOL(x) _binary_bootimage_bin_##x #endif @@ -53,10 +53,10 @@ extern "C" { #ifdef BOOT_CLASSPATH #if (defined __MINGW32__) || (defined _MSC_VER) -# define EXPORT __declspec(dllexport) +# define EXPORT __declspec(dllexport) __attribute__ ((externally_visible)) # define SYMBOL(x) binary_classpath_jar_##x #else -# define EXPORT __attribute__ ((visibility("default"))) +# define EXPORT __attribute__ ((visibility("default"))) __attribute__ ((externally_visible)) # define SYMBOL(x) _binary_classpath_jar_##x #endif diff --git a/src/common.h b/src/common.h index ac7a4e6c21..0257237c5f 100644 --- a/src/common.h +++ b/src/common.h @@ -90,10 +90,10 @@ typedef uint64_t uintptr_t; #undef JNIEXPORT #ifdef PLATFORM_WINDOWS -# define JNIEXPORT __declspec(dllexport) +# define JNIEXPORT __declspec(dllexport) __attribute__ ((externally_visible)) # define PATH_SEPARATOR ';' #else -# define JNIEXPORT __attribute__ ((visibility("default"))) +# define JNIEXPORT __attribute__ ((visibility("default"))) __attribute__ ((externally_visible)) # define PATH_SEPARATOR ':' #endif