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

Re: i386 compatibility & libstdc++

Hash: SHA1

On Monday 28 April 2003 22:00, Martin v. Löwis wrote:
> Arnd Bergmann <arnd@arndb.de> writes:
> So should the standard binaries (apt, groff, OpenGL libraries, kde
> libraries) be compiled for 386 or 486?
> If 486, how can you run the packages on 386?

They have to be compiled for i386, as they have always been.
If they were compiled for i486, they would not run on i386
anyway, with or without the bug.

We can optionally provide optimized binaries that don't run
on i386, but that question is unrelated and we can freely mix 
them as long as the i486 libstdc++ is used.

> If 386, how will they be compatible with other distributions? More
Only one way. You can use alien packages on Debian, but not Debian
C++ packages on other distributions. Is there a reason to care
about this?

> importantly, how will binaries created for other distribution work on
> Debian? If you have a library compiled for 386 and a foreign binary
> compiled for 486, you may experience data corruption: the 386 code
> will modify atomic values one way, and the 486 code *in the same
> process* will modify them another way. This just cannot work.

Ok, I probably wasn't clear enough about the actual trick. If you want
to use foreign binaries or build any debian packages libraries with
C++ for i486+, you need to install the i486 libstdc++ files.

For example, we could have these files in libstdc++5_3.3-x_i386.deb:

/usr/lib/i386/libstdc++-i386.so.5 -> libstdc++.so.5.0.3
/usr/lib/i486/libstdc++.so.5 -> libstdc++.so.5.0.3
/usr/lib/i486/libstdc++-i386.so.5 -> libstdc++.so.5.0.3

Obviously, the /usr/lib/i386/ variant is optimized for i386 and
uses the old implementation, while the one in /usr/lib/i486
uses the new atomicity variant internally. Both provide an 
__exchange_and_add() extern function with their respective 

All default packages are built for i386 (as always) and linked 
for with the soname libstdc++-i386.so.5. On i486+ systems, 
the runtime linker will automatically use 
/usr/lib/i486/libstdc++-i386.so.5, which resolve the
__exchange_and_add() function to the trivial assembly version.

Binaries built for i486 will use the inline __exchange_and_add()
function. Like alien binaries, they must not be run with the
i386 library, so they use another soname (libstdc++.so.5).
On i386 systems, those won't work, and the runtime linker will
reject them as well. 

	Arnd <><
Version: GnuPG v1.2.1 (GNU/Linux)


Reply to: