[Git][ghc/ghc][wip/rts-configure] 19 commits: Give the RTS it's own configure script

John Ericson (@Ericson2314) gitlab at gitlab.haskell.org
Mon Jan 2 07:56:10 UTC 2023



John Ericson pushed to branch wip/rts-configure at Glasgow Haskell Compiler / GHC


Commits:
d0a146a5 by John Ericson at 2023-01-01T12:48:47-05:00
Give the RTS it's own configure script

Currently it doesn't do much anything, we are just trying to introduce
it without breaking the build. Later, we will move functionality from
the top-level configure script over to it.

We need to bump Cabal for https://github.com/haskell/cabal/pull/8649; to
facilitate and existing hack of skipping some configure checks for the
RTS we now need to skip just *part* not *all* of the "post configure"
hook, as running the configure script (which we definitely want to do)
is also implemented as part of the "post configure" hook. But doing this
requires exposing functionality that wasn't exposed before.

- - - - -
dde92d14 by John Ericson at 2023-01-01T12:49:18-05:00
rts: Move external symbols logic to the configure script

This is much more terse because we are programatically handling the
leading underscore.

- - - - -
7b2cf807 by John Ericson at 2023-01-02T02:28:55-05:00
Move lib{numa,dw} defines to RTS configure

Clean up the m4 to handle the auto case always and be more consistent.
Also simplify the CPP --- we should always have both headers if we are
using libnuma.

"side effects" (AC_DEFINE, and AC_SUBST) are removed from the macros to
better separate searching from actions taken based on search results.
This might seem overkill now, but will make shuffling logic between
configure scripts easier later.

- - - - -
36a8f0e6 by John Ericson at 2023-01-02T02:55:22-05:00
RTS configure: handle ffi adjustor method

- - - - -
17a32a15 by John Ericson at 2023-01-02T02:55:22-05:00
rts configure: Move over eventfd, __thread, and mem mgmt checks

- - - - -
b0883352 by John Ericson at 2023-01-02T02:55:22-05:00
move FP_CHECK_PTHREADS to RTS configure

- - - - -
a8fe729b by John Ericson at 2023-01-02T02:55:22-05:00
Move apple compat check to RTS configure

- - - - -
569129db by John Ericson at 2023-01-02T02:55:22-05:00
Move visibility and clock_gettime checks to RTS configure

- - - - -
93ba3eae by John Ericson at 2023-01-02T02:55:22-05:00
Move leading underscore checks to RTS configure

- - - - -
2986dee7 by John Ericson at 2023-01-02T02:55:22-05:00
Move alloca, fork, const, and big endian checks to RTS configure

- - - - -
a66c9cdc by John Ericson at 2023-01-02T02:55:22-05:00
Move libdl check to RTS configure

- - - - -
88648b4a by John Ericson at 2023-01-02T02:55:22-05:00
Do FP_FIND_LIBFFI in RTS configure too

- - - - -
ee8824e5 by John Ericson at 2023-01-02T02:55:22-05:00
Split BFD support to RTS configure

- - - - -
12b63260 by John Ericson at 2023-01-02T02:55:22-05:00
Split libm check between top level and RTS

- - - - -
3f9d0618 by John Ericson at 2023-01-02T02:55:22-05:00
Split mingwex check between top level and RTS

- - - - -
4b0bb6ab by John Ericson at 2023-01-02T02:55:22-05:00
Move function checks to RTS configure

Some of these functions are used in `base` too, but we can copy the
checks over to its configure if that's an issue.

- - - - -
4bf32240 by John Ericson at 2023-01-02T02:55:22-05:00
Move over a number of C-style checks to RTS configure

- - - - -
ec6d3c89 by John Ericson at 2023-01-02T02:55:22-05:00
Move/Copy remaining AC_DEFINE to RTS config

Only exception is the LLVM version macros, which are used for GHC
itself.

- - - - -
e5be71a2 by John Ericson at 2023-01-02T02:55:22-05:00
Generate ghcplatform.h from RTS configure

- - - - -


25 changed files:

- boot
- configure.ac
- hadrian/cabal.project
- hadrian/hadrian.cabal
- hadrian/src/Base.hs
- hadrian/src/Hadrian/Haskell/Cabal/Parse.hs
- hadrian/src/Rules/Generate.hs
- hadrian/src/Rules/Lint.hs
- hadrian/src/Rules/Register.hs
- libraries/Cabal
- libraries/base/.gitignore
- m4/fp_bfd_support.m4
- m4/fp_cc_supports__atomics.m4
- m4/fp_check_pthreads.m4
- m4/fp_find_libdw.m4
- m4/fp_find_libnuma.m4
- m4/fptools_set_haskell_platform_vars.m4
- rts/.gitignore
- + rts/configure.ac
- + rts/external-symbols.list.in
- + rts/ghcplatform.h.bottom
- + rts/ghcplatform.h.top.in
- rts/posix/OSMem.c
- + rts/rts.buildinfo.in
- rts/rts.cabal.in


Changes:

=====================================
boot
=====================================
@@ -63,7 +63,7 @@ def autoreconf():
     else:
         reconf_cmd = 'autoreconf'
 
-    for dir_ in ['.'] + glob.glob('libraries/*/'):
+    for dir_ in ['.', 'rts'] + glob.glob('libraries/*/'):
         if os.path.isfile(os.path.join(dir_, 'configure.ac')):
             print("Booting %s" % dir_)
             # Update config.sub in submodules


=====================================
configure.ac
=====================================
@@ -142,28 +142,6 @@ if test "$EnableDistroToolchain" = "YES"; then
   TarballsAutodownload=NO
 fi
 
-AC_ARG_ENABLE(asserts-all-ways,
-[AS_HELP_STRING([--enable-asserts-all-ways],
-                [Usually ASSERTs are only compiled in the DEBUG way,
-                 this will enable them in all ways.])],
-  [FP_CAPITALIZE_YES_NO(["$enableval"], [EnableAssertsAllWays])],
-  [EnableAssertsAllWays=NO]
-)
-if test "$enable_asserts_all_ways" = "yes" ; then
-   AC_DEFINE([USE_ASSERTS_ALL_WAYS], [1], [Compile-in ASSERTs in all ways.])
-fi
-
-AC_ARG_ENABLE(native-io-manager,
-[AS_HELP_STRING([--enable-native-io-manager],
-                [Enable the native I/O manager by default.])],
-  [FP_CAPITALIZE_YES_NO(["$enableval"], [EnableNativeIOManager])],
-  [EnableNativeIOManager=NO]
-)
-if test "$EnableNativeIOManager" = "YES"; then
-  AC_DEFINE_UNQUOTED([DEFAULT_NATIVE_IO_MANAGER], [1], [Enable Native I/O manager as default.])
-fi
-
-
 dnl CC_STAGE0, LD_STAGE0, AR_STAGE0 are like the "previous" variable
 dnl CC, LD, AR (inherited by CC_STAGE[123], etc.)
 dnl but instead used by stage0 for bootstrapping stage1
@@ -325,9 +303,6 @@ dnl ** Do a build with tables next to code?
 dnl --------------------------------------------------------------
 
 GHC_TABLES_NEXT_TO_CODE
-if test x"$TablesNextToCode" = xYES; then
-   AC_DEFINE([TABLES_NEXT_TO_CODE], [1], [Define to 1 if info tables are laid out next to code])
-fi
 AC_SUBST(TablesNextToCode)
 
 dnl ** Does target have runtime linker support?
@@ -637,14 +612,17 @@ dnl    unregisterised, Sparc, and PPC backends. Also determines whether
 dnl    linking to libatomic is required for atomic operations, e.g. on
 dnl    RISCV64 GCC.
 FP_CC_SUPPORTS__ATOMICS
+if test "$need_latomic" = 1; then
+    AC_SUBST([NeedLibatomic],[YES])
+else
+    AC_SUBST([NeedLibatomic],[NO])
+fi
 
 FP_GCC_EXTRA_FLAGS
 
 dnl ** look to see if we have a C compiler using an llvm back end.
 dnl
 FP_CC_LLVM_BACKEND
-AS_IF([test x"$CcLlvmBackend" = x"YES"],
-  [AC_DEFINE([CC_LLVM_BACKEND], [1], [Define (to 1) if C compiler has an LLVM back end])])
 AC_SUBST(CcLlvmBackend)
 
 FPTOOLS_SET_C_LD_FLAGS([target],[CFLAGS],[LDFLAGS],[IGNORE_LINKER_LD_FLAGS],[CPPFLAGS])
@@ -835,60 +813,8 @@ dnl --------------------------------------------------
 dnl ### program checking section ends here ###
 dnl --------------------------------------------------
 
-dnl --------------------------------------------------
-dnl * Platform header file and syscall feature tests
-dnl ### checking the state of the local header files and syscalls ###
-
-dnl ** Enable large file support.  NB. do this before testing the type of
-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
+AC_CHECK_SIZEOF([void *])
 TargetWordSize=$ac_cv_sizeof_void_p
 if test "x$TargetWordSize" = x8; then
   AC_SUBST([Cabal64bit],[True])
@@ -900,28 +826,6 @@ 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], , ,
-[#define _POSIX_SOURCE 1
-#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],
@@ -929,27 +833,18 @@ AC_CHECK_LIB(
   [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_CHECK_LIB(m, atan, UseLibm=YES, UseLibm=NO)
+AC_SUBST([UseLibm])
+TargetHasLibm=$UseLibM
 AC_SUBST(TargetHasLibm)
 
 FP_BFD_SUPPORT
+AC_SUBST([UseLibbfd],[$haveLibbfd])
 
 dnl ################################################################
 dnl Check for libraries
@@ -959,164 +854,27 @@ 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])
-
-dnl --------------------------------------------------
-dnl * Miscellaneous feature tests
-dnl --------------------------------------------------
-
-dnl ** can we get alloca?
-AC_FUNC_ALLOCA
-
-dnl ** working vfork?
-AC_FUNC_FORK
-
-dnl ** determine whether or not const works
-AC_C_CONST
-
-dnl ** are we big endian?
-AC_C_BIGENDIAN
-FPTOOLS_FLOAT_WORD_ORDER_BIGENDIAN
+AC_CHECK_LIB([dl], [dlopen], UseLibdl=YES, UseLibdl=NO)
+AC_SUBST([UseLibdl])
 
 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)
-AC_LINK_IFELSE([AC_LANG_CALL([], [printf\$LDBLStub])],
-    [
-        AC_MSG_RESULT(yes)
-        AC_DEFINE([HAVE_PRINTF_LDBLSTUB],[1],
-            [Define to 1 if we have printf$LDBLStub (Apple Mac OS >= 10.4, PPC).])
-    ],
-    [
-        AC_MSG_RESULT(no)
-        AC_DEFINE([HAVE_PRINTF_LDBLSTUB],[0],
-            [Define to 1 if we have printf$LDBLStub (Apple Mac OS >= 10.4, PPC).])
-    ])
+AC_CHECK_LIB([rt], [clock_gettime], UseLibrt=YES, UseLibrt=NO)
+AC_SUBST([UseLibrt])
 
 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])
-
+AS_IF([test x"$need_lpthread" = 1],
+    [UseLibpthread=YES],
+    [UseLibpthread=NO])
+AC_SUBST([UseLibpthread])
 
 GHC_ADJUSTORS_METHOD([Target])
 AC_SUBST([UseLibffiForAdjustors])
@@ -1124,7 +882,14 @@ 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 --------------------------------------------------------------


=====================================
hadrian/cabal.project
=====================================
@@ -1,4 +1,6 @@
 packages: ./
+-- N.B. This could be removed once Cabal 3.9 is released.
+packages: ../libraries/Cabal/Cabal, ../libraries/Cabal/Cabal-syntax
 
 -- This essentially freezes the build plan for hadrian
 index-state: 2022-11-19T22:13:06Z


=====================================
hadrian/hadrian.cabal
=====================================
@@ -147,7 +147,7 @@ executable hadrian
                        , BangPatterns
     other-extensions:    MultiParamTypeClasses
                        , TypeFamilies
-    build-depends:       Cabal                >= 3.2     && < 3.9
+    build-depends:       Cabal                >= 3.9     && < 3.10
                        , base                 >= 4.8     && < 5
                        , bytestring           >= 0.10    && < 0.12
                        , containers           >= 0.5     && < 0.7


=====================================
hadrian/src/Base.hs
=====================================
@@ -20,9 +20,6 @@ module Base (
     module Stage,
     module Way,
 
-    -- * Files
-    configH,
-
     -- * Paths
     hadrianPath, configPath, configFile, sourcePath, shakeFilesDir,
     stageBinPath, stageLibPath, templateHscPath,
@@ -72,11 +69,6 @@ configFile = configPath -/- "system.config"
 sourcePath :: FilePath
 sourcePath = hadrianPath -/- "src"
 
--- TODO: Change @mk/config.h@ to @shake-build/cfg/config.h at .
--- | Path to the generated @mk/config.h@ file.
-configH :: FilePath
-configH = "mk/config.h"
-
 -- | The directory in 'buildRoot' containing the Shake database and other
 -- auxiliary files generated by Hadrian.
 shakeFilesDir :: FilePath


=====================================
hadrian/src/Hadrian/Haskell/Cabal/Parse.hs
=====================================
@@ -146,22 +146,31 @@ configurePackage context at Context {..} = do
     need deps
 
     -- Figure out what hooks we need.
-    hooks <- case C.buildType (C.flattenPackageDescription gpd) of
+    hooks <- if
+      -- Not quite right, but good enough for us:
+      | package == rts ->
+        -- Don't try to do post configuration validation for 'rts'. This
+        -- will simply not work, due to the @ld-options@ and @Stg.h at .
+        --
+        -- We used to just mkae the whole 'postConf' a no-op, but now
+        -- that th RTS has a configure script we do need to at least run
+        -- it, which is the first part of the stock 'postConf'.
+        pure $ C.autoconfUserHooks {
+          C.postConf = \_ flags pd lbi -> do
+            _ <- C.runConfigureScriptAndReadAndValidateBuildInfo flags pd lbi
+            pure ()
+        }
+      | otherwise -> case C.buildType (C.flattenPackageDescription gpd) of
         C.Configure -> pure C.autoconfUserHooks
+        C.Simple -> pure C.simpleUserHooks
+        C.Make -> fail "build-type: Make is not supported"
         -- The 'time' package has a 'C.Custom' Setup.hs, but it's actually
         -- 'C.Configure' plus a @./Setup test@ hook. However, Cabal is also
         -- 'C.Custom', but doesn't have a configure script.
         C.Custom -> do
-            configureExists <- doesFileExist $
-                replaceFileName (pkgCabalFile package) "configure"
-            pure $ if configureExists then C.autoconfUserHooks else C.simpleUserHooks
-        -- Not quite right, but good enough for us:
-        _ | package == rts ->
-            -- Don't try to do post configuration validation for 'rts'. This
-            -- will simply not work, due to the @ld-options@ and @Stg.h at .
-            pure $ C.simpleUserHooks { C.postConf = \_ _ _ _ -> return () }
-          | otherwise -> pure C.simpleUserHooks
-
+          configureExists <- doesFileExist $
+            replaceFileName (pkgCabalFile package) "configure"
+          pure $ if configureExists then C.autoconfUserHooks else C.simpleUserHooks
     -- Compute the list of flags, and the Cabal configuration arguments
     flavourArgs <- args <$> flavour
     flagList    <- interpret (target context (Cabal Flags stage) [] []) flavourArgs


=====================================
hadrian/src/Rules/Generate.hs
=====================================
@@ -146,9 +146,10 @@ generatePackageCode context@(Context stage pkg _ _) = do
     when (pkg == rts) $ do
         root -/- "**" -/- dir -/- "cmm/AutoApply.cmm" %> \file ->
             build $ target context GenApply [] [file]
-        let go gen file = generate file (semiEmptyTarget stage) gen
-        root -/- "**" -/- dir -/- "include/ghcautoconf.h" %> go generateGhcAutoconfH
-        root -/- "**" -/- dir -/- "include/ghcplatform.h" %> go generateGhcPlatformH
+        root -/- "**" -/- dir -/- "include/ghcautoconf.h" %> \_ ->
+            need . pure =<< pkgSetupConfigFile context
+        root -/- "**" -/- dir -/- "include/ghcplatform.h" %> \_ ->
+            need . pure =<< pkgSetupConfigFile context
         root -/- "**" -/- dir -/- "include/DerivedConstants.h" %> genPlatformConstantsHeader context
         root -/- "**" -/- dir -/- "include/rts/EventLogConstants.h" %> genEventTypes "--event-types-defines"
         root -/- "**" -/- dir -/- "include/rts/EventTypes.h" %> genEventTypes "--event-types-array"
@@ -319,59 +320,6 @@ ghcWrapper stage  = do
                                      else [])
                                ++ [ "$@" ]
 
--- | Given a 'String' replace characters '.' and '-' by underscores ('_') so that
--- the resulting 'String' is a valid C preprocessor identifier.
-cppify :: String -> String
-cppify = replaceEq '-' '_' . replaceEq '.' '_'
-
--- | Generate @ghcplatform.h@ header.
-generateGhcPlatformH :: Expr String
-generateGhcPlatformH = do
-    trackGenerateHs
-    stage    <- getStage
-    let chooseSetting x y = getSetting $ case stage of { Stage0 {} -> x; _ -> y }
-    buildPlatform  <- chooseSetting BuildPlatform HostPlatform
-    buildArch      <- chooseSetting BuildArch     HostArch
-    buildOs        <- chooseSetting BuildOs       HostOs
-    buildVendor    <- chooseSetting BuildVendor   HostVendor
-    hostPlatform   <- chooseSetting HostPlatform  TargetPlatform
-    hostArch       <- chooseSetting HostArch      TargetArch
-    hostOs         <- chooseSetting HostOs        TargetOs
-    hostVendor     <- chooseSetting HostVendor    TargetVendor
-    ghcUnreg       <- getFlag    GhcUnregisterised
-    return . unlines $
-        [ "#if !defined(__GHCPLATFORM_H__)"
-        , "#define __GHCPLATFORM_H__"
-        , ""
-        , "#define BuildPlatform_TYPE  " ++ cppify buildPlatform
-        , "#define HostPlatform_TYPE   " ++ cppify hostPlatform
-        , ""
-        , "#define " ++ cppify buildPlatform   ++ "_BUILD 1"
-        , "#define " ++ cppify hostPlatform ++ "_HOST 1"
-        , ""
-        , "#define " ++ buildArch   ++ "_BUILD_ARCH 1"
-        , "#define " ++ hostArch ++ "_HOST_ARCH 1"
-        , "#define BUILD_ARCH " ++ show buildArch
-        , "#define HOST_ARCH "  ++ show hostArch
-        , ""
-        , "#define " ++ buildOs   ++ "_BUILD_OS 1"
-        , "#define " ++ hostOs ++ "_HOST_OS 1"
-        , "#define BUILD_OS " ++ show buildOs
-        , "#define HOST_OS "  ++ show hostOs
-        , ""
-        , "#define " ++ buildVendor   ++ "_BUILD_VENDOR 1"
-        , "#define " ++ hostVendor ++ "_HOST_VENDOR 1"
-        , "#define BUILD_VENDOR " ++ show buildVendor
-        , "#define HOST_VENDOR "  ++ show hostVendor
-        , ""
-        ]
-        ++
-        [ "#define UnregisterisedCompiler 1" | ghcUnreg ]
-        ++
-        [ ""
-        , "#endif /* __GHCPLATFORM_H__ */"
-        ]
-
 -- See Note [tooldir: How GHC finds mingw on Windows]
 generateSettings :: Expr String
 generateSettings = do
@@ -486,26 +434,6 @@ generateConfigHs = do
     stageString (Stage0 GlobalLibs) = error "stageString: StageBoot"
 
 
--- | Generate @ghcautoconf.h@ header.
-generateGhcAutoconfH :: Expr String
-generateGhcAutoconfH = do
-    trackGenerateHs
-    configHContents  <- expr $ mapMaybe undefinePackage <$> readFileLines configH
-    return . unlines $
-        [ "#if !defined(__GHCAUTOCONF_H__)"
-        , "#define __GHCAUTOCONF_H__" ]
-        ++ configHContents ++
-        [ "#endif /* __GHCAUTOCONF_H__ */" ]
-  where
-    undefinePackage s
-        | "#define PACKAGE_" `isPrefixOf` s
-            = Just $ "/* #undef " ++ takeWhile (/=' ') (drop 8 s) ++ " */"
-        | "#define __GLASGOW_HASKELL" `isPrefixOf` s
-            = Nothing
-        | "/* REMOVE ME */" == s
-            = Nothing
-        | otherwise = Just s
-
 -- | Generate @Version.hs@ files.
 generateVersionHs :: Expr String
 generateVersionHs = do


=====================================
hadrian/src/Rules/Lint.hs
=====================================
@@ -11,13 +11,17 @@ lintRules :: Rules ()
 lintRules = do
   "lint:base" ~> lint base
   "lint:compiler" ~> lint compiler
+
+  -- Ensure that autoconf scripts, which are usually run by Cabal, are run to
+  -- avoid depending upon Cabal from the stage0 compiler..
   "libraries" -/- "base" -/- "include" -/- "HsBaseConfig.h" %> \_ ->
       -- ./configure is called here manually because we need to generate
       -- HsBaseConfig.h, which is created from HsBaseConfig.h.in. ./configure
-      -- is usually run by Cabal which generates this file but if we do that
-      -- then hadrian thinks it needs to build the stage0 compiler before
-      -- attempting to configure. Therefore we just run it directly here.
       cmd_ (Cwd "libraries/base") "./configure"
+  "rts" -/- "include" -/- "ghcautoconf.h" %> \_ ->
+      cmd_ (Cwd "rts") "./configure"
+  "rts" -/- "include" -/- "ghcplatform.h" %> \_ ->
+      cmd_ (Cwd "rts") "./configure"
 
 lint :: Action () -> Action ()
 lint lintAction = do
@@ -64,7 +68,6 @@ base = do
   let includeDirs =
         [ "rts/include"
         , "libraries/base/include"
-        , stage1RtsInc
         ]
   runHLint includeDirs [] "libraries/base"
 


=====================================
hadrian/src/Rules/Register.hs
=====================================
@@ -45,6 +45,12 @@ configurePackageRules = do
           isGmp <- (== "gmp") <$> interpretInContext ctx getBignumBackend
           when isGmp $
             need [buildP -/- "include/ghc-gmp.h"]
+        when (pkg == rts) $ do
+          -- Rts.h is a header listed in the cabal file, and configuring
+          -- therefore wants to ensure that the header "works" post-configure.
+          -- But it (transitively) includes this, so we must ensure it exists
+          -- for that check to work.
+          need [buildP -/- "include/ghcplatform.h"]
         Cabal.configurePackage ctx
 
     root -/- "**/autogen/cabal_macros.h" %> \out -> do


