From 1ec667a9acfa0eb8725bf7c720e421a19388ffe6 Mon Sep 17 00:00:00 2001 From: Simon Evans Date: Thu, 12 Jan 2017 17:45:23 +0000 Subject: [PATCH] Remove ObjC support functions not needed on non-ObjC platforms --- src/BlocksRuntime/runtime.c | 4 ++++ src/Makefile.am | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/BlocksRuntime/runtime.c b/src/BlocksRuntime/runtime.c index 1e1063684..164fe6ef6 100644 --- a/src/BlocksRuntime/runtime.c +++ b/src/BlocksRuntime/runtime.c @@ -12,8 +12,10 @@ #include #include #include +#if HAVE_OBJC #define __USE_GNU #include +#endif #if __has_include() #include #else @@ -202,6 +204,7 @@ static void (*_Block_memmove)(void *dest, void *src, unsigned long size) = _Bloc static void (*_Block_destructInstance) (const void *aBlock) = _Block_destructInstance_default; +#if HAVE_OBJC /************************************************************************** GC support SPI functions - called from ObjC runtime and CoreFoundation ***************************************************************************/ @@ -252,6 +255,7 @@ void _Block_use_RR( void (*retain)(const void *), _Block_release_object = release; _Block_destructInstance = dlsym(RTLD_DEFAULT, "objc_destructInstance"); } +#endif // HAVE_OBJC // Called from CF to indicate MRR. Newer version uses a versioned structure, so we can add more functions // without defining a new entry point. diff --git a/src/Makefile.am b/src/Makefile.am index 1e2ba6538..a574288e7 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -88,8 +88,10 @@ if BUILD_OWN_BLOCKS_RUNTIME libdispatch_la_SOURCES+= BlocksRuntime/data.c BlocksRuntime/runtime.c CBLOCKS_FLAGS+= -I$(top_srcdir)/src/BlocksRuntime CXXBLOCKS_FLAGS+= -I$(top_srcdir)/src/BlocksRuntime +if USE_OBJC BLOCKS_RUNTIME_LIBS=-ldl endif +endif libdispatch_la_LDFLAGS=-avoid-version libdispatch_la_LIBADD=$(KQUEUE_LIBS) $(PTHREAD_WORKQUEUE_LIBS) $(BSD_OVERLAY_LIBS) $(BLOCKS_RUNTIME_LIBS)