pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Prelimary clang fix for OpenJDK



Hi all,
the attached patch is the first step toward fixing the OpenJDK build
with Clang. It is not complete yet, nmethod.cpp needs to be handled
differently as it is plainly bogus. It doesn't solve the problem of
missing libstdc++.so and libgcc_s.so dependencies of the bootstrap kit.
Nor does it fix the problem of parallel GC failing to reserve memory
under load, but that issue is not compiler specific.

Joerg
Index: lang/openjdk7/Makefile
==================================================================
--- lang/openjdk7/Makefile
+++ lang/openjdk7/Makefile
@@ -170,10 +170,12 @@
        ${LN} -s ${JDK_BOOTDIR}/include ${ALT_BOOTDIR}/include
        ${LN} -s ${JDK_BOOTDIR}/lib ${ALT_BOOTDIR}/lib
        printf '#!/bin/sh\nexec %s/bin/java -mx256m "$$@"\n' \
            ${JDK_BOOTDIR} > ${ALT_BOOTDIR}/bin/java
 .else
+       cp ${.CURDIR}/hacks/libgcc_s.so.1.0 
${ALT_BOOTDIR}/jre/lib/amd64/libgcc_s.so.1
+       cp ${.CURDIR}/hacks/libstdc++.so.7.1 
${ALT_BOOTDIR}/jre/lib/amd64/libstdc++.so.7
        mv ${ALT_BOOTDIR}/bin/java ${ALT_BOOTDIR}/bin/java-real
        printf '#!/bin/sh\nexec %s/bin/java-real -mx256m "$$@"\n' \
            ${ALT_BOOTDIR} > ${ALT_BOOTDIR}/bin/java
 .endif
        chmod a+x ${ALT_BOOTDIR}/bin/java

Index: lang/openjdk7/distinfo
==================================================================
--- lang/openjdk7/distinfo
+++ lang/openjdk7/distinfo
@@ -65,11 +65,11 @@
 Size (openjdk7/rhino1_7R3.zip) = 4651597 bytes
 SHA1 (patch-Makefile) = a9e415d19c2a8edb96a60ffdf81c804476a8e2f6
 SHA1 (patch-aa) = 69da3f571d37bb461f1d3edb342a56e63a2872af
 SHA1 (patch-ab) = 35d5a4a4aa32f8b92ba82f583a2d31f2b7af7998
 SHA1 (patch-ac) = 7a7853d8d0fd451e64a6fc39c28bd2bd8173adc6
-SHA1 (patch-ae) = 0bc7f2cf43835ce7d1e30e09a570e46a952a03e8
+SHA1 (patch-ae) = 3957e011819bf49adc4bb1bb6d1c00b7afad6beb
 SHA1 (patch-ag) = 83ec8015b8e0f2657f4289cea84bdc9b6d0c5e88
 SHA1 (patch-ah) = 2d358879d2851fb2fb8161c5a1ac5a93aa7a69c2
 SHA1 (patch-ai) = bee1b592401d15a91e7d926c9011bcd0d83fb5ec
 SHA1 (patch-ak) = 45beaba484a74fb47f74bec786c418781dc478e2
 SHA1 (patch-al) = d174343a5baa8a73d18ff1020cb0cc19e6714175
@@ -115,12 +115,17 @@
 SHA1 (patch-hotspot_src_os__cpu_solaris__x86_vm_threadLS__solaris__x86.hpp) = 
062a3cf87793867b68d497b75f5fef55ed6e1666
 SHA1 (patch-hotspot_src_os_posix_vm_os__posix.cpp) = 
da6017447c5537048fcf04198c400f96568dc6e2
 SHA1 (patch-hotspot_src_os_solaris_dtrace_jhelper.d) = 
43ae9934ce7cf477f7968bcf9ba3c57e98f65cc8
 SHA1 (patch-hotspot_src_os_solaris_vm_decoder__solaris.cpp) = 
3be8a96525ead1df18a40b18dccfad4ef2765d47
 SHA1 (patch-hotspot_src_os_solaris_vm_os__solaris.cpp) = 
ea09ffd080fcf4c12b0b69cb622ee3945000cb68
+SHA1 (patch-hotspot_src_share_vm_code_nmethod.cpp) = 
ed3a768e71d48263bd5ff8c2d2d9318e4c200325
 SHA1 (patch-hotspot_src_share_vm_code_relocInfo.hpp) = 
c02b2bb64129113b5812feb02033e12969bafe04
+SHA1 (patch-hotspot_src_share_vm_memory_allocation.cpp) = 
29f0189545e0c352705338fea965d3d6aa5f5d08
+SHA1 (patch-hotspot_src_share_vm_oops_klass.cpp) = 
afc7a3bb320d33e1c209e27ff3573264b2f841b9
 SHA1 (patch-hotspot_src_share_vm_opto_node.cpp) = 
