Skip to content

Commit 117d6c7

Browse files
committed
Missing bits from the old Swift2 wrapping overlay changes that
allow 'make check' to pass by adding dependency on libswiftCore to the test programs when libdispatch was built with Swift support.
1 parent 3631802 commit 117d6c7

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

configure.ac

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ AS_IF([test "x$enable_apple_tsd_optimizations" = "xyes"],
9494
[Define to use non-portable pthread TSD optimizations for Mac OS X)])]
9595
)
9696

97+
AC_CANONICAL_TARGET
98+
9799
#
98100
# Enable building Swift overlay support into libdispatch
99101
#
@@ -102,11 +104,21 @@ AC_ARG_WITH([swift-toolchain],
102104
[swift_toolchain_path=${withval}
103105
AC_DEFINE(HAVE_SWIFT, 1, [Define if building for Swift])
104106
SWIFTC="$swift_toolchain_path/bin/swiftc"
107+
case $target_os in
108+
linux*)
109+
os_string="linux"
110+
;;
111+
*)
112+
os_string=$target_os
113+
;;
114+
esac
115+
SWIFT_LIBDIR="$swift_toolchain_path/lib/swift/$os_string/$target_cpu"
105116
have_swift=true],
106117
[have_swift=false]
107118
)
108119
AM_CONDITIONAL(HAVE_SWIFT, $have_swift)
109120
AC_SUBST([SWIFTC])
121+
AC_SUBST([SWIFT_LIBDIR])
110122

111123
#
112124
# Enable use of gold linker when building the Swift overlay
@@ -120,7 +132,6 @@ AM_CONDITIONAL(USE_GOLD_LINKER, $use_gold_linker)
120132
# Enable __thread based TSD on platforms where it is efficient
121133
# Allow override based on command line argument to configure
122134
#
123-
AC_CANONICAL_TARGET
124135
AC_ARG_ENABLE([thread-local-storage],
125136
[AS_HELP_STRING([--enable-thread-local-storage],
126137
[Enable usage of thread local storage via __thread])],,

src/swift/DispatchStubs.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,3 +185,13 @@ SOURCE(SIGNAL)
185185
SOURCE(TIMER)
186186
SOURCE(VNODE)
187187
SOURCE(WRITE)
188+
189+
// See comment in CFFuntime.c explaining why objc_retainAutoreleasedReturnValue is needed.
190+
extern "C" void swift_release(void *);
191+
extern "C" void * objc_retainAutoreleasedReturnValue(void *obj) {
192+
if (obj) {
193+
swift_release(obj);
194+
return obj;
195+
}
196+
else return NULL;
197+
}

tests/Makefile.am

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,11 @@ if HAVE_PTHREAD_WORKQUEUES
121121
endif
122122
endif
123123

124-
LDADD=libbsdtests.la $(top_builddir)/src/libdispatch.la $(KQUEUE_LIBS) $(PTHREAD_WORKQUEUE_LIBS) $(BSD_OVERLAY_LIBS)
124+
if HAVE_SWIFT
125+
SWIFT_LIBS=-L$(SWIFT_LIBDIR) -lswiftCore
126+
endif
127+
128+
LDADD=libbsdtests.la $(top_builddir)/src/libdispatch.la $(KQUEUE_LIBS) $(PTHREAD_WORKQUEUE_LIBS) $(BSD_OVERLAY_LIBS) $(SWIFT_LIBS)
125129
libbsdtests_la_LDFLAGS=-avoid-version
126130

127131
bsdtestsummarize_LDADD=-lm $(BSD_OVERLAY_LIBS)

0 commit comments

Comments
 (0)