View | Details | Raw Unified | Return to bug 209937
Collapse All | Expand All

(-)devel/libcxxrt/Makefile (-12 / +11 lines)
Lines 1-22 Link Here
1
# $FreeBSD$
1
# $FreeBSD$
2
2
3
PORTNAME=	libcxxrt
3
PORTNAME=		libcxxrt
4
PORTVERSION=	20131225
4
PORTVERSION=	20160529
5
PORTREVISION=	3
5
CATEGORIES=		devel
6
CATEGORIES=	devel
7
6
8
MAINTAINER=	mokhi64@gmail.com
7
MAINTAINER=		mokhi64@gmail.com
9
COMMENT=	Implementation of the Code Sourcery C++ ABI
8
COMMENT=		Implementation of the Code Sourcery C++ ABI
10
9
11
LICENSE=	BSD2CLAUSE
10
LICENSE=		BSD2CLAUSE
12
11
13
USE_GITHUB=	yes
12
USE_GITHUB=		yes
14
GH_ACCOUNT=	pathscale
13
GH_ACCOUNT=		pathscale
15
GH_TAGNAME=	2f150a6
14
GH_TAGNAME=		516a65c
16
15
17
USES=		cmake compiler:c++11-lang
16
USES=			cmake compiler:c++11-lang
18
USE_LDCONFIG=	yes
17
USE_LDCONFIG=	yes
19
CXXFLAGS+=	-nostdlib
18
CXXFLAGS+=		-nostdlib
20
19
21
do-install:
20
do-install:
22
	${INSTALL_LIB} ${WRKSRC}/lib/libcxxrt.so ${STAGEDIR}${PREFIX}/lib
21
	${INSTALL_LIB} ${WRKSRC}/lib/libcxxrt.so ${STAGEDIR}${PREFIX}/lib
(-)devel/libcxxrt/distinfo (-2 / +2 lines)
Lines 1-2 Link Here
1
SHA256 (pathscale-libcxxrt-20131225-2f150a6_GH0.tar.gz) = 70a89c34176d2bc683b5a3b84fea8d585bcf53c6b09d0efedbac3caf315b4fc1
1
SHA256 (pathscale-libcxxrt-20160529-516a65c_GH0.tar.gz) = 5d2b943fb8bcce453d3453246dd25242a01b2107631c52c90dbefff13fec1f65
2
SIZE (pathscale-libcxxrt-20131225-2f150a6_GH0.tar.gz) = 70243
2
SIZE (pathscale-libcxxrt-20160529-516a65c_GH0.tar.gz) = 73293
(-)devel/libcxxrt/files/patch-src_exception.cc (-48 lines)
Lines 1-48 Link Here
1
--- src/exception.cc.orig	2013-12-26 03:11:27 UTC
2
+++ src/exception.cc
3
@@ -304,13 +304,17 @@ static pthread_key_t eh_key;
4
 static void exception_cleanup(_Unwind_Reason_Code reason, 
5
                               struct _Unwind_Exception *ex)
6
 {
7
-	__cxa_free_exception(static_cast<void*>(ex));
8
+	// Exception layout:
9
+	// [__cxa_exception [_Unwind_Exception]] [exception object]
10
+	//
11
+	// __cxa_free_exception expects a pointer to the exception object
12
+	__cxa_free_exception(static_cast<void*>(ex + 1));
13
 }
14
 static void dependent_exception_cleanup(_Unwind_Reason_Code reason, 
15
                               struct _Unwind_Exception *ex)
16
 {
17
 
18
-	__cxa_free_dependent_exception(static_cast<void*>(ex));
19
+	__cxa_free_dependent_exception(static_cast<void*>(ex + 1));
20
 }
21
 
22
 /**
23
@@ -340,7 +344,8 @@ static void thread_cleanup(void* thread_
24
 		if (info->foreign_exception_state != __cxa_thread_info::none)
25
 		{
26
 			_Unwind_Exception *e = reinterpret_cast<_Unwind_Exception*>(info->globals.caughtExceptions);
27
-			e->exception_cleanup(_URC_FOREIGN_EXCEPTION_CAUGHT, e);
28
+			if (e->exception_cleanup)
29
+				e->exception_cleanup(_URC_FOREIGN_EXCEPTION_CAUGHT, e);
30
 		}
31
 		else
32
 		{
33
@@ -1270,12 +1275,13 @@ extern "C" void __cxa_end_catch()
34
 	
35
 	if (ti->foreign_exception_state != __cxa_thread_info::none)
36
 	{
37
-		globals->caughtExceptions = 0;
38
 		if (ti->foreign_exception_state != __cxa_thread_info::rethrown)
39
 		{
40
 			_Unwind_Exception *e = reinterpret_cast<_Unwind_Exception*>(ti->globals.caughtExceptions);
41
-			e->exception_cleanup(_URC_FOREIGN_EXCEPTION_CAUGHT, e);
42
+			if (e->exception_cleanup)
43
+				e->exception_cleanup(_URC_FOREIGN_EXCEPTION_CAUGHT, e);
44
 		}
45
+		globals->caughtExceptions = 0;
46
 		ti->foreign_exception_state = __cxa_thread_info::none;
47
 		return;
48
 	}
(-)devel/libcxxrt/files/patch-test_CMakeLists.txt (-24 lines)
Lines 1-24 Link Here
1
--- test/CMakeLists.txt.orig	2013-12-26 03:11:27 UTC
2
+++ test/CMakeLists.txt
3
@@ -23,6 +23,11 @@ add_executable(cxxrt-test-shared ${CXXTE
4
 set_property(TARGET cxxrt-test-shared PROPERTY LINK_FLAGS -nodefaultlibs)
5
 target_link_libraries(cxxrt-test-shared cxxrt-shared pthread dl c)
6
 
7
+include_directories(${CMAKE_SOURCE_DIR}/src)
8
+add_executable(cxxrt-test-foreign-exceptions test_foreign_exceptions.cc)
9
+set_property(TARGET cxxrt-test-foreign-exceptions PROPERTY LINK_FLAGS "-nodefaultlibs -Wl,--wrap,_Unwind_RaiseException")
10
+target_link_libraries(cxxrt-test-foreign-exceptions cxxrt-static gcc_s pthread dl c)
11
+
12
 add_test(cxxrt-test-static-test
13
          ${CMAKE_CURRENT_SOURCE_DIR}/run_test.sh
14
          ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/cxxrt-test-static
15
@@ -35,6 +40,9 @@ add_test(cxxrt-test-shared-test
16
          ${CMAKE_CURRENT_BINARY_DIR}/expected_output.log
17
          ${CMAKE_CURRENT_BINARY_DIR}/test-shared-output.log)
18
 
19
+add_test(cxxrt-test-foreign-exceptions
20
+         ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/cxxrt-test-foreign-exceptions)
21
+
22
 set(valgrind "valgrind -q")
23
 
24
 if(TEST_VALGRIND)

Return to bug 209937