diff options
31 files changed, 289 insertions, 412 deletions
diff --git a/compiler/GHC/Linker/Dynamic.hs b/compiler/GHC/Linker/Dynamic.hs index 171503d4d6..646eab59d4 100644 --- a/compiler/GHC/Linker/Dynamic.hs +++ b/compiler/GHC/Linker/Dynamic.hs @@ -3,8 +3,6 @@ -- | Dynamic linker module GHC.Linker.Dynamic ( linkDynLib - -- * Platform-specifics - , libmLinkOpts ) where @@ -214,7 +212,6 @@ linkDynLib logger tmpfs dflags0 unit_env o_files dep_packages runLink logger tmpfs dflags ( map Option verbFlags - ++ libmLinkOpts platform ++ [ Option "-o" , FileOption "" output_fn ] @@ -230,13 +227,6 @@ linkDynLib logger tmpfs dflags0 unit_env o_files dep_packages ++ map Option pkg_link_opts ) --- | Some platforms require that we explicitly link against @libm@ if any --- math-y things are used (which we assume to include all programs). See #14022. -libmLinkOpts :: Platform -> [Option] -libmLinkOpts platform - | platformHasLibm platform = [Option "-lm"] - | otherwise = [] - {- Note [-Bsymbolic assumptions by GHC] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/compiler/GHC/Linker/Static.hs b/compiler/GHC/Linker/Static.hs index 99495d33fb..d251832694 100644 --- a/compiler/GHC/Linker/Static.hs +++ b/compiler/GHC/Linker/Static.hs @@ -24,7 +24,6 @@ import GHC.Utils.TmpFs import GHC.Linker.MacOS import GHC.Linker.Unit -import GHC.Linker.Dynamic import GHC.Linker.ExtraObj import GHC.Linker.Windows import GHC.Linker.Static.Utils @@ -195,7 +194,6 @@ linkBinary' staticLink logger tmpfs dflags unit_env o_files dep_units = do ++ [ GHC.SysTools.Option "-o" , GHC.SysTools.FileOption "" output_fn ] - ++ libmLinkOpts platform ++ map GHC.SysTools.Option ( [] diff --git a/compiler/GHC/Platform.hs b/compiler/GHC/Platform.hs index a630e0c1d3..2faef1599f 100644 --- a/compiler/GHC/Platform.hs +++ b/compiler/GHC/Platform.hs @@ -79,10 +79,6 @@ data Platform = Platform -- ^ Determines whether we will be compiling info tables that reside just -- before the entry code, or with an indirection to the entry code. See -- TABLES_NEXT_TO_CODE in rts/include/rts/storage/InfoTables.h. - , platformHasLibm :: !Bool - -- ^ Some platforms require that we explicitly link against @libm@ if any - -- math-y things are used (which we assume to include all programs). See - -- #14022. , platform_constants :: !(Maybe PlatformConstants) -- ^ Constants such as structure offsets, type sizes, etc. @@ -136,7 +132,6 @@ genericPlatform = Platform , platformHasGnuNonexecStack = False , platformHasIdentDirective = False , platformHasSubsectionsViaSymbols= False - , platformHasLibm = False , platformIsCrossCompiling = False , platformLeadingUnderscore = False , platformTablesNextToCode = True diff --git a/compiler/GHC/Settings/IO.hs b/compiler/GHC/Settings/IO.hs index 06952774fd..7a971af036 100644 --- a/compiler/GHC/Settings/IO.hs +++ b/compiler/GHC/Settings/IO.hs @@ -234,7 +234,6 @@ getTargetPlatform settingsFile settings = do targetHasGnuNonexecStack <- getBooleanSetting "target has GNU nonexec stack" targetHasIdentDirective <- getBooleanSetting "target has .ident directive" targetHasSubsectionsViaSymbols <- getBooleanSetting "target has subsections via symbols" - targetHasLibm <- getBooleanSetting "target has libm" crossCompiling <- getBooleanSetting "cross compiling" tablesNextToCode <- getBooleanSetting "Tables next to code" @@ -249,6 +248,5 @@ getTargetPlatform settingsFile settings = do , platformIsCrossCompiling = crossCompiling , platformLeadingUnderscore = targetLeadingUnderscore , platformTablesNextToCode = tablesNextToCode - , platformHasLibm = targetHasLibm , platform_constants = Nothing -- will be filled later when loading (or building) the RTS unit } diff --git a/configure.ac b/configure.ac index 4a39a9a314..cf3508ce81 100644 --- a/configure.ac +++ b/configure.ac @@ -844,72 +844,19 @@ dnl off_t, because it will affect the result of that test. AC_SYS_LARGEFILE dnl ** check for specific header (.h) files that we are interested in -AC_CHECK_HEADERS([ctype.h dirent.h dlfcn.h errno.h fcntl.h grp.h limits.h locale.h nlist.h pthread.h pwd.h signal.h sys/param.h sys/mman.h sys/resource.h sys/select.h sys/time.h sys/timeb.h sys/timerfd.h sys/timers.h sys/times.h sys/utsname.h sys/wait.h termios.h utime.h windows.h winsock.h sched.h]) - -dnl sys/cpuset.h needs sys/param.h to be included first on FreeBSD 9.1; #7708 -AC_CHECK_HEADERS([sys/cpuset.h], [], [], -[[#if HAVE_SYS_PARAM_H -# include <sys/param.h> -#endif -]]) - -dnl ** check whether a declaration for `environ` is provided by libc. -FP_CHECK_ENVIRON dnl ** do we have long longs? AC_CHECK_TYPES([long long]) dnl ** what are the sizes of various types -FP_CHECK_SIZEOF_AND_ALIGNMENT(char) -FP_CHECK_SIZEOF_AND_ALIGNMENT(double) -FP_CHECK_SIZEOF_AND_ALIGNMENT(float) -FP_CHECK_SIZEOF_AND_ALIGNMENT(int) -FP_CHECK_SIZEOF_AND_ALIGNMENT(long) -if test "$ac_cv_type_long_long" = yes; then -FP_CHECK_SIZEOF_AND_ALIGNMENT(long long) -fi -FP_CHECK_SIZEOF_AND_ALIGNMENT(short) -FP_CHECK_SIZEOF_AND_ALIGNMENT(unsigned char) -FP_CHECK_SIZEOF_AND_ALIGNMENT(unsigned int) -FP_CHECK_SIZEOF_AND_ALIGNMENT(unsigned long) -if test "$ac_cv_type_long_long" = yes; then -FP_CHECK_SIZEOF_AND_ALIGNMENT(unsigned long long) -fi -FP_CHECK_SIZEOF_AND_ALIGNMENT(unsigned short) -FP_CHECK_SIZEOF_AND_ALIGNMENT(void *) - -FP_CHECK_SIZEOF_AND_ALIGNMENT(int8_t) -FP_CHECK_SIZEOF_AND_ALIGNMENT(uint8_t) -FP_CHECK_SIZEOF_AND_ALIGNMENT(int16_t) -FP_CHECK_SIZEOF_AND_ALIGNMENT(uint16_t) -FP_CHECK_SIZEOF_AND_ALIGNMENT(int32_t) -FP_CHECK_SIZEOF_AND_ALIGNMENT(uint32_t) -FP_CHECK_SIZEOF_AND_ALIGNMENT(int64_t) -FP_CHECK_SIZEOF_AND_ALIGNMENT(uint64_t) - - dnl for use in settings file +FP_CHECK_SIZEOF_AND_ALIGNMENT(void *) TargetWordSize=$ac_cv_sizeof_void_p -if test "x$TargetWordSize" = x8; then - AC_SUBST([Cabal64bit],[True]) -else - AC_SUBST([Cabal64bit],[False]) -fi AC_SUBST(TargetWordSize) AC_C_BIGENDIAN([TargetWordBigEndian=YES],[TargetWordBigEndian=NO]) AC_SUBST(TargetWordBigEndian) -FP_CHECK_FUNC([WinExec], - [@%:@include <windows.h>], [WinExec("",0)]) - -FP_CHECK_FUNC([GetModuleFileName], - [@%:@include <windows.h>], [GetModuleFileName((HMODULE)0,(LPTSTR)0,0)]) - -dnl ** check for more functions -dnl ** The following have been verified to be used in ghc/, but might be used somewhere else, too. -AC_CHECK_FUNCS([getclock getrusage gettimeofday setitimer siginterrupt sysconf times ctime_r sched_setaffinity sched_getaffinity setlocale uselocale]) - dnl ** On OS X 10.4 (at least), time.h doesn't declare ctime_r if dnl ** _POSIX_C_SOURCE is defined AC_CHECK_DECLS([ctime_r], , , @@ -917,40 +864,6 @@ AC_CHECK_DECLS([ctime_r], , , #define _POSIX_C_SOURCE 199506L #include <time.h>]) -dnl On Linux we should have program_invocation_short_name -AC_CHECK_DECLS([program_invocation_short_name], , , -[#define _GNU_SOURCE 1 -#include <errno.h>]) - -dnl ** check for mingwex library -AC_CHECK_LIB( - [mingwex], - [closedir], - [AC_SUBST([HaveLibMingwEx],[YES])] [AC_SUBST([CabalMingwex],[True])], - [AC_SUBST([HaveLibMingwEx],[NO])] [AC_SUBST([CabalMingwex],[False])]) - -if test $HaveLibMingwEx = YES ; then - AC_DEFINE([HAVE_MINGWEX], [1], [Define to 1 if you have the mingwex library.]) -fi - -dnl ** check for math library -dnl Keep that check as early as possible. -dnl as we need to know whether we need libm -dnl for math functions or not -dnl (see https://gitlab.haskell.org/ghc/ghc/issues/3730) -AC_CHECK_LIB(m, atan, HaveLibM=YES, HaveLibM=NO) -if test $HaveLibM = YES -then - AC_DEFINE([HAVE_LIBM], [1], [Define to 1 if you need to link with libm]) - AC_SUBST([UseLibm],[YES]) -else - AC_SUBST([UseLibm],[NO]) -fi -TargetHasLibm=$HaveLibM -AC_SUBST(TargetHasLibm) - -FP_BFD_SUPPORT - dnl ################################################################ dnl Check for libraries dnl ################################################################ @@ -958,12 +871,16 @@ dnl ################################################################ FP_FIND_LIBFFI AC_SUBST(UseSystemLibFFI) -dnl ** check whether we need -ldl to get dlopen() -AC_CHECK_LIB([dl], [dlopen]) -AC_CHECK_LIB([dl], [dlopen], HaveLibdl=YES, HaveLibdl=NO) -AC_SUBST([UseLibdl],[$HaveLibdl]) -dnl ** check whether we have dlinfo -AC_CHECK_FUNCS([dlinfo]) +AC_ARG_ENABLE(libffi-adjustors, + [AS_HELP_STRING( + [--enable-libffi-adjustors], + [Force use of libffi for adjustors, even on platforms which have support for more efficient, native adjustors.])], + UseLibffiForAdjustors=$enableval, + dnl do nothing +) +UseLibffiForAdjustors=NO dnl TODO + +AC_SUBST([UseLibffiForAdjustors]) dnl -------------------------------------------------- dnl * Miscellaneous feature tests @@ -986,27 +903,8 @@ dnl ** check for leading underscores in symbol names FP_LEADING_UNDERSCORE AC_SUBST([LeadingUnderscore], [`echo $fptools_cv_leading_underscore | sed 'y/yesno/YESNO/'`]) if test x"$fptools_cv_leading_underscore" = xyes; then - AC_SUBST([CabalLeadingUnderscore],[True]) AC_DEFINE([LEADING_UNDERSCORE], [1], [Define to 1 if C symbols have a leading underscore added by the compiler.]) -else - AC_SUBST([CabalLeadingUnderscore],[False]) -fi - -FP_VISIBILITY_HIDDEN - -FP_MUSTTAIL - -dnl ** check for librt -AC_CHECK_LIB([rt], [clock_gettime]) -AC_CHECK_LIB([rt], [clock_gettime], HaveLibrt=YES, HaveLibrt=NO) -if test $HaveLibrt = YES -then - AC_SUBST([UseLibrt],[YES]) -else - AC_SUBST([UseLibrt],[NO]) fi -AC_CHECK_FUNCS(clock_gettime timer_settime) -FP_CHECK_TIMER_CREATE dnl ** check for Apple's "interesting" long double compatibility scheme AC_MSG_CHECKING(for printf\$LDBLStub) @@ -1022,116 +920,10 @@ AC_LINK_IFELSE([AC_LANG_CALL([], [printf\$LDBLStub])], [Define to 1 if we have printf$LDBLStub (Apple Mac OS >= 10.4, PPC).]) ]) -FP_CHECK_PTHREADS - dnl ** check for eventfd which is needed by the I/O manager AC_CHECK_HEADERS([sys/eventfd.h]) AC_CHECK_FUNCS([eventfd]) -AC_CHECK_FUNCS([getpid getuid raise]) - -dnl ** Check for __thread support in the compiler -AC_MSG_CHECKING(for __thread support) -AC_COMPILE_IFELSE( - [ AC_LANG_SOURCE([[__thread int tester = 0;]]) ], - [ - AC_MSG_RESULT(yes) - AC_DEFINE([CC_SUPPORTS_TLS],[1],[Define to 1 if __thread is supported]) - ], - [ - AC_MSG_RESULT(no) - AC_DEFINE([CC_SUPPORTS_TLS],[0],[Define to 1 if __thread is supported]) - ]) - -dnl large address space support (see rts/include/rts/storage/MBlock.h) -dnl -dnl Darwin has vm_allocate/vm_protect -dnl Linux has mmap(MAP_NORESERVE)/madv(MADV_DONTNEED) -dnl FreeBSD, Solaris and maybe other have MAP_NORESERVE/MADV_FREE -dnl (They also have MADV_DONTNEED, but it means something else!) -dnl -dnl Windows has VirtualAlloc MEM_RESERVE/MEM_COMMIT, however -dnl it counts page-table space as committed memory, and so quickly -dnl runs out of paging file when we have multiple processes reserving -dnl 1TB of address space, we get the following error: -dnl VirtualAlloc MEM_RESERVE 1099512676352 bytes failed: The paging file is too small for this operation to complete. -dnl - -AC_ARG_ENABLE(large-address-space, - [AS_HELP_STRING([--enable-large-address-space], - [Use a single large address space on 64 bit systems (enabled by default on 64 bit platforms)])], - EnableLargeAddressSpace=$enableval, - EnableLargeAddressSpace=yes -) - -use_large_address_space=no -if test "$ac_cv_sizeof_void_p" -eq 8 ; then - if test "x$EnableLargeAddressSpace" = "xyes" ; then - if test "$ghc_host_os" = "darwin" ; then - use_large_address_space=yes - elif test "$ghc_host_os" = "openbsd" ; then - # as of OpenBSD 5.8 (2015), OpenBSD does not support mmap with MAP_NORESERVE. - # The flag MAP_NORESERVE is supported for source compatibility reasons, - # but is completely ignored by OS mmap - use_large_address_space=no - elif test "$ghc_host_os" = "mingw32" ; then - # as of Windows 8.1/Server 2012 windows does no longer allocate the page - # tabe for reserved memory eagerly. So we are now free to use LAS there too. - use_large_address_space=yes - else - AC_CHECK_DECLS([MAP_NORESERVE, MADV_FREE, MADV_DONTNEED],[],[], - [ - #include <unistd.h> - #include <sys/types.h> - #include <sys/mman.h> - #include <fcntl.h> - ]) - if test "$ac_cv_have_decl_MAP_NORESERVE" = "yes" && - test "$ac_cv_have_decl_MADV_FREE" = "yes" || - test "$ac_cv_have_decl_MADV_DONTNEED" = "yes" ; then - use_large_address_space=yes - fi - fi - fi -fi -if test "$use_large_address_space" = "yes" ; then - AC_DEFINE([USE_LARGE_ADDRESS_SPACE], [1], [Enable single heap address space support]) -fi - -dnl ** Use MMAP in the runtime linker? -dnl -------------------------------------------------------------- - -case ${TargetOS} in - linux|linux-android|freebsd|dragonfly|netbsd|openbsd|kfreebsdgnu|gnu|solaris2) - RtsLinkerUseMmap=1 - ;; - darwin|ios|watchos|tvos) - RtsLinkerUseMmap=1 - ;; - *) - # Windows (which doesn't have mmap) and everything else. - RtsLinkerUseMmap=0 - ;; - esac - -AC_DEFINE_UNQUOTED([RTS_LINKER_USE_MMAP], [$RtsLinkerUseMmap], - [Use mmap in the runtime linker]) - - -GHC_ADJUSTORS_METHOD([Target]) -AC_SUBST([UseLibffiForAdjustors]) - -dnl ** Other RTS features -dnl -------------------------------------------------------------- -FP_FIND_LIBDW -AC_SUBST(UseLibdw) -AC_SUBST(LibdwLibDir) -AC_SUBST(LibdwIncludeDir) - -FP_FIND_LIBNUMA -AC_SUBST(UseLibNuma) -AC_SUBST(LibNumaLibDir) -AC_SUBST(LibNumaIncludeDir) dnl ** Documentation dnl -------------------------------------------------------------- diff --git a/distrib/configure.ac.in b/distrib/configure.ac.in index 8b203be35d..81200c247b 100644 --- a/distrib/configure.ac.in +++ b/distrib/configure.ac.in @@ -21,19 +21,11 @@ bootstrap_target=@TargetPlatform@ TargetHasRTSLinker=@TargetHasRTSLinker@ AC_SUBST(TargetHasRTSLinker) -TargetHasLibm=@TargetHasLibm@ -AC_SUBST(TargetHasLibm) - FFIIncludeDir=@FFIIncludeDir@ FFILibDir=@FFILibDir@ AC_SUBST(FFILibDir) AC_SUBST(FFIIncludeDir) -LibdwIncludeDir=@LibdwIncludeDir@ -LibdwLibDir=@LibdwLibDir@ -AC_SUBST(LibdwLibDir) -AC_SUBST(LibdwIncludeDir) - UseLibffiForAdjustors=@UseLibffiForAdjustors@ AC_SUBST(UseLibffiForAdjustors) diff --git a/hadrian/bindist/Makefile b/hadrian/bindist/Makefile index 2b0903796e..92defdf68a 100644 --- a/hadrian/bindist/Makefile +++ b/hadrian/bindist/Makefile @@ -116,7 +116,6 @@ lib/settings : @echo ',("target has .ident directive", "$(TargetHasIdentDirective)")' >> $@ @echo ',("target has subsections via symbols", "$(TargetHasSubsectionsViaSymbols)")' >> $@ @echo ',("target has RTS linker", "$(TargetHasRTSLinker)")' >> $@ - @echo ',("target has libm", "$(TargetHasLibm)")' >> $@ @echo ',("Unregisterised", "$(GhcUnregisterised)")' >> $@ @echo ',("LLVM target", "$(LLVMTarget_CPP)")' >> $@ @echo ',("LLVM llc command", "$(SettingsLlcCommand)")' >> $@ diff --git a/hadrian/bindist/config.mk.in b/hadrian/bindist/config.mk.in index ee8366a26f..5ede1acb3f 100644 --- a/hadrian/bindist/config.mk.in +++ b/hadrian/bindist/config.mk.in @@ -253,7 +253,6 @@ TargetHasGnuNonexecStack = @TargetHasGnuNonexecStack@ TargetHasIdentDirective = @TargetHasIdentDirective@ TargetHasSubsectionsViaSymbols = @TargetHasSubsectionsViaSymbols@ TargetHasRTSLinker = @TargetHasRTSLinker@ -TargetHasLibm = @TargetHasLibm@ TablesNextToCode = @TablesNextToCode@ SettingsCCompilerCommand = @SettingsCCompilerCommand@ diff --git a/hadrian/cfg/system.config.in b/hadrian/cfg/system.config.in index 78f66df02f..9d05a9a670 100644 --- a/hadrian/cfg/system.config.in +++ b/hadrian/cfg/system.config.in @@ -172,7 +172,6 @@ target-has-gnu-nonexec-stack = @TargetHasGnuNonexecStack@ target-has-ident-directive = @TargetHasIdentDirective@ target-has-subsections-via-symbols = @TargetHasSubsectionsViaSymbols@ target-has-rts-linker = @TargetHasRTSLinker@ -target-has-libm = @TargetHasLibm@ target-arm-version = @ARM_ISA@ # Include and library directories: @@ -193,21 +192,7 @@ use-system-ffi = @UseSystemLibFFI@ ffi-include-dir = @FFIIncludeDir@ ffi-lib-dir = @FFILibDir@ -libdw-include-dir = @LibdwIncludeDir@ -libdw-lib-dir = @LibdwLibDir@ - -libnuma-include-dir = @LibNumaIncludeDir@ -libnuma-lib-dir = @LibNumaLibDir@ - # Optional Dependencies: #======================= use-lib-dw = @UseLibdw@ -use-lib-numa = @UseLibNuma@ -use-lib-mingw-ex = @HaveLibMingwEx@ -use-lib-m = @UseLibm@ -use-lib-rt = @UseLibrt@ -use-lib-dl = @UseLibdl@ -use-lib-bfd = @UseLibbfd@ -use-lib-pthread = @UseLibpthread@ -need-libatomic = @NeedLibatomic@ diff --git a/hadrian/src/Oracles/Flag.hs b/hadrian/src/Oracles/Flag.hs index 836834cbfc..76a7a6c431 100644 --- a/hadrian/src/Oracles/Flag.hs +++ b/hadrian/src/Oracles/Flag.hs @@ -32,14 +32,6 @@ data Flag = ArSupportsAtFile | BootstrapEventLoggingRts | UseLibffiForAdjustors | UseLibdw - | UseLibnuma - | UseLibmingwex - | UseLibm - | UseLibrt - | UseLibdl - | UseLibbfd - | UseLibpthread - | NeedLibatomic -- Note, if a flag is set to empty string we treat it as set to NO. This seems -- fragile, but some flags do behave like this. @@ -62,14 +54,6 @@ flag f = do BootstrapEventLoggingRts -> "bootstrap-event-logging-rts" UseLibffiForAdjustors -> "use-libffi-for-adjustors" UseLibdw -> "use-lib-dw" - UseLibnuma -> "use-lib-numa" - UseLibmingwex -> "use-lib-mingw-ex" - UseLibm -> "use-lib-m" - UseLibrt -> "use-lib-rt" - UseLibdl -> "use-lib-dl" - UseLibbfd -> "use-lib-bfd" - UseLibpthread -> "use-lib-pthread" - NeedLibatomic -> "need-libatomic" value <- lookupSystemConfig key when (value `notElem` ["YES", "NO", ""]) . error $ "Configuration flag " ++ quote (key ++ " = " ++ value) ++ " cannot be parsed." diff --git a/hadrian/src/Oracles/Setting.hs b/hadrian/src/Oracles/Setting.hs index e064d7a5c1..aa2eb0f851 100644 --- a/hadrian/src/Oracles/Setting.hs +++ b/hadrian/src/Oracles/Setting.hs @@ -56,10 +56,6 @@ data Setting = BuildArch | HostOsHaskell | IconvIncludeDir | IconvLibDir - | LibdwIncludeDir - | LibdwLibDir - | LibnumaIncludeDir - | LibnumaLibDir | LlvmTarget | ProjectGitCommitId | ProjectName @@ -158,10 +154,6 @@ setting key = lookupSystemConfig $ case key of HostOsHaskell -> "host-os-haskell" IconvIncludeDir -> "iconv-include-dir" IconvLibDir -> "iconv-lib-dir" - LibdwIncludeDir -> "libdw-include-dir" - LibdwLibDir -> "libdw-lib-dir" - LibnumaIncludeDir -> "libnuma-include-dir" - LibnumaLibDir -> "libnuma-lib-dir" LlvmTarget -> "llvm-target" ProjectGitCommitId -> "project-git-commit-id" ProjectName -> "project-name" diff --git a/hadrian/src/Rules/Generate.hs b/hadrian/src/Rules/Generate.hs index b156c9dfdf..6eb0edde75 100644 --- a/hadrian/src/Rules/Generate.hs +++ b/hadrian/src/Rules/Generate.hs @@ -264,38 +264,12 @@ templateRules = do project_version <- setting ProjectVersion project_version_munged <- setting ProjectVersionMunged - target_word_size <- settingWord TargetWordSize - lib_dw <- flag UseLibdw - lib_numa <- flag UseLibnuma - lib_mingwex <- flag UseLibmingwex - lib_m <- flag UseLibm - lib_rt <- flag UseLibrt - lib_dl <- flag UseLibdl - lib_ffi <- flag UseSystemFfi - lib_ffi_adjustors <- flag UseLibffiForAdjustors - lib_bfd <- flag UseLibbfd - lib_pthread <- flag UseLibpthread - leading_underscore <- flag LeadingUnderscore - need_libatomic <- flag NeedLibatomic let cabal_bool True = "True" cabal_bool False = "False" subst = replace "@ProjectVersion@" project_version . replace "@ProjectVersionMunged@" project_version_munged - . replace "@Cabal64bit@" (cabal_bool (target_word_size == 8)) - . replace "@CabalMingwex@" (cabal_bool lib_mingwex) - . replace "@CabalHaveLibdw@" (cabal_bool lib_dw) - . replace "@CabalHaveLibm@" (cabal_bool lib_m) - . replace "@CabalHaveLibrt@" (cabal_bool lib_rt) - . replace "@CabalHaveLibdl@" (cabal_bool lib_dl) - . replace "@CabalUseSystemLibFFI@" (cabal_bool lib_ffi) - . replace "@CabalLibffiAdjustors@" (cabal_bool lib_ffi_adjustors) - . replace "@CabalNeedLibpthread@" (cabal_bool lib_pthread) - . replace "@CabalHaveLibbfd@" (cabal_bool lib_bfd) - . replace "@CabalHaveLibNuma@" (cabal_bool lib_numa) - . replace "@CabalLeadingUnderscore@" (cabal_bool leading_underscore) - . replace "@CabalNeedLibatomic@" (cabal_bool need_libatomic) s <- readFile' (out <.> "in") writeFile' out (subst s) @@ -415,7 +389,6 @@ generateSettings = do , ("target has .ident directive", expr $ lookupSystemConfig "target-has-ident-directive") , ("target has subsections via symbols", expr $ lookupSystemConfig "target-has-subsections-via-symbols") , ("target has RTS linker", expr $ lookupSystemConfig "target-has-rts-linker") - , ("target has libm", expr $ lookupSystemConfig "target-has-libm") , ("Unregisterised", expr $ yesNo <$> flag GhcUnregisterised) , ("LLVM target", getSetting LlvmTarget) , ("LLVM llc command", expr $ settingsFileSetting SettingsFileSetting_LlcCommand) diff --git a/hadrian/src/Settings/Packages.hs b/hadrian/src/Settings/Packages.hs index 128262a0ab..7268a7a041 100644 --- a/hadrian/src/Settings/Packages.hs +++ b/hadrian/src/Settings/Packages.hs @@ -283,10 +283,6 @@ rtsPackageArgs = package rts ? do useSystemFfi <- expr $ flag UseSystemFfi ffiIncludeDir <- getSetting FfiIncludeDir ffiLibraryDir <- getSetting FfiLibDir - libdwIncludeDir <- getSetting LibdwIncludeDir - libdwLibraryDir <- getSetting LibdwLibDir - libnumaIncludeDir <- getSetting LibnumaIncludeDir - libnumaLibraryDir <- getSetting LibnumaLibDir -- Arguments passed to GHC when compiling C and .cmm sources. let ghcArgs = mconcat @@ -391,9 +387,7 @@ rtsPackageArgs = package rts ? do , Debug `wayUnit` way `cabalFlag` "find-ptr" ] , builder (Cabal Setup) ? mconcat - [ cabalExtraDirs libdwIncludeDir libdwLibraryDir - , cabalExtraDirs libnumaIncludeDir libnumaLibraryDir - , useSystemFfi ? cabalExtraDirs ffiIncludeDir ffiLibraryDir + [ useSystemFfi ? cabalExtraDirs ffiIncludeDir ffiLibraryDir ] , builder (Cc (FindCDependencies CDep)) ? cArgs , builder (Cc (FindCDependencies CxxDep)) ? cArgs @@ -405,7 +399,7 @@ rtsPackageArgs = package rts ? do [ "-DTOP=" ++ show top ] , builder HsCpp ? flag UseLibdw ? arg "-DUSE_LIBDW" - , builder HsCpp ? flag UseLibmingwex ? arg "-DHAVE_LIBMINGWEX" ] + ] -- Compile various performance-critical pieces *without* -fPIC -dynamic -- even when building a shared library. If we don't do this, then the diff --git a/libraries/Cabal b/libraries/Cabal -Subproject 5abfa5032cb6f011c9a7e02d14c9f10dcb2d660 +Subproject 30f8a46008d164b5c4c6ce0b4453eb93eb5ef46 diff --git a/rts/configure.ac b/rts/configure.ac index 81c702d3c4..a9d08b179d 100644 --- a/rts/configure.ac +++ b/rts/configure.ac @@ -8,7 +8,7 @@ AC_INIT([GHC run-time system], [1.0.2], [libraries@haskell.org], [rts]) -AC_CONFIG_MACRO_DIRS([../m4]) +AC_CONFIG_MACRO_DIRS([m4 ../m4]) # Safety check: Ensure that we are in the correct source directory. AC_CONFIG_SRCDIR([include/rts/Constants.h]) @@ -29,19 +29,143 @@ AC_CONFIG_HEADERS([ghcautoconf.h.autoconf]) AC_CANONICAL_BUILD AC_CANONICAL_HOST +GHC_CONVERT_PLATFORM_PARTS([build], [Build]) GHC_CONVERT_PLATFORM_PARTS([host], [Host]) +FPTOOLS_SET_PLATFORM_VARS([build], [Build]) FPTOOLS_SET_PLATFORM_VARS([host], [Host]) FPTOOLS_SET_HASKELL_PLATFORM_VARS([Host]) +AC_CHECK_HEADERS([ctype.h dirent.h dlfcn.h errno.h fcntl.h grp.h limits.h locale.h nlist.h pthread.h pwd.h signal.h sys/param.h sys/mman.h sys/resource.h sys/select.h sys/time.h sys/timeb.h sys/timerfd.h sys/timers.h sys/times.h sys/utsname.h sys/wait.h termios.h utime.h windows.h winsock.h sched.h]) + +AC_CHECK_FUNCS([getclock getrusage gettimeofday setitimer siginterrupt sysconf times ctime_r sched_setaffinity sched_getaffinity setlocale uselocale]) + +dnl sys/cpuset.h needs sys/param.h to be included first on FreeBSD 9.1; #7708 +AC_CHECK_HEADERS([sys/cpuset.h], [], [], +[[#if HAVE_SYS_PARAM_H +# include <sys/param.h> +#endif +]]) + +dnl ** check whether a declaration for `environ` is provided by libc. +FP_CHECK_ENVIRON + dnl ** Other RTS features dnl -------------------------------------------------------------- -AC_DEFINE_UNQUOTED([USE_LIBDW], [$CABAL_FLAG_libdw], [Set to 1 to use libdw]) -AC_DEFINE_UNQUOTED([HAVE_LIBNUMA], [$CABAL_FLAG_libnuma], [Define to 1 if you have libnuma]) +FP_FIND_LIBDW + +FP_FIND_LIBNUMA -dnl ** Write config files +FP_LEADING_UNDERSCORE +FP_MUSTTAIL + +dnl ** Check for __thread support in the compiler +AC_MSG_CHECKING(for __thread support) +AC_COMPILE_IFELSE( + [ AC_LANG_SOURCE([[__thread int tester = 0;]]) ], + [ + AC_MSG_RESULT(yes) + AC_DEFINE([CC_SUPPORTS_TLS],[1],[Define to 1 if __thread is supported]) + ], + [ + AC_MSG_RESULT(no) + AC_DEFINE([CC_SUPPORTS_TLS],[0],[Define to 1 if __thread is supported]) + ]) + +dnl ** Use MMAP in the runtime linker? dnl -------------------------------------------------------------- +case ${TargetOS} in + linux|linux-android|freebsd|dragonfly|netbsd|openbsd|kfreebsdgnu|gnu|solaris2) + RtsLinkerUseMmap=1 + ;; + darwin|ios|watchos|tvos) + RtsLinkerUseMmap=1 + ;; + *) + # Windows (which doesn't have mmap) and everything else. + RtsLinkerUseMmap=0 + ;; + esac + +AC_DEFINE_UNQUOTED([RTS_LINKER_USE_MMAP], [$RtsLinkerUseMmap], + [Use mmap in the runtime linker]) + + +GHC_ADJUSTORS_METHOD([Target]) +AC_SUBST([UseLibffiForAdjustors]) +AS_IF( + [test x"${UseLibffiForAdjustors}" = x"YES"], + [AC_DEFINE([GHC_LIBFFI_ADJUSTORS],[1],[Should libffi be used for adjustors?])], + [AC_DEFINE([GHC_LIBFFI_ADJUSTORS],[0],[Should libffi be used for adjustors?])] +) + +dnl ** do we have long longs? +AC_CHECK_TYPES([long long]) + +dnl ** what are the sizes of various types +FP_CHECK_SIZEOF_AND_ALIGNMENT(char) +FP_CHECK_SIZEOF_AND_ALIGNMENT(double) +FP_CHECK_SIZEOF_AND_ALIGNMENT(float) +FP_CHECK_SIZEOF_AND_ALIGNMENT(int) +FP_CHECK_SIZEOF_AND_ALIGNMENT(long) +if test "$ac_cv_type_long_long" = yes; then +FP_CHECK_SIZEOF_AND_ALIGNMENT(long long) +fi +FP_CHECK_SIZEOF_AND_ALIGNMENT(short) +FP_CHECK_SIZEOF_AND_ALIGNMENT(unsigned char) +FP_CHECK_SIZEOF_AND_ALIGNMENT(unsigned int) +FP_CHECK_SIZEOF_AND_ALIGNMENT(unsigned long) +if test "$ac_cv_type_long_long" = yes; then +FP_CHECK_SIZEOF_AND_ALIGNMENT(unsigned long long) +fi +FP_CHECK_SIZEOF_AND_ALIGNMENT(unsigned short) +FP_CHECK_SIZEOF_AND_ALIGNMENT(void *) + +FP_CHECK_SIZEOF_AND_ALIGNMENT(int8_t) +FP_CHECK_SIZEOF_AND_ALIGNMENT(uint8_t) +FP_CHECK_SIZEOF_AND_ALIGNMENT(int16_t) +FP_CHECK_SIZEOF_AND_ALIGNMENT(uint16_t) +FP_CHECK_SIZEOF_AND_ALIGNMENT(int32_t) +FP_CHECK_SIZEOF_AND_ALIGNMENT(uint32_t) +FP_CHECK_SIZEOF_AND_ALIGNMENT(int64_t) +FP_CHECK_SIZEOF_AND_ALIGNMENT(uint64_t) + +dnl ** check for pthreads +FP_CHECK_PTHREADS + +dnl ** check for math library +dnl Keep that check as early as possible. +dnl as we need to know whether we need libm +dnl for math functions or not +dnl (see https://gitlab.haskell.org/ghc/ghc/issues/3730) +AC_CHECK_LIB([m], [atan], [need_libm=1], [need_libm=0]) +AC_DEFINE_UNQUOTED([GHC_NEED_LIBM], [$need_libm], [Define to 1 if you need to link with libm]) + +dnl ** check for librt +AC_CHECK_LIB([rt], [clock_gettime], [need_librt=1], [need_librt=1]) +AC_DEFINE_UNQUOTED([GHC_NEED_LIBRT], [$need_librt], [Define to 1 if you need to link with librt]) +AC_CHECK_FUNCS(clock_gettime timer_settime) +FP_CHECK_TIMER_CREATE + +dnl ** check whether we need -ldl to get dlopen() +AC_CHECK_LIB([dl], [dlopen], [need_libdl=1], [need_libdl=0]) +AC_DEFINE_UNQUOTED([GHC_NEED_LIBDL], [$need_libdl], [Define to 1 if you need to link with libdl to get dlopen]) +dnl ** check whether we have dlinfo +AC_CHECK_FUNCS([dlinfo]) + +dnl ** On Linux we should have program_invocation_short_name +AC_CHECK_DECLS([program_invocation_short_name], , , +[#define _GNU_SOURCE 1 +#include <errno.h>]) + +dnl ** check whether we should use the two-step allocator +FP_LARGE_ADDRESS_SPACE + +FP_BFD_SUPPORT + +AC_CONFIG_FILES([rts.buildinfo]) + AC_OUTPUT dnl ###################################################################### @@ -55,9 +179,9 @@ touch include/ghcautoconf.h echo "#if !defined(__GHCAUTOCONF_H__)" >> include/ghcautoconf.h echo "#define __GHCAUTOCONF_H__" >> include/ghcautoconf.h -# Copy the contents of $srcdir/../mk/config.h, turning '#define PACKAGE_FOO +# Copy the contents of ghcautoconf.h.autoconf, turning '#define PACKAGE_FOO # "blah"' into '/* #undef PACKAGE_FOO */' to avoid clashes. -cat $srcdir/../mk/config.h ghcautoconf.h.autoconf | sed \ +sed ghcautoconf.h.autoconf \ -e 's,^\([ ]*\)#[ ]*define[ ][ ]*\(PACKAGE_[A-Z]*\)[ ][ ]*".*".*$,\1/* #undef \2 */,' \ -e '/__GLASGOW_HASKELL/d' \ -e '/REMOVE ME/d' \ @@ -92,4 +216,6 @@ cat $srcdir/rts.buildinfo.in | \ "$CC" -E -P -traditional - -o - \ > rts.buildinfo echo "" >> rts.buildinfo +echo "cc-options: ${CFLAGS}" >> rts.buildinfo +echo "ld-options: ${LDFLAGS}" >> rts.buildinfo rm -f external-symbols.list diff --git a/rts/include/rts/PosixSource.h b/rts/include/rts/PosixSource.h index be6c8ecca1..bc1be83d87 100644 --- a/rts/include/rts/PosixSource.h +++ b/rts/include/rts/PosixSource.h @@ -37,6 +37,8 @@ #define _XOPEN_SOURCE 700 #endif +#define _GNU_SOURCE 1 + #if defined(mingw32_HOST_OS) # if defined(__USE_MINGW_ANSI_STDIO) # if __USE_MINGW_ANSI_STDIO != 1 diff --git a/rts/linker/Elf.c b/rts/linker/Elf.c index 3595a4c3d4..ff242e835a 100644 --- a/rts/linker/Elf.c +++ b/rts/linker/Elf.c @@ -28,10 +28,10 @@ #include "linker/util.h" #include "linker/elf_util.h" -#include <link.h> #include <stdlib.h> #include <unistd.h> #include <string.h> +#include <link.h> #if defined(HAVE_DLFCN_H) #include <dlfcn.h> #endif diff --git a/rts/linker/elf_got.c b/rts/linker/elf_got.c index 4d0c97871e..9c9f07e7fa 100644 --- a/rts/linker/elf_got.c +++ b/rts/linker/elf_got.c @@ -1,6 +1,7 @@ #include "Rts.h" #include "elf_got.h" #include "linker/MMap.h" +#include "sys/mman.h" #include <string.h> diff --git a/m4/fp_bfd_support.m4 b/rts/m4/fp_bfd_support.m4 index 2f357820f7..2f357820f7 100644 --- a/m4/fp_bfd_support.m4 +++ b/rts/m4/fp_bfd_support.m4 diff --git a/m4/fp_cc_supports__atomics.m4 b/rts/m4/fp_cc_supports__atomics.m4 index bd3750e972..9c15ef6a1f 100644 --- a/m4/fp_cc_supports__atomics.m4 +++ b/rts/m4/fp_cc_supports__atomics.m4 @@ -62,11 +62,6 @@ AC_DEFUN([FP_CC_SUPPORTS__ATOMICS], AC_MSG_ERROR([C compiler needs to support __atomic primitives.]) ]) AC_DEFINE([HAVE_C11_ATOMICS], [1], [Does C compiler support __atomic primitives?]) - if test "$need_latomic" = 1; then - AC_SUBST([NeedLibatomic],[YES]) - else - AC_SUBST([NeedLibatomic],[NO]) - fi - AC_DEFINE_UNQUOTED([NEED_ATOMIC_LIB], [$need_latomic], + AC_DEFINE_UNQUOTED([GHC_NEED_LIBATOMIC], [$need_latomic], [Define to 1 if we need -latomic.]) ]) diff --git a/m4/fp_check_pthreads.m4 b/rts/m4/fp_check_pthreads.m4 index 5713e7c743..5c63cac2a5 100644 --- a/m4/fp_check_pthreads.m4 +++ b/rts/m4/fp_check_pthreads.m4 @@ -12,23 +12,20 @@ AC_DEFUN([FP_CHECK_PTHREADS], AC_CHECK_FUNC(pthread_create, [ AC_MSG_RESULT(no) - AC_SUBST([UseLibpthread],[NO]) need_lpthread=0 ], [ AC_CHECK_LIB(pthread, pthread_create, [ AC_MSG_RESULT(yes) - AC_SUBST([UseLibpthread],[YES]) need_lpthread=1 ], [ - AC_SUBST([UseLibpthread],[NO]) AC_MSG_RESULT([no pthreads support found.]) need_lpthread=0 ]) ]) - AC_DEFINE_UNQUOTED([NEED_PTHREAD_LIB], [$need_lpthread], + AC_DEFINE_UNQUOTED([GHC_NEED_LIBPTHREAD], [$need_lpthread], [Define 1 if we need to link code using pthreads with -lpthread]) dnl Setting thread names diff --git a/m4/fp_find_libdw.m4 b/rts/m4/fp_find_libdw.m4 index fa5bf807cb..70305c78fe 100644 --- a/m4/fp_find_libdw.m4 +++ b/rts/m4/fp_find_libdw.m4 @@ -45,5 +45,12 @@ AC_DEFUN([FP_FIND_LIBDW], CFLAGS="$CFLAGS2" LDFLAGS="$LDFLAGS2" fi + + AC_SUBST(UseLibdw) + USE_LIBDW=0 + if test $UseLibdw = "YES" ; then + USE_LIBDW=1 + fi + AC_DEFINE_UNQUOTED([USE_LIBDW], [$USE_LIBDW], [Set to 1 to use libdw] ]) diff --git a/m4/fp_find_libnuma.m4 b/rts/m4/fp_find_libnuma.m4 index 1563ca4e89..eadd7d86fd 100644 --- a/m4/fp_find_libnuma.m4 +++ b/rts/m4/fp_find_libnuma.m4 @@ -27,7 +27,7 @@ AC_DEFUN([FP_FIND_LIBNUMA], [], [enable_numa=auto]) - UseLibNuma=NO + HaveLibNuma=0 if test "$enable_numa" != "no" ; then CFLAGS2="$CFLAGS" CFLAGS="$LIBNUMA_CFLAGS $CFLAGS" @@ -37,13 +37,15 @@ AC_DEFUN([FP_FIND_LIBNUMA], AC_CHECK_HEADERS([numa.h numaif.h]) if test "x:$ac_cv_header_numa_h:$ac_cv_header_numaif_h" = "x:yes:yes" ; then - AC_CHECK_LIB([numa], [numa_available], [UseLibNuma=YES]) + AC_CHECK_LIB([numa], [numa_available], [HaveLibNuma=1]) fi - if test "x:$enable_numa:$UseLibNuma" = "x:yes:NO" ; then + if test "x:$enable_numa:$HaveLibNuma" = "x:yes:0" ; then AC_MSG_ERROR([Cannot find system libnuma (required by --enable-numa)]) fi CFLAGS="$CFLAGS2" LDFLAGS="$LDFLAGS2" fi + + AC_DEFINE_UNQUOTED([HAVE_LIBNUMA], [$HaveLibNuma], [Define to 1 if you have libnuma]) ]) diff --git a/rts/m4/fp_large_address_space.m4 b/rts/m4/fp_large_address_space.m4 new file mode 100644 index 0000000000..fd8a352a57 --- /dev/null +++ b/rts/m4/fp_large_address_space.m4 @@ -0,0 +1,57 @@ +dnl large address space support (see rts/include/rts/storage/MBlock.h) +dnl +dnl Darwin has vm_allocate/vm_protect +dnl Linux has mmap(MAP_NORESERVE)/madv(MADV_DONTNEED) +dnl FreeBSD, Solaris and maybe other have MAP_NORESERVE/MADV_FREE +dnl (They also have MADV_DONTNEED, but it means something else!) +dnl +dnl Windows has VirtualAlloc MEM_RESERVE/MEM_COMMIT, however +dnl it counts page-table space as committed memory, and so quickly +dnl runs out of paging file when we have multiple processes reserving +dnl 1TB of address space, we get the following error: +dnl VirtualAlloc MEM_RESERVE 1099512676352 bytes failed: The paging file is too small for this operation to complete. +dnl + +AC_DEFUN([FP_LARGE_ADDRESS_SPACE], +[ + AC_ARG_ENABLE(large-address-space, + [AS_HELP_STRING([--enable-large-address-space], + [Use a single large address space on 64 bit systems (enabled by default on 64 bit platforms)])], + EnableLargeAddressSpace=$enableval, + EnableLargeAddressSpace=yes + ) + + use_large_address_space=no + if test "$ac_cv_sizeof_void_p" -eq 8 ; then + if test "x$EnableLargeAddressSpace" = "xyes" ; then + if test "$ghc_host_os" = "darwin" ; then + use_large_address_space=yes + elif test "$ghc_host_os" = "openbsd" ; then + # as of OpenBSD 5.8 (2015), OpenBSD does not support mmap with MAP_NORESERVE. + # The flag MAP_NORESERVE is supported for source compatibility reasons, + # but is completely ignored by OS mmap + use_large_address_space=no + elif test "$ghc_host_os" = "mingw32" ; then + # as of Windows 8.1/Server 2012 windows does no longer allocate the page + # tabe for reserved memory eagerly. So we are now free to use LAS there too. + use_large_address_space=yes + else + AC_CHECK_DECLS([MAP_NORESERVE, MADV_FREE, MADV_DONTNEED],[],[], + [ + #include <unistd.h> + #include <sys/types.h> + #include <sys/mman.h> + #include <fcntl.h> + ]) + if test "$ac_cv_have_decl_MAP_NORESERVE" = "yes" && + test "$ac_cv_have_decl_MADV_FREE" = "yes" || + test "$ac_cv_have_decl_MADV_DONTNEED" = "yes" ; then + use_large_address_space=yes + fi + fi + fi + fi + if test "$use_large_address_space" = "yes" ; then + AC_DEFINE([USE_LARGE_ADDRESS_SPACE], [1], [Enable single heap address space support]) + fi +]) diff --git a/m4/fp_musttail.m4 b/rts/m4/fp_musttail.m4 index 0c61c2ad4c..0c61c2ad4c 100644 --- a/m4/fp_musttail.m4 +++ b/rts/m4/fp_musttail.m4 diff --git a/m4/fp_visibility_hidden.m4 b/rts/m4/fp_visibility_hidden.m4 index 5f5cebeeec..5f5cebeeec 100644 --- a/m4/fp_visibility_hidden.m4 +++ b/rts/m4/fp_visibility_hidden.m4 diff --git a/m4/ghc_adjustors_method.m4 b/rts/m4/ghc_adjustors_method.m4 index cae941a20e..cae941a20e 100644 --- a/m4/ghc_adjustors_method.m4 +++ b/rts/m4/ghc_adjustors_method.m4 diff --git a/rts/posix/OSThreads.c b/rts/posix/OSThreads.c index 44cda2626d..5b5b736703 100644 --- a/rts/posix/OSThreads.c +++ b/rts/posix/OSThreads.c @@ -32,6 +32,9 @@ #if defined(netbsd_HOST_OS) #define _NETBSD_SOURCE 1 #endif +#if defined(linux_HOST_OS) +#define _GNU_SOURCE 1 +#endif #include "Rts.h" diff --git a/rts/posix/ticker/Pthread.c b/rts/posix/ticker/Pthread.c index a4c7af588f..9200ff8318 100644 --- a/rts/posix/ticker/Pthread.c +++ b/rts/posix/ticker/Pthread.c @@ -55,6 +55,9 @@ #include <string.h> +#if defined(linux_HOST_OS) +#define _GNU_SOURCE 1 +#endif #include <pthread.h> #if defined(HAVE_PTHREAD_NP_H) #include <pthread_np.h> diff --git a/rts/rts.buildinfo.in b/rts/rts.buildinfo.in index 07540357c8..ac68fdc861 100644 --- a/rts/rts.buildinfo.in +++ b/rts/rts.buildinfo.in @@ -1,3 +1,63 @@ -- External symbols referenced by the RTS ld-options: #include "external-symbols.list" + +#if GHC_LIBFFI_ADJUSTORS + -- Adjustors via libffi + c-sources: adjustor/LibffiAdjustor.c +#else + -- Use GHC's native adjustors +# if defined(i386_HOST_ARCH) + asm-sources: adjustor/Nativei386Asm.S + c-sources: adjustor/Nativei386.c +# elif defined(x86_64_HOST_ARCH) +# if defined(mingw32_HOST_OS) + asm-sources: adjustor/NativeAmd64MingwAsm.S + c-sources: adjustor/NativeAmd64Mingw.c +# else + asm-sources: adjustor/NativeAmd64Asm.S + c-sources: adjustor/NativeAmd64.c +# endif +# elif defined(powerpc_HOST_ARCH) || defined(powerpc64_HOST_ARCH) + asm-sources: AdjustorAsm.S + c-sources: adjustor/NativePowerPC.c +# elif defined(ia64_HOST_ARCH) + c-sources: adjustor/NativeIA64.c +# endif +#endif + +#if GHC_NEED_LIBRT + extra-libraries: rt +#endif + +#if GHC_NEED_LIBM + extra-libraries: m +#endif + +#if GHC_NEED_LIBDL + extra-libraries: dl +#endif + +#if GHC_NEED_LIBATOMIC + -- for sub-word-sized atomic operations (#19119) + extra-libraries: atomic +#endif + +#if GHC_NEED_LIBPTHREAD + -- for pthread_getthreadid_np, pthread_create, ... + extra-libraries: pthread +#endif + +#if USE_LIBBFD + -- for debugging + extra-libraries: bfd iberty +#endif + +#if USE_LIBDW + -- for backtraces + extra-libraries: elf dw +#endif + +#if USE_LIBNUMA + extra-libraries: numa +#endif diff --git a/rts/rts.cabal.in b/rts/rts.cabal.in index 98ca808917..52b8311027 100644 --- a/rts/rts.cabal.in +++ b/rts/rts.cabal.in @@ -28,32 +28,9 @@ source-repository head location: https://gitlab.haskell.org/ghc/ghc.git subdir: rts -flag libm - default: @CabalHaveLibm@ -flag librt - default: @CabalHaveLibrt@ -flag libdl - default: @CabalHaveLibdl@ +-- Configuration flag use-system-libffi - default: @CabalUseSystemLibFFI@ -flag libffi-adjustors - default: @CabalLibffiAdjustors@ -flag need-pthread - default: @CabalNeedLibpthread@ -flag libbfd - default: @CabalHaveLibbfd@ -flag mingwex - default: @CabalMingwex@ -flag need-atomic - default: @CabalNeedLibatomic@ -flag libdw - default: @CabalHaveLibdw@ -flag libnuma - default: @CabalHaveLibNuma@ -flag 64bit - default: @Cabal64bit@ -flag leading-underscore - default: @CabalLeadingUnderscore@ + description: Use the system's libffi library rather than GHC's internally built library. flag smp default: True flag find-ptr @@ -177,13 +154,6 @@ library -- that it is ordered correctly with libpthread, since ghc-prim.cabal -- also explicitly lists libc. See #19029. extra-libraries: c - if flag(libm) - -- for ldexp() - extra-libraries: m - if flag(librt) - extra-libraries: rt - if flag(libdl) - extra-libraries: dl if flag(use-system-libffi) extra-libraries: ffi if os(windows) @@ -203,22 +173,8 @@ library -- and also centralizes the versioning. cpp-options: -D_WIN32_WINNT=0x06010000 cc-options: -D_WIN32_WINNT=0x06010000 - if flag(need-pthread) - -- for pthread_getthreadid_np, pthread_create, ... - extra-libraries: pthread - if flag(need-atomic) - -- for sub-word-sized atomic operations (#19119) - extra-libraries: atomic - if flag(libbfd) - -- for debugging - extra-libraries: bfd iberty - if flag(mingwex) + if os(windows) extra-libraries: mingwex - if flag(libdw) - -- for backtraces - extra-libraries: elf dw - if flag(libnuma) - extra-libraries: numa if !flag(smp) cpp-options: -DNOSMP @@ -297,8 +253,6 @@ library if os(osx) ld-options: "-Wl,-search_paths_first" - -- See Note [fd_set_overflow] - "-Wl,-U,___darwin_check_fd_set_overflow" if !arch(x86_64) && !arch(aarch64) ld-options: -read_only_relocs warning @@ -315,27 +269,6 @@ library -- AutoApply is generated AutoApply.cmm - -- Adjustor stuff - if flag(libffi-adjustors) - c-sources: adjustor/LibffiAdjustor.c - else - -- Use GHC's native adjustors - if arch(i386) - asm-sources: adjustor/Nativei386Asm.S - c-sources: adjustor/Nativei386.c - if arch(x86_64) - if os(mingw32) - asm-sources: adjustor/NativeAmd64MingwAsm.S - c-sources: adjustor/NativeAmd64Mingw.c - else - asm-sources: adjustor/NativeAmd64Asm.S - c-sources: adjustor/NativeAmd64.c - if arch(ppc) || arch(ppc64) - asm-sources: AdjustorAsm.S - c-sources: adjustor/NativePowerPC.c - if arch(ia64) - c-sources: adjustor/NativeIA64.c - -- Use assembler STG entrypoint on architectures where it is used if arch(ppc) || arch(ppc64) || arch(s390x) || arch(riscv64) || arch(loongarch64) asm-sources: StgCRunAsm.S |