Complete the mapping of unprefixed Interlocked functions to the ones starting with an underscore in winnt.h.
This makes it consistent with x86_64. Avoid declaring the dllimported versions of the functions. We currently export them with the __imp_ prefix in lib32/kernel32.def (but marked as DATA, so there is no symbol without the __imp_ prefix). When these functions are used normally, this works just fine, but if e.g. initializing a global variable pointing to such a function, it will end up referencing the actual function name without the __imp_ prefix (which lld will fail to link). This fixes linking sqlite3 as a part of Qt for i386. Signed-off-by: Martin Storsjö <mar...@martin.st> --- mingw-w64-headers/include/interlockedapi.h | 33 --------------------------- mingw-w64-headers/include/winnt.h | 36 ++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 33 deletions(-) diff --git a/mingw-w64-headers/include/interlockedapi.h b/mingw-w64-headers/include/interlockedapi.h index bec2a93..40b1e24 100644 --- a/mingw-w64-headers/include/interlockedapi.h +++ b/mingw-w64-headers/include/interlockedapi.h @@ -14,39 +14,6 @@ extern "C" { #endif #if !defined (NOWINBASEINTERLOCK) && !defined (_NTOS_) -#if !defined (__x86_64__) && !defined (__ia64__) && !defined (__arm__) && !defined (__aarch64__) - WINBASEAPI LONG WINAPI InterlockedIncrement (LONG volatile *lpAddend); - WINBASEAPI LONG WINAPI InterlockedDecrement (LONG volatile *lpAddend); - WINBASEAPI LONG WINAPI InterlockedExchange (LONG volatile *Target, LONG Value); - WINBASEAPI LONG WINAPI InterlockedExchangeAdd (LONG volatile *Addend, LONG Value); - WINBASEAPI LONG WINAPI InterlockedCompareExchange (LONG volatile *Destination, LONG Exchange, LONG Comperand); - WINBASEAPI LONGLONG WINAPI InterlockedCompareExchange64 (LONGLONG volatile *Destination, LONGLONG Exchange, LONGLONG Comperand); - -#define InterlockedExchangePointer(Target, Value) (PVOID)InterlockedExchange ((PLONG) (Target),((LONG) (LONG_PTR) (Value))) -#define InterlockedExchangePointerNoFence InterlockedExchangePointer - -#if defined(__MINGW_INTRIN_INLINE) && (defined(__GNUC__) && (__MINGW_GNUC_PREREQ(4, 9) || (__MINGW_GNUC_PREREQ(4, 8) && __GNUC_PATCHLEVEL__ >= 2))) - __MINGW_INTRIN_INLINE LONG WINAPI InterlockedIncrement(LONG volatile *lpAddend) { - return _InterlockedIncrement(lpAddend); - } - __MINGW_INTRIN_INLINE LONG WINAPI InterlockedDecrement(LONG volatile *lpAddend) { - return _InterlockedDecrement(lpAddend); - } - __MINGW_INTRIN_INLINE LONG WINAPI InterlockedExchange(LONG volatile *Target, LONG Value) { - return _InterlockedExchange(Target, Value); - } - __MINGW_INTRIN_INLINE LONG WINAPI InterlockedExchangeAdd(LONG volatile *Addend, LONG Value) { - return _InterlockedExchangeAdd(Addend, Value); - } - __MINGW_INTRIN_INLINE LONG WINAPI InterlockedCompareExchange(LONG volatile *Destination, LONG Exchange, LONG Comperand) { - return _InterlockedCompareExchange(Destination, Exchange, Comperand); - } - __MINGW_INTRIN_INLINE LONGLONG WINAPI InterlockedCompareExchange64(LONGLONG volatile *Destination, LONGLONG Exchange, LONGLONG Comperand) { - return _InterlockedCompareExchange64(Destination, Exchange, Comperand); - } -#endif -#endif - #if defined (_SLIST_HEADER_) && !defined (_NTOSP_) WINBASEAPI VOID WINAPI InitializeSListHead (PSLIST_HEADER ListHead); WINBASEAPI PSLIST_ENTRY WINAPI InterlockedPopEntrySList (PSLIST_HEADER ListHead); diff --git a/mingw-w64-headers/include/winnt.h b/mingw-w64-headers/include/winnt.h index 6a51c44..544f7ab 100644 --- a/mingw-w64-headers/include/winnt.h +++ b/mingw-w64-headers/include/winnt.h @@ -2060,9 +2060,45 @@ extern "C" { #define BitScanForward _BitScanForward #define BitScanReverse _BitScanReverse +#define InterlockedIncrement16 _InterlockedIncrement16 +#define InterlockedDecrement16 _InterlockedDecrement16 #define InterlockedCompareExchange16 _InterlockedCompareExchange16 + +#define InterlockedAnd _InterlockedAnd +#define InterlockedOr _InterlockedOr +#define InterlockedXor _InterlockedXor +#define InterlockedIncrement _InterlockedIncrement +#define InterlockedIncrementAcquire InterlockedIncrement +#define InterlockedIncrementRelease InterlockedIncrement +#define InterlockedDecrement _InterlockedDecrement +#define InterlockedDecrementAcquire InterlockedDecrement +#define InterlockedDecrementRelease InterlockedDecrement #define InterlockedAdd _InterlockedAdd +#define InterlockedExchange _InterlockedExchange +#define InterlockedExchangeAdd _InterlockedExchangeAdd +#define InterlockedCompareExchange _InterlockedCompareExchange +#define InterlockedCompareExchangeAcquire InterlockedCompareExchange +#define InterlockedCompareExchangeRelease InterlockedCompareExchange + +#define InterlockedAnd64 _InterlockedAnd64 +#define InterlockedAndAffinity InterlockedAnd64 +#define InterlockedOr64 _InterlockedOr64 +#define InterlockedOrAffinity InterlockedOr64 +#define InterlockedXor64 _InterlockedXor64 +#define InterlockedIncrement64 _InterlockedIncrement64 +#define InterlockedDecrement64 _InterlockedDecrement64 #define InterlockedAdd64 _InterlockedAdd64 +#define InterlockedExchange64 _InterlockedExchange64 +#define InterlockedExchangeAcquire64 InterlockedExchange64 +#define InterlockedExchangeAdd64 _InterlockedExchangeAdd64 +#define InterlockedCompareExchange64 _InterlockedCompareExchange64 +#define InterlockedCompareExchangeAcquire64 InterlockedCompareExchange64 +#define InterlockedCompareExchangeRelease64 InterlockedCompareExchange64 + +#define InterlockedExchangePointer _InterlockedExchangePointer +#define InterlockedCompareExchangePointer _InterlockedCompareExchangePointer +#define InterlockedCompareExchangePointerAcquire _InterlockedCompareExchangePointer +#define InterlockedCompareExchangePointerRelease _InterlockedCompareExchangePointer #ifdef _PREFIX_ /* BYTE __readfsbyte(DWORD Offset); moved to psdk_inc/intrin-impl.h */ -- 2.7.4 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public