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..181ad56161 100644 --- a/classpath/jni-util.h +++ b/classpath/jni-util.h @@ -16,15 +16,16 @@ #include "string.h" #undef JNIEXPORT + #if (defined __MINGW32__) || (defined _MSC_VER) # define PLATFORM_WINDOWS # define PATH_SEPARATOR ';' # define JNIEXPORT __declspec(dllexport) -#else +#else // not (defined __MINGW32__) || (defined _MSC_VER) # define PLATFORM_POSIX # define PATH_SEPARATOR ':' # define JNIEXPORT __attribute__ ((visibility("default"))) -#endif +#endif // not (defined __MINGW32__) || (defined _MSC_VER) #ifdef _MSC_VER diff --git a/src/boot.cpp b/src/boot.cpp index e313b6c553..b46bac72fb 100644 --- a/src/boot.cpp +++ b/src/boot.cpp @@ -24,13 +24,17 @@ extern "C" void __cxa_pure_virtual(void) { abort(); } #endif // not _MSC_VER +#if (defined __MINGW32__) || (defined _MSC_VER) +# define EXPORT __declspec(dllexport) +#else +# define EXPORT __attribute__ ((visibility("default"))) +#endif + #ifdef BOOT_IMAGE #if (defined __MINGW32__) || (defined _MSC_VER) -# define EXPORT __declspec(dllexport) # define SYMBOL(x) binary_bootimage_bin_##x #else -# define EXPORT __attribute__ ((visibility("default"))) # define SYMBOL(x) _binary_bootimage_bin_##x #endif @@ -53,10 +57,8 @@ extern "C" { #ifdef BOOT_CLASSPATH #if (defined __MINGW32__) || (defined _MSC_VER) -# define EXPORT __declspec(dllexport) # define SYMBOL(x) binary_classpath_jar_##x #else -# define EXPORT __attribute__ ((visibility("default"))) # define SYMBOL(x) _binary_classpath_jar_##x #endif diff --git a/src/common.h b/src/common.h index 7c92f85f2c..744a507822 100644 --- a/src/common.h +++ b/src/common.h @@ -92,10 +92,10 @@ typedef uint64_t uintptr_t; #ifdef PLATFORM_WINDOWS # define JNIEXPORT __declspec(dllexport) # define PATH_SEPARATOR ';' -#else +#else // not PLATFORM_WINDOWS # define JNIEXPORT __attribute__ ((visibility("default"))) # define PATH_SEPARATOR ':' -#endif +#endif // not PLATFORM_WINDOWS #if (defined ARCH_x86_32) || (defined ARCH_powerpc) || (defined ARCH_arm) # define LD "ld"