summaryrefslogtreecommitdiff
path: root/rts
diff options
context:
space:
mode:
authorRyan Scott <ryan.gl.scott@gmail.com>2022-09-13 06:36:18 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2023-02-03 14:07:30 -0500
commitde1d15127ac3f41ac3044215b0ea3398a36edc89 (patch)
tree22fb2d1aeef3872e2624fb2dce40f3b8d0db2548 /rts
parent8feb93013cf6f093e025c9e9a3213ae1fa0f73a0 (diff)
downloadhaskell-de1d15127ac3f41ac3044215b0ea3398a36edc89.tar.gz
Windows: Remove mingwex dependency
The clang based toolchain uses ucrt as its math library and so mingwex is no longer needed. In fact using mingwex will cause incompatibilities as the default routines in both have differing ULPs and string formatting modifiers. ``` $ LIBRARY_PATH=/mingw64/lib ghc/_build/stage1/bin/ghc Bug.hs -fforce-recomp && ./Bug.exe [1 of 2] Compiling Main ( Bug.hs, Bug.o ) ghc.exe: | C:\Users\winferno\Software\ghc\_build\stage1\lib\x86_64-windows-ghc-9.5.20220908\base-4.17.0.0\libHSbase-4.17.0.0.a: unknown symbol `__imp___p__environ' ghc.exe: | C:\Users\winferno\Software\ghc\_build\stage1\lib\x86_64-windows-ghc-9.5.20220908\base-4.17.0.0\libHSbase-4.17.0.0.a: unknown symbol `__hscore_get_errno' ghc.exe: | C:\Users\winferno\Software\ghc\_build\stage1\lib\x86_64-windows-ghc-9.5.20220908\base-4.17.0.0\libHSbase-4.17.0.0.a: unknown symbol `base_ForeignziCziError_errnoToIOError_info' ghc.exe: | C:\Users\winferno\Software\ghc\_build\stage1\lib\x86_64-windows-ghc-9.5.20220908\base-4.17.0.0\libHSbase-4.17.0.0.a: unknown symbol `base_GHCziWindows_failIf2_closure' ghc.exe: | C:\Users\winferno\Software\ghc\_build\stage1\lib\x86_64-windows-ghc-9.5.20220908\base-4.17.0.0\libHSbase-4.17.0.0.a: unknown symbol `base_GHCziIOziEncodingziCodePageziAPI_mkCodePageEncoding_info' ghc.exe: | C:\Users\winferno\Software\ghc\_build\stage1\lib\x86_64-windows-ghc-9.5.20220908\base-4.17.0.0\libHSbase-4.17.0.0.a: unknown symbol `base_GHCziIOziEncodingziCodePage_currentCodePage_closure' ghc.exe: | C:\Users\winferno\Software\ghc\_build\stage1\lib\x86_64-windows-ghc-9.5.20220908\base-4.17.0.0\libHSbase-4.17.0.0.a: unknown symbol `base_GHCziIOziEncoding_getForeignEncoding_closure' ghc.exe: | C:\Users\winferno\Software\ghc\_build\stage1\lib\x86_64-windows-ghc-9.5.20220908\base-4.17.0.0\libHSbase-4.17.0.0.a: unknown symbol `base_ForeignziCziString_withCStringLen1_info' ghc.exe: | C:\Users\winferno\Software\ghc\_build\stage1\lib\x86_64-windows-ghc-9.5.20220908\base-4.17.0.0\libHSbase-4.17.0.0.a: unknown symbol `base_GHCziIOziHandleziInternals_zdwflushCharReadBuffer_info' ghc.exe: | C:\Users\winferno\Software\ghc\_build\stage1\lib\x86_64-windows-ghc-9.5.20220908\base-4.17.0.0\libHSbase-4.17.0.0.a: unknown symbol `base_GHCziIOziHandleziText_hGetBuf1_info' ghc.exe: | C:\Users\winferno\Software\ghc\_build\stage1\lib\x86_64-windows-ghc-9.5.20220908\base-4.17.0.0\libHSbase-4.17.0.0.a: unknown symbol `base_GHCziFingerprint_fingerprintString_closure' ghc.exe: | C:\Users\winferno\Software\ghc\_build\stage1\lib\x86_64-windows-ghc-9.5.20220908\base-4.17.0.0\libHSbase-4.17.0.0.a: unknown symbol `base_DataziTypeableziInternal_mkTrCon_closure' ghc.exe: | C:\Users\winferno\Software\ghc\_build\stage1\lib\x86_64-windows-ghc-9.5.20220908\base-4.17.0.0\libHSbase-4.17.0.0.a: unknown symbol `base_GHCziException_errorCallWithCallStackException_closure' ghc.exe: | C:\Users\winferno\Software\ghc\_build\stage1\lib\x86_64-windows-ghc-9.5.20220908\base-4.17.0.0\libHSbase-4.17.0.0.a: unknown symbol `base_GHCziErr_error_info' ghc.exe: | C:\Users\winferno\Software\ghc\_build\stage1\lib\x86_64-windows-ghc-9.5.20220908\template-haskell-2.19.0.0\libHStemplate-haskell-2.19.0.0.a: unknown symbol `base_DataziMaybe_fromJust1_info' ghc.exe: | C:\Users\winferno\Software\ghc\_build\stage1\lib\x86_64-windows-ghc-9.5.20220908\template-haskell-2.19.0.0\libHStemplate-haskell-2.19.0.0.a: unknown symbol `templatezmhaskell_LanguageziHaskellziTHziSyntax_IntPrimL_con_info' ghc.exe: ^^ Could not load 'templatezmhaskell_LanguageziHaskellziTHziLibziInternal_stringL_closure', dependency unresolved. See top entry above. <no location info>: error: GHC.ByteCode.Linker.lookupCE During interactive linking, GHCi couldn't find the following symbol: templatezmhaskell_LanguageziHaskellziTHziLibziInternal_stringL_closure This may be due to you not asking GHCi to load extra object files, archives or DLLs needed by your current session. Restart GHCi, specifying the missing library using the -L/path/to/object/dir and -lmissinglibname flags, or simply by naming the relevant files on the GHCi command line. Alternatively, this link failure might indicate a bug in GHCi. If you suspect the latter, please report this as a GHC bug: https://www.haskell.org/ghc/reportabug ```
Diffstat (limited to 'rts')
-rw-r--r--rts/Linker.c6
-rw-r--r--rts/RtsSymbols.c149
-rw-r--r--rts/linker/PEi386.c16
-rw-r--r--rts/rts.cabal.in5
4 files changed, 5 insertions, 171 deletions
diff --git a/rts/Linker.c b/rts/Linker.c
index 6300240c48..af91a098be 100644
--- a/rts/Linker.c
+++ b/rts/Linker.c
@@ -135,7 +135,8 @@ extern void iconv();
This is to enable lazy loading of symbols. Eager loading is problematic
as it means that all symbols must be available, even those which we will
never use. This is especially painful on Windows, where the number of
- libraries required to link things like mingwex grows to be quite high.
+ libraries required to link things like mingwex (TODO: We no longer depend
+ on mingwex, so think of a different example here) grows to be quite high.
We proceed through these stages as follows,
@@ -193,7 +194,8 @@ extern void iconv();
1) Dependency chains, if A.o required a .o in libB but A.o isn't required to link
then we don't need to load libB. This means the dependency chain for libraries
- such as mingw32 and mingwex can be broken down.
+ such as mingw32 and mingwex (TODO: We no longer depend on mingwex, so think of
+ a different example here) can be broken down.
2) The number of duplicate symbols, since now only symbols that are
true duplicates will display the error.
diff --git a/rts/RtsSymbols.c b/rts/RtsSymbols.c
index 357ea4ddce..a95a1b1231 100644
--- a/rts/RtsSymbols.c
+++ b/rts/RtsSymbols.c
@@ -113,26 +113,6 @@ extern char **environ;
* by the RtsSymbols entry. To avoid this we introduce a horrible special case
* in `ghciInsertSymbolTable`, ensure that `atexit` is never overridden.
*/
-/*
- * Note [Symbols for MinGW's printf]
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- * The printf offered by Microsoft's libc implementation, msvcrt, is quite
- * incomplete, lacking support for even %ull. Consequently mingw-w64 offers its
- * own implementation which we enable. However, to be thread-safe the
- * implementation uses _lock_file. This would be fine except msvcrt.dll doesn't
- * export _lock_file, only numbered versions do (e.g. msvcrt90.dll).
- *
- * To work around this mingw-w64 packages a static archive of msvcrt which
- * includes their own implementation of _lock_file. However, this means that
- * the archive contains things which the dynamic library does not; consequently
- * we need to ensure that the runtime linker provides this symbol.
- *
- * It's all just so terrible.
- *
- * See also:
- * https://sourceforge.net/p/mingw-w64/wiki2/gnu%20printf/
- * https://sourceforge.net/p/mingw-w64/discussion/723797/thread/55520785/
- */
/* Note [_iob_func symbol]
* ~~~~~~~~~~~~~~~~~~~~~~~
* Microsoft in VS2013 to VS2015 transition made a backwards incompatible change
@@ -170,10 +150,6 @@ extern char **environ;
SymI_NeedsProto(__mingw_module_is_dll) \
RTS_WIN32_ONLY(SymI_NeedsProto(___chkstk_ms)) \
RTS_WIN64_ONLY(SymI_NeedsProto(___chkstk_ms)) \
- RTS_WIN64_ONLY(SymI_HasProto(_errno)) \
- /* see Note [Symbols for MinGW's printf] */ \
- SymI_HasProto(_lock_file) \
- SymI_HasProto(_unlock_file) \
SymI_HasProto(__mingw_vsnwprintf) \
/* ^^ Need to figure out why this is needed. */ \
/* See Note [_iob_func symbol] */ \
@@ -185,120 +161,8 @@ extern char **environ;
/* ^^ Need to figure out why this is needed. */ \
SymI_HasProto(__mingw_vfprintf) \
/* ^^ Need to figure out why this is needed. */
-
-#define RTS_MINGW_COMPAT_SYMBOLS \
- SymI_HasProto_deprecated(access) \
- SymI_HasProto_deprecated(cabs) \
- SymI_HasProto_deprecated(cgets) \
- SymI_HasProto_deprecated(chdir) \
- SymI_HasProto_deprecated(chmod) \
- SymI_HasProto_deprecated(chsize) \
- SymI_HasProto_deprecated(close) \
- SymI_HasProto_deprecated(cprintf) \
- SymI_HasProto_deprecated(cputs) \
- SymI_HasProto_deprecated(creat) \
- SymI_HasProto_deprecated(cscanf) \
- SymI_HasProto_deprecated(cwait) \
- SymI_HasProto_deprecated(dup) \
- SymI_HasProto_deprecated(dup2) \
- SymI_HasProto_deprecated(ecvt) \
- SymI_HasProto_deprecated(eof) \
- SymI_HasProto_deprecated(execl) \
- SymI_HasProto_deprecated(execle) \
- SymI_HasProto_deprecated(execlp) \
- SymI_HasProto_deprecated(execlpe) \
- SymI_HasProto_deprecated(execv) \
- SymI_HasProto_deprecated(execve) \
- SymI_HasProto_deprecated(execvp) \
- SymI_HasProto_deprecated(execvpe) \
- SymI_HasProto_deprecated(fcloseall) \
- SymI_HasProto_deprecated(fcvt) \
- SymI_HasProto_deprecated(fdopen) \
- SymI_HasProto_deprecated(fgetchar) \
- SymI_HasProto_deprecated(filelength) \
- SymI_HasProto_deprecated(fileno) \
- SymI_HasProto_deprecated(flushall) \
- SymI_HasProto_deprecated(fputchar) \
- SymI_HasProto_deprecated(gcvt) \
- SymI_HasProto_deprecated(getch) \
- SymI_HasProto_deprecated(getche) \
- SymI_HasProto_deprecated(getcwd) \
- SymI_HasProto_deprecated(getpid) \
- SymI_HasProto_deprecated(getw) \
- SymI_HasProto_deprecated(hypot) \
- SymI_HasProto_deprecated(inp) \
- SymI_HasProto_deprecated(inpw) \
- SymI_HasProto_deprecated(isascii) \
- SymI_HasProto_deprecated(isatty) \
- SymI_HasProto_deprecated(iscsym) \
- SymI_HasProto_deprecated(iscsymf) \
- SymI_HasProto_deprecated(itoa) \
- SymI_HasProto_deprecated(j0) \
- SymI_HasProto_deprecated(j1) \
- SymI_HasProto_deprecated(jn) \
- SymI_HasProto_deprecated(kbhit) \
- SymI_HasProto_deprecated(lfind) \
- SymI_HasProto_deprecated(locking) \
- SymI_HasProto_deprecated(lsearch) \
- SymI_HasProto_deprecated(lseek) \
- SymI_HasProto_deprecated(ltoa) \
- SymI_HasProto_deprecated(memccpy) \
- SymI_HasProto_deprecated(memicmp) \
- SymI_HasProto_deprecated(mkdir) \
- SymI_HasProto_deprecated(mktemp) \
- SymI_HasProto_deprecated(open) \
- SymI_HasProto_deprecated(outp) \
- SymI_HasProto_deprecated(outpw) \
- SymI_HasProto_deprecated(putch) \
- SymI_HasProto_deprecated(putenv) \
- SymI_HasProto_deprecated(putw) \
- SymI_HasProto_deprecated(read) \
- SymI_HasProto_deprecated(rmdir) \
- SymI_HasProto_deprecated(rmtmp) \
- SymI_HasProto_deprecated(setmode) \
- SymI_HasProto_deprecated(sopen) \
- SymI_HasProto_deprecated(spawnl) \
- SymI_HasProto_deprecated(spawnle) \
- SymI_HasProto_deprecated(spawnlp) \
- SymI_HasProto_deprecated(spawnlpe) \
- SymI_HasProto_deprecated(spawnv) \
- SymI_HasProto_deprecated(spawnve) \
- SymI_HasProto_deprecated(spawnvp) \
- SymI_HasProto_deprecated(spawnvpe) \
- SymI_HasProto_deprecated(strcmpi) \
- SymI_HasProto_deprecated(strdup) \
- SymI_HasProto_deprecated(stricmp) \
- SymI_HasProto_deprecated(strlwr) \
- SymI_HasProto_deprecated(strnicmp) \
- SymI_HasProto_deprecated(strnset) \
- SymI_HasProto_deprecated(strrev) \
- SymI_HasProto_deprecated(strset) \
- SymI_HasProto_deprecated(strupr) \
- SymI_HasProto_deprecated(swab) \
- SymI_HasProto_deprecated(tell) \
- SymI_HasProto_deprecated(tempnam) \
- SymI_HasProto_deprecated(toascii) \
- SymI_HasProto_deprecated(tzset) \
- SymI_HasProto_deprecated(ultoa) \
- SymI_HasProto_deprecated(umask) \
- SymI_HasProto_deprecated(ungetch) \
- SymI_HasProto_deprecated(unlink) \
- SymI_HasProto_deprecated(wcsdup) \
- SymI_HasProto_deprecated(wcsicmp) \
- SymI_HasProto_deprecated(wcsicoll) \
- SymI_HasProto_deprecated(wcslwr) \
- SymI_HasProto_deprecated(wcsnicmp) \
- SymI_HasProto_deprecated(wcsnset) \
- SymI_HasProto_deprecated(wcsrev) \
- SymI_HasProto_deprecated(wcsset) \
- SymI_HasProto_deprecated(wcsupr) \
- SymI_HasProto_deprecated(write) \
- SymI_HasProto_deprecated(y0) \
- SymI_HasProto_deprecated(y1) \
- SymI_HasProto_deprecated(yn)
#else
#define RTS_MINGW_ONLY_SYMBOLS /**/
-#define RTS_MINGW_COMPAT_SYMBOLS /**/
#endif
@@ -1121,7 +985,6 @@ extern char **environ;
#define SymI_HasProto(vvv) /**/
#define SymI_HasDataProto(vvv) /**/
#define SymI_HasProto_redirect(vvv,xxx,strength,ty) /**/
-#define SymI_HasProto_deprecated(vvv) /**/
RTS_SYMBOLS
RTS_RET_SYMBOLS
@@ -1139,7 +1002,6 @@ RTS_LIBFFI_SYMBOLS
#undef SymI_HasProto
#undef SymI_HasDataProto
#undef SymI_HasProto_redirect
-#undef SymI_HasProto_deprecated
#undef SymE_HasProto
#undef SymE_HasDataProto
#undef SymE_NeedsProto
@@ -1165,22 +1027,11 @@ RTS_LIBFFI_SYMBOLS
{ MAYBE_LEADING_UNDERSCORE_STR(#vvv), \
(void*)(&(xxx)), strength, ty },
-// SymI_HasProto_deprecated allows us to redirect references from their deprecated
-// names to the undeprecated ones. e.g. access -> _access.
-// We use the hexspeak for unallocated memory 0xBAADF00D to signal the RTS
-// that this needs to be loaded from somewhere else.
-// These are inserted as weak symbols to prevent us overriding packages that do
-// define them, since on Windows these functions shouldn't be in the top level
-// namespace, but we have them for POSIX compatibility.
-#define SymI_HasProto_deprecated(vvv) \
- { #vvv, (void*)0xBAADF00D, STRENGTH_WEAK, SYM_TYPE_CODE },
-
RtsSymbolVal rtsSyms[] = {
RTS_SYMBOLS
RTS_RET_SYMBOLS
RTS_POSIX_ONLY_SYMBOLS
RTS_MINGW_ONLY_SYMBOLS
- RTS_MINGW_COMPAT_SYMBOLS
RTS_DARWIN_ONLY_SYMBOLS
RTS_OPENBSD_ONLY_SYMBOLS
RTS_LIBGCC_SYMBOLS
diff --git a/rts/linker/PEi386.c b/rts/linker/PEi386.c
index 8e2ce984ca..8d5238f792 100644
--- a/rts/linker/PEi386.c
+++ b/rts/linker/PEi386.c
@@ -2171,21 +2171,7 @@ SymbolAddr *lookupSymbol_PEi386(SymbolName *lbl, ObjectCode *dependent, SymType
} else {
if (type) *type = pinfo->type;
- // If Windows, perform initialization of uninitialized
- // Symbols from the C runtime which was loaded above.
- // We do this on lookup to prevent the hit when
- // The symbol isn't being used.
- if (pinfo->value == (void*)0xBAADF00D)
- {
- char symBuffer[50];
- const char *crt_impl = "ucrtbase";
- sprintf(symBuffer, "_%s", lbl);
- static HMODULE crt = NULL;
- if (!crt) crt = GetModuleHandle(crt_impl);
- pinfo->value = GetProcAddress(crt, symBuffer);
- return pinfo->value;
- }
- else if (pinfo && pinfo->owner && isSymbolImport (pinfo->owner, lbl))
+ if (pinfo && pinfo->owner && isSymbolImport (pinfo->owner, lbl))
{
/* See Note [BFD import library]. */
HINSTANCE dllInstance = (HINSTANCE)lookupDependentSymbol(pinfo->value, dependent, type);
diff --git a/rts/rts.cabal.in b/rts/rts.cabal.in
index be54a086e9..00d720d4ff 100644
--- a/rts/rts.cabal.in
+++ b/rts/rts.cabal.in
@@ -39,8 +39,6 @@ flag need-pthread
default: @CabalNeedLibpthread@
flag libbfd
default: @CabalHaveLibbfd@
-flag mingwex
- default: @CabalMingwex@
flag need-atomic
default: @CabalNeedLibatomic@
flag libdw
@@ -83,7 +81,6 @@ library
exposed: True
exposed-modules:
-
if os(ghcjs)
include-dirs: include
@@ -209,8 +206,6 @@ library
if flag(libbfd)
-- for debugging
extra-libraries: bfd iberty
- if flag(mingwex)
- extra-libraries: mingwex
if flag(libdw)
-- for backtraces
extra-libraries: elf dw