diff options
author | Alexis Ballier <aballier@gentoo.org> | 2012-05-31 20:48:43 +0000 |
---|---|---|
committer | Alexis Ballier <aballier@gentoo.org> | 2012-05-31 20:48:43 +0000 |
commit | 31fccd5c937216c710ff7999b978b6e0acb69606 (patch) | |
tree | ac83664daee78a2cf8f1d034f68fc296945922e4 /sys-libs/libcxxrt/files | |
parent | Bump LeechCraft to 0.5.70 "Hessian Blade" (diff) | |
download | gentoo-2-31fccd5c937216c710ff7999b978b6e0acb69606.tar.gz gentoo-2-31fccd5c937216c710ff7999b978b6e0acb69606.tar.bz2 gentoo-2-31fccd5c937216c710ff7999b978b6e0acb69606.zip |
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.
(Portage version: 2.2.0_alpha108/cvs/Linux x86_64)
Diffstat (limited to 'sys-libs/libcxxrt/files')
-rw-r--r-- | sys-libs/libcxxrt/files/Makefile | 23 | ||||
-rw-r--r-- | sys-libs/libcxxrt/files/Makefile.test | 7 | ||||
-rw-r--r-- | sys-libs/libcxxrt/files/unwind.h | 94 |
3 files changed, 124 insertions, 0 deletions
diff --git a/sys-libs/libcxxrt/files/Makefile b/sys-libs/libcxxrt/files/Makefile new file mode 100644 index 000000000000..18b90a7cf712 --- /dev/null +++ b/sys-libs/libcxxrt/files/Makefile @@ -0,0 +1,23 @@ +LIB=cxxrt +MAJ=1 +OBJS=dynamic_cast.o exception.o guard.o stdexcept.o typeinfo.o memory.o auxhelper.o libelftc_dem_gnu3.o +SOBJS=${OBJS:.o=.So} + +static: lib$(LIB).a + +shared: lib$(LIB).so + +%.So: %.cc + $(CXX) -fPIC $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< + +%.So: %.c + $(CC) -fPIC $(CFLAGS) $(CPPFLAGS) -c -o $@ $< + +lib$(LIB).a: $(OBJS) + $(AR) cr $@ $^ + +lib$(LIB).so.$(MAJ): $(SOBJS) + $(CXX) -fPIC -nodefaultlibs $(CXXFLAGS) $(LDFLAGS) -shared -Wl,-soname,$@ -o $@ $^ $(LIBS) + +lib$(LIB).so: lib$(LIB).so.$(MAJ) + ln -s $< $@ diff --git a/sys-libs/libcxxrt/files/Makefile.test b/sys-libs/libcxxrt/files/Makefile.test new file mode 100644 index 000000000000..55099426e7b4 --- /dev/null +++ b/sys-libs/libcxxrt/files/Makefile.test @@ -0,0 +1,7 @@ +OBJS=test.o test_exception.o test_guard.o test_typeinfo.o + +cxxrttest: $(OBJS) + $(CXX) -nodefaultlibs $(CXXFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) + +check: cxxrttest + ./cxxrttest diff --git a/sys-libs/libcxxrt/files/unwind.h b/sys-libs/libcxxrt/files/unwind.h new file mode 100644 index 000000000000..04b1f1d18b8f --- /dev/null +++ b/sys-libs/libcxxrt/files/unwind.h @@ -0,0 +1,94 @@ +/* + * Copyright 2012 David Chisnall. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include_next <unwind.h> + +#ifndef CXXRT_UNWIND_H_INCLUDED +#define CXXRT_UNWIND_H_INCLUDED + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __arm__ +#define DECLARE_PERSONALITY_FUNCTION(name) \ +_Unwind_Reason_Code name(_Unwind_State state,\ + struct _Unwind_Exception *exceptionObject,\ + struct _Unwind_Context *context); + +#define BEGIN_PERSONALITY_FUNCTION(name) \ +_Unwind_Reason_Code name(_Unwind_State state,\ + struct _Unwind_Exception *exceptionObject,\ + struct _Unwind_Context *context)\ +{\ + int version = 1;\ + uint64_t exceptionClass = exceptionObject->exception_class;\ + int actions;\ + switch (state)\ + {\ + default: return _URC_FAILURE;\ + case _US_VIRTUAL_UNWIND_FRAME:\ + {\ + actions = _UA_SEARCH_PHASE;\ + break;\ + }\ + case _US_UNWIND_FRAME_STARTING:\ + {\ + actions = _UA_CLEANUP_PHASE;\ + if (exceptionObject->barrier_cache.sp == _Unwind_GetGR(context, 13))\ + {\ + actions |= _UA_HANDLER_FRAME;\ + }\ + break;\ + }\ + case _US_UNWIND_FRAME_RESUME:\ + {\ + return continueUnwinding(exceptionObject, context);\ + break;\ + }\ + }\ + _Unwind_SetGR (context, 12, (unsigned long)exceptionObject);\ + +#define CALL_PERSONALITY_FUNCTION(name) name(state,exceptionObject,context) +#else +#define DECLARE_PERSONALITY_FUNCTION(name) \ +_Unwind_Reason_Code name(int version,\ + _Unwind_Action actions,\ + uint64_t exceptionClass,\ + struct _Unwind_Exception *exceptionObject,\ + struct _Unwind_Context *context); +#define BEGIN_PERSONALITY_FUNCTION(name) \ +_Unwind_Reason_Code name(int version,\ + _Unwind_Action actions,\ + uint64_t exceptionClass,\ + struct _Unwind_Exception *exceptionObject,\ + struct _Unwind_Context *context)\ +{ + +#define CALL_PERSONALITY_FUNCTION(name) name(version, actions, exceptionClass, exceptionObject, context) +#endif + +#ifdef __cplusplus +} +#endif + +#endif |