Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <914b5486.dNq.dMV.20.hISEiN@mailjet.com>
Date: Sat, 25 Jul 2015 11:17:57 +0200
From: Joakim Sindholt <opensource@...sha.com>
To: musl@...ts.openwall.com
Subject: Re: implement stdatomic.h library interface

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




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.