Skip to content

Commit 74b8cec

Browse files
authored
Merge pull request swiftlang#80 from seabaylea/experimental-overlay
Provide Swift 3 overlay
2 parents 245c9b3 + a0843e3 commit 74b8cec

File tree

6 files changed

+619
-73
lines changed

6 files changed

+619
-73
lines changed

configure.ac

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,20 @@ AC_ARG_WITH([swift-toolchain],
108108
[AS_HELP_STRING([--with-swift-toolchain], [Specify path to Swift toolchain])],
109109
[swift_toolchain_path=${withval}
110110
AC_DEFINE(HAVE_SWIFT, 1, [Define if building for Swift])
111-
SWIFTC="$swift_toolchain_path/bin/swiftc"
111+
SWIFT_TOOLCHAIN_PATH="$swift_toolchain_path"
112112
have_swift=true],
113113
[have_swift=false]
114114
)
115115
AM_CONDITIONAL(HAVE_SWIFT, $have_swift)
116-
AC_SUBST([SWIFTC])
116+
AC_SUBST([SWIFT_TOOLCHAIN_PATH])
117+
118+
#
119+
# Enable use of gold linker when building the Swift overlay
120+
# to avoid a symbol relocation issue.
121+
# Ultimately the request to use gold should be passed in as an arg
122+
#
123+
AC_CHECK_PROG(use_gold_linker, ld.gold, true, false)
124+
AM_CONDITIONAL(USE_GOLD_LINKER, $use_gold_linker)
117125

118126
AC_USE_SYSTEM_EXTENSIONS
119127
AM_INIT_AUTOMAKE([foreign no-dependencies subdir-objects])

dispatch/module.map

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
module Dispatch [system] {
1+
module Dispatch {
2+
requires blocks
3+
export *
4+
link "dispatch"
5+
link "BlocksRuntime"
6+
}
7+
8+
module CDispatch [system] {
29
umbrella header "dispatch.h"
310
requires blocks
411
export *

src/Makefile.am

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,14 @@ if HAVE_PTHREAD_WORKQUEUES
8181
endif
8282
endif
8383

84+
if HAVE_SWIFT
85+
SWIFTC=${SWIFT_TOOLCHAIN_PATH}/bin/swiftc
86+
SWIFT_RUNTIME_LIBS=$(SWIFT_TOOLCHAIN_PATH)/lib/swift/linux
87+
SWIFT_LIBS=-L$(SWIFT_RUNTIME_LIBS) -lswiftCore
88+
endif
89+
8490
libdispatch_la_LDFLAGS=-avoid-version
85-
libdispatch_la_LIBADD=$(KQUEUE_LIBS) $(PTHREAD_WORKQUEUE_LIBS) $(BSD_OVERLAY_LIBS)
91+
libdispatch_la_LIBADD=$(KQUEUE_LIBS) $(PTHREAD_WORKQUEUE_LIBS) $(BSD_OVERLAY_LIBS) $(SWIFT_LIBS)
8692

8793
if HAVE_DARWIN_LD
8894
libdispatch_la_LDFLAGS+=-Wl,-compatibility_version,1 \
@@ -128,6 +134,10 @@ EXTRA_libdispatch_la_SOURCES+=swift/Dispatch.swift
128134
EXTRA_libdispatch_la_DEPENDENCIES+=$(abs_builddir)/Dispatch.o $(abs_builddir)/Dispatch.swiftmodule
129135
libdispatch_la_LIBADD+=$(abs_builddir)/Dispatch.o
130136

137+
if USE_GOLD_LINKER
138+
libdispatch_la_LDFLAGS+=-Xcompiler -fuse-ld=gold
139+
endif
140+
131141
SWIFT_OBJECTS= \
132142
$(abs_builddir)/Dispatch.swiftmodule \
133143
$(abs_builddir)/Dispatch.swiftdoc \

0 commit comments

Comments
 (0)