summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2021-12-18 19:29:13 -0500
committerBen Gamari <ben@smart-cactus.org>2021-12-20 12:28:45 -0500
commit7a0dcdceab882782cdbe5ce1f84269bb16909acb (patch)
treea0b84bc20218ee300da71b0d726d89173bf83f59
parent887d8b4c409c06257a63751e4e84c86ddf5cc874 (diff)
downloadhaskell-wip/environ.tar.gz
rts: Consolidate RtsSymbols from libcwip/environ
Previously (9ebda74ec5331911881d734b21fbb31c00a0a22f) `environ` was added to `RtsSymbols` to ensure that environment was correctly propagated when statically linking. However, this introduced #20577 since platforms are inconsistent in whether they provide a prototype for `environ`. I fixed this by providing a prototype but while doing so dropped symbol-table entry, presumably thinking that it was redundant due to the entry in the mingw-specific table. Here I reintroduce the symbol table entry for `environ` and move libc symbols shared by Windows and Linux into a new macro, `RTS_LIBC_SYMBOLS`, avoiding this potential confusion.
-rw-r--r--rts/RtsSymbols.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/rts/RtsSymbols.c b/rts/RtsSymbols.c
index 7d7b8422c2..ffc6888578 100644
--- a/rts/RtsSymbols.c
+++ b/rts/RtsSymbols.c
@@ -65,7 +65,6 @@ extern char **environ;
SymI_HasProto(signal_handlers) \
SymI_HasProto(stg_sig_install) \
SymI_HasProto(rtsTimerSignal) \
- SymI_HasProto_redirect(atexit, atexit, STRENGTH_STRONG) /* See Note [Strong symbols] */ \
SymI_NeedsDataProto(nocldstop)
#endif
@@ -159,7 +158,6 @@ extern char **environ;
SymI_HasProto(stg_asyncDoProczh) \
SymI_HasProto(rts_InstallConsoleEvent) \
SymI_HasProto(rts_ConsoleHandlerDone) \
- SymI_HasProto(atexit) \
RTS_WIN32_ONLY(SymI_NeedsProto(___chkstk_ms)) \
RTS_WIN64_ONLY(SymI_NeedsProto(___chkstk_ms)) \
RTS_WIN32_ONLY(SymI_HasProto(_imp___environ)) \
@@ -1064,6 +1062,11 @@ extern char **environ;
#define RTS_LIBGCC_SYMBOLS
#endif
+// Symbols defined by libc
+#define RTS_LIBC_SYMBOLS \
+ SymI_HasProto_redirect(atexit, atexit, STRENGTH_STRONG) /* See Note [Strong symbols] */ \
+ SymI_HasProto(environ)
+
#if !defined(DYNAMIC) && defined(linux_HOST_OS)
// we need these for static musl builds. However when
// linking shared objects (DLLs) this will fail, hence
@@ -1101,6 +1104,7 @@ RTS_POSIX_ONLY_SYMBOLS
RTS_MINGW_ONLY_SYMBOLS
RTS_DARWIN_ONLY_SYMBOLS
RTS_OPENBSD_ONLY_SYMBOLS
+RTS_LIBC_SYMBOLS
RTS_LIBGCC_SYMBOLS
RTS_FINI_ARRAY_SYMBOLS
RTS_LIBFFI_SYMBOLS