869d8ec9dc6dae6e0b8a23fe44f2583747059553
+SHA1 (patch-hotspot_src_share_vm_services_memRecorder.hpp) = 
4c06319b1a050e80514dcd915d19049b3c317a2e
+SHA1 (patch-hotspot_src_share_vm_services_memTrackWorker.cpp) = 
6206c862a3c73f5f8dbb809ccea5512a34cd3fd6
 SHA1 (patch-hotspot_src_share_vm_utilities_globalDefinitions__gcc.hpp) = 
fe40909864fc561495b1e15a5bc6c7c6373830b2
 SHA1 (patch-hotspot_src_share_vm_utilities_hashtable.cpp) = 
30084c64570e420fbda8fbd36fcd4aa2641eab8e
 SHA1 (patch-jdk_make_com_sun_Makefile) = 
5826c64eb1971d69e8b874d6b8a60d25e0d02c5b
 SHA1 (patch-jdk_make_com_sun_java_pack_Makefile) = 
bb258d4c2235ea780810d980b84b90a0380f3b46
 SHA1 (patch-jdk_make_com_sun_jmx_Makefile) = 
65fa2d6191311766cdb5d9933d760cae7955f664

Index: lang/openjdk7/patches/patch-ae
==================================================================
--- lang/openjdk7/patches/patch-ae
+++ lang/openjdk7/patches/patch-ae
@@ -1,22 +1,34 @@
 $NetBSD: patch-ae,v 1.5 2013/06/15 09:31:05 jperkin Exp $
 
 Additional BSD support.
 
---- hotspot/make/bsd/makefiles/gcc.make.orig   2013-05-29 03:57:57.000000000 
+0000
+--- hotspot/make/bsd/makefiles/gcc.make.orig   2014-01-01 05:50:04.000000000 
+0000
 +++ hotspot/make/bsd/makefiles/gcc.make
-@@ -242,6 +242,15 @@ MAPFLAG = -Xlinker --version-script=FILE
+@@ -116,7 +116,6 @@ CFLAGS += $(VM_PICFLAG)
+ CFLAGS += -fno-rtti
+ CFLAGS += -fno-exceptions
+ CFLAGS += -pthread
+-CFLAGS += -fcheck-new
+ # version 4 and above support fvisibility=hidden (matches jni_x86.h file)
+ # except 4.1.2 gives pointless warnings that can't be disabled (afaik)
+ ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 
\) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
+@@ -214,7 +213,7 @@ endif
+ 
+ # Flags for generating make dependency flags.
+ ifneq ("${CC_VER_MAJOR}", "2")
+-DEPFLAGS = -fpch-deps -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d)
++DEPFLAGS = -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d)
+ endif
+ 
+ # -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp.
+@@ -243,6 +242,10 @@ MAPFLAG = -Xlinker --version-script=FILE
  #
  # Shared Library
  #
 +
-+ifeq ($(OS_VENDOR), NetBSD)
-+# XXX tnn fixme: -lgcc_s seems to be needed on NetBSD.
-+LFLAGS += -lgcc_s
-+endif
-+
 +# XXX tnn fixme: this probably should go someplace else.
 +CFLAGS += -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
 +
  ifeq ($(OS_VENDOR), Darwin)
    # Standard linker flags
    LFLAGS +=

ADDED    lang/openjdk7/patches/patch-hotspot_src_share_vm_code_nmethod.cpp
Index: lang/openjdk7/patches/patch-hotspot_src_share_vm_code_nmethod.cpp
==================================================================
--- lang/openjdk7/patches/patch-hotspot_src_share_vm_code_nmethod.cpp
+++ lang/openjdk7/patches/patch-hotspot_src_share_vm_code_nmethod.cpp
@@ -0,0 +1,12 @@
+$NetBSD$
+
+--- hotspot/src/share/vm/code/nmethod.cpp.orig 2014-02-10 21:07:15.000000000 
+0000
++++ hotspot/src/share/vm/code/nmethod.cpp
+@@ -787,6 +787,7 @@ nmethod::nmethod(
+ }
+ #endif // def HAVE_DTRACE_H
+ 
++#pragma GCC diagnostic ignored "-Wnew-returns-null"
+ void* nmethod::operator new(size_t size, int nmethod_size) {
+   // Always leave some room in the CodeCache for I2C/C2I adapters
+   if (CodeCache::largest_free_block() < CodeCacheMinimumFreeSpace) return 
NULL;

ADDED    lang/openjdk7/patches/patch-hotspot_src_share_vm_memory_allocation.cpp
Index: lang/openjdk7/patches/patch-hotspot_src_share_vm_memory_allocation.cpp
==================================================================
--- lang/openjdk7/patches/patch-hotspot_src_share_vm_memory_allocation.cpp
+++ lang/openjdk7/patches/patch-hotspot_src_share_vm_memory_allocation.cpp
@@ -0,0 +1,31 @@
+$NetBSD$
+
+--- hotspot/src/share/vm/memory/allocation.cpp.orig    2014-01-25 
07:34:05.000000000 +0000
++++ hotspot/src/share/vm/memory/allocation.cpp
+@@ -46,9 +46,9 @@
+ # include "os_bsd.inline.hpp"
+ #endif
+ 
+-void* StackObj::operator new(size_t size)  { ShouldNotCallThis(); return 0; };
++void* StackObj::operator new(size_t size)  { ShouldNotCallThis(); 
__builtin_unreachable(); };
+ void  StackObj::operator delete(void* p)   { ShouldNotCallThis(); };
+-void* _ValueObj::operator new(size_t size)  { ShouldNotCallThis(); return 0; 
};
++void* _ValueObj::operator new(size_t size)  { ShouldNotCallThis(); 
__builtin_unreachable(); };
+ void  _ValueObj::operator delete(void* p)   { ShouldNotCallThis(); };
+ 
+ void* ResourceObj::operator new(size_t size, allocation_type type, MEMFLAGS 
flags) {
+@@ -414,12 +414,12 @@ Arena::~Arena() {
+ 
+ void* Arena::operator new(size_t size) {
+   assert(false, "Use dynamic memory type binding");
+-  return NULL;
++  __builtin_unreachable();
+ }
+ 
+ void* Arena::operator new (size_t size, const std::nothrow_t&  
nothrow_constant) {
+   assert(false, "Use dynamic memory type binding");
+-  return NULL;
++  __builtin_unreachable();
+ }
+ 
+   // dynamic memory type binding

ADDED    lang/openjdk7/patches/patch-hotspot_src_share_vm_oops_klass.cpp
Index: lang/openjdk7/patches/patch-hotspot_src_share_vm_oops_klass.cpp
==================================================================
--- lang/openjdk7/patches/patch-hotspot_src_share_vm_oops_klass.cpp
+++ lang/openjdk7/patches/patch-hotspot_src_share_vm_oops_klass.cpp
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- hotspot/src/share/vm/oops/klass.cpp.orig   2014-02-10 20:57:51.000000000 
+0000
++++ hotspot/src/share/vm/oops/klass.cpp
+@@ -189,7 +189,7 @@ void* Klass_vtbl::operator new(size_t ig
+   // after the return of permanent_obj_allocate().
+   klassOop k =
+     (klassOop) CollectedHeap::permanent_obj_allocate_no_klass_install(klass,
+-      size, CHECK_NULL);
++      size, THREAD);
+   return k->klass_part();
+ }
+ 

ADDED    
lang/openjdk7/patches/patch-hotspot_src_share_vm_services_memRecorder.hpp
Index: lang/openjdk7/patches/patch-hotspot_src_share_vm_services_memRecorder.hpp
==================================================================
--- lang/openjdk7/patches/patch-hotspot_src_share_vm_services_memRecorder.hpp
+++ lang/openjdk7/patches/patch-hotspot_src_share_vm_services_memRecorder.hpp
@@ -0,0 +1,15 @@
+$NetBSD$
+
+--- hotspot/src/share/vm/services/memRecorder.hpp.orig 2014-01-25 
07:34:05.000000000 +0000
++++ hotspot/src/share/vm/services/memRecorder.hpp
+@@ -61,7 +61,9 @@ template <class E, int SIZE> class Fixed
+ 
+   void* operator new(size_t size) {
+     assert(false, "use nothrow version");
+-    return NULL;
++#ifdef __clang__
++    __builtin_unreachable();
++#endif
+   }
+ 
+   void operator delete(void* p) {

ADDED    
lang/openjdk7/patches/patch-hotspot_src_share_vm_services_memTrackWorker.cpp
Index: 
lang/openjdk7/patches/patch-hotspot_src_share_vm_services_memTrackWorker.cpp
==================================================================
--- lang/openjdk7/patches/patch-hotspot_src_share_vm_services_memTrackWorker.cpp
+++ lang/openjdk7/patches/patch-hotspot_src_share_vm_services_memTrackWorker.cpp
@@ -0,0 +1,14 @@
+$NetBSD$
+
+--- hotspot/src/share/vm/services/memTrackWorker.cpp.orig      2014-02-10 
21:02:48.000000000 +0000
++++ hotspot/src/share/vm/services/memTrackWorker.cpp
+@@ -64,8 +64,7 @@ MemTrackWorker::~MemTrackWorker() {
+ }
+ 
+ void* MemTrackWorker::operator new(size_t size) {
+-  assert(false, "use nothrow version");
+-  return NULL;
++  abort();
+ }
+ 
+ void* MemTrackWorker::operator new(size_t size, const std::nothrow_t& 
nothrow_constant) {



Home | Main Index | Thread Index | Old Index