summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorFantix King2012-09-20 14:05:46 +0800
committerFantix King2015-11-13 01:19:05 +0800
commit462e8fb70a0b3a4e9bd76f3c9026ce0fd76bbadc (patch)
treef4c40f84d5a25b76aee6879177068bcbc81200a2
parent052102d1f699e17c805a04f96746711fa6aba0c4 (diff)
downloadaur-462e8fb70a0b3a4e9bd76f3c9026ce0fd76bbadc.tar.gz
2.16.0-2.1
-rw-r--r--.SRCINFO24
-rw-r--r--PKGBUILD155
-rw-r--r--glibc-2.15-fix-res_query-assert.patch51
-rw-r--r--glibc-2.15-revert-c5a0802a.patch226
-rw-r--r--glibc-2.22-roundup.patch666
5 files changed, 347 insertions, 775 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 277865f7cd8..7e814dad6bd 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,24 +1,24 @@
pkgbase = libx32-glibc
- pkgdesc = GNU C Library (x32 ABI)
- pkgver = 2.22
- pkgrel = 3.1
+ pkgdesc = GNU C Library for X32 ABI
+ pkgver = 2.16.0
+ pkgrel = 2.1
url = http://www.gnu.org/software/libc
arch = x86_64
license = GPL
license = LGPL
- makedepends = gcc-multilib-x32>=5.2
- provides = glibc-x32-seed
+ makedepends = gcc-multilib-x32>=4.7
conflicts = glibc-x32-seed
options = !strip
- options = staticlibs
options = !emptydirs
- source = http://ftp.gnu.org/gnu/libc/glibc-2.22.tar.xz
- source = http://ftp.gnu.org/gnu/libc/glibc-2.22.tar.xz.sig
- source = glibc-2.22-roundup.patch
+ source = http://ftp.gnu.org/gnu/libc/glibc-2.16.0.tar.xz
+ source = http://ftp.gnu.org/gnu/libc/glibc-2.16.0.tar.xz.sig
+ source = glibc-2.15-fix-res_query-assert.patch
+ source = glibc-2.15-revert-c5a0802a.patch
source = libx32-glibc.conf
- md5sums = e51e02bf552a0a1fbbdc948fb2f5e83c
- md5sums = SKIP
- md5sums = b6b7a0e8d6e6520e40e3164ae773631d
+ md5sums = 80b181b02ab249524ec92822c0174cf7
+ md5sums = 2a1221a15575820751c325ef4d2fbb90
+ md5sums = 31f415b41197d85d3bbee3d1eecd06a3
+ md5sums = 0a0383d50d63f1c02919fe9943b82014
md5sums = 34a4169d2bdc5a3eb83676a0831aae57
pkgname = libx32-glibc
diff --git a/PKGBUILD b/PKGBUILD
index b66913908f4..180c7589722 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,150 +1,105 @@
-# $Id: PKGBUILD 144552 2015-10-21 09:06:37Z heftig $
+# $Id: PKGBUILD 73695 2012-07-14 13:05:07Z allan $
# Maintainer: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
# Contributor: Jan de Groot <jgc@archlinux.org>
# Contributor: Allan McRae <allan@archlinux.org>
-# x32 Maintainer: Fantix King <fantix.king@gmail.com>
# toolchain build order: linux-api-headers->glibc->binutils->gcc->binutils->glibc
-# NOTE: valgrind-multilib requires rebuild with each major glibc version
-
+# NOTE: valgrind requires rebuilt with each major glibc version
_pkgbasename=glibc
pkgname=libx32-$_pkgbasename
-pkgver=2.22
-pkgrel=3.1
-pkgdesc="GNU C Library (x32 ABI)"
+pkgver=2.16.0
+pkgrel=2.1
+pkgdesc="GNU C Library for X32 ABI"
arch=('x86_64')
url="http://www.gnu.org/software/libc"
license=('GPL' 'LGPL')
-groups=()
-depends=()
-makedepends=('gcc-multilib-x32>=5.2')
-backup=()
+makedepends=('gcc-multilib-x32>=4.7')
conflicts=('glibc-x32-seed')
-provides=('glibc-x32-seed')
-
-
-options=('!strip' 'staticlibs' '!emptydirs')
-
+options=('!strip' '!emptydirs')
source=(http://ftp.gnu.org/gnu/libc/${_pkgbasename}-${pkgver}.tar.xz{,.sig}
- glibc-2.22-roundup.patch
+ glibc-2.15-fix-res_query-assert.patch
+ glibc-2.15-revert-c5a0802a.patch
libx32-glibc.conf)
-md5sums=('e51e02bf552a0a1fbbdc948fb2f5e83c'
- 'SKIP'
- 'b6b7a0e8d6e6520e40e3164ae773631d'
+md5sums=('80b181b02ab249524ec92822c0174cf7'
+ '2a1221a15575820751c325ef4d2fbb90'
+ '31f415b41197d85d3bbee3d1eecd06a3'
+ '0a0383d50d63f1c02919fe9943b82014'
'34a4169d2bdc5a3eb83676a0831aae57')
-validpgpkeys=('F37CDAB708E65EA183FD1AF625EF0A436C2A4AFF') # Carlos O'Donell
-prepare() {
- cd ${srcdir}/glibc-${pkgver}
+build() {
+ cd ${srcdir}/${_pkgbasename}-${pkgver}
- # glibc-2.21..01b07c70
- patch -p1 -i $srcdir/glibc-2.22-roundup.patch
+ # fix res_query assertion
+ # http://sourceware.org/bugzilla/show_bug.cgi?id=13013
+ patch -p1 -i ${srcdir}/glibc-2.15-fix-res_query-assert.patch
- mkdir ${srcdir}/glibc-build
-}
+ # revert commit c5a0802a - causes various hangs
+ # https://bugzilla.redhat.com/show_bug.cgi?id=552960
+ patch -p1 -i ${srcdir}/glibc-2.15-revert-c5a0802a.patch
+
+ cd ${srcdir}
+ mkdir glibc-build
+ cd glibc-build
-build() {
- cd ${srcdir}/glibc-build
- #if [[ ${CARCH} = "i686" ]]; then
- # Hack to fix NPTL issues with Xen, only required on 32bit platforms
- # TODO: make separate glibc-xen package for i686
- #export CFLAGS="${CFLAGS} -mno-tls-direct-seg-refs"
- #fi
+ # Hack to fix NPTL issues with Xen, only required on 32bit platforms
+ # TODO: make separate glibc-xen package for i686
+ export CFLAGS="${CFLAGS} -mno-tls-direct-seg-refs"
if [ -x "/opt/gcc-x32-seed/bin/gcc" ]; then
echo "Using gcc-x32-seed"
- gcc_home=`ls -d /opt/gcc-x32-seed/lib/gcc/x86_64-unknown-linux-gnu/*/`
- export CC="/opt/gcc-x32-seed/bin/gcc -mx32 -B"${gcc_home}
- export CXX="/opt/gcc-x32-seed/bin/g++ -mx32 -B"${gcc_home}
- seed_params='--target=x86_64-x32-linux --build=x86_64-linux --host=x86_64-x32-linux'
+ export CC="/opt/gcc-x32-seed/bin/gcc -mx32 -B/opt/gcc-x32-seed/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/"
+ export CXX="/opt/gcc-x32-seed/bin/cpp -mx32 -B/opt/gcc-x32-seed/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/"
else
echo "Using gcc-multilib-x32"
export CC="gcc -mx32"
export CXX="g++ -mx32"
- seed_params=''
fi
echo "slibdir=/usr/libx32" >> configparms
- echo "rtlddir=/usr/libx32" >> configparms
- echo "sbindir=/usr/bin" >> configparms
- echo "rootsbindir=/usr/bin" >> configparms
- # remove hardening options for building libraries
- CFLAGS=${CFLAGS/-fstack-protector-strong/}
- CPPFLAGS=${CPPFLAGS/-D_FORTIFY_SOURCE=2/}
+ # remove hardening options from CFLAGS for building libraries
+ CFLAGS=${CFLAGS/-fstack-protector/}
+ CFLAGS=${CFLAGS/-D_FORTIFY_SOURCE=2/}
${srcdir}/${_pkgbasename}-${pkgver}/configure --prefix=/usr \
--libdir=/usr/libx32 --libexecdir=/usr/libx32 \
--with-headers=/usr/include \
- --with-bugurl=https://bugs.archlinux.org/ \
- --enable-add-ons \
+ --enable-add-ons=nptl,libidn \
--enable-obsolete-rpc \
--enable-kernel=2.6.32 \
--enable-bind-now --disable-profile \
--enable-stackguard-randomization \
- --enable-lock-elision \
- --enable-multi-arch \
- --disable-werror \
- ${seed_params} \
- x86_64-unknown-linux-gnux32
+ --target=x86_64-x32-linux --build=x86_64-linux --host=x86_64-x32-linux \
+ --enable-multi-arch x86_64-x32-linux
# build libraries with hardening disabled
echo "build-programs=no" >> configparms
make
-
+
# re-enable hardening for programs
sed -i "/build-programs=/s#no#yes#" configparms
- echo "CC += -fstack-protector-strong -D_FORTIFY_SOURCE=2" >> configparms
- echo "CXX += -fstack-protector-strong -D_FORTIFY_SOURCE=2" >> configparms
+ echo "CC += -fstack-protector -D_FORTIFY_SOURCE=2" >> configparms
+ echo "CXX += -fstack-protector -D_FORTIFY_SOURCE=2" >> configparms
make
# remove harding in preparation to run test-suite
- sed -i '5,7d' configparms
+ sed -i '2,4d' configparms
}
check() {
cd ${srcdir}/glibc-build
-
- if [ -x "/opt/gcc-x32-seed/bin/gcc" ]; then
- make check || true
- else
- # some failures are "expected"
- make check || true
- fi
+ make -k check
}
package() {
cd ${srcdir}/glibc-build
-
-
-
-
make install_root=${pkgdir} install
rm -rf ${pkgdir}/{etc,sbin,usr/{bin,sbin,share},var}
- # We need to keep x32 ABI specific header files
- find ${pkgdir}/usr/include -type f -not -name '*-x32.h' -delete
-
-
- # Dynamic linker
- mkdir ${pkgdir}/usr/lib
- ln -s ../libx32/ld-linux-x32.so.2 ${pkgdir}/usr/lib/
-
- # Add libx32 paths to the default library search path
- install -Dm644 "$srcdir/libx32-glibc.conf" "$pkgdir/etc/ld.so.conf.d/libx32-glibc.conf"
-
- # Symlink /usr/libx32/locale to /usr/lib/locale
- ln -s ../lib/locale "$pkgdir/usr/libx32/locale"
-
- # remove the static libraries that have a shared counterpart
- # libc, libdl, libm and libpthread are required for toolchain testsuites
- # in addition libcrypt appears widely required
- rm $pkgdir/usr/libx32/lib{anl,BrokenLocale,nsl,resolv,rt,util}.a
-
-
-
+ # We need one 32 bit specific header file
+ find ${pkgdir}/usr/include -type f -not -name stubs-x32.h -delete
# Do not strip the following files for improved debugging support
# ("improved" as in not breaking gdb and valgrind...):
@@ -154,19 +109,25 @@ package() {
# libthread_db-1.0.so
cd $pkgdir
- strip $STRIP_BINARIES \
- \
- \
- usr/libx32/getconf/*
-
+ strip $STRIP_BINARIES usr/libx32/getconf/* || true
strip $STRIP_STATIC usr/libx32/*.a
- strip $STRIP_SHARED usr/libx32/lib{anl,BrokenLocale,cidn,crypt}-*.so \
+ strip $STRIP_SHARED usr/libx32/{libanl,libBrokenLocale,libcidn,libcrypt}-*.so \
usr/libx32/libnss_{compat,db,dns,files,hesiod,nis,nisplus}-*.so \
- usr/libx32/lib{dl,m,nsl,resolv,rt,util}-*.so \
- usr/libx32/lib{memusage,pcprofile,SegFault}.so \
- usr/libx32/{audit,gconv}/*.so || true
+ usr/libx32/{libdl,libm,libnsl,libresolv,librt,libutil}-*.so \
+ usr/libx32/{libmemusage,libpcprofile,libSegFault}.so \
+ usr/libx32/{pt_chown,{audit,gconv}/*.so}
+
+ # Dynamic linker
+ mkdir ${pkgdir}/usr/lib
+ ln -s ../libx32/ld-linux-x32.so.2 ${pkgdir}/usr/lib/
+
+ # Add libx32 paths to the default library search path
+ install -Dm644 "$srcdir/libx32-glibc.conf" "$pkgdir/etc/ld.so.conf.d/libx32-glibc.conf"
+
+ # Symlink /usr/libx32/locale to /usr/lib/locale
+ ln -s ../lib/locale "$pkgdir/usr/libx32/locale"
# Fix issue that core/glibc didn't fix the path to /lib/ld-linux-x32.so.2
ln -s /usr/lib ${pkgdir}/libx32
diff --git a/glibc-2.15-fix-res_query-assert.patch b/glibc-2.15-fix-res_query-assert.patch
new file mode 100644
index 00000000000..a894da9c795
--- /dev/null
+++ b/glibc-2.15-fix-res_query-assert.patch
@@ -0,0 +1,51 @@
+--- a/resolv/res_query.c
++++ a/resolv/res_query.c
+@@ -122,6 +122,7 @@ __libc_res_nquery(res_state statp,
+ int *resplen2)
+ {
+ HEADER *hp = (HEADER *) answer;
++ HEADER *hp2;
+ int n, use_malloc = 0;
+ u_int oflags = statp->_flags;
+
+@@ -239,26 +240,25 @@ __libc_res_nquery(res_state statp,
+ /* __libc_res_nsend might have reallocated the buffer. */
+ hp = (HEADER *) *answerp;
+
+- /* We simplify the following tests by assigning HP to HP2. It
+- is easy to verify that this is the same as ignoring all
+- tests of HP2. */
+- HEADER *hp2 = answerp2 ? (HEADER *) *answerp2 : hp;
+-
+- if (n < (int) sizeof (HEADER) && answerp2 != NULL
+- && *resplen2 > (int) sizeof (HEADER))
++ /* We simplify the following tests by assigning HP to HP2 or
++ vice versa. It is easy to verify that this is the same as
++ ignoring all tests of HP or HP2. */
++ if (answerp2 == NULL || *resplen2 < (int) sizeof (HEADER))
+ {
+- /* Special case of partial answer. */
+- assert (hp != hp2);
+- hp = hp2;
++ hp2 = hp;
+ }
+- else if (answerp2 != NULL && *resplen2 < (int) sizeof (HEADER)
+- && n > (int) sizeof (HEADER))
++ else
+ {
+- /* Special case of partial answer. */
+- assert (hp != hp2);
+- hp2 = hp;
++ hp2 = (HEADER *) *answerp2;
++ if (n < (int) sizeof (HEADER))
++ {
++ hp = hp2;
++ }
+ }
+
++ /* Make sure both hp and hp2 are defined */
++ assert((hp != NULL) && (hp2 != NULL));
++
+ if ((hp->rcode != NOERROR || ntohs(hp->ancount) == 0)
+ && (hp2->rcode != NOERROR || ntohs(hp2->ancount) == 0)) {
+ #ifdef DEBUG
diff --git a/glibc-2.15-revert-c5a0802a.patch b/glibc-2.15-revert-c5a0802a.patch
new file mode 100644
index 00000000000..d8894723ae8
--- /dev/null
+++ b/glibc-2.15-revert-c5a0802a.patch
@@ -0,0 +1,226 @@
+diff -rup a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S
+--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S 2011-12-22 18:04:12.937212834 +0000
++++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S 2011-12-22 18:04:42.104222278 +0000
+@@ -137,7 +137,6 @@ __pthread_cond_wait:
+ cmpl $PI_BIT, %eax
+ jne 18f
+
+-90:
+ movl $(FUTEX_WAIT_REQUEUE_PI|FUTEX_PRIVATE_FLAG), %ecx
+ movl %ebp, %edx
+ xorl %esi, %esi
+@@ -151,9 +150,6 @@ __pthread_cond_wait:
+ sete 16(%esp)
+ je 19f
+
+- cmpl $-EAGAIN, %eax
+- je 91f
+-
+ /* Normal and PI futexes dont mix. Use normal futex functions only
+ if the kernel does not support the PI futex functions. */
+ cmpl $-ENOSYS, %eax
+@@ -398,78 +394,6 @@ __pthread_cond_wait:
+ #endif
+ call __lll_unlock_wake
+ jmp 11b
+-
+-91:
+-.LcleanupSTART2:
+- /* FUTEX_WAIT_REQUEUE_PI returned EAGAIN. We need to
+- call it again. */
+-
+- /* Get internal lock. */
+- movl $1, %edx
+- xorl %eax, %eax
+- LOCK
+-#if cond_lock == 0
+- cmpxchgl %edx, (%ebx)
+-#else
+- cmpxchgl %edx, cond_lock(%ebx)
+-#endif
+- jz 92f
+-
+-#if cond_lock == 0
+- movl %ebx, %edx
+-#else
+- leal cond_lock(%ebx), %edx
+-#endif
+-#if (LLL_SHARED-LLL_PRIVATE) > 255
+- xorl %ecx, %ecx
+-#endif
+- cmpl $-1, dep_mutex(%ebx)
+- setne %cl
+- subl $1, %ecx
+- andl $(LLL_SHARED-LLL_PRIVATE), %ecx
+-#if LLL_PRIVATE != 0
+- addl $LLL_PRIVATE, %ecx
+-#endif
+- call __lll_lock_wait
+-
+-92:
+- /* Increment the cond_futex value again, so it can be used as a new
+- expected value. */
+- addl $1, cond_futex(%ebx)
+- movl cond_futex(%ebx), %ebp
+-
+- /* Unlock. */
+- LOCK
+-#if cond_lock == 0
+- subl $1, (%ebx)
+-#else
+- subl $1, cond_lock(%ebx)
+-#endif
+- je 93f
+-#if cond_lock == 0
+- movl %ebx, %eax
+-#else
+- leal cond_lock(%ebx), %eax
+-#endif
+-#if (LLL_SHARED-LLL_PRIVATE) > 255
+- xorl %ecx, %ecx
+-#endif
+- cmpl $-1, dep_mutex(%ebx)
+- setne %cl
+- subl $1, %ecx
+- andl $(LLL_SHARED-LLL_PRIVATE), %ecx
+-#if LLL_PRIVATE != 0
+- addl $LLL_PRIVATE, %ecx
+-#endif
+- call __lll_unlock_wake
+-
+-93:
+- /* Set the rest of SYS_futex args for FUTEX_WAIT_REQUEUE_PI. */
+- xorl %ecx, %ecx
+- movl dep_mutex(%ebx), %edi
+- jmp 90b
+-.LcleanupEND2:
+-
+ .size __pthread_cond_wait, .-__pthread_cond_wait
+ versioned_symbol (libpthread, __pthread_cond_wait, pthread_cond_wait,
+ GLIBC_2_3_2)
+@@ -642,10 +566,6 @@ __condvar_w_cleanup:
+ .long .LcleanupEND-.Lsub_cond_futex
+ .long __condvar_w_cleanup-.LSTARTCODE
+ .uleb128 0
+- .long .LcleanupSTART2-.LSTARTCODE
+- .long .LcleanupEND2-.LcleanupSTART2
+- .long __condvar_w_cleanup-.LSTARTCODE
+- .uleb128 0
+ .long .LcallUR-.LSTARTCODE
+ .long .LENDCODE-.LcallUR
+ .long 0
+Only in b/nptl/sysdeps/unix/sysv/linux/i386/i486: pthread_cond_wait.S.orig
+diff -rup a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
+--- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S 2011-12-22 18:04:12.941212837 +0000
++++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S 2011-12-22 18:05:05.155229737 +0000
+@@ -23,7 +23,6 @@
+ #include <lowlevelcond.h>
+ #include <tcb-offsets.h>
+ #include <pthread-pi-defines.h>
+-#include <pthread-errnos.h>
+ #include <stap-probe.h>
+
+ #include <kernel-features.h>
+@@ -137,14 +136,11 @@ __pthread_cond_wait:
+ cmpl $PI_BIT, %eax
+ jne 61f
+
+-90:
+ movl $(FUTEX_WAIT_REQUEUE_PI|FUTEX_PRIVATE_FLAG), %esi
+ movl $SYS_futex, %eax
+ syscall
+
+ movl $1, %r8d
+- cmpq $-EAGAIN, %rax
+- je 91f
+ #ifdef __ASSUME_REQUEUE_PI
+ jmp 62f
+ #else
+@@ -331,70 +327,6 @@ __pthread_cond_wait:
+
+ 13: movq %r10, %rax
+ jmp 14b
+-
+-91:
+-.LcleanupSTART2:
+- /* FUTEX_WAIT_REQUEUE_PI returned EAGAIN. We need to
+- call it again. */
+- movq 8(%rsp), %rdi
+-
+- /* Get internal lock. */
+- movl $1, %esi
+- xorl %eax, %eax
+- LOCK
+-#if cond_lock == 0
+- cmpxchgl %esi, (%rdi)
+-#else
+- cmpxchgl %esi, cond_lock(%rdi)
+-#endif
+- jz 92f
+-
+-#if cond_lock != 0
+- addq $cond_lock, %rdi
+-#endif
+- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
+- movl $LLL_PRIVATE, %eax
+- movl $LLL_SHARED, %esi
+- cmovne %eax, %esi
+- callq __lll_lock_wait
+-#if cond_lock != 0
+- subq $cond_lock, %rdi
+-#endif
+-92:
+- /* Increment the cond_futex value again, so it can be used as a new
+- expected value. */
+- incl cond_futex(%rdi)
+- movl cond_futex(%rdi), %edx
+-
+- /* Release internal lock. */
+- LOCK
+-#if cond_lock == 0
+- decl (%rdi)
+-#else
+- decl cond_lock(%rdi)
+-#endif
+- jz 93f
+-
+-#if cond_lock != 0
+- addq $cond_lock, %rdi
+-#endif
+- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
+- movl $LLL_PRIVATE, %eax
+- movl $LLL_SHARED, %esi
+- cmovne %eax, %esi
+- /* The call preserves %rdx. */
+- callq __lll_unlock_wake
+-#if cond_lock != 0
+- subq $cond_lock, %rdi
+-#endif
+-93:
+- /* Set the rest of SYS_futex args for FUTEX_WAIT_REQUEUE_PI. */
+- xorq %r10, %r10
+- mov dep_mutex(%rdi), %R8_LP
+- leaq cond_futex(%rdi), %rdi
+- jmp 90b
+-.LcleanupEND2:
+-
+ .size __pthread_cond_wait, .-__pthread_cond_wait
+ versioned_symbol (libpthread, __pthread_cond_wait, pthread_cond_wait,
+ GLIBC_2_3_2)
+@@ -547,15 +479,11 @@ __condvar_cleanup1:
+ .uleb128 .LcleanupSTART-.LSTARTCODE
+ .uleb128 .LcleanupEND-.LcleanupSTART
+ .uleb128 __condvar_cleanup1-.LSTARTCODE
+- .uleb128 0
+- .uleb128 .LcleanupSTART2-.LSTARTCODE
+- .uleb128 .LcleanupEND2-.LcleanupSTART2
+- .uleb128 __condvar_cleanup1-.LSTARTCODE
+- .uleb128 0
++ .uleb128 0
+ .uleb128 .LcallUR-.LSTARTCODE
+ .uleb128 .LENDCODE-.LcallUR
+ .uleb128 0
+- .uleb128 0
++ .uleb128 0
+ .Lcstend:
+
diff --git a/glibc-2.22-roundup.patch b/glibc-2.22-roundup.patch
deleted file mode 100644
index 7991d33afeb..00000000000
--- a/glibc-2.22-roundup.patch
+++ /dev/null
@@ -1,666 +0,0 @@
-diff --git a/ChangeLog b/ChangeLog
-index cb9124e..d0d2cbd 100644
---- a/ChangeLog
-+++ b/ChangeLog
-@@ -1,3 +1,74 @@
-+2015-08-31 Brett Neumeier <brett@neumeier.us>
-+
-+ [BZ #18870]
-+ * sysdeps/sparc/sparc32/sem_open.c: Add missing #include
-+
-+2015-08-28 Mike Frysinger <vapier@gentoo.org>
-+
-+ [BZ #18887]
-+ * misc/Makefile (tests): Add tst-mntent-blank-corrupt and
-+ tst-mntent-blank-passno.
-+ * misc/mntent_r.c (__getmntent_r): Do not read past buffer[0].
-+ * misc/tst-mntent-blank-corrupt.c: New test.
-+ * misc/tst-mntent-blank-passno.c: New test ripped from ...
-+ * misc/tst-mntent.c (do_test): ... here.
-+
-+2015-08-25 Roland McGrath <roland@hack.frob.com>
-+
-+ * sysdeps/nacl/start.c (_start): Call __nacl_main instead of main
-+ if the weak reference is not null.
-+
-+2015-08-19 Andrew Senkevich <andrew.senkevich@intel.com>
-+
-+ [BZ #18796]
-+ * scripts/test-installation.pl: Don't add -lmvec to build options
-+ if libmvec wasn't built.
-+ * NEWS: Mention this fix.
-+
-+2015-08-10 Maxim Ostapenko <m.ostapenko@partner.samsung.com>
-+
-+ [BZ #18778]
-+ * elf/Makefile (tests): Add Add tst-nodelete2.
-+ (modules-names): Add tst-nodelete2mod.
-+ (tst-nodelete2mod.so-no-z-defs): New.
-+ ($(objpfx)tst-nodelete2): Likewise.
-+ ($(objpfx)tst-nodelete2.out): Likewise.
-+ (LDFLAGS-tst-nodelete2): Likewise.
-+ * elf/dl-close.c (_dl_close_worker): Move DF_1_NODELETE clearing
-+ out of loop through all loaded libraries.
-+ * elf/tst-nodelete2.c: New file.
-+ * elf/tst-nodelete2mod.c: Likewise.
-+
-+2015-08-10 Andreas Schwab <schwab@suse.de>
-+
-+ [BZ #18781]
-+ * sysdeps/unix/sysv/linux/openat.c (__OPENAT) [MORE_OFLAGS]: Add
-+ MORE_OFLAGS to oflag.
-+ * io/test-lfs.c (do_test): Test openat64.
-+
-+2015-08-08 John David Anglin <danglin@gcc.gnu.org>
-+
-+ [BZ #18787]
-+ * sysdeps/unix/sysv/linux/hppa/bits/atomic.h (_LWS_CLOBBER): Revise
-+ clobber registers.
-+ (atomic_compare_and_exchange_val_acq): Use register asms to assign
-+ operand registers. Use register %r20 for EAGAIN and EDEADLOCK checks.
-+ Cast return to __typeof (oldval).
-+
-+2015-08-08 Mike Frysinger <vapier@gentoo.org>
-+
-+ * sysdeps/unix/sysv/linux/microblaze/sysdep.h: Wrap the whole file
-+ in _LINUX_MICROBLAZE_SYSDEP_H defines. Include sysdeps/unix/sysdep.h
-+ and delete sys/syscall.h include.
-+
-+2015-08-07 Mike Frysinger <vapier@gentoo.org>
-+
-+ * sysdeps/hppa/dl-symaddr.c (_dl_symbol_address): Add rtld_hidden_def.
-+
-+2015-08-05 Zack Weinberg <zackw@panix.com>
-+
-+ * misc/regexp.h: Update comments.
-+
- 2015-08-05 Carlos O'Donell <carlos@systemhalted.org>
-
- * version.h (RELEASE): Set to "stable".
-diff --git a/NEWS b/NEWS
-index 4c31de7..ce0255a 100644
---- a/NEWS
-+++ b/NEWS
-@@ -5,6 +5,12 @@ See the end for copying conditions.
- Please send GNU C library bug reports via <http://sourceware.org/bugzilla/>
- using `glibc' in the "product" field.
-
-+Version 2.22.1
-+
-+* The following bugs are resolved with this release:
-+
-+ 18778, 18781, 18787, 18796, 18870, 18887.
-+
- Version 2.22
-
- * The following bugs are resolved with this release:
-@@ -84,7 +90,7 @@ Version 2.22
- release. Use of this header will trigger a deprecation warning.
- Application developers should update their code to use <regex.h> instead.
-
-- This header was formerly part of SUSv2, but was deprecated in 1997 and
-+ This header was formerly part of SUS, but was deprecated in 1994 and
- removed from the standard in 2001. Also, the glibc implementation
- leaks memory. See BZ#18681 for more details.
-
-diff --git a/elf/Makefile b/elf/Makefile
-index 4ceeaf8..71a18a1 100644
---- a/elf/Makefile
-+++ b/elf/Makefile
-@@ -148,7 +148,8 @@ tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
- tst-unique1 tst-unique2 $(if $(CXX),tst-unique3 tst-unique4 \
- tst-nodelete) \
- tst-initorder tst-initorder2 tst-relsort1 tst-null-argv \
-- tst-ptrguard1 tst-tlsalign tst-tlsalign-extern tst-nodelete-opened
-+ tst-ptrguard1 tst-tlsalign tst-tlsalign-extern tst-nodelete-opened \
-+ tst-nodelete2
- # reldep9
- ifeq ($(build-hardcoded-path-in-tests),yes)
- tests += tst-dlopen-aout
-@@ -218,7 +219,7 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
- tst-initorder2d \
- tst-relsort1mod1 tst-relsort1mod2 tst-array2dep \
- tst-array5dep tst-null-argv-lib \
-- tst-tlsalign-lib tst-nodelete-opened-lib
-+ tst-tlsalign-lib tst-nodelete-opened-lib tst-nodelete2mod
- ifeq (yes,$(have-protected-data))
- modules-names += tst-protected1moda tst-protected1modb
- tests += tst-protected1a tst-protected1b
-@@ -594,6 +595,7 @@ tst-auditmod9b.so-no-z-defs = yes
- tst-nodelete-uniquemod.so-no-z-defs = yes
- tst-nodelete-rtldmod.so-no-z-defs = yes
- tst-nodelete-zmod.so-no-z-defs = yes
-+tst-nodelete2mod.so-no-z-defs = yes
-
- ifeq ($(build-shared),yes)
- # Build all the modules even when not actually running test programs.
-@@ -1164,6 +1166,11 @@ $(objpfx)tst-nodelete.out: $(objpfx)tst-nodelete-uniquemod.so \
- LDFLAGS-tst-nodelete = -rdynamic
- LDFLAGS-tst-nodelete-zmod.so = -Wl,--enable-new-dtags,-z,nodelete
-
-+$(objpfx)tst-nodelete2: $(libdl)
-+$(objpfx)tst-nodelete2.out: $(objpfx)tst-nodelete2mod.so
-+
-+LDFLAGS-tst-nodelete2 = -rdynamic
-+
- $(objpfx)tst-initorder-cmp.out: tst-initorder.exp $(objpfx)tst-initorder.out
- cmp $^ > $@; \
- $(evaluate-test)
-diff --git a/elf/dl-close.c b/elf/dl-close.c
-index 9105277..c897247 100644
---- a/elf/dl-close.c
-+++ b/elf/dl-close.c
-@@ -144,6 +144,14 @@ _dl_close_worker (struct link_map *map, bool force)
- char done[nloaded];
- struct link_map *maps[nloaded];
-
-+ /* Clear DF_1_NODELETE to force object deletion. We don't need to touch
-+ l_tls_dtor_count because forced object deletion only happens when an
-+ error occurs during object load. Destructor registration for TLS
-+ non-POD objects should not have happened till then for this
-+ object. */
-+ if (force)
-+ map->l_flags_1 &= ~DF_1_NODELETE;
-+
- /* Run over the list and assign indexes to the link maps and enter
- them into the MAPS array. */
- int idx = 0;
-@@ -153,13 +161,6 @@ _dl_close_worker (struct link_map *map, bool force)
- maps[idx] = l;
- ++idx;
-
-- /* Clear DF_1_NODELETE to force object deletion. We don't need to touch
-- l_tls_dtor_count because forced object deletion only happens when an
-- error occurs during object load. Destructor registration for TLS
-- non-POD objects should not have happened till then for this
-- object. */
-- if (force)
-- l->l_flags_1 &= ~DF_1_NODELETE;
- }
- assert (idx == nloaded);
-
-diff --git a/elf/tst-nodelete2.c b/elf/tst-nodelete2.c
-new file mode 100644
-index 0000000..388e8af
---- /dev/null
-+++ b/elf/tst-nodelete2.c
-@@ -0,0 +1,37 @@
-+#include "../dlfcn/dlfcn.h"
-+#include <stdio.h>
-+#include <stdlib.h>
-+#include <gnu/lib-names.h>
-+
-+static int
-+do_test (void)
-+{
-+ int result = 0;
-+
-+ printf ("\nOpening pthread library.\n");
-+ void *pthread = dlopen (LIBPTHREAD_SO, RTLD_LAZY);
-+
-+ /* This is a test for correct DF_1_NODELETE clearing when dlopen failure
-+ happens. We should clear DF_1_NODELETE for failed library only, because
-+ doing this for others (e.g. libpthread) might cause them to be unloaded,
-+ that may lead to some global references (e.g. __rtld_lock_unlock) to be
-+ broken. The dlopen should fail because of undefined symbols in shared
-+ library, that cause DF_1_NODELETE to be cleared. For libpthread, this
-+ flag should be set, because if not, SIGSEGV will happen in dlclose. */
-+ if (dlopen ("tst-nodelete2mod.so", RTLD_NOW) != NULL)
-+ {
-+ printf ("Unique symbols test failed\n");
-+ result = 1;
-+ }
-+
-+ if (pthread)
-+ dlclose (pthread);
-+
-+ if (result == 0)
-+ printf ("SUCCESS\n");
-+
-+ return result;
-+}
-+
-+#define TEST_FUNCTION do_test ()
-+#include "../test-skeleton.c"
-diff --git a/elf/tst-nodelete2mod.c b/elf/tst-nodelete2mod.c
-new file mode 100644
-index 0000000..e88c756
---- /dev/null
-+++ b/elf/tst-nodelete2mod.c
-@@ -0,0 +1,7 @@
-+/* Undefined symbol. */
-+extern int not_exist (void);
-+
-+int foo (void)
-+{
-+ return not_exist ();
-+}
-diff --git a/elf/tst-znodelete-zlib.cc b/elf/tst-znodelete-zlib.cc
-deleted file mode 100644
-index 1e8f368..0000000
---- a/elf/tst-znodelete-zlib.cc
-+++ /dev/null
-@@ -1,6 +0,0 @@
--extern int not_exist (void);
--
--int foo (void)
--{
-- return not_exist ();
--}
-diff --git a/io/test-lfs.c b/io/test-lfs.c
-index 539c2a2..b6ebae4 100644
---- a/io/test-lfs.c
-+++ b/io/test-lfs.c
-@@ -144,7 +144,7 @@ test_ftello (void)
- int
- do_test (int argc, char *argv[])
- {
-- int ret;
-+ int ret, fd2;
- struct stat64 statbuf;
-
- ret = lseek64 (fd, TWO_GB+100, SEEK_SET);
-@@ -195,6 +195,25 @@ do_test (int argc, char *argv[])
- error (EXIT_FAILURE, 0, "stat reported size %lld instead of %lld.",
- (long long int) statbuf.st_size, (TWO_GB + 100 + 5));
-
-+ fd2 = openat64 (AT_FDCWD, name, O_RDWR);
-+ if (fd2 == -1)
-+ {
-+ if (errno == ENOSYS)
-+ {
-+ /* Silently ignore this test. */
-+ error (0, 0, "openat64 is not supported");
-+ }
-+ else
-+ error (EXIT_FAILURE, errno, "openat64 failed to open big file");
-+ }
-+ else
-+ {
-+ ret = close (fd2);
-+
-+ if (ret == -1)
-+ error (EXIT_FAILURE, errno, "error closing file");
-+ }
-+
- test_ftello ();
-
- return 0;
-diff --git a/misc/Makefile b/misc/Makefile
-index aecb0da..2f5edf6 100644
---- a/misc/Makefile
-+++ b/misc/Makefile
-@@ -76,7 +76,8 @@ install-lib := libg.a
- gpl2lgpl := error.c error.h
-
- tests := tst-dirname tst-tsearch tst-fdset tst-efgcvt tst-mntent tst-hsearch \
-- tst-error1 tst-pselect tst-insremque tst-mntent2 bug-hsearch1
-+ tst-error1 tst-pselect tst-insremque tst-mntent2 bug-hsearch1 \
-+ tst-mntent-blank-corrupt tst-mntent-blank-passno
- ifeq ($(run-built-tests),yes)
- tests-special += $(objpfx)tst-error1-mem.out
- endif
-diff --git a/misc/mntent_r.c b/misc/mntent_r.c
-index 6159873..4f26998 100644
---- a/misc/mntent_r.c
-+++ b/misc/mntent_r.c
-@@ -136,7 +136,9 @@ __getmntent_r (FILE *stream, struct mntent *mp, char *buffer, int bufsiz)
- end_ptr = strchr (buffer, '\n');
- if (end_ptr != NULL) /* chop newline */
- {
-- while (end_ptr[-1] == ' ' || end_ptr[-1] == '\t')
-+ /* Do not walk past the start of buffer if it's all whitespace. */
-+ while (end_ptr != buffer
-+ && (end_ptr[-1] == ' ' || end_ptr[-1] == '\t'))
- end_ptr--;
- *end_ptr = '\0';
- }
-diff --git a/misc/regexp.h b/misc/regexp.h
-index 3460989..42394f7 100644
---- a/misc/regexp.h
-+++ b/misc/regexp.h
-@@ -19,10 +19,11 @@
- #ifndef _REGEXP_H
- #define _REGEXP_H 1
-
--/* The contents of this header file were standardized in the
-- Single Unix Specification, Version 2 (1997) but marked as
-- LEGACY; new applications were already being encouraged to
-- use <regex.h> instead. POSIX.1-2001 removed this header.
-+/* The contents of this header file were originally standardized in
-+ the Single Unix Specification, Issue 3 (1992). In Issue 4 (1994)
-+ the header was marked as TO BE WITHDRAWN, and new applications
-+ were encouraged to use <regex.h> instead. It was officially
-+ withdrawn from the standard in Issue 6 (aka POSIX.1-2001).
-
- This header is provided only for backward compatibility.
- It will be removed in the next release of the GNU C Library.
-diff --git a/misc/tst-mntent-blank-corrupt.c b/misc/tst-mntent-blank-corrupt.c
-new file mode 100644
-index 0000000..92266a3
---- /dev/null
-+++ b/misc/tst-mntent-blank-corrupt.c
-@@ -0,0 +1,45 @@
-+/* Make sure blank lines does not cause memory corruption BZ #18887.
-+
-+ Copyright (C) 2009-2015 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <http://www.gnu.org/licenses/>. */
-+
-+#include <mntent.h>
-+#include <stdio.h>
-+#include <string.h>
-+
-+/* Make sure blank lines don't trigger memory corruption. This doesn't happen
-+ for all targets though, so it's a best effort test BZ #18887. */
-+static int
-+do_test (void)
-+{
-+ FILE *fp;
-+
-+ fp = tmpfile ();
-+ fputs ("\n \n/foo\\040dir /bar\\040dir auto bind \t \n", fp);
-+ rewind (fp);
-+
-+ /* The corruption happens here ... */
-+ getmntent (fp);
-+ /* ... but trigers here. */
-+ endmntent (fp);
-+
-+ /* If the test failed, we would crash, and not hit this point. */
-+ return 0;
-+}
-+
-+#define TEST_FUNCTION do_test ()
-+#include "../test-skeleton.c"
-diff --git a/misc/tst-mntent-blank-passno.c b/misc/tst-mntent-blank-passno.c
-new file mode 100644
-index 0000000..fc04291
---- /dev/null
-+++ b/misc/tst-mntent-blank-passno.c
-@@ -0,0 +1,53 @@
-+/* Make sure trailing whitespace is handled properly BZ #17273.
-+
-+ Copyright (C) 2009-2015 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <http://www.gnu.org/licenses/>. */
-+
-+#include <mntent.h>
-+#include <stdio.h>
-+#include <string.h>
-+
-+/* Check entries to make sure trailing whitespace is ignored and we return the
-+ correct passno value BZ #17273. */
-+static int
-+do_test (void)
-+{
-+ int result = 0;
-+ FILE *fp;
-+ struct mntent *mnt;
-+
-+ fp = tmpfile ();
-+ fputs ("/foo\\040dir /bar\\040dir auto bind \t \n", fp);
-+ rewind (fp);
-+
-+ mnt = getmntent (fp);
-+ if (strcmp (mnt->mnt_fsname, "/foo dir") != 0
-+ || strcmp (mnt->mnt_dir, "/bar dir") != 0
-+ || strcmp (mnt->mnt_type, "auto") != 0
-+ || strcmp (mnt->mnt_opts, "bind") != 0
-+ || mnt->mnt_freq != 0
-+ || mnt->mnt_passno != 0)
-+ {
-+ puts ("Error while reading entry with trailing whitespaces");
-+ result = 1;
-+ }
-+
-+ return result;
-+}
-+
-+#define TEST_FUNCTION do_test ()
-+#include "../test-skeleton.c"
-diff --git a/misc/tst-mntent.c b/misc/tst-mntent.c
-index 876c89f..820b354 100644
---- a/misc/tst-mntent.c
-+++ b/misc/tst-mntent.c
-@@ -73,26 +73,6 @@ main (int argc, char *argv[])
- puts ("Error while reading written entry back in");
- result = 1;
- }
--
-- /* Part III: Entry with whitespaces at the end of a line. */
-- rewind (fp);
--
-- fputs ("/foo\\040dir /bar\\040dir auto bind \t \n", fp);
--
-- rewind (fp);
--
-- mnt = getmntent (fp);
--
-- if (strcmp (mnt->mnt_fsname, "/foo dir") != 0
-- || strcmp (mnt->mnt_dir, "/bar dir") != 0
-- || strcmp (mnt->mnt_type, "auto") != 0
-- || strcmp (mnt->mnt_opts, "bind") != 0
-- || mnt->mnt_freq != 0
-- || mnt->mnt_passno != 0)
-- {
-- puts ("Error while reading entry with trailing whitespaces");
-- result = 1;
-- }
- }
-
- return result;
-diff --git a/scripts/test-installation.pl b/scripts/test-installation.pl
-index cac1562..79b2b3e 100755
---- a/scripts/test-installation.pl
-+++ b/scripts/test-installation.pl
-@@ -80,16 +80,25 @@ arglist: while (@ARGV) {
- # We expect none or one argument.
- if ($#ARGV == -1) {
- $soversions="soversions.mk";
-+ $config="config.make";
- } elsif ($#ARGV == 0) {
- if (-d $ARGV[0]) {
- $soversions = "$ARGV[0]/soversions.mk";
-+ $config = "$ARGV[0]/config.make";
- } else {
-- $soversions = $ARGV[0];
-+ $soversions = $dir = $ARGV[0];
-+ $dir =~ s!/?[^/]*/*$!!;
-+ $config = $dir . "/config.make";
- }
- } else {
- die "Wrong number of arguments.";
- }
-
-+if (system ("grep -q \"build-mathvec = yes\" $config") == 0) {
-+ $build_mathvec = 1;
-+} else {
-+ $build_mathvec = 0;
-+}
-
- # Read names and versions of all shared libraries that are part of
- # glibc
-@@ -111,6 +120,8 @@ while (<SOVERSIONS>) {
- # - libthread_db since it contains unresolved references
- # - it's just a test NSS module
- # - We don't provide the libgcc so we don't test it
-+ # - libmvec if it wasn't built
-+ next if ($build_mathvec == 0 && $name eq "mvec");
- if ($name ne "nss_ldap" && $name ne "db1"
- && !($name =~/^nss1_/) && $name ne "thread_db"
- && $name ne "nss_test1" && $name ne "libgcc_s") {
-diff --git a/sysdeps/hppa/dl-symaddr.c b/sysdeps/hppa/dl-symaddr.c
-index b707c19..89d8baf 100644
---- a/sysdeps/hppa/dl-symaddr.c
-+++ b/sysdeps/hppa/dl-symaddr.c
-@@ -33,3 +33,4 @@ _dl_symbol_address (struct link_map *map, const ElfW(Sym) *ref)
- else
- return (void *) value;
- }
-+rtld_hidden_def (_dl_symbol_address)
-diff --git a/sysdeps/nacl/start.c b/sysdeps/nacl/start.c
-index a4b6dd3..8e8bc1a 100644
---- a/sysdeps/nacl/start.c
-+++ b/sysdeps/nacl/start.c
-@@ -44,6 +44,10 @@
- /* The application defines this, of course. */
- extern int main (int argc, char **argv, char **envp);
-
-+/* But maybe it defines this too, in which case it takes precedence. */
-+extern int __nacl_main (int argc, char **argv, char **envp)
-+ __attribute__ ((weak));
-+
- /* These are defined in libc. */
- extern int __libc_csu_init (int argc, char **argv, char **envp);
- extern void __libc_csu_fini (void);
-@@ -59,7 +63,7 @@ _start (uint32_t info[])
- {
- /* The generic code actually assumes that envp follows argv. */
-
-- __libc_start_main (&main,
-+ __libc_start_main (&__nacl_main ?: &main,
- nacl_startup_argc (info),
- nacl_startup_argv (info),
- nacl_startup_auxv (info),
-diff --git a/sysdeps/sparc/sparc32/sem_open.c b/sysdeps/sparc/sparc32/sem_open.c
-index 16cb9ad..59df2d7 100644
---- a/sysdeps/sparc/sparc32/sem_open.c
-+++ b/sysdeps/sparc/sparc32/sem_open.c
-@@ -29,6 +29,7 @@
- #include <sys/mman.h>
- #include <sys/stat.h>
- #include "semaphoreP.h"
-+#include <futex-internal.h>
- #include <shm-directory.h>
-
-
-diff --git a/sysdeps/unix/sysv/linux/hppa/bits/atomic.h b/sysdeps/unix/sysv/linux/hppa/bits/atomic.h
-index abde83e..6e73504 100644
---- a/sysdeps/unix/sysv/linux/hppa/bits/atomic.h
-+++ b/sysdeps/unix/sysv/linux/hppa/bits/atomic.h
-@@ -56,42 +56,41 @@ typedef uintmax_t uatomic_max_t;
- #define _LWS "0xb0"
- #define _LWS_CAS "0"
- /* Note r31 is the link register. */
--#define _LWS_CLOBBER "r1", "r26", "r25", "r24", "r23", "r22", "r21", "r20", "r28", "r31", "memory"
-+#define _LWS_CLOBBER "r1", "r23", "r22", "r20", "r31", "memory"
- /* String constant for -EAGAIN. */
- #define _ASM_EAGAIN "-11"
- /* String constant for -EDEADLOCK. */
- #define _ASM_EDEADLOCK "-45"
-
- #if __ASSUME_LWS_CAS
--/* The only basic operation needed is compare and exchange. */
-+/* The only basic operation needed is compare and exchange. The mem
-+ pointer must be word aligned. */
- # define atomic_compare_and_exchange_val_acq(mem, newval, oldval) \
- ({ \
-- volatile int lws_errno; \
-- __typeof__ (*mem) lws_ret; \
-- asm volatile( \
-+ register long lws_errno asm("r21"); \
-+ register unsigned long lws_ret asm("r28"); \
-+ register unsigned long lws_mem asm("r26") = (unsigned long)(mem); \
-+ register unsigned long lws_old asm("r25") = (unsigned long)(oldval);\
-+ register unsigned long lws_new asm("r24") = (unsigned long)(newval);\
-+ __asm__ __volatile__( \
- "0: \n\t" \
-- "copy %2, %%r26 \n\t" \
-- "copy %3, %%r25 \n\t" \
-- "copy %4, %%r24 \n\t" \
- "ble " _LWS "(%%sr2, %%r0) \n\t" \
- "ldi " _LWS_CAS ", %%r20 \n\t" \
-- "ldi " _ASM_EAGAIN ", %%r24 \n\t" \
-- "cmpb,=,n %%r24, %%r21, 0b \n\t" \
-+ "ldi " _ASM_EAGAIN ", %%r20 \n\t" \
-+ "cmpb,=,n %%r20, %%r21, 0b \n\t" \
- "nop \n\t" \
-- "ldi " _ASM_EDEADLOCK ", %%r25 \n\t" \
-- "cmpb,=,n %%r25, %%r21, 0b \n\t" \
-+ "ldi " _ASM_EDEADLOCK ", %%r20 \n\t" \
-+ "cmpb,=,n %%r20, %%r21, 0b \n\t" \
- "nop \n\t" \
-- "stw %%r28, %0 \n\t" \
-- "stw %%r21, %1 \n\t" \
-- : "=m" (lws_ret), "=m" (lws_errno) \
-- : "r" (mem), "r" (oldval), "r" (newval) \
-+ : "=r" (lws_ret), "=r" (lws_errno) \
-+ : "r" (lws_mem), "r" (lws_old), "r" (lws_new) \
- : _LWS_CLOBBER \
- ); \
- \
-- if(lws_errno == -EFAULT || lws_errno == -ENOSYS) \
-+ if (lws_errno == -EFAULT || lws_errno == -ENOSYS) \
- ABORT_INSTRUCTION; \
- \
-- lws_ret; \
-+ (__typeof (oldval)) lws_ret; \
- })
-
- # define atomic_compare_and_exchange_bool_acq(mem, newval, oldval) \
-diff --git a/sysdeps/unix/sysv/linux/microblaze/sysdep.h b/sysdeps/unix/sysv/linux/microblaze/sysdep.h
-index 83c0340..9d5c542 100644
---- a/sysdeps/unix/sysv/linux/microblaze/sysdep.h
-+++ b/sysdeps/unix/sysv/linux/microblaze/sysdep.h
-@@ -16,8 +16,11 @@
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-+#ifndef _LINUX_MICROBLAZE_SYSDEP_H
-+#define _LINUX_MICROBLAZE_SYSDEP_H 1
-+
-+#include <sysdeps/unix/sysdep.h>
- #include <sysdeps/microblaze/sysdep.h>
--#include <sys/syscall.h>
-
- /* Defines RTLD_PRIVATE_ERRNO. */
- #include <dl-sysdep.h>
-@@ -305,3 +308,5 @@ SYSCALL_ERROR_LABEL_DCL: \
- # define PTR_DEMANGLE(var) (void) (var)
-
- #endif /* not __ASSEMBLER__ */
-+
-+#endif /* _LINUX_MICROBLAZE_SYSDEP_H */
-diff --git a/sysdeps/unix/sysv/linux/openat.c b/sysdeps/unix/sysv/linux/openat.c
-index 6777123..ad8e31d 100644
---- a/sysdeps/unix/sysv/linux/openat.c
-+++ b/sysdeps/unix/sysv/linux/openat.c
-@@ -68,6 +68,11 @@ __OPENAT (int fd, const char *file, int oflag, ...)
- va_end (arg);
- }
-
-+ /* We have to add the O_LARGEFILE flag for openat64. */
-+#ifdef MORE_OFLAGS
-+ oflag |= MORE_OFLAGS;
-+#endif
-+
- return SYSCALL_CANCEL (openat, fd, file, oflag, mode);
- }
- libc_hidden_def (__OPENAT)