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

Re: Bug#198158: architecture i386 isn't i386 anymore



On Tue, 24 Jun 2003, "Martin v. Löwis" wrote:

> John Goerzen wrote:
>
> > Nobody has even explained WHY we have this issue.  The summary posted on the
> > bug report just said that there is a problem with atomicity.h, not what the
> > problem is or why it exists.
>
> Just look at the file for yourself. It is easy enough to see: it uses
> inline assembly that is only available on i486:
>
> static inline _Atomic_word
> __attribute__ ((__unused__))
> __exchange_and_add (volatile _Atomic_word *__mem, int __val)
> {
>    register _Atomic_word __result;
>    __asm__ __volatile__ ("lock; xaddl %0,%2"
>                          : "=r" (__result)
>                          : "0" (__val), "m" (*__mem)
>                          : "memory");
>    return __result;
> }
>
> In particular, the lock prefix is not available on i386. Since this is
> an inline function, this code is inserted into any C++ binary, so you
> can't change its implementation by replacing the library.
>
> In g++ 3.2, this code was distributed as "i386", and nobody noticed that
> it doesn't work on i386 for quite some time. In gcc 3.3, an
> implementation is provided that works on i386, and this implementation
> here is declared i486. Unfortunately, the two implementations are not
> binary compatible. Debian has to pick one of these, and it needs to pick
> the i486 version for compatibility with other Linux distributions (which
> either ship with gcc 3.2 today, or target i586+ only, anyway).

Er, if this function is inlined, then how can it be part of some published
api?  If it's not part of some published api, then how can using an i386
variation cause problems with other distributions?



Reply to: