Commit 17ac9b19 authored by Ben Gamari's avatar Ben Gamari Committed by Ben Gamari

rts: Provide _lock_file in symbol table on Windows

Test Plan: Validate on Windows, ensure that linking works.

Reviewers: Phyx, austin, erikd, simonmar

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2817
parent 2618090b
...@@ -70,6 +70,27 @@ ...@@ -70,6 +70,27 @@
#define RTS_WIN64_ONLY(X) /**/ #define RTS_WIN64_ONLY(X) /**/
#endif #endif
/*
* 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/
*/
#define RTS_MINGW_ONLY_SYMBOLS \ #define RTS_MINGW_ONLY_SYMBOLS \
SymI_HasProto(stg_asyncReadzh) \ SymI_HasProto(stg_asyncReadzh) \
SymI_HasProto(stg_asyncWritezh) \ SymI_HasProto(stg_asyncWritezh) \
...@@ -84,7 +105,9 @@ ...@@ -84,7 +105,9 @@
RTS_WIN32_ONLY(SymI_HasProto(_imp___environ)) \ RTS_WIN32_ONLY(SymI_HasProto(_imp___environ)) \
RTS_WIN64_ONLY(SymI_HasProto(__imp__environ)) \ RTS_WIN64_ONLY(SymI_HasProto(__imp__environ)) \
RTS_WIN32_ONLY(SymI_HasProto(_imp___iob)) \ RTS_WIN32_ONLY(SymI_HasProto(_imp___iob)) \
RTS_WIN64_ONLY(SymI_HasProto(__iob_func)) RTS_WIN64_ONLY(SymI_HasProto(__iob_func)) \
/* see Note [Symbols for MinGW's printf] */ \
SymI_HasProto(_lock_file)
#define RTS_MINGW_COMPAT_SYMBOLS \ #define RTS_MINGW_COMPAT_SYMBOLS \
SymI_HasProto_deprecated(access) \ SymI_HasProto_deprecated(access) \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment