Index: runtime/cmake/LibompHandleFlags.cmake =================================================================== --- runtime/cmake/LibompHandleFlags.cmake +++ runtime/cmake/LibompHandleFlags.cmake @@ -156,6 +156,11 @@ if(${IA32}) libomp_append(libflags_local -lirc_pic LIBOMP_HAVE_IRC_PIC_LIBRARY) endif() + IF(${CMAKE_SYSTEM_NAME} MATCHES "DragonFly") + libomp_append(libflags_local "-Wl,--no-as-needed" LIBOMP_HAVE_AS_NEEDED_FLAG) + libomp_append(libflags_local "-lm") + libomp_append(libflags_local "-Wl,--as-needed" LIBOMP_HAVE_AS_NEEDED_FLAG) + ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "DragonFly") IF(${CMAKE_SYSTEM_NAME} MATCHES "NetBSD") libomp_append(libflags_local -lm) ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "NetBSD") Index: runtime/cmake/LibompMicroTests.cmake =================================================================== --- runtime/cmake/LibompMicroTests.cmake +++ runtime/cmake/LibompMicroTests.cmake @@ -176,6 +176,9 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "NetBSD") set(libomp_expected_library_deps libc.so.12 libpthread.so.1 libm.so.0) libomp_append(libomp_expected_library_deps libhwloc.so.5 LIBOMP_USE_HWLOC) +elseif(CMAKE_SYSTEM_NAME MATCHES "DragonFly") + set(libomp_expected_library_deps libc.so.8 libpthread.so.0 libm.so.4) + libomp_append(libomp_expected_library_deps libhwloc.so.5 LIBOMP_USE_HWLOC) elseif(APPLE) set(libomp_expected_library_deps /usr/lib/libSystem.B.dylib) elseif(WIN32) Index: runtime/src/kmp.h =================================================================== --- runtime/src/kmp.h +++ runtime/src/kmp.h @@ -1019,6 +1019,10 @@ /* TODO: tune for KMP_OS_DARWIN */ #define KMP_INIT_WAIT 1024U /* initial number of spin-tests */ #define KMP_NEXT_WAIT 512U /* susequent number of spin-tests */ +#elif KMP_OS_DRAGONFLY +/* TODO: tune for KMP_OS_DRAGONFLY */ +#define KMP_INIT_WAIT 1024U /* initial number of spin-tests */ +#define KMP_NEXT_WAIT 512U /* susequent number of spin-tests */ #elif KMP_OS_FREEBSD /* TODO: tune for KMP_OS_FREEBSD */ #define KMP_INIT_WAIT 1024U /* initial number of spin-tests */ Index: runtime/src/kmp_ftn_entry.h =================================================================== --- runtime/src/kmp_ftn_entry.h +++ runtime/src/kmp_ftn_entry.h @@ -348,7 +348,7 @@ #else int gtid; -#if KMP_OS_DARWIN || KMP_OS_FREEBSD || KMP_OS_NETBSD +#if KMP_OS_DARWIN || KMP_OS_DRAGONFLY || KMP_OS_FREEBSD || KMP_OS_NETBSD gtid = __kmp_entry_gtid(); #elif KMP_OS_WINDOWS if (!__kmp_init_parallel || Index: runtime/src/kmp_platform.h =================================================================== --- runtime/src/kmp_platform.h +++ runtime/src/kmp_platform.h @@ -19,6 +19,7 @@ /* ---------------------- Operating system recognition ------------------- */ #define KMP_OS_LINUX 0 +#define KMP_OS_DRAGONFLY 0 #define KMP_OS_FREEBSD 0 #define KMP_OS_NETBSD 0 #define KMP_OS_DARWIN 0 @@ -46,6 +47,11 @@ #else #endif +#if (defined __DragonFly__) +#undef KMP_OS_DRAGONFLY +#define KMP_OS_DRAGONFLY 1 +#endif + #if (defined __FreeBSD__) #undef KMP_OS_FREEBSD #define KMP_OS_FREEBSD 1 @@ -62,12 +68,13 @@ #endif #if (1 != \ - KMP_OS_LINUX + KMP_OS_FREEBSD + KMP_OS_NETBSD + KMP_OS_DARWIN + \ - KMP_OS_WINDOWS) + KMP_OS_LINUX + KMP_OS_DRAGONFLY + KMP_OS_FREEBSD + KMP_OS_NETBSD + \ + KMP_OS_DARWIN + KMP_OS_WINDOWS) #error Unknown OS #endif -#if KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_NETBSD || KMP_OS_DARWIN +#if KMP_OS_LINUX || KMP_OS_DRAGONFLY || KMP_OS_FREEBSD || KMP_OS_NETBSD || \ + KMP_OS_DARWIN #undef KMP_OS_UNIX #define KMP_OS_UNIX 1 #endif Index: runtime/src/kmp_runtime.cpp =================================================================== --- runtime/src/kmp_runtime.cpp +++ runtime/src/kmp_runtime.cpp @@ -7507,8 +7507,8 @@ #if KMP_ARCH_X86_64 || KMP_ARCH_PPC64 || KMP_ARCH_AARCH64 || KMP_ARCH_MIPS64 -#if KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_NETBSD || KMP_OS_WINDOWS || \ - KMP_OS_DARWIN +#if KMP_OS_LINUX || KMP_OS_DRAGONFLY || KMP_OS_FREEBSD || KMP_OS_NETBSD || \ + KMP_OS_WINDOWS || KMP_OS_DARWIN int teamsize_cutoff = 4; @@ -7530,8 +7530,8 @@ } #else #error "Unknown or unsupported OS" -#endif // KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_NETBSD || KMP_OS_WINDOWS || -// KMP_OS_DARWIN +#endif // KMP_OS_LINUX || KMP_OS_DRAGONFLY || KMP_OS_FREEBSD || KMP_OS_NETBSD \ +// || KMP_OS_WINDOWS || KMP_OS_DARWIN #elif KMP_ARCH_X86 || KMP_ARCH_ARM || KMP_ARCH_AARCH || KMP_ARCH_MIPS Index: runtime/src/kmp_wrapper_malloc.h =================================================================== --- runtime/src/kmp_wrapper_malloc.h +++ runtime/src/kmp_wrapper_malloc.h @@ -96,7 +96,7 @@ #if KMP_OS_WINDOWS #include // Windows* OS: _alloca() declared in "malloc.h". #define alloca _alloca // Allow to use alloca() with no underscore. -#elif KMP_OS_FREEBSD || KMP_OS_NETBSD +#elif KMP_OS_DRAGONFLY || KMP_OS_FREEBSD || KMP_OS_NETBSD // Declared in "stdlib.h". #elif KMP_OS_UNIX #include // Linux* OS and OS X*: alloc() declared in "alloca". Index: runtime/src/z_Linux_util.cpp =================================================================== --- runtime/src/z_Linux_util.cpp +++ runtime/src/z_Linux_util.cpp @@ -24,7 +24,7 @@ #include "kmp_wait_release.h" #include "kmp_wrapper_getpid.h" -#if !KMP_OS_FREEBSD && !KMP_OS_NETBSD +#if !KMP_OS_DRAGONFLY && !KMP_OS_FREEBSD && !KMP_OS_NETBSD #include #endif #include // HUGE_VAL. @@ -52,7 +52,7 @@ #elif KMP_OS_DARWIN #include #include -#elif KMP_OS_FREEBSD +#elif KMP_OS_DRAGONFLY || KMP_OS_FREEBSD #include #endif @@ -446,7 +446,7 @@ determined exactly, FALSE if incremental refinement is necessary. */ static kmp_int32 __kmp_set_stack_info(int gtid, kmp_info_t *th) { int stack_data; -#if KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_NETBSD +#if KMP_OS_LINUX || KMP_OS_DRAGONFLY || KMP_OS_FREEBSD || KMP_OS_NETBSD /* Linux* OS only -- no pthread_getattr_np support on OS X* */ pthread_attr_t attr; int status; @@ -461,7 +461,7 @@ /* Fetch the real thread attributes */ status = pthread_attr_init(&attr); KMP_CHECK_SYSFAIL("pthread_attr_init", status); -#if KMP_OS_FREEBSD || KMP_OS_NETBSD +#if KMP_OS_DRAGONFLY || KMP_OS_FREEBSD || KMP_OS_NETBSD status = pthread_attr_get_np(pthread_self(), &attr); KMP_CHECK_SYSFAIL("pthread_attr_get_np", status); #else @@ -485,7 +485,7 @@ TCW_4(th->th.th_info.ds.ds_stackgrow, FALSE); return TRUE; } -#endif /* KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_NETBSD */ +#endif /* KMP_OS_LINUX || KMP_OS_DRAGONFLY || KMP_OS_FREEBSD || KMP_OS_NETBSD */ /* Use incremental refinement starting from initial conservative estimate */ TCW_PTR(th->th.th_info.ds.ds_stacksize, 0); TCW_PTR(th->th.th_info.ds.ds_stackbase, &stack_data); @@ -499,7 +499,7 @@ sigset_t new_set, old_set; #endif /* KMP_BLOCK_SIGNALS */ void *exit_val; -#if KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_NETBSD +#if KMP_OS_LINUX || KMP_OS_DRAGONFLY || KMP_OS_FREEBSD || KMP_OS_NETBSD void *volatile padding = 0; #endif int gtid; @@ -547,7 +547,7 @@ KMP_CHECK_SYSFAIL("pthread_sigmask", status); #endif /* KMP_BLOCK_SIGNALS */ -#if KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_NETBSD +#if KMP_OS_LINUX || KMP_OS_DRAGONFLY || KMP_OS_FREEBSD || KMP_OS_NETBSD if (__kmp_stkoffset > 0 && gtid > 0) { padding = KMP_ALLOCA(gtid * __kmp_stkoffset); } @@ -1788,7 +1788,7 @@ int r = 0; -#if KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_NETBSD +#if KMP_OS_LINUX || KMP_OS_DRAGONFLY || KMP_OS_FREEBSD || KMP_OS_NETBSD r = sysconf(_SC_NPROCESSORS_ONLN); @@ -2046,9 +2046,9 @@ found = 1; }; // if -#elif KMP_OS_FREEBSD || KMP_OS_NETBSD +#elif KMP_OS_DRAGONFLY || KMP_OS_FREEBSD || KMP_OS_NETBSD - // FIXME(FreeBSD, NetBSD): Implement this + // FIXME(DragonFly, FreeBSD, NetBSD): Implement this found = 1; #else