public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jonathan Yong <jyong@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-6601] libgcc: Fix __gthr_i486_lock_cmp_xchg clobber for Windows
Date: Sat, 15 Jan 2022 13:31:16 +0000 (GMT)	[thread overview]
Message-ID: <20220115133116.97C923858D35@sourceware.org> (raw)

https://gcc.gnu.org/g:dcf8fe1eeab668a4d24bcc4baa3ad185dbf1b5e0

commit r12-6601-gdcf8fe1eeab668a4d24bcc4baa3ad185dbf1b5e0
Author: Jonathan Yong <10walls@gmail.com>
Date:   Sat Jan 15 13:24:33 2022 +0000

    libgcc: Fix __gthr_i486_lock_cmp_xchg clobber for Windows
    
    2022-01-14  David  <gccbugzilla@limegreensocks.com>
    
    libgcc/
            * config/i386/gthr-win32.c (__gthr_i486_lock_cmp_xchg):
            Remove inlined version, Windows 95 is no longer relevant.
            * config/i386/gthr-win32.h
            (__GTHREAD_I486_INLINE_LOCK_PRIMITIVES): unset.

Diff:
---
 libgcc/config/i386/gthr-win32.c |  2 --
 libgcc/config/i386/gthr-win32.h | 23 ++---------------------
 2 files changed, 2 insertions(+), 23 deletions(-)

diff --git a/libgcc/config/i386/gthr-win32.c b/libgcc/config/i386/gthr-win32.c
index 0ad29bea6da..fad8f8aca1e 100644
--- a/libgcc/config/i386/gthr-win32.c
+++ b/libgcc/config/i386/gthr-win32.c
@@ -31,8 +31,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #ifndef __GTHREAD_HIDE_WIN32API
 # define __GTHREAD_HIDE_WIN32API 1
 #endif
-#undef  __GTHREAD_I486_INLINE_LOCK_PRIMITIVES
-#define __GTHREAD_I486_INLINE_LOCK_PRIMITIVES
 #include "gthr-win32.h"
 
 /* Windows32 threads specific definitions. The windows32 threading model
diff --git a/libgcc/config/i386/gthr-win32.h b/libgcc/config/i386/gthr-win32.h
index cbc7a2dae15..6f70e9b9dea 100644
--- a/libgcc/config/i386/gthr-win32.h
+++ b/libgcc/config/i386/gthr-win32.h
@@ -374,28 +374,9 @@ extern int _CRT_MT;
 extern int __mingwthr_key_dtor (unsigned long, void (*) (void *));
 #endif /* _WIN32 && !__CYGWIN__ */
 
-/* The Windows95 kernel does not export InterlockedCompareExchange.
-   This provides a substitute.   When building apps that reference
-   gthread_mutex_try_lock, the  __GTHREAD_I486_INLINE_LOCK_PRIMITIVES
-   macro  must be defined if Windows95 is a target.  Currently
-   gthread_mutex_try_lock is not referenced by libgcc or libstdc++.  */
-#ifdef __GTHREAD_I486_INLINE_LOCK_PRIMITIVES
-static inline long
-__gthr_i486_lock_cmp_xchg(long *__dest, long __xchg, long __comperand)
-{
-  long result;
-  __asm__ __volatile__ ("\n\
-	lock\n\
-	cmpxchg{l} {%4, %1|%1, %4}\n"
-	: "=a" (result), "=m" (*__dest)
-	: "0" (__comperand), "m" (*__dest), "r" (__xchg)
-	: "cc");
-  return result;
-}
-#define __GTHR_W32_InterlockedCompareExchange __gthr_i486_lock_cmp_xchg
-#else  /* __GTHREAD_I486_INLINE_LOCK_PRIMITIVES */
+/* __GTHR_W32_InterlockedCompareExchange is left over from win95,
+   which did not support InterlockedCompareExchange. */
 #define __GTHR_W32_InterlockedCompareExchange InterlockedCompareExchange
-#endif /* __GTHREAD_I486_INLINE_LOCK_PRIMITIVES */
 
 static inline int
 __gthread_active_p (void)


                 reply	other threads:[~2022-01-15 13:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220115133116.97C923858D35@sourceware.org \
    --to=jyong@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).