Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 14 Jan 2016 23:37:48 +0100
From: Jens Gustedt <jens.gustedt@...ia.fr>
To: musl@...ts.openwall.com
Subject: Re: atomic.h cleanup

Am Donnerstag, den 14.01.2016, 17:12 -0500 schrieb Rich Felker:
> There are already multiple reasons we don't use the compiler's
> atomics, either directly or indirectly via stdatomic.h. They're not
> supported in some old/alternative compilers, they generate highly
> suboptimal code even on modern compilers for some important archs
> (e.g. ARM),

I have seen some pretty good assembler when using the
__atomic... builtins, so I can't completely follow, here.

> and they fail to properly support archs where it's
> necessary to make a runtime choice of which atomic code paths to use
> in order to achieve safe/correct behavior.

ok

> > > > Last time I looked, all usages but one of atomic operations in musl
> > > > are clean. If an atomic operation is used for a data a some point,
> > > > atomic operations are used in all other places. So moving to
> > > > _Atomic(int) would be a option. (Basically this would be `volatile
> > > > int*` => `_Atomic(int)`, IIRC).
> > 
> > oops I meant `volatile int*` => `_Atomic(int)*`
> > 
> > > pthread_once_t and pthread_spinlock_t are
> > > publicly visibles type (without volatile and
> > > _Atomic)
> > > 
> > > i dont think we can fix those without abi
> > > change.
> > 
> > This is really a question what ABI means in this case. The width,
> > alignment and representation of the `int` would stay the same, we
> > would just internally (to the library implementation) interpret it as
> > _Atomic(int).
> 
> From a C++ perspective ABI certainly includes the type that will
> appear in mangled function names. This is the main motivation for not
> changing types like this. Of course LTO could also break when formal
> types don't match.

Yes, I know. I was thinking of a way to have the externally visible
type remain stable, but internally use _Atomic.

Jens

-- 
:: INRIA Nancy Grand Est ::: Camus ::::::: ICube/ICPS :::
:: ::::::::::::::: office Strasbourg : +33 368854536   ::
:: :::::::::::::::::::::: gsm France : +33 651400183   ::
:: ::::::::::::::: gsm international : +49 15737185122 ::
:: http://icube-icps.unistra.fr/index.php/Jens_Gustedt ::




Download attachment "signature.asc" of type "application/pgp-signature" (182 bytes)

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.