Rodrigo Mesquita pushed to branch wip/romes/T26166 at Glasgow Haskell Compiler / GHC
Commits:
fa3d52d7 by Rodrigo Mesquita at 2025-09-29T22:37:33+01:00
It would still fail to compile .hsc files because of the ld-options... But you can just include the RTS stub in all of those too.... :(
- - - - -
23 changed files:
- libraries/ghc-internal/include/RtsIfaceStub.h
- libraries/ghc-internal/include/RtsIfaceSymbols.h
- libraries/ghc-internal/src/GHC/Internal/Clock.hsc
- libraries/ghc-internal/src/GHC/Internal/ConsoleHandler.hsc
- libraries/ghc-internal/src/GHC/Internal/Event/EPoll.hsc
- libraries/ghc-internal/src/GHC/Internal/Event/KQueue.hsc
- libraries/ghc-internal/src/GHC/Internal/Event/Poll.hsc
- libraries/ghc-internal/src/GHC/Internal/ExecutionStack/Internal.hsc
- libraries/ghc-internal/src/GHC/Internal/Heap/Constants.hsc
- libraries/ghc-internal/src/GHC/Internal/Heap/InfoTable.hsc
- libraries/ghc-internal/src/GHC/Internal/Heap/InfoTable/Types.hsc
- libraries/ghc-internal/src/GHC/Internal/Heap/InfoTableProf.hsc
- libraries/ghc-internal/src/GHC/Internal/IO/Handle/Lock/Flock.hsc
- libraries/ghc-internal/src/GHC/Internal/IO/Handle/Lock/LinuxOFD.hsc
- libraries/ghc-internal/src/GHC/Internal/IO/Handle/Lock/Windows.hsc
- libraries/ghc-internal/src/GHC/Internal/InfoProv/Types.hsc
- libraries/ghc-internal/src/GHC/Internal/RTS/Flags.hsc
- libraries/ghc-internal/src/GHC/Internal/RTS/Flags/Test.hsc
- libraries/ghc-internal/src/GHC/Internal/Stack/CCS.hsc
- libraries/ghc-internal/src/GHC/Internal/Stack/Constants.hsc
- libraries/ghc-internal/src/GHC/Internal/Stats.hsc
- libraries/ghc-internal/src/GHC/Internal/System/Environment/Blank.hsc
- libraries/ghc-internal/src/GHC/Internal/System/Environment/ExecutablePath.hsc
Changes:
=====================================
libraries/ghc-internal/include/RtsIfaceStub.h
=====================================
@@ -1,3 +1,5 @@
+#pragma once
+
#include
void __attribute__((weak)) init_ghc_hs_iface(void) {
fprintf(stderr, "init_ghc_hs_iface: weak constructor stub for init_ghc_hs_iface was not overriden by the actual constructor. Obviously wrong! This stub should never make it into the final object except for in the Cabal checkForeignDeps configuration checks!");
=====================================
libraries/ghc-internal/include/RtsIfaceSymbols.h
=====================================
@@ -65,3 +65,4 @@ UNDEF_CLOSURE(GHCziInternalziWasmziPrimziImports, raiseJSException_closure)
UNDEF_CLOSURE(GHCziInternalziWasmziPrim, JSVal_con_info)
UNDEF_CLOSURE(GHCziInternalziWasmziPrim, threadDelay_closure)
#endif
+
=====================================
libraries/ghc-internal/src/GHC/Internal/Clock.hsc
=====================================
@@ -15,6 +15,8 @@ import GHC.Internal.Float () -- for Num Double instance
import GHC.Internal.Num
#endif
+#include "RtsIfaceStub.h"
+
-- | Return monotonic time in seconds, since some unspecified starting point
--
-- @since base-4.11.0.0
=====================================
libraries/ghc-internal/src/GHC/Internal/ConsoleHandler.hsc
=====================================
@@ -19,6 +19,7 @@
-----------------------------------------------------------------------------
module GHC.Internal.ConsoleHandler
+#include "RtsIfaceStub.h"
#if !defined(mingw32_HOST_OS)
where
=====================================
libraries/ghc-internal/src/GHC/Internal/Event/EPoll.hsc
=====================================
@@ -24,6 +24,7 @@ module GHC.Internal.Event.EPoll
import qualified GHC.Internal.Event.Internal as E
#include "EventConfig.h"
+#include "RtsIfaceStub.h"
#if !defined(HAVE_EPOLL)
import GHC.Internal.Base
=====================================
libraries/ghc-internal/src/GHC/Internal/Event/KQueue.hsc
=====================================
@@ -16,6 +16,7 @@ module GHC.Internal.Event.KQueue
import qualified GHC.Internal.Event.Internal as E
#include "EventConfig.h"
+#include "RtsIfaceStub.h"
#if !defined(HAVE_KQUEUE)
import GHC.Internal.Base
=====================================
libraries/ghc-internal/src/GHC/Internal/Event/Poll.hsc
=====================================
@@ -11,6 +11,7 @@ module GHC.Internal.Event.Poll
) where
#include "EventConfig.h"
+#include "RtsIfaceStub.h"
#if !defined(HAVE_POLL_H)
import GHC.Internal.Base
=====================================
libraries/ghc-internal/src/GHC/Internal/ExecutionStack/Internal.hsc
=====================================
@@ -21,6 +21,7 @@
#include "HsFFI.h"
#include "HsBaseConfig.h"
#include "rts/Libdw.h"
+#include "RtsIfaceStub.h"
{-# LANGUAGE MultiWayIf #-}
=====================================
libraries/ghc-internal/src/GHC/Internal/Heap/Constants.hsc
=====================================
@@ -7,6 +7,7 @@ module GHC.Internal.Heap.Constants
) where
#include "MachDeps.h"
+#include "RtsIfaceStub.h"
import GHC.Internal.Data.Bits
import GHC.Internal.Int
=====================================
libraries/ghc-internal/src/GHC/Internal/Heap/InfoTable.hsc
=====================================
@@ -6,6 +6,7 @@ module GHC.Internal.Heap.InfoTable
) where
#include "Rts.h"
+#include "RtsIfaceStub.h"
import GHC.Internal.Base
import GHC.Internal.Real
=====================================
libraries/ghc-internal/src/GHC/Internal/Heap/InfoTable/Types.hsc
=====================================
@@ -10,6 +10,7 @@ module GHC.Internal.Heap.InfoTable.Types
) where
#include "Rts.h"
+#include "RtsIfaceStub.h"
import GHC.Internal.Base
import GHC.Internal.Generics
=====================================
libraries/ghc-internal/src/GHC/Internal/Heap/InfoTableProf.hsc
=====================================
@@ -10,6 +10,7 @@ module GHC.Internal.Heap.InfoTableProf
-- representation of StgInfoTable_ when hsc2hs runs.
#define PROFILING
#include "Rts.h"
+#include "RtsIfaceStub.h"
import GHC.Internal.Base
import GHC.Internal.Real
=====================================
libraries/ghc-internal/src/GHC/Internal/IO/Handle/Lock/Flock.hsc
=====================================
@@ -8,6 +8,7 @@
module GHC.Internal.IO.Handle.Lock.Flock where
#include "HsBaseConfig.h"
+#include "RtsIfaceStub.h"
#if !HAVE_FLOCK
-- See W1 of Note [Tracking dependencies on primitives] in GHC.Internal.Base
=====================================
libraries/ghc-internal/src/GHC/Internal/IO/Handle/Lock/LinuxOFD.hsc
=====================================
@@ -8,6 +8,7 @@
module GHC.Internal.IO.Handle.Lock.LinuxOFD where
#include "HsBaseConfig.h"
+#include "RtsIfaceStub.h"
#if !HAVE_OFD_LOCKING
-- See W1 of Note [Tracking dependencies on primitives] in GHC.Internal.Base
=====================================
libraries/ghc-internal/src/GHC/Internal/IO/Handle/Lock/Windows.hsc
=====================================
@@ -8,6 +8,7 @@
module GHC.Internal.IO.Handle.Lock.Windows where
#include "HsBaseConfig.h"
+#include "RtsIfaceStub.h"
#if !defined(mingw32_HOST_OS)
-- See W1 of Note [Tracking dependencies on primitives] in GHC.Internal.Base
=====================================
libraries/ghc-internal/src/GHC/Internal/InfoProv/Types.hsc
=====================================
@@ -5,6 +5,7 @@
{-# LANGUAGE NoImplicitPrelude #-}
#include "Rts.h"
+#include "RtsIfaceStub.h"
module GHC.Internal.InfoProv.Types
( InfoProv(..)
=====================================
libraries/ghc-internal/src/GHC/Internal/RTS/Flags.hsc
=====================================
@@ -52,6 +52,7 @@ module GHC.Internal.RTS.Flags
) where
#include "Rts.h"
+#include "RtsIfaceStub.h"
#include "rts/Flags.h"
import GHC.Internal.Data.Functor ((<$>))
=====================================
libraries/ghc-internal/src/GHC/Internal/RTS/Flags/Test.hsc
=====================================
@@ -7,6 +7,8 @@ module GHC.Internal.RTS.Flags.Test
)
where
+#include "RtsIfaceStub.h"
+
import GHC.Internal.Base
#if !defined(javascript_HOST_ARCH)
=====================================
libraries/ghc-internal/src/GHC/Internal/Stack/CCS.hsc
=====================================
@@ -47,6 +47,7 @@ import GHC.Internal.List ( concatMap, reverse )
#define PROFILING
#include "Rts.h"
+#include "RtsIfaceStub.h"
-- | A cost-centre stack from GHC's cost-center profiler.
data CostCentreStack
=====================================
libraries/ghc-internal/src/GHC/Internal/Stack/Constants.hsc
=====================================
@@ -14,6 +14,7 @@ import GHC.Internal.Real
#undef MBLOCK_SIZE
#undef BLOCKS_PER_MBLOCK
#include "DerivedConstants.h"
+#include "RtsIfaceStub.h"
newtype ByteOffset = ByteOffset { offsetInBytes :: Int }
deriving newtype (Eq, Show, Integral, Real, Num, Enum, Ord)
=====================================
libraries/ghc-internal/src/GHC/Internal/Stats.hsc
=====================================
@@ -45,6 +45,7 @@ import GHC.Internal.Foreign.Storable
import GHC.Internal.Foreign.Ptr
#include "Rts.h"
+#include "RtsIfaceStub.h"
foreign import ccall "getRTSStats" getRTSStats_ :: Ptr () -> IO ()
=====================================
libraries/ghc-internal/src/GHC/Internal/System/Environment/Blank.hsc
=====================================
@@ -74,6 +74,7 @@ import qualified GHC.Internal.System.Environment as Environment
#endif
#include "HsBaseConfig.h"
+#include "RtsIfaceStub.h"
throwInvalidArgument :: String -> IO a
throwInvalidArgument from =
=====================================
libraries/ghc-internal/src/GHC/Internal/System/Environment/ExecutablePath.hsc
=====================================
@@ -104,6 +104,9 @@ import GHC.Internal.Foreign.Storable
import GHC.Internal.System.Posix.Internals
#endif
+#include "RtsIfaceStub.h"
+
+
-- The exported function is defined outside any if-guard to make sure
-- every OS implements it with the same type.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/fa3d52d71e2f919975b6a1ceb1769c39...
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/fa3d52d71e2f919975b6a1ceb1769c39...
You're receiving this email because of your account on gitlab.haskell.org.