diff --git a/makefile b/makefile index cde9ffff5b..10cc18eb47 100644 --- a/makefile +++ b/makefile @@ -86,9 +86,11 @@ ifneq ($(openjdk),) openjdk-jar-dep = $(build)/openjdk-jar.dep classpath-jar-dep = $(openjdk-jar-dep) javahome = $(embed-prefix)/javahomeJar - javahome-files = lib/zi lib/currency.data + javahome-files = lib/zi ifeq ($(platform),windows) javahome-files += lib/tzmappings + else + javahome-files += lib/currency.data endif javahome-object = $(build)/javahome-jar.o else @@ -835,6 +837,11 @@ $(openjdk-headers-dep): @mkdir -p $(dir $(@)) $(javah) -d $(build)/openjdk -bootclasspath $(boot-classpath) \ $(openjdk-headers-classes) +ifeq ($(platform),windows) + sed 's/^#ifdef _WIN64/#if 1/' \ + < "$(openjdk-src)/windows/native/java/net/net_util_md.h" \ + > $(build)/openjdk/net_util_md.h +endif @touch $(@) $(openjdk-jar-dep): diff --git a/openjdk-src.mk b/openjdk-src.mk index c3985492ce..b11819bd70 100644 --- a/openjdk-src.mk +++ b/openjdk-src.mk @@ -131,14 +131,14 @@ openjdk-headers-classes = \ sun.nio.ch.Net \ sun.nio.ch.ServerSocketChannelImpl \ sun.nio.ch.SocketChannelImpl \ - sun.nio.ch.EPollArrayWrapper \ + sun.nio.ch.SocketDispatcher \ sun.nio.ch.PollArrayWrapper \ - sun.nio.ch.InheritedChannel \ sun.nio.ch.NativeThread \ sun.reflect.ConstantPool \ sun.reflect.NativeConstructorAccessorImpl \ sun.reflect.NativeMethodAccessorImpl \ sun.reflect.Reflection \ + sun.security.provider.NativeSeedGenerator # todo: set properties according to architecture targeted and OpenJDK # version used: @@ -183,19 +183,38 @@ ifeq ($(platform),windows) $(openjdk-src)/windows/native/java/io/WinNTFileSystem_md.c \ $(openjdk-src)/windows/native/java/lang/java_props_md.c \ $(openjdk-src)/windows/native/java/lang/ProcessEnvironment_md.c \ + $(openjdk-src)/windows/native/java/net/net_util_md.c \ $(openjdk-src)/windows/native/java/net/InetAddressImplFactory.c \ $(openjdk-src)/windows/native/java/net/Inet4AddressImpl.c \ $(openjdk-src)/windows/native/java/net/Inet6AddressImpl.c \ $(openjdk-src)/windows/native/java/net/NetworkInterface.c \ + $(openjdk-src)/windows/native/java/net/NetworkInterface_winXP.c \ + $(openjdk-src)/windows/native/java/net/NetworkInterface_win9x.c \ + $(openjdk-src)/windows/native/java/net/SocketInputStream.c \ + $(openjdk-src)/windows/native/java/net/SocketOutputStream.c \ $(openjdk-src)/windows/native/java/util/WindowsPreferences.c \ $(openjdk-src)/windows/native/java/util/logging.c \ $(openjdk-src)/windows/native/java/util/TimeZone_md.c \ $(openjdk-src)/windows/native/sun/io/Win32ErrorMode.c \ + $(openjdk-src)/windows/native/sun/nio/ch/DatagramChannelImpl.c \ + $(openjdk-src)/windows/native/sun/nio/ch/DatagramDispatcher.c \ + $(openjdk-src)/windows/native/sun/nio/ch/FileChannelImpl.c \ + $(openjdk-src)/windows/native/sun/nio/ch/FileDispatcher.c \ + $(openjdk-src)/windows/native/sun/nio/ch/FileKey.c \ + $(openjdk-src)/windows/native/sun/nio/ch/IOUtil.c \ + $(openjdk-src)/windows/native/sun/nio/ch/Net.c \ + $(openjdk-src)/windows/native/sun/nio/ch/ServerSocketChannelImpl.c \ + $(openjdk-src)/windows/native/sun/nio/ch/SocketChannelImpl.c \ + $(openjdk-src)/windows/native/sun/nio/ch/SocketDispatcher.c \ + $(openjdk-src)/windows/native/sun/nio/ch/WindowsSelectorImpl.c \ + $(openjdk-src)/windows/native/sun/security/provider/WinCAPISeedGenerator.c openjdk-headers-classes += \ - sun.io.Win32ErrorMode + sun.io.Win32ErrorMode \ + sun.nio.ch.WindowsSelectorImpl \ - openjdk-cflags += "-I$(openjdk-src)/windows/javavm/export" \ + openjdk-cflags += \ + "-I$(openjdk-src)/windows/javavm/export" \ "-I$(openjdk-src)/windows/native/common" \ "-I$(openjdk-src)/windows/native/java/io" \ "-I$(openjdk-src)/windows/native/java/net" \ @@ -203,7 +222,10 @@ ifeq ($(platform),windows) "-I$(openjdk-src)/windows/javavm/include" \ "-I$(root)/win32/include" \ -D_JNI_IMPLEMENTATION_ \ - -D_JAVASOFT_WIN32_TYPEDEF_MD_H_ + -D_JAVASOFT_WIN32_TYPEDEF_MD_H_ \ + -D_WINSOCK2API_ \ + -Ds6_words=_s6_words \ + -Ds6_bytes=_s6_bytes else openjdk-sources += \ $(openjdk-src)/solaris/native/common/jdk_util_md.c \ @@ -251,7 +273,9 @@ else $(openjdk-src)/solaris/native/sun/nio/ch/NativeThread.c \ openjdk-headers-classes += \ - java.io.UnixFileSystem + java.io.UnixFileSystem \ + sun.nio.ch.InheritedChannel \ + sun.nio.ch.EPollArrayWrapper \ openjdk-cflags += "-I$(openjdk-src)/solaris/javavm/export" \ "-I$(openjdk-src)/solaris/native/common" \ diff --git a/src/main.cpp b/src/main.cpp index 7bc5e85aa9..bafca2a515 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -59,6 +59,11 @@ class RuntimeArray { // ourselves: extern "C" void __cxa_pure_virtual(void) { abort(); } +// we link against a System implmentation, which requires this at link +// time, but it should not be used at runtime: +extern "C" uint64_t +vmNativeCall(void*, void*, unsigned, unsigned) { abort(); } + #endif // BOOT_LIBRARY namespace { @@ -111,19 +116,21 @@ mainClass(const char* jar) Finder* finder = makeFinder(system, &allocator, jar, 0); - const char* result = 0; + char* result = 0; System::Region* region = finder->find("META-INF/MANIFEST.MF"); if (region) { unsigned start = 0; unsigned length; while (readLine(region->start(), region->length(), &start, &length)) { + const unsigned PrefixLength = 12; if (strncmp("Main-Class: ", reinterpret_cast - (region->start() + start), 12) == 0) + (region->start() + start), PrefixLength) == 0) { - result = strndup - (reinterpret_cast(region->start() + start + 12), - length - 12); + result = static_cast(malloc(length + 1 - PrefixLength)); + memcpy(result, region->start() + start + PrefixLength, + length - PrefixLength); + result[length - PrefixLength] = 0; break; } start += length; diff --git a/src/openjdk/my_net_util.c b/src/openjdk/my_net_util.c index 13eea537ae..11728df231 100644 --- a/src/openjdk/my_net_util.c +++ b/src/openjdk/my_net_util.c @@ -1,2 +1,20 @@ #define JNI_OnLoad net_JNI_OnLoad #include "net_util.c" + +#ifdef _WIN32 + +#undef IN6_SET_ADDR_UNSPECIFIED +#define IN6_SET_ADDR_UNSPECIFIED(a) \ + memset((a)->s6_bytes,0,sizeof(struct in6_addr)) + +void +IN6ADDR_SETANY(struct sockaddr_in6 *a) +{ + a->sin6_family = AF_INET6; + a->sin6_port = 0; + a->sin6_flowinfo = 0; + IN6_SET_ADDR_UNSPECIFIED(&a->sin6_addr); + a->sin6_scope_id = 0; +} + +#endif