diff options
author | Ben Gamari <ben@smart-cactus.org> | 2021-12-18 19:29:13 -0500 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-01-15 03:41:16 -0500 |
commit | e2b60be8472ad5b7b6ef2b265b4a06d1b2b67c7d (patch) | |
tree | a01e4825b950e2dd910a1b47a3dfe647633e1808 | |
parent | 52a4f5ab44a7d4c89189b9132a5560cb85d18714 (diff) | |
download | haskell-e2b60be8472ad5b7b6ef2b265b4a06d1b2b67c7d.tar.gz |
rts: Consolidate RtsSymbols from libc
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.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/rts/RtsSymbols.c b/rts/RtsSymbols.c index f76573e3ae..894e9ff305 100644 --- a/rts/RtsSymbols.c +++ b/rts/RtsSymbols.c @@ -72,7 +72,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 @@ -166,7 +165,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)) \ @@ -1071,6 +1069,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 @@ -1108,6 +1111,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 |