void-packages/srcpkgs/musl/template
Enno Boland 5b058b9593 musl: fix failure to obtain EOWNERDEAD status for process-shared robust mutexes
Added upstream patch:

Linux's documentation (robust-futex-ABI.txt) claims that, when a
process dies with a futex on the robust list, bit 30 (0x40000000) is
set to indicate the status. however, what actually happens is that
bits 0-30 are replaced with the value 0x40000000, i.e. bits 0-29
(containing the old owner tid) are cleared at the same time bit 30 is
set.

our userspace-side code for robust mutexes was written based on that
documentation, assuming that kernel would never produce a futex value
of 0x40000000, since the low (owner) bits would always be non-zero.
commit d338b506e39b1e2c68366b12be90704c635602ce introduced this
assumption explicitly while fixing another bug in how non-recoverable
status for robust mutexes was tracked. presumably the tests conducted
at that time only checked non-process-shared robust mutexes, which are
handled in pthread_exit (which implemented the documented kernel
protocol, not the actual one) rather than by the kernel.

change pthread_exit robust list processing to match the kernel
behavior, clearing bits 0-29 while setting bit 30, and use the value
0x7fffffff instead of 0x40000000 to encode non-recoverable status. the
choice of value here is arbitrary; any value with at least one of bits
0-29 set should work just as well,

fixes #4392
2016-06-28 14:20:34 +02:00

57 lines
1.6 KiB
Bash

# Template file for 'musl'.
pkgname=musl
version=1.1.14
revision=2
build_style=gnu-configure
configure_args="--prefix=/usr --disable-gcc-wrapper"
conflicts="glibc>=0"
bootstrap=yes
short_desc="The musl C library"
maintainer="Juan RP <xtraeme@voidlinux.eu>"
license="MIT"
homepage="http://www.musl-libc.org/"
distfiles="http://www.musl-libc.org/releases/musl-${version}.tar.gz"
checksum=35f6c00c84a6091bd5dab29eedde7508dae755ead92dcc0239f3677d1055b9b5
nostrip_files="libc.so"
shlib_provides="libc.so"
only_for_archs="i686-musl x86_64-musl armv5tel-musl armv6l-musl armv7l-musl aarch64-musl mips-musl mipsel-musl mipselhf-musl"
post_build() {
$CC $CFLAGS $LDFLAGS ${FILESDIR}/getent.c -o getent
$CC $CFLAGS $LDFLAGS ${FILESDIR}/getconf.c -o getconf
$CC $CFLAGS $LDFLAGS ${FILESDIR}/iconv.c -o iconv
}
do_install() {
# Move everything to /usr.
vmkdir usr/lib
ln -sfr ${DESTDIR}/usr/lib ${DESTDIR}/lib
make DESTDIR=${DESTDIR} install
rm ${DESTDIR}/lib
# provide ldd
vmkdir usr/bin
ln -s /usr/lib/libc.so ${DESTDIR}/usr/bin/ldd
# additional utils from Alpine/NetBSD
vbin iconv
vbin getent
vman ${FILESDIR}/getent.1
vbin getconf
vman ${FILESDIR}/getconf.1
# Fake ldconfig
ln -s true ${DESTDIR}/usr/bin/ldconfig
# Create xbps.d(5) arch override file
vmkdir usr/share/xbps.d
echo "architecture=${XBPS_TARGET_MACHINE}" > ${DESTDIR}/usr/share/xbps.d/musl-arch.conf
vlicense COPYRIGHT
}
musl-devel_package() {
depends="kernel-libc-headers ${sourcepkg}-${version}_${revision}"
short_desc+=" - development files"
pkg_install() {
vmove usr/include
vmove usr/lib/*.a
vmove usr/lib/*.o
}
}