Gentoo Archives: gentoo-commits

From: "Alexis Ballier (aballier)" <aballier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in sys-libs/libcxxrt/files: Makefile.test unwind.h Makefile
Date: Thu, 31 May 2012 20:48:53
Message-Id: 20120531204843.193C92004B@flycatcher.gentoo.org
1 aballier 12/05/31 20:48:43
2
3 Added: Makefile.test unwind.h Makefile
4 Log:
5 Use our own makefiles, its so simple that we do not need to rely on cmake for this. Build it on top of libunwind instead of using libgcc_s for unwinding. Remove their libunwind bundled headers and ship a reduced one with only the added macros libcxxrt needs. Build with -nodefaultlibs to ensure we do not link to gcc libs. Add static-libs useflag. Give it a src_test.
6
7 (Portage version: 2.2.0_alpha108/cvs/Linux x86_64)
8
9 Revision Changes Path
10 1.1 sys-libs/libcxxrt/files/Makefile.test
11
12 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-libs/libcxxrt/files/Makefile.test?rev=1.1&view=markup
13 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-libs/libcxxrt/files/Makefile.test?rev=1.1&content-type=text/plain
14
15 Index: Makefile.test
16 ===================================================================
17 OBJS=test.o test_exception.o test_guard.o test_typeinfo.o
18
19 cxxrttest: $(OBJS)
20 $(CXX) -nodefaultlibs $(CXXFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
21
22 check: cxxrttest
23 ./cxxrttest
24
25
26
27 1.1 sys-libs/libcxxrt/files/unwind.h
28
29 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-libs/libcxxrt/files/unwind.h?rev=1.1&view=markup
30 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-libs/libcxxrt/files/unwind.h?rev=1.1&content-type=text/plain
31
32 Index: unwind.h
33 ===================================================================
34 /*
35 * Copyright 2012 David Chisnall. All rights reserved.
36 *
37 * Permission is hereby granted, free of charge, to any person obtaining a copy
38 * of this software and associated documentation files (the "Software"), to
39 * deal in the Software without restriction, including without limitation the
40 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
41 * sell copies of the Software, and to permit persons to whom the Software is
42 * furnished to do so, subject to the following conditions:
43 *
44 * The above copyright notice and this permission notice shall be
45 * included in all copies or substantial portions of the Software.
46 *
47 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
48 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
49 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
50 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
51 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
52 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
53 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
54 */
55
56 #include_next <unwind.h>
57
58 #ifndef CXXRT_UNWIND_H_INCLUDED
59 #define CXXRT_UNWIND_H_INCLUDED
60
61 #ifdef __cplusplus
62 extern "C" {
63 #endif
64
65 #ifdef __arm__
66 #define DECLARE_PERSONALITY_FUNCTION(name) \
67 _Unwind_Reason_Code name(_Unwind_State state,\
68 struct _Unwind_Exception *exceptionObject,\
69 struct _Unwind_Context *context);
70
71 #define BEGIN_PERSONALITY_FUNCTION(name) \
72 _Unwind_Reason_Code name(_Unwind_State state,\
73 struct _Unwind_Exception *exceptionObject,\
74 struct _Unwind_Context *context)\
75 {\
76 int version = 1;\
77 uint64_t exceptionClass = exceptionObject->exception_class;\
78 int actions;\
79 switch (state)\
80 {\
81 default: return _URC_FAILURE;\
82 case _US_VIRTUAL_UNWIND_FRAME:\
83 {\
84 actions = _UA_SEARCH_PHASE;\
85 break;\
86 }\
87 case _US_UNWIND_FRAME_STARTING:\
88 {\
89 actions = _UA_CLEANUP_PHASE;\
90 if (exceptionObject->barrier_cache.sp == _Unwind_GetGR(context, 13))\
91 {\
92 actions |= _UA_HANDLER_FRAME;\
93 }\
94 break;\
95 }\
96 case _US_UNWIND_FRAME_RESUME:\
97 {\
98 return continueUnwinding(exceptionObject, context);\
99 break;\
100 }\
101 }\
102 _Unwind_SetGR (context, 12, (unsigned long)exceptionObject);\
103
104 #define CALL_PERSONALITY_FUNCTION(name) name(state,exceptionObject,context)
105 #else
106 #define DECLARE_PERSONALITY_FUNCTION(name) \
107 _Unwind_Reason_Code name(int version,\
108 _Unwind_Action actions,\
109 uint64_t exceptionClass,\
110 struct _Unwind_Exception *exceptionObject,\
111 struct _Unwind_Context *context);
112 #define BEGIN_PERSONALITY_FUNCTION(name) \
113 _Unwind_Reason_Code name(int version,\
114 _Unwind_Action actions,\
115 uint64_t exceptionClass,\
116 struct _Unwind_Exception *exceptionObject,\
117 struct _Unwind_Context *context)\
118 {
119
120 #define CALL_PERSONALITY_FUNCTION(name) name(version, actions, exceptionClass, exceptionObject, context)
121 #endif
122
123 #ifdef __cplusplus
124 }
125 #endif
126
127 #endif
128
129
130
131 1.1 sys-libs/libcxxrt/files/Makefile
132
133 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-libs/libcxxrt/files/Makefile?rev=1.1&view=markup
134 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-libs/libcxxrt/files/Makefile?rev=1.1&content-type=text/plain
135
136 Index: Makefile
137 ===================================================================
138 LIB=cxxrt
139 MAJ=1
140 OBJS=dynamic_cast.o exception.o guard.o stdexcept.o typeinfo.o memory.o auxhelper.o libelftc_dem_gnu3.o
141 SOBJS=${OBJS:.o=.So}
142
143 static: lib$(LIB).a
144
145 shared: lib$(LIB).so
146
147 %.So: %.cc
148 $(CXX) -fPIC $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $<
149
150 %.So: %.c
151 $(CC) -fPIC $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
152
153 lib$(LIB).a: $(OBJS)
154 $(AR) cr $@ $^
155
156 lib$(LIB).so.$(MAJ): $(SOBJS)
157 $(CXX) -fPIC -nodefaultlibs $(CXXFLAGS) $(LDFLAGS) -shared -Wl,-soname,$@ -o $@ $^ $(LIBS)
158
159 lib$(LIB).so: lib$(LIB).so.$(MAJ)
160 ln -s $< $@