summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99498.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-oe/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99498.patch')
-rw-r--r--meta-oe/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99498.patch186
1 files changed, 186 insertions, 0 deletions
diff --git a/meta-oe/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99498.patch b/meta-oe/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99498.patch
new file mode 100644
index 000000000..9c305cc65
--- /dev/null
+++ b/meta-oe/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99498.patch
@@ -0,0 +1,186 @@
12011-02-16 Nathan Sidwell <nathan@codesourcery.com>
2
3 Issue #10439
4 gcc/
5 * config/arm/unwind-arm.c (enum __cxa_type_match_result): New.
6 (cxa_type_match): Correct declaration.
7 (__gnu_unwind_pr_common): Reconstruct
8 additional indirection when __cxa_type_match returns
9 succeeded_with_ptr_to_base.
10
11 libstdc++/
12 * libsupc++/eh_arm.c (__cxa_type_match): Construct address of
13 thrown object here. Return succeded_with_ptr_to_base for all
14 pointer cases.
15
16=== modified file 'gcc/config/arm/unwind-arm.c'
17--- old/gcc/config/arm/unwind-arm.c 2010-08-12 12:39:35 +0000
18+++ new/gcc/config/arm/unwind-arm.c 2011-04-08 10:41:46 +0000
19@@ -32,13 +32,18 @@
20 typedef unsigned char bool;
21
22 typedef struct _ZSt9type_info type_info; /* This names C++ type_info type */
23+enum __cxa_type_match_result
24+ {
25+ ctm_failed = 0,
26+ ctm_succeeded = 1,
27+ ctm_succeeded_with_ptr_to_base = 2
28+ };
29
30 void __attribute__((weak)) __cxa_call_unexpected(_Unwind_Control_Block *ucbp);
31 bool __attribute__((weak)) __cxa_begin_cleanup(_Unwind_Control_Block *ucbp);
32-bool __attribute__((weak)) __cxa_type_match(_Unwind_Control_Block *ucbp,
33- const type_info *rttip,
34- bool is_reference,
35- void **matched_object);
36+enum __cxa_type_match_result __attribute__((weak)) __cxa_type_match
37+ (_Unwind_Control_Block *ucbp, const type_info *rttip,
38+ bool is_reference, void **matched_object);
39
40 _Unwind_Ptr __attribute__((weak))
41 __gnu_Unwind_Find_exidx (_Unwind_Ptr, int *);
42@@ -1107,6 +1112,7 @@
43 _uw rtti;
44 bool is_reference = (data[0] & uint32_highbit) != 0;
45 void *matched;
46+ enum __cxa_type_match_result match_type;
47
48 /* Check for no-throw areas. */
49 if (data[1] == (_uw) -2)
50@@ -1118,17 +1124,31 @@
51 {
52 /* Match a catch specification. */
53 rtti = _Unwind_decode_target2 ((_uw) &data[1]);
54- if (!__cxa_type_match (ucbp, (type_info *) rtti,
55- is_reference,
56- &matched))
57- matched = (void *)0;
58+ match_type = __cxa_type_match (ucbp,
59+ (type_info *) rtti,
60+ is_reference,
61+ &matched);
62 }
63+ else
64+ match_type = ctm_succeeded;
65
66- if (matched)
67+ if (match_type)
68 {
69 ucbp->barrier_cache.sp =
70 _Unwind_GetGR (context, R_SP);
71- ucbp->barrier_cache.bitpattern[0] = (_uw) matched;
72+ // ctm_succeeded_with_ptr_to_base really
73+ // means _c_t_m indirected the pointer
74+ // object. We have to reconstruct the
75+ // additional pointer layer by using a temporary.
76+ if (match_type == ctm_succeeded_with_ptr_to_base)
77+ {
78+ ucbp->barrier_cache.bitpattern[2]
79+ = (_uw) matched;
80+ ucbp->barrier_cache.bitpattern[0]
81+ = (_uw) &ucbp->barrier_cache.bitpattern[2];
82+ }
83+ else
84+ ucbp->barrier_cache.bitpattern[0] = (_uw) matched;
85 ucbp->barrier_cache.bitpattern[1] = (_uw) data;
86 return _URC_HANDLER_FOUND;
87 }
88
89=== modified file 'libstdc++-v3/libsupc++/eh_arm.cc'
90--- old/libstdc++-v3/libsupc++/eh_arm.cc 2009-04-09 14:00:19 +0000
91+++ new/libstdc++-v3/libsupc++/eh_arm.cc 2011-04-08 10:41:46 +0000
92@@ -30,10 +30,11 @@
93 using namespace __cxxabiv1;
94
95
96-// Given the thrown type THROW_TYPE, pointer to a variable containing a
97-// pointer to the exception object THROWN_PTR_P and a type CATCH_TYPE to
98-// compare against, return whether or not there is a match and if so,
99-// update *THROWN_PTR_P.
100+// Given the thrown type THROW_TYPE, exception object UE_HEADER and a
101+// type CATCH_TYPE to compare against, return whether or not there is
102+// a match and if so, update *THROWN_PTR_P to point to either the
103+// type-matched object, or in the case of a pointer type, the object
104+// pointed to by the pointer.
105
106 extern "C" __cxa_type_match_result
107 __cxa_type_match(_Unwind_Exception* ue_header,
108@@ -41,51 +42,51 @@
109 bool is_reference __attribute__((__unused__)),
110 void** thrown_ptr_p)
111 {
112- bool forced_unwind = __is_gxx_forced_unwind_class(ue_header->exception_class);
113- bool foreign_exception = !forced_unwind && !__is_gxx_exception_class(ue_header->exception_class);
114- bool dependent_exception =
115- __is_dependent_exception(ue_header->exception_class);
116+ bool forced_unwind
117+ = __is_gxx_forced_unwind_class(ue_header->exception_class);
118+ bool foreign_exception
119+ = !forced_unwind && !__is_gxx_exception_class(ue_header->exception_class);
120+ bool dependent_exception
121+ = __is_dependent_exception(ue_header->exception_class);
122 __cxa_exception* xh = __get_exception_header_from_ue(ue_header);
123 __cxa_dependent_exception *dx = __get_dependent_exception_from_ue(ue_header);
124 const std::type_info* throw_type;
125+ void *thrown_ptr = 0;
126
127 if (forced_unwind)
128 throw_type = &typeid(abi::__forced_unwind);
129 else if (foreign_exception)
130 throw_type = &typeid(abi::__foreign_exception);
131- else if (dependent_exception)
132- throw_type = __get_exception_header_from_obj
133- (dx->primaryException)->exceptionType;
134 else
135- throw_type = xh->exceptionType;
136-
137- void* thrown_ptr = *thrown_ptr_p;
138+ {
139+ if (dependent_exception)
140+ xh = __get_exception_header_from_obj (dx->primaryException);
141+ throw_type = xh->exceptionType;
142+ // We used to require the caller set the target of thrown_ptr_p,
143+ // but that's incorrect -- the EHABI makes no such requirement
144+ // -- and not all callers will set it. Fortunately callers that
145+ // do initialize will always pass us the value we calculate
146+ // here, so there's no backwards compatibility problem.
147+ thrown_ptr = __get_object_from_ue (ue_header);
148+ }
149+
150+ __cxa_type_match_result result = ctm_succeeded;
151
152 // Pointer types need to adjust the actual pointer, not
153 // the pointer to pointer that is the exception object.
154 // This also has the effect of passing pointer types
155 // "by value" through the __cxa_begin_catch return value.
156 if (throw_type->__is_pointer_p())
157- thrown_ptr = *(void**) thrown_ptr;
158+ {
159+ thrown_ptr = *(void**) thrown_ptr;
160+ // We need to indicate the indirection to our caller.
161+ result = ctm_succeeded_with_ptr_to_base;
162+ }
163
164 if (catch_type->__do_catch(throw_type, &thrown_ptr, 1))
165 {
166 *thrown_ptr_p = thrown_ptr;
167-
168- if (typeid(*catch_type) == typeid (typeid(void*)))
169- {
170- const __pointer_type_info *catch_pointer_type =
171- static_cast<const __pointer_type_info *> (catch_type);
172- const __pointer_type_info *throw_pointer_type =
173- static_cast<const __pointer_type_info *> (throw_type);
174-
175- if (typeid (*catch_pointer_type->__pointee) != typeid (void)
176- && (*catch_pointer_type->__pointee !=
177- *throw_pointer_type->__pointee))
178- return ctm_succeeded_with_ptr_to_base;
179- }
180-
181- return ctm_succeeded;
182+ return result;
183 }
184
185 return ctm_failed;
186