From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/8181 Path: news.gmane.org!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: implement stdatomic.h library interface Date: Thu, 23 Jul 2015 16:42:39 +0200 Message-ID: <20150723144238.GD382@port70.net> References: <1437645508.3270.7.camel@inria.fr> <20150723130517.GC382@port70.net> <1437660254.3270.9.camel@inria.fr> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1437662579 25327 80.91.229.3 (23 Jul 2015 14:42:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 23 Jul 2015 14:42:59 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-8194-gllmg-musl=m.gmane.org@lists.openwall.com Thu Jul 23 16:42:59 2015 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1ZIHi3-00008X-3F for gllmg-musl@m.gmane.org; Thu, 23 Jul 2015 16:42:55 +0200 Original-Received: (qmail 30149 invoked by uid 550); 23 Jul 2015 14:42:52 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 30123 invoked from network); 23 Jul 2015 14:42:51 -0000 Mail-Followup-To: musl@lists.openwall.com Content-Disposition: inline In-Reply-To: <1437660254.3270.9.camel@inria.fr> User-Agent: Mutt/1.5.23 (2014-03-12) Xref: news.gmane.org gmane.linux.lib.musl.general:8181 Archived-At: * Jens Gustedt [2015-07-23 16:04:14 +0200]: > Am Donnerstag, den 23.07.2015, 15:05 +0200 schrieb Szabolcs Nagy: > > it seems gcc does not pass -latomic automatically to the linker > > which is ugly (i think atomics should work transparently), but > > ppl using atomics will. > > I think the situation is somewhat comparable to -lm. Other libraries > may implement that as separate .a or .so, we should just integrate it > to the whole, and provide an empty libatomic.[a|so] i think it's a bit different because -lm is libc and libatomic is compiler runtime now. (and extern linkage behaviour for math functions is more clear than for "generic" atomic functions). > > (there is another problem that gcc libatomic on x86 uses ifunc > > dispatch for some __atomic_*_16 functions which does not work > > with musl now, this can be worked around by rebuilding gcc with > > --disable-gnu-indirect-function.) > > Can you explain in more detail what is not working? i mean that on a normal build of gcc >=4.9 libatomic uses the gnu IFUNC feature (runtime dispatch for function symbols based on cpu features at early startup). this IFUNC elf extension is not supported by musl now so loading a shared object with such symbols will fail (not sure what happens with static linking) so you have to build a musl specific toolchain now to use libatomic. (some x86_64 cpus have cmpxchg16b and there is different __atomic_*_16 implementation for them).