dbus 1.2.16

Thiago Macieira thiago at kde.org
Thu Jul 16 06:16:24 PDT 2009


Em Quinta-feira 16 Julho 2009, às 14:16:31, Scott James Remnant escreveu:
> On Thu, 2009-07-16 at 13:40 +0200, Thiago Macieira wrote:
> > That means:
> >  - for the feature to be enabled, we need to pass -march to i486 or
> > higher - distributions will not be able to compile D-Bus for non-486
> > processors.
> >
> > I personally don't think 386 processors is a problem. However, we still
> > need to change ./configure. Does anyone have a patch?
>
> Ubuntu is certainly built -march=i486
>
> The most obvious configure test would be:
>
> AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
> [[int inc(int *i)
> { return __sync_sub_and_fetch(i, 1) + 1; }
> ]], [])],
> [],
> [AC_MSG_ERROR([D-Bus requires -march=486 or better])])
>
> Scott

Thanks for the hint. It was actually simpler than that.

Lennart did add a configure check for it:
   [AC_LINK_IFELSE(
      AC_LANG_PROGRAM([], [[int a = 4; __sync_sub_and_fetch(&a, 4);]]),
      [dbus_cv_sync_sub_and_fetch=yes],
      [dbus_cv_sync_sub_and_fetch=no])

The problem is that GCC is too smart for its own good. The code above compiles 
on i386 because the return value from __sync_sub_and_fetch is ignored. 
Therefore, GCC can use the simple "lock add" sequence on i386.

By changing it to int b = __sync...., the compiler can no longer use "lock 
add" but has to use "lock xadd", which requires i486.

Problem fixed.
-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Senior Product Manager - Nokia, Qt Software
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.freedesktop.org/archives/dbus/attachments/20090716/d071069d/attachment-0001.pgp 


More information about the dbus mailing list