[Git][ghc/ghc][wip/T26166] 6 commits: RtsIfaceStub must be imported by all hsc2hs

Rodrigo Mesquita pushed to branch wip/T26166 at Glasgow Haskell Compiler / GHC Commits: 0328e335 by Rodrigo Mesquita at 2025-10-09T11:13:50+01:00 RtsIfaceStub must be imported by all hsc2hs Bump hsc2hs submodule - - - - - d7e5b3bf by Rodrigo Mesquita at 2025-10-09T11:14:21+01:00 Declare all undefined symbols of the RTS to link against - - - - - a1c87ac0 by Rodrigo Mesquita at 2025-10-09T11:15:27+01:00 Revert "Declare all undefined symbols of the RTS to link against" This reverts commit d7e5b3bff81a8495ca8ecf8aa1278c3947003ea8. This was not necessary after all because -undefined dynamic_lookup turns out still works as long as the undefined symbols are not given with -u...!!!!! - - - - - e460125b by Rodrigo Mesquita at 2025-10-09T11:16:14+01:00 Revert "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.... :(" This reverts commit 8155efe9a802a5414a9b6c407dc21bfa365e475b. No longer necessary since the hsc2hs bump - - - - - 15fa314d by Rodrigo Mesquita at 2025-10-09T11:16:42+01:00 Re-add pragma once - - - - - cff2ab64 by Rodrigo Mesquita at 2025-10-09T11:20:02+01:00 Keep -undefined dynamic_lookup when linking shared libs bc as long as there are no -u flags, undefined dynamic lookup still works. See https://gitlab.haskell.org/ghc/ghc/-/issues/26166#note_641256 - - - - - 26 changed files: - compiler/GHC/Linker/Dynamic.hs - libraries/base/src/System/CPUTime.hsc - libraries/ghc-internal/ghc-internal.cabal.in - 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 - utils/hsc2hs Changes: ===================================== compiler/GHC/Linker/Dynamic.hs ===================================== @@ -144,6 +144,12 @@ linkDynLib logger tmpfs dflags0 unit_env o_files dep_packages -- About the options used for Darwin: -- -dynamiclib -- Apple's way of saying -shared + -- -undefined dynamic_lookup: + -- Without these options, we'd have to specify the correct + -- dependencies for each of the dylibs. Note that we could + -- (and should) do without this for all libraries except + -- the RTS; all we need to do is to pass the correct + -- HSfoo_dyn.dylib files to the link command. -- -single_module -- Build the dynamic library as a single "module", i.e. no -- dynamic binding nonsense when referring to symbols from @@ -176,6 +182,9 @@ linkDynLib logger tmpfs dflags0 unit_env o_files dep_packages , FileOption "" output_fn ] ++ map Option o_files + ++ [ Option "-undefined", + Option "dynamic_lookup" + ] ++ (if toolSettings_ldSupportsSingleModule (toolSettings dflags) then [ Option "-single_module" ] else [ ]) ===================================== libraries/base/src/System/CPUTime.hsc ===================================== @@ -17,6 +17,7 @@ #include "HsFFI.h" #include "HsBaseConfig.h" +#include "RtsIfaceStub.h" -- For various _POSIX_* #defines #if defined(HAVE_UNISTD_H) ===================================== libraries/ghc-internal/ghc-internal.cabal.in ===================================== @@ -486,6 +486,7 @@ Library RtsIfaceStub.h install-includes: HsBase.h + RtsIfaceStub.h consUtils.h if flag(need-atomic) ===================================== libraries/ghc-internal/include/RtsIfaceSymbols.h ===================================== @@ -65,4 +65,3 @@ 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,8 +15,6 @@ 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,7 +19,6 @@ ----------------------------------------------------------------------------- module GHC.Internal.ConsoleHandler -#include "RtsIfaceStub.h" #if !defined(mingw32_HOST_OS) where ===================================== libraries/ghc-internal/src/GHC/Internal/Event/EPoll.hsc ===================================== @@ -24,7 +24,6 @@ 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,7 +16,6 @@ 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,7 +11,6 @@ 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,7 +21,6 @@ #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,7 +7,6 @@ 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,7 +6,6 @@ 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,7 +10,6 @@ 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,7 +10,6 @@ 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,7 +8,6 @@ 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,7 +8,6 @@ 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,7 +8,6 @@ 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,7 +5,6 @@ {-# LANGUAGE NoImplicitPrelude #-} #include "Rts.h" -#include "RtsIfaceStub.h" module GHC.Internal.InfoProv.Types ( InfoProv(..) ===================================== libraries/ghc-internal/src/GHC/Internal/RTS/Flags.hsc ===================================== @@ -52,7 +52,6 @@ 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,8 +7,6 @@ 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,7 +47,6 @@ 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,7 +14,6 @@ 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,7 +45,6 @@ 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,7 +74,6 @@ 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,9 +104,6 @@ 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. ===================================== utils/hsc2hs ===================================== @@ -1 +1 @@ -Subproject commit fe3990b9f35000427b016a79330d9f195587cad8 +Subproject commit 3863f81b72d1c5877505e840fd203193c50d2e0f View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/a025452f36c3aa2e77f64c25888cc3c... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/a025452f36c3aa2e77f64c25888cc3c... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Rodrigo Mesquita (@alt-romes)