Skip to content

fixes for compilation/linking problems on linux #144

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ config
configure
libtool
.dirstamp
/dispatch/module.modulemap
/private/module.modulemap
16 changes: 15 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,20 @@ AS_IF([test "x$have_mach" = "xtrue"], [
])
AM_CONDITIONAL(HAVE_DARWIN_LD, [test "x$dispatch_cv_ld_darwin" == "xyes"])

#
# symlink platform-specific module.modulemap files
#
AS_CASE([$target_os],
[darwin*], [ dispatch_module_map_os=darwin ],
[ dispatch_module_map_os=generic ]
)
AC_CONFIG_COMMANDS([modulemaps], [
ln -fs $dispatch_module_map_os/module.modulemap $ac_top_srcdir/dispatch/module.modulemap
ln -fs $dispatch_module_map_os/module.modulemap $ac_top_srcdir/private/module.modulemap
],
[dispatch_module_map_os="$dispatch_module_map_os"]
)

#
# Temporary: some versions of clang do not mark __builtin_trap() as
# __attribute__((__noreturn__)). Detect and add if required.
Expand All @@ -449,6 +463,6 @@ AC_CONFIG_FILES([Makefile dispatch/Makefile man/Makefile os/Makefile private/Mak
#
# Generate testsuite links
#
AC_CONFIG_LINKS([tests/dispatch:$top_srcdir/private tests/leaks-wrapper:tests/leaks-wrapper.sh])
AC_CONFIG_LINKS([tests/dispatch:$ac_top_srcdir/private tests/leaks-wrapper:tests/leaks-wrapper.sh])

AC_OUTPUT
2 changes: 1 addition & 1 deletion dispatch/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ dispatch_HEADERS= \
time.h

if HAVE_SWIFT
dispatch_HEADERS+=module.map
dispatch_HEADERS+=module.modulemap
endif
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions libdispatch.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -662,8 +662,8 @@
C01866BD1C5973210040FC07 /* libdispatch.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libdispatch.a; sourceTree = BUILT_PRODUCTS_DIR; };
C01866BE1C59735B0040FC07 /* libdispatch-mp-static.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "libdispatch-mp-static.xcconfig"; sourceTree = "<group>"; };
C01866BF1C5976C90040FC07 /* run-on-install.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = "run-on-install.sh"; sourceTree = "<group>"; };
C901445E1C73A7FE002638FC /* module.modulemap */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = "sourcecode.module-map"; path = module.modulemap; sourceTree = "<group>"; };
C90144641C73A845002638FC /* module.modulemap */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = "sourcecode.module-map"; path = module.modulemap; sourceTree = "<group>"; };
C901445E1C73A7FE002638FC /* module.modulemap */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = "sourcecode.module-map"; name = module.modulemap; path = darwin/module.modulemap; sourceTree = "<group>"; };
C90144641C73A845002638FC /* module.modulemap */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = "sourcecode.module-map"; name = module.modulemap; path = darwin/module.modulemap; sourceTree = "<group>"; };
C913AC0E143BD34800B78976 /* data_private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = data_private.h; sourceTree = "<group>"; tabWidth = 8; };
C927F35F10FD7F1000C5AB8B /* ddt.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ddt.xcodeproj; path = tools/ddt/ddt.xcodeproj; sourceTree = "<group>"; };
C96CE17A1CEB851600F4B8E6 /* dispatch_objc.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = dispatch_objc.m; sourceTree = "<group>"; };
Expand Down
File renamed without changes.
11 changes: 11 additions & 0 deletions private/generic/module.modulemap
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module DispatchPrivate [system] [extern_c] {
umbrella header "private.h"
exclude header "mach_private.h"
module * { export * }
export *
}

module DispatchIntrospectionPrivate [system] [extern_c] {
header "introspection_private.h"
export *
}
5 changes: 3 additions & 2 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,11 @@ 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
BLOCKS_RUNTIME_LIBS=-ldl
endif

libdispatch_la_LDFLAGS=-avoid-version
libdispatch_la_LIBADD=$(KQUEUE_LIBS) $(PTHREAD_WORKQUEUE_LIBS) $(BSD_OVERLAY_LIBS)
libdispatch_la_LIBADD=$(KQUEUE_LIBS) $(PTHREAD_WORKQUEUE_LIBS) $(BSD_OVERLAY_LIBS) $(BLOCKS_RUNTIME_LIBS)

if HAVE_DARWIN_LD
libdispatch_la_LDFLAGS+=-Wl,-compatibility_version,1 \
Expand Down Expand Up @@ -163,7 +164,7 @@ SWIFT_GEN_FILES= \
$(SWIFT_OBJ_FILES:%=%.~partial.swiftdoc) \
$(SWIFT_OBJ_FILES:%=%.~partial.swiftdeps)

SWIFTC_FLAGS = -Xcc -fmodule-map-file=$(abs_top_srcdir)/dispatch/module.map -I$(abs_top_srcdir) -Xcc -fblocks
SWIFTC_FLAGS = -Xcc -fmodule-map-file=$(abs_top_srcdir)/dispatch/module.modulemap -I$(abs_top_srcdir) -Xcc -fblocks
if DISPATCH_ENABLE_OPTIMIZATION
SWIFTC_FLAGS+=-O
endif
Expand Down
2 changes: 1 addition & 1 deletion src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -1197,7 +1197,7 @@ dispatch_source_type_readwrite_init(dispatch_source_t ds,
dispatch_queue_t q DISPATCH_UNUSED)
{
ds->ds_is_level = true;
#ifdef HAVE_DECL_NOTE_LOWAT
#if HAVE_DECL_NOTE_LOWAT
// bypass kernel check for device kqueue support rdar://19004921
ds->ds_dkev->dk_kevent.fflags = NOTE_LOWAT;
#endif
Expand Down
7 changes: 7 additions & 0 deletions src/queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -2734,12 +2734,16 @@ _dispatch_block_create_with_voucher_and_priority(dispatch_block_flags_t flags,
bool assign = (flags & DISPATCH_BLOCK_ASSIGN_CURRENT);

if (assign && !(flags & DISPATCH_BLOCK_HAS_VOUCHER)) {
#if OS_VOUCHER_ACTIVITY_SPI
voucher = VOUCHER_CURRENT;
#endif
flags |= DISPATCH_BLOCK_HAS_VOUCHER;
}
#if OS_VOUCHER_ACTIVITY_SPI
if (voucher == VOUCHER_CURRENT) {
voucher = _voucher_get();
}
#endif
if (assign && !(flags & DISPATCH_BLOCK_HAS_PRIORITY)) {
pri = _dispatch_priority_propagate();
flags |= DISPATCH_BLOCK_HAS_PRIORITY;
Expand Down Expand Up @@ -5840,6 +5844,9 @@ _dispatch_main_queue_callback_4CF(
void
dispatch_main(void)
{
dispatch_once_f(&_dispatch_root_queues_pred, NULL,
_dispatch_root_queues_init_once);

#if HAVE_PTHREAD_MAIN_NP
if (pthread_main_np()) {
#endif
Expand Down
2 changes: 0 additions & 2 deletions src/shims/linux_stubs.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ typedef uint32_t voucher_activity_trace_id_t;

typedef uint32_t voucher_activity_id_t;

typedef uint32_t _voucher_activity_buffer_hook_t;;

typedef uint32_t voucher_activity_flag_t;

typedef struct { } mach_msg_header_t;
Expand Down
2 changes: 2 additions & 0 deletions src/voucher.c
Original file line number Diff line number Diff line change
Expand Up @@ -1560,6 +1560,7 @@ _voucher_init(void)
{
}

#if OS_VOUCHER_ACTIVITY_SPI
void*
voucher_activity_get_metadata_buffer(size_t *length)
{
Expand Down Expand Up @@ -1631,6 +1632,7 @@ voucher_activity_initialize_4libtrace(voucher_activity_hooks_t hooks)
{
(void)hooks;
}
#endif // OS_VOUCHER_ACTIVITY_SPI

size_t
_voucher_debug(voucher_t v, char* buf, size_t bufsiz)
Expand Down
2 changes: 2 additions & 0 deletions src/voucher_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,10 @@ voucher_get_mach_voucher(voucher_t voucher);
void _voucher_init(void);
void _voucher_atfork_child(void);
void _voucher_activity_debug_channel_init(void);
#if OS_VOUCHER_ACTIVITY_SPI
void _voucher_activity_swap(firehose_activity_id_t old_id,
firehose_activity_id_t new_id);
#endif
void _voucher_xref_dispose(voucher_t voucher);
void _voucher_dispose(voucher_t voucher);
size_t _voucher_debug(voucher_t v, char* buf, size_t bufsiz);
Expand Down