summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2022-12-30 12:38:25 -0500
committerJohn Ericson <John.Ericson@Obsidian.Systems>2023-01-01 12:49:18 -0500
commitdde92d14a0dc64a1d3025ab97773bed72727b006 (patch)
treec2dd9d66907546e0987ba8015a25d2474d81ce46
parentd0a146a5914f62414b1b09d88741bf0da7f277d9 (diff)
downloadhaskell-dde92d14a0dc64a1d3025ab97773bed72727b006.tar.gz
rts: Move external symbols logic to the configure script
This is much more terse because we are programatically handling the leading underscore.
-rw-r--r--rts/.gitignore1
-rw-r--r--rts/configure.ac29
-rw-r--r--rts/external-symbols.list.in103
-rw-r--r--rts/rts.buildinfo.in3
-rw-r--r--rts/rts.cabal.in197
5 files changed, 139 insertions, 194 deletions
diff --git a/rts/.gitignore b/rts/.gitignore
index 662c3c974c..657baa7c17 100644
--- a/rts/.gitignore
+++ b/rts/.gitignore
@@ -18,6 +18,7 @@
/config.status
/configure
+/external-symbols.list
/ghcautoconf.h.autoconf.in
/ghcautoconf.h.autoconf
/include/ghcautoconf.h
diff --git a/rts/configure.ac b/rts/configure.ac
index fa90a0e114..7c64d491e1 100644
--- a/rts/configure.ac
+++ b/rts/configure.ac
@@ -55,3 +55,32 @@ 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 ######################################################################
+
+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
diff --git a/rts/external-symbols.list.in b/rts/external-symbols.list.in
new file mode 100644
index 0000000000..deb04f956f
--- /dev/null
+++ b/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
diff --git a/rts/rts.buildinfo.in b/rts/rts.buildinfo.in
new file mode 100644
index 0000000000..07540357c8
--- /dev/null
+++ b/rts/rts.buildinfo.in
@@ -0,0 +1,3 @@
+-- External symbols referenced by the RTS
+ld-options:
+#include "external-symbols.list"
diff --git a/rts/rts.cabal.in b/rts/rts.cabal.in
index 5213a0fecd..98ca808917 100644
--- a/rts/rts.cabal.in
+++ b/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
@@ -291,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"