Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Jan 2015 20:16:02 +0900
From:      "Daisuke Aoyama" <aoyama@peach.ne.jp>
To:        "Andreas Tobler" <andreast-list@fgznet.ch>, <freebsd-arm@freebsd.org>
Subject:   Re: C++ exception of RPi
Message-ID:  <F5A3DFE519574132A8DDBBB8E0AB7904@ad.peach.ne.jp>
In-Reply-To: <54BC2D0A.6080509@fgznet.ch>
References:  <8938766D727E4CD587AB34DB32A67916@ad.peach.ne.jp> <B2EE65BDDC8E4D059172C2E23AB9E147@ad.peach.ne.jp> <54BC2D0A.6080509@fgznet.ch>

next in thread | previous in thread | raw e-mail | index | archive | help
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<uint64_t>(*reinterpret_cast<uint8_t*>(*data)) << 0;=0A=
+			*data +=3D sizeof(uint8_t);=0A=
+			v +=3D static_cast<uint64_t>(*reinterpret_cast<uint8_t*>(*data)) << =
8;=0A=
+			*data +=3D sizeof(uint8_t);=0A=
+			v +=3D static_cast<uint64_t>(*reinterpret_cast<uint8_t*>(*data)) << =
16;=0A=
+			*data +=3D sizeof(uint8_t);=0A=
+			v +=3D static_cast<uint64_t>(*reinterpret_cast<uint8_t*>(*data)) << =
24;=0A=
+			*data +=3D sizeof(uint8_t);=0A=
+			break;=0A=
+		case DW_EH_PE_absptr:=0A=
+			v =3D static_cast<uint64_t>(*reinterpret_cast<uint8_t*>(*data)) << 0;=0A=
+			*data +=3D sizeof(uint8_t);=0A=
+			v +=3D static_cast<uint64_t>(*reinterpret_cast<uint8_t*>(*data)) << =
8;=0A=
+			*data +=3D sizeof(uint8_t);=0A=
+			v +=3D static_cast<uint64_t>(*reinterpret_cast<uint8_t*>(*data)) << =
16;=0A=
+			*data +=3D sizeof(uint8_t);=0A=
+			v +=3D static_cast<uint64_t>(*reinterpret_cast<uint8_t*>(*data)) << =
24;=0A=
+			*data +=3D sizeof(uint8_t);=0A=
+			v =3D static_cast<uint64_t>(static_cast<intptr_t>(v));=0A=
+			break;=0A=
+#else /* __ORDER_BIG_ENDIAN__ */=0A=
+		case DW_EH_PE_udata4:=0A=
+			v =3D static_cast<uint64_t>(*reinterpret_cast<uint8_t*>(*data)) << =
24;=0A=
+			*data +=3D sizeof(uint8_t);=0A=
+			v +=3D static_cast<uint64_t>(*reinterpret_cast<uint8_t*>(*data)) << =
16;=0A=
+			*data +=3D sizeof(uint8_t);=0A=
+			v +=3D static_cast<uint64_t>(*reinterpret_cast<uint8_t*>(*data)) << =
8;=0A=
+			*data +=3D sizeof(uint8_t);=0A=
+			v +=3D static_cast<uint64_t>(*reinterpret_cast<uint8_t*>(*data)) << =
0;=0A=
+			*data +=3D sizeof(uint8_t);=0A=
+			break;=0A=
+		case DW_EH_PE_absptr:=0A=
+			v =3D static_cast<uint64_t>(*reinterpret_cast<uint8_t*>(*data)) << =
24;=0A=
+			*data +=3D sizeof(uint8_t);=0A=
+			v +=3D static_cast<uint64_t>(*reinterpret_cast<uint8_t*>(*data)) << =
16;=0A=
+			*data +=3D sizeof(uint8_t);=0A=
+			v +=3D static_cast<uint64_t>(*reinterpret_cast<uint8_t*>(*data)) << =
8;=0A=
+			*data +=3D sizeof(uint8_t);=0A=
+			v +=3D static_cast<uint64_t>(*reinterpret_cast<uint8_t*>(*data)) << =
0;=0A=
+			*data +=3D sizeof(uint8_t);=0A=
+			v =3D static_cast<uint64_t>(static_cast<intptr_t>(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--




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?F5A3DFE519574132A8DDBBB8E0AB7904>