=====================================
libraries/Cabal
=====================================
@@ -1 +1 @@
-Subproject commit 6cd29789ca866464dc3af89f62c98c41264ce3cd
+Subproject commit 5abfa5032cb6f011c9a7e02d14c9f10dcb2d660d


=====================================
libraries/base/.gitignore
=====================================
@@ -19,4 +19,3 @@
 /include/EventConfig.h
 /include/HsBaseConfig.h
 /include/HsBaseConfig.h.in
-


=====================================
m4/fp_bfd_support.m4
=====================================
@@ -2,7 +2,7 @@
 # ----------------------
 # whether to use libbfd for debugging RTS
 AC_DEFUN([FP_BFD_SUPPORT], [
-    HaveLibbfd=NO
+    haveLibbfd=NO
     AC_ARG_ENABLE(bfd-debug,
         [AS_HELP_STRING([--enable-bfd-debug],
               [Enable symbol resolution for -debug rts ('+RTS -Di') via binutils' libbfd [default=no]])],
@@ -40,10 +40,9 @@ AC_DEFUN([FP_BFD_SUPPORT], [
                                     bfd_get_symbol_info(abfd,symbol_table[0],&info);
                                 }
                         ]])],
-                        HaveLibbfd=YES,dnl bfd seems to work
+                        haveLibbfd=YES dnl bfd seems to work
                         [AC_MSG_ERROR([can't use 'bfd' library])])
             LIBS="$save_LIBS"
         ]
     )
-    AC_SUBST([UseLibbfd],[$HaveLibbfd])
 ])


=====================================
m4/fp_cc_supports__atomics.m4
=====================================
@@ -61,12 +61,4 @@ AC_DEFUN([FP_CC_SUPPORTS__ATOMICS],
         AC_MSG_RESULT(no)
         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],
-        [Define to 1 if we need -latomic.])
 ])


=====================================
m4/fp_check_pthreads.m4
=====================================
@@ -12,18 +12,15 @@ 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
               ])


=====================================
m4/fp_find_libdw.m4
=====================================
@@ -12,8 +12,6 @@ AC_DEFUN([FP_FIND_LIBDW],
       LIBDW_LDFLAGS="-L$withval"
     ])
 
