[Git][ghc/ghc][wip/rts-configure-symbols] rts: Move most external symbols logic to the configure script
John Ericson (@Ericson2314)
gitlab at gitlab.haskell.org
Thu Jan 19 19:29:58 UTC 2023
John Ericson pushed to branch wip/rts-configure-symbols at Glasgow Haskell Compiler / GHC
Commits:
5aa44791 by John Ericson at 2023-01-19T13:49:52-05:00
rts: Move most external symbols logic to the configure script
This is much more terse because we are programmatically handling the
leading underscore.
`findPtr` however is still handled in the Cabal file because we need a
newer Cabal to pass flags to the configure script automatically.
Co-Authored-By: Ben Gamari <ben at well-typed.com>
- - - - -
5 changed files:
- rts/.gitignore
- rts/configure.ac
- + rts/external-symbols.list.in
- + rts/rts.buildinfo.in
- rts/rts.cabal.in
Changes:
=====================================
rts/.gitignore
=====================================
@@ -18,6 +18,7 @@
/config.status
/configure
+/external-symbols.list
/ghcautoconf.h.autoconf.in
/ghcautoconf.h.autoconf
/include/ghcautoconf.h
=====================================
rts/configure.ac
=====================================
@@ -55,3 +55,34 @@ cat $srcdir/../mk/config.h ghcautoconf.h.autoconf | sed \
>> include/ghcautoconf.h
echo "#endif /* __GHCAUTOCONF_H__ */" >> include/ghcautoconf.h
]
+
+dnl ######################################################################
+dnl Generate external symbol flags (-Wl,-u...)
+dnl ######################################################################
+
+dnl See Note [Undefined symbols in the RTS]
+
+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,96 @@
+#include "ghcautoconf.h"
+
+#if 0
+See Note [Undefined symbols in the RTS]
+#endif
+
+#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
+
+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/rts.buildinfo.in
=====================================
@@ -0,0 +1,3 @@
+-- External symbols referenced by the RTS
+ld-options:
+#include "external-symbols.list"
=====================================
rts/rts.cabal.in
=====================================
@@ -14,9 +14,12 @@ 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
@@ -293,201 +296,22 @@ library
stg/Types.h
-- See Note [Undefined symbols in the RTS]
- 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"
+ --
+ -- We should handle this symbol with the others in the configure script
+ -- once we are using Cabal containing
+ -- https://github.com/haskell/cabal/pull/8565 /
+ -- 30f8a46008d164b5c4c6ce0b4453eb93eb5ef46c.
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"
-- See Note [fd_set_overflow]
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/5aa4479131d46f25695cdbcfcb873db1e482e37c
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/5aa4479131d46f25695cdbcfcb873db1e482e37c
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/20230119/752694a9/attachment-0001.html>
More information about the ghc-commits
mailing list