Separate ObjC++ support out into libobjcxx. Now code that doesn't need ObjCXX support can safely ignore it again.

This commit is contained in:
theraven 2011-04-05 17:21:30 +00:00
parent 7e71ffe24d
commit 600e970dea
5 changed files with 24 additions and 13 deletions

View File

@ -7,7 +7,7 @@ SVN_TAG_NAME=objc2
include $(GNUSTEP_MAKEFILES)/common.make
LIBRARY_NAME = libobjc
LIBRARY_NAME = libobjc libobjcxx
libobjc_VERSION = 4
@ -41,12 +41,8 @@ libobjc_C_FILES = \
statics_loader.c\
toydispatch.c
ifneq ($(objective-cxx), no)
libobjc_CC_FILES = objcxx_eh.cc
libobjc_LDFLAGS = -lstdc++
else
libobjc_CFLAGS += -DNO_OBJCXX
endif
libobjcxx_CC_FILES = objcxx_eh.cc
libobjcxx_LDFLAGS = -lstdc++ -lobjc
ifneq ($(enable_legacy), no)
libobjc_C_FILES += legacy_malloc.c

View File

@ -16,6 +16,9 @@ PREFIX?= /usr/local
LIB_DIR= ${PREFIX}/lib
HEADER_DIR= ${PREFIX}/include
OBJCXX_OBJECTS = \
objcxx_eh.o
OBJECTS = \
NSBlocks.o\
Protocol2.o\
@ -34,7 +37,6 @@ OBJECTS = \
legacy_malloc.o\
loader.o\
mutation.o\
objcxx_eh.o\
properties.o\
protocol.o\
runtime.o\
@ -45,11 +47,15 @@ OBJECTS = \
sync.o\
toydispatch.o
all: libobjc.so.$(VERSION) libobjc.a
all: libobjc.so.$(VERSION) libobjc.a libobjcxx.so.$(VERSION)
libobjcxx.so.$(VERSION): $(OBJCXX_OBJECTS)
@echo Linking shared library...
@$(CXX) -Wl,-shared -o $@ $(OBJCXX_OBJECTS)
libobjc.so.$(VERSION): $(OBJECTS)
@echo Linking shared library...
@$(CXX) -Wl,-shared -o $@ $(OBJECTS)
@ld -shared -o $@ $(OBJECTS)
libobjc.a: $(OBJECTS)
@echo Linking static library...
@ -67,14 +73,19 @@ libobjc.a: $(OBJECTS)
install: all
install -d $(LIB_DIR)
install -m 444 libobjc.so.$(VERSION) $(LIB_DIR)
install -m 444 libobjcxx.so.$(VERSION) $(LIB_DIR)
install -m 444 libobjc.a $(LIB_DIR)
ln -sf $(LIB_DIR)/libobjc.so.$(VERSION) $(LIB_DIR)/libobjc.so
ln -sf $(LIB_DIR)/libobjc.so.$(VERSION) $(LIB_DIR)/libobjc.so.$(MAJOR_VERSION)
ln -sf $(LIB_DIR)/libobjc.so.$(VERSION) $(LIB_DIR)/libobjc.so.$(MAJOR_VERSION).$(MINOR_VERSION)
ln -sf $(LIB_DIR)/libobjcxx.so.$(VERSION) $(LIB_DIR)/libobjcxx.so
ln -sf $(LIB_DIR)/libobjcxx.so.$(VERSION) $(LIB_DIR)/libobjcxx.so.$(MAJOR_VERSION)
ln -sf $(LIB_DIR)/libobjcxx.so.$(VERSION) $(LIB_DIR)/libobjcxx.so.$(MAJOR_VERSION).$(MINOR_VERSION)
install -d $(HEADER_DIR)/objc
install -m 444 objc/*.h $(HEADER_DIR)/objc
clean:
rm -f $(OBJECTS)
rm -f libobjc.so.$(VERSION)
rm -f libobjcxx.so.$(VERSION)
rm -f libobjc.a

View File

@ -280,6 +280,7 @@ struct dwarf_eh_action
/**
* Look up the landing pad that corresponds to the current invoke.
*/
__attribute__((unused))
static struct dwarf_eh_action
dwarf_eh_find_callsite(struct _Unwind_Context *context, struct dwarf_eh_lsda *lsda)
{

View File

@ -368,8 +368,6 @@ _Unwind_Reason_Code __gnu_objc_personality_v0(int version,
return _URC_INSTALL_CONTEXT;
}
#ifndef NO_OBJCXX
_Unwind_Reason_Code __gnustep_objcxx_personality_v0(int version,
_Unwind_Action actions,
uint64_t exceptionClass,
@ -398,4 +396,3 @@ _Unwind_Reason_Code __gnustep_objcxx_personality_v0(int version,
exceptionObject, context);
}
#endif

View File

@ -5,6 +5,7 @@ extern "C" {
* Allocates a C++ exception. This function is part of the Itanium C++ ABI and
* is provided externally.
*/
__attribute__((weak))
void *__cxa_allocate_exception(size_t thrown_size);
/**
* Initialises an exception object returned by __cxa_allocate_exception() for
@ -12,11 +13,13 @@ void *__cxa_allocate_exception(size_t thrown_size);
* _Unwind_Exception structure within this structure, and should be passed to
* the C++ personality function.
*/
__attribute__((weak))
struct _Unwind_Exception *objc_init_cxx_exception(void *thrown_exception);
/**
* The GNU C++ exception personality function, provided by libsupc++ (GNU) or
* libcxxrt (PathScale).
*/
__attribute__((weak))
_Unwind_Reason_Code __gxx_personality_v0(int version,
_Unwind_Action actions,
uint64_t exceptionClass,
@ -26,18 +29,21 @@ _Unwind_Reason_Code __gxx_personality_v0(int version,
* Frees an exception object allocated by __cxa_allocate_exception(). Part of
* the Itanium C++ ABI.
*/
__attribute__((weak))
void __cxa_free_exception(void *thrown_exception);
/**
* Tests whether a C++ exception contains an Objective-C object, and returns if
* if it does. Returns -1 if it doesn't. -1 is used instead of 0, because
* throwing nil is allowed, but throwing non-nil, invalid objects is not.
*/
__attribute__((weak))
void *objc_object_for_cxx_exception(void *thrown_exception);
/**
* Prints the type info associated with an exception. Used only when
* debugging, not compiled in the normal build.
*/
__attribute__((weak))
void print_type_info(void *thrown_exception);