mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Joakim Sindholt <opensource@zhasha.com>
To: musl@lists.openwall.com
Subject: Re: implement stdatomic.h library interface
Date: Sat, 25 Jul 2015 11:17:57 +0200	[thread overview]
Message-ID: <914b5486.dNq.dMV.20.hISEiN@mailjet.com> (raw)
In-Reply-To: <1437806035.23129.2.camel@inria.fr>

On Sat, 2015-07-25 at 08:33 +0200, Jens Gustedt wrote:
> > If not, then given that there seem to be serious issues
> > with the gcc libatomic implementation (the whole ifunc mess, compat
> > problems between code built with 'hard' and 'soft' atomics, etc.) it
> > _might_ make sense to provide them in musl. But I'd like to make sure
> > we consider all other options, including possibly a separate
> > replacement for libatomic that's independent of musl.
> 
> First, the gcc libatomic is what it is, gcc. So a complete
> installation of musl then would always depend on the presence of
> gcc. And if maybe this needs a gcc (or parts of its library) that is
> compiled with special options, this sounds relatively prohibitive to
> me.

The ifunc mess means that it just plain wont work on musl, and musl
doesn't support ifuncs because they're effectively a completely
unspecified hack to turn existing ABI into function pointers. I'm not
sure if it's even possible to support in static binaries.
So regardless of how any of us feel about it, we would need to either
get ifunc support or replace gcc's libatomic.

> clang relies on the C library (it seems on bsd) or a gcc installation
> as a fallback.

I'm not sure what you mean by this. Can you clarify? Compiler-rt has all
of clang's own fallback symbols and it looks like they're incompatible
with libatomic.

As far as I can tell they just use regular spinlocks on linux without
any libc dependency what-so-ever and on FreeBSD it goes straight to
_umtx_op which looks like their version of futex.

; nm -g amd64/lib/libcompiler_rt.a | grep atomic
atomic.o:
0000000000000130 T __atomic_compare_exchange
0000000000000880 T __atomic_compare_exchange_1
00000000000008e0 T __atomic_compare_exchange_2
0000000000000940 T __atomic_compare_exchange_4
00000000000009a0 T __atomic_compare_exchange_8
0000000000000580 T __atomic_exchange
0000000000000790 T __atomic_exchange_1
00000000000007d0 T __atomic_exchange_2
0000000000000810 T __atomic_exchange_4
0000000000000840 T __atomic_exchange_8
0000000000000a00 T __atomic_fetch_add_1
0000000000000a40 T __atomic_fetch_add_2
0000000000000a80 T __atomic_fetch_add_4
0000000000000ac0 T __atomic_fetch_add_8
0000000000000c00 T __atomic_fetch_and_1
0000000000000c90 T __atomic_fetch_and_2
0000000000000d20 T __atomic_fetch_and_4
0000000000000da0 T __atomic_fetch_and_8
0000000000000e70 T __atomic_fetch_or_1
0000000000000f00 T __atomic_fetch_or_2
0000000000000f90 T __atomic_fetch_or_4
0000000000001010 T __atomic_fetch_or_8
0000000000000b00 T __atomic_fetch_sub_1
0000000000000b40 T __atomic_fetch_sub_2
0000000000000b80 T __atomic_fetch_sub_4
0000000000000bc0 T __atomic_fetch_sub_8
00000000000010e0 T __atomic_fetch_xor_1
0000000000001170 T __atomic_fetch_xor_2
0000000000001200 T __atomic_fetch_xor_4
0000000000001280 T __atomic_fetch_xor_8
0000000000000000 T __atomic_load
00000000000006c0 T __atomic_load_1
00000000000006e0 T __atomic_load_2
0000000000000700 T __atomic_load_4
0000000000000710 T __atomic_load_8
0000000000000090 T __atomic_store
0000000000000720 T __atomic_store_1
0000000000000740 T __atomic_store_2
0000000000000760 T __atomic_store_4
0000000000000770 T __atomic_store_8
atomic_flag_clear.o:
0000000000000000 T atomic_flag_clear
atomic_flag_clear_explicit.o:
0000000000000000 T atomic_flag_clear_explicit
atomic_flag_test_and_set.o:
0000000000000000 T atomic_flag_test_and_set
atomic_flag_test_and_set_explicit.o:
0000000000000000 T atomic_flag_test_and_set_explicit
atomic_signal_fence.o:
0000000000000000 T atomic_signal_fence
atomic_thread_fence.o:
0000000000000000 T atomic_thread_fence

https://github.com/llvm-mirror/compiler-rt/blob/master/lib/builtins/atomic.c

-- Joakim






  reply	other threads:[~2015-07-25  9:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-23  9:58 Jens Gustedt
2015-07-23 12:14 ` Joakim Sindholt
2015-07-23 22:21   ` Jens Gustedt
2015-07-24 23:18   ` Rich Felker
2015-07-25  6:33     ` Jens Gustedt
2015-07-25  9:17       ` Joakim Sindholt [this message]
2015-07-25 12:12         ` Jens Gustedt
2015-07-23 13:05 ` Szabolcs Nagy
2015-07-23 14:04   ` Jens Gustedt
2015-07-23 14:42     ` Szabolcs Nagy
2015-07-23 15:04       ` Jens Gustedt
2015-07-23 16:32         ` Joakim Sindholt
2015-07-23 17:02           ` Szabolcs Nagy
2015-07-23 22:44           ` Jens Gustedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=914b5486.dNq.dMV.20.hISEiN@mailjet.com \
    --to=opensource@zhasha.com \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).