[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: i386 compatibility & libstdc++

Hash: SHA1

On Saturday 26 April 2003 16:38, Matthew Garrett wrote:

> Is it possible to "fix" this (ie, provide ABI compatible versions for
> i386 and i486) without breaking stuff? 386s are faster than many other
> pieces of hardware that we still support, so dropping them seems strange
> - on the other hand, an i386 sub-distribution sounds like a world of
> pain. Having a standard library that only supports one of the allegedly
> supported processors if the ABI changes sounds like the real bug to me.

Right. Any reason why the patch below should not work? When
__exchange_and_add is an extern function, the implementation does not
matter to applications using it. Binaries optimized for i486 or higher
can still use the inline function then, just i386 optimized ones will
be even slower than they are now. There will of course have to be two
variants of libstdc++ -- binaries built for i486 will require the new
library but all other c++ libraries and application are compatible 
regardless of their optimization level.

We should still discuss an i686 (or i586) optimized port, but fixing
the problem will make it possible to seperate the issues.

	Arnd <><

- --- config/cpu/i486/atomicity.h	2002-06-24 07:47:41.000000000 +0200
+++ config/cpu/i486/atomicity.h.fixed	2003-04-28 11:27:31.000000000 +0200
@@ -32,6 +32,10 @@
 typedef int _Atomic_word;
+#if defined(__i486) || defined(__i586) || defined(__i686) || defined(__k6) || defined(__athlon) || defined(__pentium4) || defined(__x86_64)
+// the "i486" and above part
 static inline _Atomic_word 
 __attribute__ ((__unused__))
 __exchange_and_add (volatile _Atomic_word *__mem, int __val)
@@ -52,6 +56,21 @@
 			: : "ir" (__val), "m" (*__mem) : "memory");
+#else /* i386 compatible */
+extern _Atomic_word
+__attribute__ ((__unused__))
+__exchange_and_add (volatile _Atomic_word* __mem, int __val);
+static inline void
+__attribute__ ((__unused__))
+__atomic_add (volatile _Atomic_word* __mem, int __val)
+  (void) __exchange_and_add (__mem, __val);
 #endif /* atomicity.h */
Version: GnuPG v1.2.1 (GNU/Linux)


Reply to: