NetBSD Problem Report #48693
From wiz@yt.nih.at Mon Mar 31 08:54:22 2014
Return-Path: <wiz@yt.nih.at>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
(using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits))
(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
by mollari.NetBSD.org (Postfix) with ESMTPS id 777DBA5806
for <gnats-bugs@gnats.NetBSD.org>; Mon, 31 Mar 2014 08:54:22 +0000 (UTC)
Message-Id: <20140331085347.7FC482AC0FE@yt.nih.at>
Date: Mon, 31 Mar 2014 10:53:47 +0200 (CEST)
From: Thomas Klausner <wiz@NetBSD.org>
Reply-To: Thomas Klausner <wiz@NetBSD.org>
To: gnats-bugs@NetBSD.org
Subject: openjdk7 does not build with clang-3.5trunk201163 from NetBSD base
X-Send-Pr-Version: 3.95
>Number: 48693
>Category: pkg
>Synopsis: openjdk7 does not build with clang-3.5trunk201163 from NetBSD base
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: pkg-manager
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Mar 31 08:55:00 +0000 2014
>Closed-Date: Thu Jan 07 08:55:36 +0000 2021
>Last-Modified: Thu Jan 07 08:55:36 +0000 2021
>Originator: Thomas Klausner
>Release: NetBSD 6.99.39
>Organization:
Curiosity is the very basis of education and if you tell me that
curiosity killed the cat, I say only that the cat died nobly.
- Arnold Edinborough
>Environment:
Architecture: x86_64
Machine: amd64
>Description:
The build of openjdk7 with clang from NetBSD-current (6.99.39/amd64) stops with
In file included from /disk/3/archive/obj/lang/openjdk7/work.x86_64/openjdk/hotspot/src/share/vm/precompiled/precompiled.hpp:36:
In file included from /usr/obj/lang/openjdk7/work.x86_64/openjdk/hotspot/src/share/vm/ci/ciConstant.hpp:29:
In file included from /usr/obj/lang/openjdk7/work.x86_64/openjdk/hotspot/src/share/vm/ci/ciNullObject.hpp:30:
In file included from /usr/obj/lang/openjdk7/work.x86_64/openjdk/hotspot/src/share/vm/ci/ciUtilities.hpp:28:
In file included from /usr/obj/lang/openjdk7/work.x86_64/openjdk/hotspot/src/share/vm/ci/ciEnv.hpp:30:
In file included from /usr/obj/lang/openjdk7/work.x86_64/openjdk/hotspot/src/share/vm/classfile/systemDictionary.hpp:29:
In file included from /usr/obj/lang/openjdk7/work.x86_64/openjdk/hotspot/src/share/vm/classfile/classLoader.hpp:28:
In file included from /usr/obj/lang/openjdk7/work.x86_64/openjdk/hotspot/src/share/vm/classfile/classFileParser.hpp:29:
In file included from /usr/obj/lang/openjdk7/work.x86_64/openjdk/hotspot/src/share/vm/memory/resourceArea.hpp:39:
In file included from /usr/obj/lang/openjdk7/work.x86_64/openjdk/hotspot/src/os/bsd/vm/thread_bsd.inline.hpp:30:
In file included from /usr/obj/lang/openjdk7/work.x86_64/openjdk/hotspot/src/share/vm/runtime/thread.hpp:44:
/usr/obj/lang/openjdk7/work.x86_64/openjdk/hotspot/src/share/vm/services/memRecorder.hpp:64:5: error: 'operator new' should not return a null pointer unless it is declared 'throw()' [-Werror,-Wnew-returns-null]
return NULL;
^
1 error generated.
Setting MAKE_JOBS_SAFE=no does not help.
>How-To-Repeat:
Compile NetBSD with clang, set:
PKGSRC_COMPILER= clang
CLANGBASE= /usr
HAVE_LLVM= yes
in your /etc/mk.conf and build lang/openjdk7.
>Fix:
>Release-Note:
>Audit-Trail:
From: Joerg Sonnenberger <joerg@britannica.bec.de>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: pkg/48693: openjdk7 does not build with clang-3.5trunk201163
from NetBSD base
Date: Mon, 31 Mar 2014 11:59:24 +0200
--jRHKVT23PllUwdXP
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
See attached patch.
--jRHKVT23PllUwdXP
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="openjdk.diff"
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) {
--jRHKVT23PllUwdXP--
From: Thomas Klausner <wiz@NetBSD.org>
To: gnats-bugs@NetBSD.org
Cc: Joerg Sonnenberger <joerg@britannica.bec.de>
Subject: Re: pkg/48693: openjdk7 does not build with clang-3.5trunk201163
from NetBSD base
Date: Mon, 31 Mar 2014 12:33:52 +0200
Thanks. Where do I get the contents of hacks/ ?
> + 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
Thomas
From: Joerg Sonnenberger <joerg@britannica.bec.de>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: pkg/48693: openjdk7 does not build with clang-3.5trunk201163
from NetBSD base
Date: Mon, 31 Mar 2014 13:05:05 +0200
On Mon, Mar 31, 2014 at 10:35:00AM +0000, Thomas Klausner wrote:
> The following reply was made to PR pkg/48693; it has been noted by GNATS.
>
> From: Thomas Klausner <wiz@NetBSD.org>
> To: gnats-bugs@NetBSD.org
> Cc: Joerg Sonnenberger <joerg@britannica.bec.de>
> Subject: Re: pkg/48693: openjdk7 does not build with clang-3.5trunk201163
> from NetBSD base
> Date: Mon, 31 Mar 2014 12:33:52 +0200
>
> Thanks. Where do I get the contents of hacks/ ?
>
> > + 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
That's a copy from netbsd-6 to get the binary bootstrap working on a
pure clang release build.
Joerg
From: Thomas Klausner <wiz@NetBSD.org>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: pkg/48693: openjdk7 does not build with clang-3.5trunk201163
from NetBSD base
Date: Mon, 31 Mar 2014 14:57:05 +0200
On Mon, Mar 31, 2014 at 11:10:01AM +0000, Joerg Sonnenberger wrote:
> > > + 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
>
> That's a copy from netbsd-6 to get the binary bootstrap working on a
> pure clang release build.
We should probably make a package for these so we can use them as
build dependencies, or at least a tarball so it can be used as
additional distfile.
Thomas
From: Joerg Sonnenberger <joerg@britannica.bec.de>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: pkg/48693: openjdk7 does not build with clang-3.5trunk201163
from NetBSD base
Date: Mon, 31 Mar 2014 17:32:16 +0200
On Mon, Mar 31, 2014 at 01:00:03PM +0000, Thomas Klausner wrote:
> The following reply was made to PR pkg/48693; it has been noted by GNATS.
>
> From: Thomas Klausner <wiz@NetBSD.org>
> To: gnats-bugs@NetBSD.org
> Cc:
> Subject: Re: pkg/48693: openjdk7 does not build with clang-3.5trunk201163
> from NetBSD base
> Date: Mon, 31 Mar 2014 14:57:05 +0200
>
> On Mon, Mar 31, 2014 at 11:10:01AM +0000, Joerg Sonnenberger wrote:
> > > > + 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
> >
> > That's a copy from netbsd-6 to get the binary bootstrap working on a
> > pure clang release build.
>
> We should probably make a package for these so we can use them as
> build dependencies, or at least a tarball so it can be used as
> additional distfile.
Well, the correct approach would be a bootstrap build that links
statically against libstdc++ and libgcc_s, I think. No idea how to
create that one though.
Joerg
From: "OBATA Akio" <obata@lins.jp>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: pkg/48693: openjdk7 does not build with clang-3.5trunk201163 from
NetBSD base
Date: Tue, 01 Apr 2014 10:17:43 +0900
I believe that the correct approach is "provide compat libraries as a separate packages".
It is not only for this case but also resolve other ABI incompatibilities,
binaries built with gcc will not be usable with clang based userland.
--
OBATA Akio / obata@lins.jp
State-Changed-From-To: open->closed
State-Changed-By: maya@NetBSD.org
State-Changed-When: Thu, 07 Jan 2021 08:55:36 +0000
State-Changed-Why:
Stale bug report. We do not have an openjdk7 package any more. Openjdk8 seems to have some logic to make it conditional for no-libstdc++ so it might work.
>Unformatted:
(Contact us)
$NetBSD: gnats-precook-prs,v 1.4 2018/12/21 14:20:20 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.