-  AC_SUBST(LibdwLibDir)
-
   AC_ARG_WITH([libdw-includes],
     [AS_HELP_STRING([--with-libdw-includes=ARG],
       [Find includes for libdw in ARG [default=system default]])
@@ -23,35 +21,29 @@ AC_DEFUN([FP_FIND_LIBDW],
       LIBDW_CFLAGS="-I$withval"
     ])
 
-  AC_SUBST(LibdwIncludeDir)
+  AC_ARG_ENABLE(dwarf-unwind,
+    [AS_HELP_STRING([--enable-dwarf-unwind],
+      [Enable DWARF unwinding support in the runtime system via elfutils' libdw [default=no]])],
+    [],
+    [enable_dwarf_unwind=no])
 
   UseLibdw=NO
-  USE_LIBDW=0
-  AC_ARG_ENABLE(dwarf-unwind,
-      [AS_HELP_STRING([--enable-dwarf-unwind],
-          [Enable DWARF unwinding support in the runtime system via elfutils' libdw [default=no]])])
-  if test "$enable_dwarf_unwind" = "yes" ; then
+  if test "$enable_dwarf_unwind" != "no" ; then
     CFLAGS2="$CFLAGS"
     CFLAGS="$LIBDW_CFLAGS $CFLAGS"
     LDFLAGS2="$LDFLAGS"
     LDFLAGS="$LIBDW_LDFLAGS $LDFLAGS"
 
-    AC_CHECK_LIB(dw, dwfl_attach_state,
-        [AC_CHECK_HEADERS([elfutils/libdw.h], [break], [])
-         UseLibdw=YES],
-        [AC_MSG_ERROR([Cannot find system libdw (required by --enable-dwarf-unwind)])])
+    AC_CHECK_HEADER([elfutils/libdwfl.h],
+      [AC_CHECK_LIB(dw, dwfl_attach_state,
+        [UseLibdw=YES])])
+
+    if test "x:$enable_dwarf_unwind:$UseLibdw" = "x:yes:NO" ; then
+      AC_MSG_ERROR([Cannot find system libdw (required by --enable-dwarf-unwind)])
+    fi
 
     CFLAGS="$CFLAGS2"
     LDFLAGS="$LDFLAGS2"
   fi
-
-  AC_SUBST(UseLibdw)
-  if test $UseLibdw = "YES" ; then
-    USE_LIBDW=1
-    AC_SUBST([CabalHaveLibdw],[True])
-  else
-    AC_SUBST([CabalHaveLibdw],[False])
-  fi
-  AC_DEFINE_UNQUOTED([USE_LIBDW], [$USE_LIBDW], [Set to 1 to use libdw])
 ])
 


=====================================
m4/fp_find_libnuma.m4
=====================================
@@ -11,8 +11,6 @@ AC_DEFUN([FP_FIND_LIBNUMA],
       LIBNUMA_LDFLAGS="-L$withval"
     ])
 
-  AC_SUBST(LibNumaLibDir)
-
   AC_ARG_WITH([libnuma-includes],
     [AS_HELP_STRING([--with-libnuma-includes=ARG],
       [Find includes for libnuma in ARG [default=system default]])
@@ -22,14 +20,14 @@ AC_DEFUN([FP_FIND_LIBNUMA],
       LIBNUMA_CFLAGS="-I$withval"
     ])
 
-  AC_SUBST(LibNumaIncludeDir)
-
-  HaveLibNuma=0
   AC_ARG_ENABLE(numa,
-      [AS_HELP_STRING([--enable-numa],
-          [Enable NUMA memory policy and thread affinity support in the
-           runtime system via numactl's libnuma [default=auto]])])
+    [AS_HELP_STRING([--enable-numa],
+      [Enable NUMA memory policy and thread affinity support in the
+       runtime system via numactl's libnuma [default=auto]])],
+    [],
+    [enable_numa=auto])
 
+  UseLibNuma=NO
   if test "$enable_numa" != "no" ; then
     CFLAGS2="$CFLAGS"
     CFLAGS="$LIBNUMA_CFLAGS $CFLAGS"
@@ -38,23 +36,14 @@ AC_DEFUN([FP_FIND_LIBNUMA],
 
     AC_CHECK_HEADERS([numa.h numaif.h])
 
-    if test "$ac_cv_header_numa_h$ac_cv_header_numaif_h" = "yesyes" ; then
-      AC_CHECK_LIB(numa, numa_available,HaveLibNuma=1)
+    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])
     fi
-    if test "$enable_numa:$HaveLibNuma" = "yes:0" ; then
-        AC_MSG_ERROR([Cannot find system libnuma (required by --enable-numa)])
+    if test "x:$enable_numa:$UseLibNuma" = "x:yes:NO" ; 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])
-  if test $HaveLibNuma = "1" ; then
-    AC_SUBST([UseLibNuma],[YES])
-    AC_SUBST([CabalHaveLibNuma],[True])
-  else
-    AC_SUBST([UseLibNuma],[NO])
-    AC_SUBST([CabalHaveLibNuma],[False])
-  fi
 ])


=====================================
m4/fptools_set_haskell_platform_vars.m4
=====================================
@@ -162,8 +162,6 @@ AC_DEFUN([GHC_SUBSECTIONS_VIA_SYMBOLS],
             TargetHasSubsectionsViaSymbols=NO
          else
             TargetHasSubsectionsViaSymbols=YES
-            AC_DEFINE([HAVE_SUBSECTIONS_VIA_SYMBOLS],[1],
-                   [Define to 1 if Apple-style dead-stripping is supported.])
          fi
         ],
         [TargetHasSubsectionsViaSymbols=NO


=====================================
rts/.gitignore
=====================================
@@ -12,7 +12,13 @@
 /package.conf.install.raw
 /fs.*
 
+/aclocal.m4
 /autom4te.cache/
 /config.log
 /config.status
 /configure
+
+/external-symbols.list
+/ghcautoconf.h.autoconf.in
+/ghcautoconf.h.autoconf
+/include/ghcautoconf.h


=====================================
rts/configure.ac
=====================================
@@ -0,0 +1,430 @@
+# Configure script template for the Run-time System of GHC
+#
+# Process with 'autoreconf' to get a working configure script.
+#
+# For the generated configure script, do "./configure --help" to
+# see what flags are available. (Better yet, read the documentation!)
+#
+
+AC_INIT([GHC run-time system], [1.0.2], [libraries at haskell.org], [rts])
+
+AC_CONFIG_MACRO_DIRS([../m4])
+
+# Safety check: Ensure that we are in the correct source directory.
+AC_CONFIG_SRCDIR([include/rts/Constants.h])
+
+dnl * We require autoconf version 2.69 due to
+dnl   https://bugs.ruby-lang.org/issues/8179. Also see #14910.
+dnl * We need 2.50 due to the use of AC_SYS_LARGEFILE and AC_MSG_NOTICE.
+dnl * We need 2.52 due to the use of AS_TR_CPP and AS_TR_SH.
+dnl * Using autoconf 2.59 started to give nonsense like this
+dnl     #define SIZEOF_CHAR 0
+dnl   recently.
+AC_PREREQ([2.69])
+
+AC_CONFIG_FILES([ghcplatform.h.top])
+
+AC_CONFIG_HEADERS([ghcautoconf.h.autoconf])
+
+AC_ARG_ENABLE(asserts-all-ways,
+[AS_HELP_STRING([--enable-asserts-all-ways],
+                [Usually ASSERTs are only compiled in the DEBUG way,
+                 this will enable them in all ways.])],
+  [FP_CAPITALIZE_YES_NO(["$enableval"], [EnableAssertsAllWays])],
+  [EnableAssertsAllWays=NO]
+)
+if test "$enable_asserts_all_ways" = "yes" ; then
+   AC_DEFINE([USE_ASSERTS_ALL_WAYS], [1], [Compile-in ASSERTs in all ways.])
+fi
+
+AC_ARG_ENABLE(native-io-manager,
+[AS_HELP_STRING([--enable-native-io-manager],
+                [Enable the native I/O manager by default.])],
+  [FP_CAPITALIZE_YES_NO(["$enableval"], [EnableNativeIOManager])],
+  [EnableNativeIOManager=NO]
+)
+if test "$EnableNativeIOManager" = "YES"; then
+  AC_DEFINE_UNQUOTED([DEFAULT_NATIVE_IO_MANAGER], [1], [Enable Native I/O manager as default.])
+fi
+
+# We have to run these unconditionally, but we may discard their
+# results in the following code
+AC_CANONICAL_BUILD
+AC_CANONICAL_HOST
+
+dnl ** Do an unregisterised build?
+dnl --------------------------------------------------------------
+
+GHC_UNREGISTERISED
+
+dnl ** Do a build with tables next to code?
+dnl --------------------------------------------------------------
+
+GHC_TABLES_NEXT_TO_CODE
+if test x"$TablesNextToCode" = xYES; then
+   AC_DEFINE([TABLES_NEXT_TO_CODE], [1], [Define to 1 if info tables are laid out next to code])
+fi
+
+dnl detect compiler (prefer gcc over clang) and set $CC (unless CC already set),
+dnl later CC is copied to CC_STAGE{1,2,3}
+AC_PROG_CC([cc gcc clang])
+
+dnl make extensions visible to allow feature-tests to detect them lateron
+AC_USE_SYSTEM_EXTENSIONS
+
+dnl ** Used to determine how to compile ghc-prim's atomics.c, used by
+dnl    unregisterised, Sparc, and PPC backends. Also determines whether
+dnl    linking to libatomic is required for atomic operations, e.g. on
+dnl    RISCV64 GCC.
+FP_CC_SUPPORTS__ATOMICS
+AC_DEFINE([HAVE_C11_ATOMICS], [1], [Does C compiler support __atomic primitives?])
+AC_DEFINE_UNQUOTED([NEED_ATOMIC_LIB], [$need_latomic],
+    [Define to 1 if we need -latomic for sub-word atomic operations.])
+
+dnl ** look to see if we have a C compiler using an llvm back end.
+dnl
+FP_CC_LLVM_BACKEND
+AS_IF([test x"$CcLlvmBackend" = x"YES"],
+  [AC_DEFINE([CC_LLVM_BACKEND], [1], [Define (to 1) if C compiler has an LLVM back end])])
+
+GHC_CONVERT_PLATFORM_PARTS([build], [Build])
+FPTOOLS_SET_PLATFORM_VARS([build],[Build])
+FPTOOLS_SET_HASKELL_PLATFORM_VARS([Build])
+
+GHC_CONVERT_PLATFORM_PARTS([host], [Host])
+FPTOOLS_SET_PLATFORM_VARS([host], [Host])
+FPTOOLS_SET_HASKELL_PLATFORM_VARS([Host])
+
+GHC_SUBSECTIONS_VIA_SYMBOLS
+AS_IF([test x"${TargetHasSubsectionsViaSymbols}" = x"YES"],
+  [AC_DEFINE([HAVE_SUBSECTIONS_VIA_SYMBOLS],[1],
+    [Define to 1 if Apple-style dead-stripping is supported.])])
+
+dnl --------------------------------------------------
+dnl * Platform header file and syscall feature tests
+dnl ### checking the state of the local header files and syscalls ###
+
+dnl ** Enable large file support.  NB. do this before testing the type of
+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)
+
+
+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], , ,
+[#define _POSIX_SOURCE 1
+#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([HaveLibMingwEx],[NO])])
+
+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,
+  [AC_DEFINE([HAVE_LIBM], [1], [Define to 1 if you need to link with libm])])
+
+FP_BFD_SUPPORT
+
+dnl ################################################################
+dnl Check for libraries
+dnl ################################################################
+
+FP_FIND_LIBFFI
+
+dnl ** check whether we need -ldl to get dlopen()
+AC_CHECK_LIB([dl], [dlopen])
+dnl ** check whether we have dlinfo
+AC_CHECK_FUNCS([dlinfo])
+
+dnl --------------------------------------------------
+dnl * Miscellaneous feature tests
+dnl --------------------------------------------------
+
+dnl ** can we get alloca?
+AC_FUNC_ALLOCA
+
+dnl ** working vfork?
+AC_FUNC_FORK
+
+dnl ** determine whether or not const works
+AC_C_CONST
+
+dnl ** are we big endian?
+AC_C_BIGENDIAN
+FPTOOLS_FLOAT_WORD_ORDER_BIGENDIAN
+
+dnl ** check for leading underscores in symbol names
+FP_LEADING_UNDERSCORE
+if test x"$fptools_cv_leading_underscore" = xyes; then
+   AC_DEFINE([LEADING_UNDERSCORE], [1], [Define to 1 if C symbols have a leading underscore added by the compiler.])
+fi
+
+FP_VISIBILITY_HIDDEN
+
+FP_MUSTTAIL
+
+dnl ** check for librt
+AC_CHECK_LIB([rt], [clock_gettime])
+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)
+AC_LINK_IFELSE([AC_LANG_CALL([], [printf\$LDBLStub])],
+    [
+        AC_MSG_RESULT(yes)
+        AC_DEFINE([HAVE_PRINTF_LDBLSTUB],[1],
+            [Define to 1 if we have printf$LDBLStub (Apple Mac OS >= 10.4, PPC).])
+    ],
+    [
+        AC_MSG_RESULT(no)
+        AC_DEFINE([HAVE_PRINTF_LDBLSTUB],[0],
+            [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 ${HostOS} 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([Host])
+AC_SUBST([UseLibffiForAdjustors])
+
+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])
+
+dnl ** Write config files
+dnl --------------------------------------------------------------
+
+AC_OUTPUT
+
+dnl ######################################################################
+dnl Generate ghcplatform.h
+dnl ######################################################################
+
+[
+mkdir -p include
+
+touch include/ghcplatform.h
+> include/ghcplatform.h
+
+cat ghcplatform.h.top                          >> include/ghcplatform.h
+]
+AS_IF([test x"${Unregisterised}" = x"YES"],
+  [echo "#define UnregisterisedCompiler 1"     >> include/ghcplatform.h])
+[
+cat $srcdir/ghcplatform.h.bottom               >> include/ghcplatform.h
+]
+
+dnl ######################################################################
+dnl Generate ghcautoconf.h
+dnl ######################################################################
+
+[
+touch include/ghcautoconf.h
+> 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
+# "blah"' into '/* #undef PACKAGE_FOO */' to avoid clashes.
+cat $srcdir/../mk/config.h ghcautoconf.h.autoconf | sed \
+   -e 's,^\([	 ]*\)#[	 ]*define[	 ][	 ]*\(PACKAGE_[A-Z]*\)[	 ][ 	]*".*".*$,\1/* #undef \2 */,' \
+   -e '/__GLASGOW_HASKELL/d' \
+   -e '/REMOVE ME/d' \
+   >> include/ghcautoconf.h
+echo "#endif /* __GHCAUTOCONF_H__ */" >> include/ghcautoconf.h
+]
+
+dnl ######################################################################
+dnl Generate external symbol flags (-Wl,-u...)
+dnl ######################################################################
+
+cat $srcdir/external-symbols.list.in \
+    | "$CC" -E -P -traditional -Iinclude - -o - \
+    | sed '/^$/d' \
+    > external-symbols.list \
+    || exit 1
+
+mv external-symbols.list external-symbols.tmp
+if [[ -n "$LeadingUnderscore" ]]; then
+    sed 's/^/  -Wl,-u_/' external-symbols.tmp > external-symbols.list
+else
+    sed 's/^/  -Wl,-u/' external-symbols.tmp > external-symbols.list
+fi
+rm -f external-symbols.tmp
+
+dnl ######################################################################
+dnl Generate build-info
+dnl ######################################################################
+
+cat $srcdir/rts.buildinfo.in | \
+    sed -e 's/^  *//' | \
+    "$CC" -E -P -traditional - -o - \
+    > rts.buildinfo
+echo "" >> rts.buildinfo
+rm -f external-symbols.list


=====================================
rts/external-symbols.list.in
=====================================
@@ -0,0 +1,103 @@
+#include "ghcautoconf.h"
+
+#if SIZEOF_VOID_P == 8
+hs_atomic_add64
+hs_atomic_sub64
+hs_atomic_and64
+hs_atomic_nand64
+hs_atomic_or64
+hs_atomic_xor64
+hs_atomicread64
+hs_atomicwrite64
+#endif
+
+#if mingw32_HOST_OS
+base_GHCziEventziWindows_processRemoteCompletion_closure
+#endif
+
+#if darwin_HOST_OS
+#if 0
+See Note [fd_set_overflow]
+#endif
+__darwin_check_fd_set_overflow
+#endif
+
+#if FIND_PTR
+findPtr
+#endif
+
+base_GHCziTopHandler_runIO_closure
+base_GHCziTopHandler_runNonIO_closure
+ghczmprim_GHCziTupleziPrim_Z0T_closure
+ghczmprim_GHCziTypes_True_closure
+ghczmprim_GHCziTypes_False_closure
+base_GHCziPack_unpackCString_closure
+base_GHCziWeakziFinalizze_runFinalizzerBatch_closure
+base_GHCziIOziException_stackOverflow_closure
+base_GHCziIOziException_heapOverflow_closure
+base_GHCziIOziException_allocationLimitExceeded_closure
+base_GHCziIOziException_blockedIndefinitelyOnMVar_closure
+base_GHCziIOziException_blockedIndefinitelyOnSTM_closure
+base_GHCziIOziException_cannotCompactFunction_closure
+base_GHCziIOziException_cannotCompactPinned_closure
+base_GHCziIOziException_cannotCompactMutable_closure
+base_GHCziIOPort_doubleReadException_closure
+base_ControlziExceptionziBase_nonTermination_closure
+base_ControlziExceptionziBase_nestedAtomically_closure
+base_GHCziEventziThread_blockedOnBadFD_closure
+base_GHCziConcziSync_runSparks_closure
+base_GHCziConcziIO_ensureIOManagerIsRunning_closure
+base_GHCziConcziIO_interruptIOManager_closure
+base_GHCziConcziIO_ioManagerCapabilitiesChanged_closure
+base_GHCziConcziSignal_runHandlersPtr_closure
+base_GHCziTopHandler_flushStdHandles_closure
+base_GHCziTopHandler_runMainIO_closure
+ghczmprim_GHCziTypes_Czh_con_info
+ghczmprim_GHCziTypes_Izh_con_info
+ghczmprim_GHCziTypes_Fzh_con_info
+ghczmprim_GHCziTypes_Dzh_con_info
+ghczmprim_GHCziTypes_Wzh_con_info
+base_GHCziPtr_Ptr_con_info
+base_GHCziPtr_FunPtr_con_info
+base_GHCziInt_I8zh_con_info
+base_GHCziInt_I16zh_con_info
+base_GHCziInt_I32zh_con_info
+base_GHCziInt_I64zh_con_info
+base_GHCziWord_W8zh_con_info
+base_GHCziWord_W16zh_con_info
+base_GHCziWord_W32zh_con_info
+base_GHCziWord_W64zh_con_info
+base_GHCziStable_StablePtr_con_info
+hs_atomic_add8
+hs_atomic_add16
+hs_atomic_add32
+hs_atomic_sub8
+hs_atomic_sub16
+hs_atomic_sub32
+hs_atomic_and8
+hs_atomic_and16
+hs_atomic_and32
+hs_atomic_nand8
+hs_atomic_nand16
+hs_atomic_nand32
+hs_atomic_or8
+hs_atomic_or16
+hs_atomic_or32
+hs_atomic_xor8
+hs_atomic_xor16
+hs_atomic_xor32
+hs_cmpxchg8
+hs_cmpxchg16
+hs_cmpxchg32
+hs_cmpxchg64
+hs_xchg8
+hs_xchg16
+hs_xchg32
+hs_xchg64
+hs_atomicread8
+hs_atomicread16
+hs_atomicread32
+hs_atomicwrite8
+hs_atomicwrite16
+hs_atomicwrite32
+base_GHCziStackziCloneStack_StackSnapshot_closure


=====================================
rts/ghcplatform.h.bottom
=====================================
@@ -0,0 +1,2 @@
+
+#endif /* __GHCPLATFORM_H__ */


=====================================
rts/ghcplatform.h.top.in
=====================================
@@ -0,0 +1,23 @@
+#if !defined(__GHCPLATFORM_H__)
+#define __GHCPLATFORM_H__
+
+#define BuildPlatform_TYPE  @BuildPlatform_CPP@
+#define HostPlatform_TYPE   @HostPlatform_CPP@
+
+#define @BuildPlatform_CPP at _BUILD  1
+#define @HostPlatform_CPP at _HOST  1
+
+#define @BuildArch_CPP at _BUILD_ARCH  1
+#define @HostArch_CPP at _HOST_ARCH  1
+#define BUILD_ARCH  "@BuildArch_CPP@"
+#define HOST_ARCH  "@HostArch_CPP@"
+
+#define @BuildOS_CPP at _BUILD_OS  1
+#define @HostOS_CPP at _HOST_OS  1
+#define BUILD_OS  "@BuildOS_CPP@"
+#define HOST_OS  "@HostOS_CPP@"
+
+#define @BuildVendor_CPP at _BUILD_VENDOR  1
+#define @HostVendor_CPP at _HOST_VENDOR  1
+#define BUILD_VENDOR  "@BuildVendor_CPP@"
+#define HOST_VENDOR  "@HostVendor_CPP@"


=====================================
rts/posix/OSMem.c
=====================================
@@ -30,10 +30,8 @@
 #if defined(HAVE_FCNTL_H)
 #include <fcntl.h>
 #endif
-#if defined(HAVE_NUMA_H)
+#if HAVE_LIBNUMA
 #include <numa.h>
-#endif
-#if defined(HAVE_NUMAIF_H)
 #include <numaif.h>
 #endif
 #if defined(HAVE_SYS_RESOURCE_H) && defined(HAVE_SYS_TIME_H)


=====================================
rts/rts.buildinfo.in
=====================================
@@ -0,0 +1,3 @@
+-- External symbols referenced by the RTS
+ld-options:
+#include "external-symbols.list"


=====================================
rts/rts.cabal.in
=====================================
@@ -1,9 +1,27 @@
 cabal-version: 3.0
 name: rts
 version: 1.0.2
+synopsis: The GHC runtime system
+description:
+    The GHC runtime system.
+
+    Code produced by GHC links this library to provide missing functionality
+    that cannot be written in Haskell itself.
 license: BSD-3-Clause
 maintainer: glasgow-haskell-users at haskell.org
-build-type: Simple
+build-type: Configure
+
+extra-source-files:
+    configure
+    configure.ac
+    external-symbols.list.in
+    rts.buildinfo.in
+
+extra-tmp-files:
+    autom4te.cache
+    rts.buildinfo
+    config.log
+    config.status
 
 source-repository head
     type:     git
@@ -206,6 +224,7 @@ library
 
       include-dirs: include
       includes: Rts.h
+      autogen-includes: ghcautoconf.h ghcplatform.h
       install-includes: Cmm.h HsFFI.h MachDeps.h Rts.h RtsAPI.h Stg.h
                         ghcautoconf.h ghcconfig.h ghcplatform.h ghcversion.h
                         -- ^ from include
@@ -275,200 +294,6 @@ library
                         stg/SMP.h
                         stg/Ticky.h
                         stg/Types.h
-      if flag(64bit)
-        if flag(leading-underscore)
-          ld-options:
-            "-Wl,-u,_hs_atomic_add64"
-            "-Wl,-u,_hs_atomic_sub64"
-            "-Wl,-u,_hs_atomic_and64"
-            "-Wl,-u,_hs_atomic_nand64"
-            "-Wl,-u,_hs_atomic_or64"
-            "-Wl,-u,_hs_atomic_xor64"
-            "-Wl,-u,_hs_atomicread64"
-            "-Wl,-u,_hs_atomicwrite64"
-        else
-          ld-options:
-            "-Wl,-u,hs_atomic_add64"
-            "-Wl,-u,hs_atomic_sub64"
-            "-Wl,-u,hs_atomic_and64"
-            "-Wl,-u,hs_atomic_nand64"
-            "-Wl,-u,hs_atomic_or64"
-            "-Wl,-u,hs_atomic_xor64"
-            "-Wl,-u,hs_atomicread64"
-            "-Wl,-u,hs_atomicwrite64"
-      if flag(leading-underscore)
-        ld-options:
-           "-Wl,-u,_base_GHCziTopHandler_runIO_closure"
-           "-Wl,-u,_base_GHCziTopHandler_runNonIO_closure"
-           "-Wl,-u,_ghczmprim_GHCziTupleziPrim_Z0T_closure"
-           "-Wl,-u,_ghczmprim_GHCziTypes_True_closure"
-           "-Wl,-u,_ghczmprim_GHCziTypes_False_closure"
-           "-Wl,-u,_base_GHCziPack_unpackCString_closure"
-           "-Wl,-u,_base_GHCziWeakziFinalizze_runFinalizzerBatch_closure"
-           "-Wl,-u,_base_GHCziIOziException_stackOverflow_closure"
-           "-Wl,-u,_base_GHCziIOziException_heapOverflow_closure"
-           "-Wl,-u,_base_GHCziIOziException_allocationLimitExceeded_closure"
-           "-Wl,-u,_base_GHCziIOziException_blockedIndefinitelyOnMVar_closure"
-           "-Wl,-u,_base_GHCziIOziException_blockedIndefinitelyOnSTM_closure"
-           "-Wl,-u,_base_GHCziIOziException_cannotCompactFunction_closure"
-           "-Wl,-u,_base_GHCziIOziException_cannotCompactPinned_closure"
-           "-Wl,-u,_base_GHCziIOziException_cannotCompactMutable_closure"
-           "-Wl,-u,_base_GHCziIOPort_doubleReadException_closure"
-           "-Wl,-u,_base_ControlziExceptionziBase_nonTermination_closure"
-           "-Wl,-u,_base_ControlziExceptionziBase_nestedAtomically_closure"
-           "-Wl,-u,_base_GHCziEventziThread_blockedOnBadFD_closure"
-           "-Wl,-u,_base_GHCziConcziSync_runSparks_closure"
-           "-Wl,-u,_base_GHCziConcziIO_ensureIOManagerIsRunning_closure"
-           "-Wl,-u,_base_GHCziConcziIO_interruptIOManager_closure"
-           "-Wl,-u,_base_GHCziConcziIO_ioManagerCapabilitiesChanged_closure"
-           "-Wl,-u,_base_GHCziConcziSignal_runHandlersPtr_closure"
-           "-Wl,-u,_base_GHCziTopHandler_flushStdHandles_closure"
-           "-Wl,-u,_base_GHCziTopHandler_runMainIO_closure"
-           "-Wl,-u,_ghczmprim_GHCziTypes_Czh_con_info"
-           "-Wl,-u,_ghczmprim_GHCziTypes_Izh_con_info"
-           "-Wl,-u,_ghczmprim_GHCziTypes_Fzh_con_info"
-           "-Wl,-u,_ghczmprim_GHCziTypes_Dzh_con_info"
-           "-Wl,-u,_ghczmprim_GHCziTypes_Wzh_con_info"
-           "-Wl,-u,_base_GHCziPtr_Ptr_con_info"
-           "-Wl,-u,_base_GHCziPtr_FunPtr_con_info"
-           "-Wl,-u,_base_GHCziInt_I8zh_con_info"
-           "-Wl,-u,_base_GHCziInt_I16zh_con_info"
-           "-Wl,-u,_base_GHCziInt_I32zh_con_info"
-           "-Wl,-u,_base_GHCziInt_I64zh_con_info"
-           "-Wl,-u,_base_GHCziWord_W8zh_con_info"
-           "-Wl,-u,_base_GHCziWord_W16zh_con_info"
-           "-Wl,-u,_base_GHCziWord_W32zh_con_info"
-           "-Wl,-u,_base_GHCziWord_W64zh_con_info"
-           "-Wl,-u,_base_GHCziStable_StablePtr_con_info"
-           "-Wl,-u,_hs_atomic_add8"
-           "-Wl,-u,_hs_atomic_add16"
-           "-Wl,-u,_hs_atomic_add32"
-           "-Wl,-u,_hs_atomic_sub8"
-           "-Wl,-u,_hs_atomic_sub16"
-           "-Wl,-u,_hs_atomic_sub32"
-           "-Wl,-u,_hs_atomic_and8"
-           "-Wl,-u,_hs_atomic_and16"
-           "-Wl,-u,_hs_atomic_and32"
-           "-Wl,-u,_hs_atomic_nand8"
-           "-Wl,-u,_hs_atomic_nand16"
-           "-Wl,-u,_hs_atomic_nand32"
-           "-Wl,-u,_hs_atomic_or8"
-           "-Wl,-u,_hs_atomic_or16"
-           "-Wl,-u,_hs_atomic_or32"
-           "-Wl,-u,_hs_atomic_xor8"
-           "-Wl,-u,_hs_atomic_xor16"
-           "-Wl,-u,_hs_atomic_xor32"
-           "-Wl,-u,_hs_cmpxchg8"
-           "-Wl,-u,_hs_cmpxchg16"
-           "-Wl,-u,_hs_cmpxchg32"
-           "-Wl,-u,_hs_cmpxchg64"
-           "-Wl,-u,_hs_xchg8"
-           "-Wl,-u,_hs_xchg16"
-           "-Wl,-u,_hs_xchg32"
-           "-Wl,-u,_hs_xchg64"
-           "-Wl,-u,_hs_atomicread8"
-           "-Wl,-u,_hs_atomicread16"
-           "-Wl,-u,_hs_atomicread32"
-           "-Wl,-u,_hs_atomicwrite8"
-           "-Wl,-u,_hs_atomicwrite16"
-           "-Wl,-u,_hs_atomicwrite32"
-           "-Wl,-u,_base_GHCziStackziCloneStack_StackSnapshot_closure"
-
-        if flag(find-ptr)
-          -- This symbol is useful in gdb, but not referred to anywhere,
-          -- so we need to force it to be included in the binary.
-          ld-options: "-Wl,-u,_findPtr"
-
-      else
-        ld-options:
-           "-Wl,-u,base_GHCziTopHandler_runIO_closure"
-           "-Wl,-u,base_GHCziTopHandler_runNonIO_closure"
-           "-Wl,-u,ghczmprim_GHCziTupleziPrim_Z0T_closure"
-           "-Wl,-u,ghczmprim_GHCziTypes_True_closure"
-           "-Wl,-u,ghczmprim_GHCziTypes_False_closure"
-           "-Wl,-u,base_GHCziPack_unpackCString_closure"
-           "-Wl,-u,base_GHCziWeakziFinalizze_runFinalizzerBatch_closure"
-           "-Wl,-u,base_GHCziIOziException_stackOverflow_closure"
-           "-Wl,-u,base_GHCziIOziException_heapOverflow_closure"
-           "-Wl,-u,base_GHCziIOziException_allocationLimitExceeded_closure"
-           "-Wl,-u,base_GHCziIOziException_blockedIndefinitelyOnMVar_closure"
-           "-Wl,-u,base_GHCziIOziException_blockedIndefinitelyOnSTM_closure"
-           "-Wl,-u,base_GHCziIOziException_cannotCompactFunction_closure"
-           "-Wl,-u,base_GHCziIOziException_cannotCompactPinned_closure"
-           "-Wl,-u,base_GHCziIOziException_cannotCompactMutable_closure"
-           "-Wl,-u,base_GHCziIOPort_doubleReadException_closure"
-           "-Wl,-u,base_ControlziExceptionziBase_nonTermination_closure"
-           "-Wl,-u,base_ControlziExceptionziBase_nestedAtomically_closure"
-           "-Wl,-u,base_GHCziEventziThread_blockedOnBadFD_closure"
-           "-Wl,-u,base_GHCziConcziSync_runSparks_closure"
-           "-Wl,-u,base_GHCziConcziIO_ensureIOManagerIsRunning_closure"
-           "-Wl,-u,base_GHCziConcziIO_interruptIOManager_closure"
-           "-Wl,-u,base_GHCziConcziIO_ioManagerCapabilitiesChanged_closure"
-           "-Wl,-u,base_GHCziConcziSignal_runHandlersPtr_closure"
-           "-Wl,-u,base_GHCziTopHandler_flushStdHandles_closure"
-           "-Wl,-u,base_GHCziTopHandler_runMainIO_closure"
-           "-Wl,-u,ghczmprim_GHCziTypes_Czh_con_info"
-           "-Wl,-u,ghczmprim_GHCziTypes_Izh_con_info"
-           "-Wl,-u,ghczmprim_GHCziTypes_Fzh_con_info"
-           "-Wl,-u,ghczmprim_GHCziTypes_Dzh_con_info"
-           "-Wl,-u,ghczmprim_GHCziTypes_Wzh_con_info"
-           "-Wl,-u,base_GHCziPtr_Ptr_con_info"
-           "-Wl,-u,base_GHCziPtr_FunPtr_con_info"
-           "-Wl,-u,base_GHCziInt_I8zh_con_info"
-           "-Wl,-u,base_GHCziInt_I16zh_con_info"
-           "-Wl,-u,base_GHCziInt_I32zh_con_info"
-           "-Wl,-u,base_GHCziInt_I64zh_con_info"
-           "-Wl,-u,base_GHCziWord_W8zh_con_info"
-           "-Wl,-u,base_GHCziWord_W16zh_con_info"
-           "-Wl,-u,base_GHCziWord_W32zh_con_info"
-           "-Wl,-u,base_GHCziWord_W64zh_con_info"
-           "-Wl,-u,base_GHCziStable_StablePtr_con_info"
-           "-Wl,-u,hs_atomic_add8"
-           "-Wl,-u,hs_atomic_add16"
-           "-Wl,-u,hs_atomic_add32"
-           "-Wl,-u,hs_atomic_sub8"
-           "-Wl,-u,hs_atomic_sub16"
-           "-Wl,-u,hs_atomic_sub32"
-           "-Wl,-u,hs_atomic_and8"
-           "-Wl,-u,hs_atomic_and16"
-           "-Wl,-u,hs_atomic_and32"
-           "-Wl,-u,hs_atomic_nand8"
-           "-Wl,-u,hs_atomic_nand16"
-           "-Wl,-u,hs_atomic_nand32"
-           "-Wl,-u,hs_atomic_or8"
-           "-Wl,-u,hs_atomic_or16"
-           "-Wl,-u,hs_atomic_or32"
-           "-Wl,-u,hs_atomic_xor8"
-           "-Wl,-u,hs_atomic_xor16"
-           "-Wl,-u,hs_atomic_xor32"
-           "-Wl,-u,hs_cmpxchg8"
-           "-Wl,-u,hs_cmpxchg16"
-           "-Wl,-u,hs_cmpxchg32"
-           "-Wl,-u,hs_cmpxchg64"
-           "-Wl,-u,hs_xchg8"
-           "-Wl,-u,hs_xchg16"
-           "-Wl,-u,hs_xchg32"
-           "-Wl,-u,hs_xchg64"
-           "-Wl,-u,hs_atomicread8"
-           "-Wl,-u,hs_atomicread16"
-           "-Wl,-u,hs_atomicread32"
-           "-Wl,-u,hs_atomicwrite8"
-           "-Wl,-u,hs_atomicwrite16"
-           "-Wl,-u,hs_atomicwrite32"
-           "-Wl,-u,base_GHCziStackziCloneStack_StackSnapshot_closure"
-
-        if flag(find-ptr)
-          -- This symbol is useful in gdb, but not referred to anywhere,
-          -- so we need to force it to be included in the binary.
-          ld-options: "-Wl,-u,findPtr"
-
-      if os(windows)
-        if flag(leading-underscore)
-          ld-options:
-             "-Wl,-u,_base_GHCziEventziWindows_processRemoteCompletion_closure"
-        else
-          ld-options:
-             "-Wl,-u,base_GHCziEventziWindows_processRemoteCompletion_closure"
 
       if os(osx)
         ld-options: "-Wl,-search_paths_first"



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/94a51526cc898d8d510e254f373db835d8cafc94...e5be71a2f99891e63afb203ed1f14303c3815ea5

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/94a51526cc898d8d510e254f373db835d8cafc94...e5be71a2f99891e63afb203ed1f14303c3815ea5
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230102/814feeed/attachment-0001.html>


More information about the ghc-commits mailing list