Fix the build with GC enabled, export the GC symbols in all build configurations.

main
theraven 13 years ago
parent 3f94730ba8
commit c819b379da

@ -36,7 +36,6 @@ set(libobjc_C_SRCS
dtable.c
eh_personality.c
encoding2.c
gc_none.c
hash_table.c
hooks.c
ivar.c
@ -114,6 +113,9 @@ if (BOEHM_GC)
set(CMAKE_OBJC_FLAGS "${CMAKE_OBJC_FLAGS} -fobjc-gc")
set(objc_LINK_FLAGS "${objc_LINK_FLAGS} ${GC_CFLAGS}")
add_definitions(-DENABLE_GC)
list(APPEND libobjc_OBJC_SRCS gc_boehm.c)
else ()
list(APPEND libobjc_OBJC_SRCS gc_none.c)
endif ()
set(LEGACY_COMPAT FALSE CACHE BOOL

@ -4,6 +4,7 @@
#include "class.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
static id allocate_class(Class cls, size_t extraBytes)
{
@ -45,3 +46,75 @@ PRIVATE void enableGC(BOOL exclusive)
abort();
}
#endif
void objc_set_collection_threshold(size_t threshold) {}
void objc_set_collection_ratio(size_t ratio) {}
void objc_collect(unsigned long options) {}
BOOL objc_collectingEnabled(void) { return NO; }
BOOL objc_atomicCompareAndSwapPtr(id predicate, id replacement, volatile id *objectLocation)
{
return __sync_bool_compare_and_swap(objectLocation, predicate, replacement);
}
BOOL objc_atomicCompareAndSwapPtrBarrier(id predicate, id replacement, volatile id *objectLocation)
{
return __sync_bool_compare_and_swap(objectLocation, predicate, replacement);
}
BOOL objc_atomicCompareAndSwapGlobal(id predicate, id replacement, volatile id *objectLocation)
{
return objc_atomicCompareAndSwapPtr(predicate, replacement, objectLocation);
}
BOOL objc_atomicCompareAndSwapGlobalBarrier(id predicate, id replacement, volatile id *objectLocation)
{
return objc_atomicCompareAndSwapPtr(predicate, replacement, objectLocation);
}
BOOL objc_atomicCompareAndSwapInstanceVariable(id predicate, id replacement, volatile id *objectLocation)
{
return objc_atomicCompareAndSwapPtr(predicate, replacement, objectLocation);
}
BOOL objc_atomicCompareAndSwapInstanceVariableBarrier(id predicate, id replacement, volatile id *objectLocation)
{
return objc_atomicCompareAndSwapPtr(predicate, replacement, objectLocation);
}
id objc_assign_strongCast(id val, id *ptr)
{
*ptr = val;
return val;
}
id objc_assign_global(id val, id *ptr)
{
*ptr = val;
return val;
}
id objc_assign_ivar(id val, id dest, ptrdiff_t offset)
{
*(id*)((char*)dest+offset) = val;
return val;
}
void *objc_memmove_collectable(void *dst, const void *src, size_t size)
{
return memmove(dst, src, size);
}
id objc_read_weak(id *location)
{
return *location;
}
id objc_assign_weak(id value, id *location)
{
*location = value;
return value;
}
id objc_allocate_object(Class cls, int extra)
{
return class_createInstance(cls, extra);
}
BOOL objc_collecting_enabled(void) { return NO; }
void objc_startCollectorThread(void) {}
void objc_clear_stack(unsigned long options) {}
BOOL objc_is_finalized(void *ptr) { return NO; }
void objc_finalizeOnMainThread(Class cls) {}

@ -76,7 +76,7 @@ struct __cxa_exception
unexpected_handler unexpectedHandler;
terminate_handler terminateHandler;
__cxa_exception *nextException;
unsigned int handlerCount;
int handlerCount;
int handlerSwitchValue;
const char *actionRecord;
const char *languageSpecificData;

Loading…
Cancel
Save