From owner-freebsd-arm@FreeBSD.ORG Mon Jan 19 11:16:20 2015 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7751CF2D for ; Mon, 19 Jan 2015 11:16:20 +0000 (UTC) Received: from moon.peach.ne.jp (moon.peach.ne.jp [203.141.148.98]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 22C0EB83 for ; Mon, 19 Jan 2015 11:16:17 +0000 (UTC) Received: from moon.peach.ne.jp (localhost [127.0.0.1]) by moon.peach.ne.jp (Postfix) with ESMTP id 8950F68120; Mon, 19 Jan 2015 20:16:08 +0900 (JST) Received: from artemis (unknown [172.18.0.21]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by moon.peach.ne.jp (Postfix) with ESMTPSA id 7AE696811E; Mon, 19 Jan 2015 20:16:08 +0900 (JST) Message-ID: From: "Daisuke Aoyama" To: "Andreas Tobler" , References: <8938766D727E4CD587AB34DB32A67916@ad.peach.ne.jp> <54BC2D0A.6080509@fgznet.ch> In-Reply-To: <54BC2D0A.6080509@fgznet.ch> Subject: Re: C++ exception of RPi Date: Mon, 19 Jan 2015 20:16:02 +0900 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0A1F_01D03424.BF4F0BC0" X-Priority: 3 X-MSMail-Priority: Normal Importance: Normal X-Mailer: Microsoft Windows Live Mail 14.0.8117.416 X-MimeOLE: Produced By Microsoft MimeOLE V14.0.8117.416 X-Virus-Scanned: ClamAV using ClamSMTP X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Jan 2015 11:16:20 -0000 This is a multi-part message in MIME format. ------=_NextPart_000_0A1F_01D03424.BF4F0BC0 Content-Type: text/plain; format=flowed; charset="windows-1252"; reply-type=response Content-Transfer-Encoding: 7bit Thank you for testing. If possible, please try this EH patch extracted from src-r277169-20150114.patch.gz How to use it: ---------------------------------------------------------------------- If you don't have source tree, check out with your kernel version. # uname -v FreeBSD 11.0-CURRENT #0 r276981: Mon Jan 12 09:04:54 UTC 2015 root@grind.freebsd.org:/usr/obj/arm.armv6/usr/src/sys/RPI-B # svnlite checkout -r 276981 svn://svn.FreeBSD.org/base/head /usr/src Apply the patch # cd /usr/src # patch < /path/to/eh.patch Build the patched library # cd /usr/src/lib/libcxxrt # make Try with new library # cd /path/to/sample.cc # clang++ sample.cc /usr/src/lib/libcxxrt/libcxxrt.a # ./a.out catch: 10 ---------------------------------------------------------------------- If it works, you will run "make install" in /usr/src/lib/libcxxrt. -- Daisuke Aoyama ------=_NextPart_000_0A1F_01D03424.BF4F0BC0 Content-Type: application/octet-stream; name="eh.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="eh.patch" Index: contrib/libcxxrt/dwarf_eh.h=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= --- contrib/libcxxrt/dwarf_eh.h (revision 277169)=0A= +++ contrib/libcxxrt/dwarf_eh.h (working copy)=0A= @@ -228,13 +228,64 @@=0A= *data +=3D sizeof(type);\=0A= break;=0A= READ(DW_EH_PE_udata2, uint16_t)=0A= - READ(DW_EH_PE_udata4, uint32_t)=0A= + //READ(DW_EH_PE_udata4, uint32_t)=0A= READ(DW_EH_PE_udata8, uint64_t)=0A= READ(DW_EH_PE_sdata2, int16_t)=0A= READ(DW_EH_PE_sdata4, int32_t)=0A= READ(DW_EH_PE_sdata8, int64_t)=0A= + //READ(DW_EH_PE_absptr, intptr_t)=0A= +#undef READ=0A= +#if defined(__arm__)=0A= + // workaround for unaligned access=0A= +#if __BYTE_ORDER__ =3D=3D __ORDER_LITTLE_ENDIAN__=0A= + case DW_EH_PE_udata4:=0A= + v =3D static_cast(*reinterpret_cast(*data)) << 0;=0A= + *data +=3D sizeof(uint8_t);=0A= + v +=3D static_cast(*reinterpret_cast(*data)) << = 8;=0A= + *data +=3D sizeof(uint8_t);=0A= + v +=3D static_cast(*reinterpret_cast(*data)) << = 16;=0A= + *data +=3D sizeof(uint8_t);=0A= + v +=3D static_cast(*reinterpret_cast(*data)) << = 24;=0A= + *data +=3D sizeof(uint8_t);=0A= + break;=0A= + case DW_EH_PE_absptr:=0A= + v =3D static_cast(*reinterpret_cast(*data)) << 0;=0A= + *data +=3D sizeof(uint8_t);=0A= + v +=3D static_cast(*reinterpret_cast(*data)) << = 8;=0A= + *data +=3D sizeof(uint8_t);=0A= + v +=3D static_cast(*reinterpret_cast(*data)) << = 16;=0A= + *data +=3D sizeof(uint8_t);=0A= + v +=3D static_cast(*reinterpret_cast(*data)) << = 24;=0A= + *data +=3D sizeof(uint8_t);=0A= + v =3D static_cast(static_cast(v));=0A= + break;=0A= +#else /* __ORDER_BIG_ENDIAN__ */=0A= + case DW_EH_PE_udata4:=0A= + v =3D static_cast(*reinterpret_cast(*data)) << = 24;=0A= + *data +=3D sizeof(uint8_t);=0A= + v +=3D static_cast(*reinterpret_cast(*data)) << = 16;=0A= + *data +=3D sizeof(uint8_t);=0A= + v +=3D static_cast(*reinterpret_cast(*data)) << = 8;=0A= + *data +=3D sizeof(uint8_t);=0A= + v +=3D static_cast(*reinterpret_cast(*data)) << = 0;=0A= + *data +=3D sizeof(uint8_t);=0A= + break;=0A= + case DW_EH_PE_absptr:=0A= + v =3D static_cast(*reinterpret_cast(*data)) << = 24;=0A= + *data +=3D sizeof(uint8_t);=0A= + v +=3D static_cast(*reinterpret_cast(*data)) << = 16;=0A= + *data +=3D sizeof(uint8_t);=0A= + v +=3D static_cast(*reinterpret_cast(*data)) << = 8;=0A= + *data +=3D sizeof(uint8_t);=0A= + v +=3D static_cast(*reinterpret_cast(*data)) << = 0;=0A= + *data +=3D sizeof(uint8_t);=0A= + v =3D static_cast(static_cast(v));=0A= + break;=0A= +#endif /* __BYTE_ORDER__ =3D=3D __ORDER_LITTLE_ENDIAN__ */=0A= +#else /* !__arm__ */=0A= + READ(DW_EH_PE_udata4, uint32_t)=0A= READ(DW_EH_PE_absptr, intptr_t)=0A= -#undef READ=0A= +#endif /* __arm__ */=0A= // Read variable-length types=0A= case DW_EH_PE_sleb128:=0A= v =3D read_sleb128(data);=0A= ------=_NextPart_000_0A1F_01D03424.BF4F0BC0--