update gcc 6.3.1 binutils and glibc

This commit is contained in:
Weng Xuetian 2017-03-17 06:36:56 +00:00
parent 310950f74a
commit ca6e21201c
16 changed files with 118 additions and 1478 deletions

View File

@ -1,25 +1,23 @@
pkgname=binutils
pkgver=2.27
pkgrel=3
pkgver=2.28
pkgrel=1
_commit=7fa393306ed8b93019d225548474c0540b8928f7
pkgdesc="A set of programs to assemble and manipulate binary and object files"
arch=('x86_64')
url="http://www.gnu.org/software/binutils/"
license=('GPL')
groups=('base-devel')
depends=('glibc>=2.24' 'zlib')
depends=('glibc>=2.25' 'zlib')
makedepends=('git')
checkdepends=('dejagnu' 'bc')
conflicts=('binutils-multilib')
replaces=('binutils-multilib')
options=('!distcc' '!ccache' 'staticlibs')
install=binutils.install
#source=(ftp://ftp.gnu.org/gnu/binutils/binutils-${pkgver}.tar.bz2{,.sig}
# binutils-e9c1bdad.patch)
source=(git://sourceware.org/git/binutils-gdb.git#commit=2870b1ba)
options=('staticlibs' '!distcc' '!ccache')
source=(git+https://sourceware.org/git/binutils-gdb.git#commit=${_commit})
md5sums=('SKIP')
validpgpkeys=('EAF1C276A747E9ED86210CBAC3126D3B4AE55E93') # Tristan Gingold
prepare() {
cd ${srcdir}/binutils-gdb
cd binutils-gdb
# hack! - libiberty configure tests for header files using "$CPP $CPPFLAGS"
sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" libiberty/configure
@ -28,22 +26,29 @@ prepare() {
}
build() {
cd ${srcdir}/binutils-build
cd binutils-build
${srcdir}/binutils-gdb/configure --prefix=/usr \
../binutils-gdb/configure \
--prefix=/usr \
--with-lib-path=/usr/lib:/usr/local/lib \
--with-bugurl=http://chakralinux.org/bugtracker \
--enable-threads --enable-shared --with-pic \
--enable-ld=default --enable-gold --enable-plugins \
--disable-werror --disable-gdb # we have an extra gdb package, so we do not build gdb from binutils
--enable-threads \
--enable-shared \
--enable-ld=default \
--enable-gold \
--enable-plugins \
--enable-deterministic-archives \
--disable-werror \
--disable-gdb # we have an extra gdb package, so we do not build gdb from binutils
# check the host environment and makes sure all the necessary tools are available
make configure-host
make tooldir=/usr
}
check() {
cd ${srcdir}/binutils-build
cd binutils-build
# unset LDFLAGS as testsuite makes assumptions about which ones are active
# ignore failures in gold testsuite...
@ -51,7 +56,7 @@ check() {
}
package() {
cd ${srcdir}/binutils-build
cd binutils-build
make prefix=${pkgdir}/usr tooldir=${pkgdir}/usr install
# Remove unwanted files
@ -59,4 +64,6 @@ package() {
# No shared linking to these files outside binutils
rm ${pkgdir}/usr/lib/lib{bfd,opcodes}.so
echo "INPUT ( /usr/lib/libbfd.a -liberty -lz -ldl )" > "$pkgdir"/usr/lib/libbfd.so
echo "INPUT ( /usr/lib/libopcodes.a -lbfd )" > "$pkgdir"/usr/lib/libopcodes.so
}

View File

@ -1,47 +1,30 @@
# maintainer: Manuel Tortosa <manutortosa[at]chakra-project[dot]org>
pkgname=('gcc' 'gcc-libs' 'lib32-gcc-libs' 'gcc-fortran' 'gcc-objc' 'gcc-ada' 'gcc-go')
pkgver=5.2.0
_pkgver=5
_islver=0.14.1
pkgrel=9
#_snapshot=4.9-20140903
pkgver=6.3.1
_pkgver=6
_islver=0.16.1
pkgrel=1
_commit=4fc407888a30c5d953816b05c8a8e98ec2ab3101
pkgdesc="The GNU Compiler Collection"
arch=('x86_64')
license=('GPL' 'LGPL' 'FDL' 'custom')
url="http://gcc.gnu.org"
makedepends=('binutils>=2.25.1' 'libmpc' 'gcc-ada' 'doxygen' 'lib32-gcc-libs')
makedepends=('binutils>=2.28' 'libmpc' 'gcc-ada' 'doxygen' 'git' 'lib32-gcc-libs')
checkdepends=('dejagnu' 'inetutils')
options=('!emptydirs')
source=(ftp://gcc.gnu.org/pub/gcc/releases/gcc-${pkgver}/gcc-${pkgver}.tar.bz2
#ftp://gcc.gnu.org/pub/gcc/snapshots/${_snapshot}/gcc-${_snapshot}.tar.bz2
#http://isl.gforge.inria.fr/isl-${_islver}.tar.bz2
isl_0.15-1.patch
isl_0.15-2.patch
pr66035.patch)
md5sums=('a51bcfeb3da7dd4c623e27207ed43467'
'd37a0a5794bc1e1bb33a042619221109'
'3d79eb00e081193e1a30960a3d73e3c2'
'5b980076cd5fcbc3aff6014f306282dd')
if [ -n "${_snapshot}" ]; then
_basedir="${srcdir}/gcc-${_snapshot}"
else
_basedir="gcc-${pkgver}"
fi
source=(git+https://gcc.gnu.org/git/gcc.git#commit=${_commit}
http://isl.gforge.inria.fr/isl-${_islver}.tar.bz2)
md5sums=('SKIP'
'ac1f25a0677912952718a51f5bc20f32')
_libdir="usr/lib/gcc/$CHOST/$pkgver"
prepare() {
cd ${srcdir}/${_basedir}
# link isl for in-tree build ONLY USED FOR BOOSTRAPPING
# ln -s ../isl-${_islver} isl
# DIFFERENCE COMPARED TO ARCH
# we're NOT using isl for in-tree build
# 5.2 states that it supports isl 0.15 (as long as the patches are applied...)
cd ${srcdir}/gcc
# link isl for in-tree build
ln -s ../isl-${_islver} isl
# Do not run fixincludes
sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in
@ -49,24 +32,10 @@ prepare() {
# Arch Linux installs x86_64 libraries /lib, so do we
sed -i '/m64=/s/lib64/lib/' gcc/config/i386/t-linux64
echo ${pkgver} > gcc/BASE-VER
# hack! - some configure tests for header files using "$CPP $CPPFLAGS"
sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" {libiberty,gcc}/configure
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66035
patch -p1 -i ${srcdir}/pr66035.patch
# support isl 0.15
patch -p1 -i ${srcdir}/isl_0.15-1.patch
msg "fixing includes"
pushd gcc
patch -p1 -i ${srcdir}/isl_0.15-2.patch
popd
mkdir -p ${srcdir}/gcc-build
mkdir ${srcdir}/gcc-build
}
build() {
@ -77,19 +46,32 @@ build() {
CFLAGS=${CFLAGS/-pipe/}
CXXFLAGS=${CXXFLAGS/-pipe/}
${srcdir}/${_basedir}/configure --prefix=/usr \
--libdir=/usr/lib --libexecdir=/usr/lib \
--mandir=/usr/share/man --infodir=/usr/share/info \
${srcdir}/gcc/configure --prefix=/usr \
--libdir=/usr/lib \
--libexecdir=/usr/lib \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--with-bugurl=https://chakraos.org/bugtracker \
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ \
--enable-shared --enable-threads=posix --enable-libmpx \
--with-system-zlib --with-isl --enable-__cxa_atexit \
--disable-libunwind-exceptions --enable-clocale=gnu \
--disable-libstdcxx-pch --disable-libssp \
--enable-gnu-unique-object --enable-linker-build-id \
--enable-lto --enable-plugin --enable-install-libiberty \
--with-linker-hash-style=gnu --enable-gnu-indirect-function \
--enable-multilib --disable-werror \
--enable-shared \
--enable-threads=posix \
--enable-libmpx \
--with-system-zlib \
--with-isl \
--enable-__cxa_atexit \
--disable-libunwind-exceptions \
--enable-clocale=gnu \
--disable-libstdcxx-pch \
--disable-libssp \
--enable-gnu-unique-object \
--enable-linker-build-id \
--enable-lto \
--enable-plugin \
--enable-install-libiberty \
--with-linker-hash-style=gnu \
--enable-gnu-indirect-function \
--enable-multilib \
--disable-werror \
--enable-checking=release \
--with-default-libstdcxx-abi=gcc4-compatible
@ -108,14 +90,15 @@ check() {
# do not abort on error as some are "expected"
make -k check || true
${srcdir}/${_basedir}/contrib/test_summary
${srcdir}/gcc/contrib/test_summary
}
package_gcc-libs()
{
pkgdesc="Runtime libraries shipped by GCC"
groups=('base')
depends=('glibc>=2.20')
depends=('glibc>=2.25')
conflicts=('gcc-libs-multilib')
provides=('gcc-libs-multilib=${pkgver}')
replaces=('gcc-libs-multilib')
@ -126,10 +109,11 @@ package_gcc-libs()
make -C $CHOST/libgcc DESTDIR=${pkgdir} install-shared
rm ${pkgdir}/${_libdir}/libgcc_eh.a
for lib in libatomic \
libcilkrts \
libgfortran \
libgo \
libgomp \
libitm \
libquadmath \
@ -142,9 +126,12 @@ package_gcc-libs()
make -C $CHOST/libsanitizer/tsan DESTDIR=${pkgdir} install-toolexeclibLTLIBRARIES
make -C $CHOST/libobjc DESTDIR=${pkgdir} install-libs
make -C $CHOST/libstdc++-v3/po DESTDIR=${pkgdir} install
make -C $CHOST/libmpx DESTDIR=${pkgdir} install
rm ${pkgdir}/usr/lib/libmpx.spec
for lib in libgomp \
libitm \
libquadmath; do
@ -155,7 +142,7 @@ package_gcc-libs()
rm -r ${pkgdir}/usr/lib32
# Install Runtime Library Exception
install -Dm644 ${srcdir}/${_basedir}/COPYING.RUNTIME \
install -Dm644 ${srcdir}/gcc/COPYING.RUNTIME \
${pkgdir}/usr/share/licenses/gcc-libs/RUNTIME.LIBRARY.EXCEPTION
}
@ -173,6 +160,7 @@ package_lib32-gcc-libs()
for lib in libatomic \
libcilkrts \
libgfortran \
libgo \
libgomp \
libitm \
libquadmath \
@ -188,7 +176,7 @@ package_lib32-gcc-libs()
rm -r ${pkgdir}/usr/lib
# Install Runtime Library Exception
install -Dm644 ${srcdir}/${_basedir}/COPYING.RUNTIME \
install -Dm644 ${srcdir}/gcc/COPYING.RUNTIME \
${pkgdir}/usr/share/licenses/lib32-gcc-libs/RUNTIME.LIBRARY.EXCEPTION
}
@ -196,7 +184,7 @@ package_lib32-gcc-libs()
package_gcc()
{
pkgdesc="The GNU Compiler Collection - C and C++ frontends"
depends=("gcc-libs=$pkgver-$pkgrel" 'binutils>=2.24' 'libmpc' 'isl')
depends=("gcc-libs=$pkgver-$pkgrel" 'binutils>=2.28' 'libmpc' 'isl')
optdepends=("lib32-gcc-libs: to compile with -m32")
conflicts=('gcc-multilib')
provides=('gcc-multilib=${pkgver}')
@ -317,9 +305,9 @@ package_gcc-fortran()
install=gcc-fortran.install
cd ${srcdir}/gcc-build
make -C $CHOST/libgfortran DESTDIR=$pkgdir install-{caf,my}execlibLTLIBRARIES \
make -C $CHOST/libgfortran DESTDIR=$pkgdir install-cafexeclibLTLIBRARIES \
install-{toolexeclibDATA,nodist_fincludeHEADERS}
make -C $CHOST/32/libgfortran DESTDIR=$pkgdir install-{caf,my}execlibLTLIBRARIES \
make -C $CHOST/32/libgfortran DESTDIR=$pkgdir install-cafexeclibLTLIBRARIES \
install-{toolexeclibDATA,nodist_fincludeHEADERS}
make -C $CHOST/libgomp DESTDIR=$pkgdir install-nodist_fincludeHEADERS
make -C gcc DESTDIR=$pkgdir fortran.install-{common,man,info}

View File

@ -1,17 +0,0 @@
--- gcc/c-family/c-opts.c (revision 200330)
+++ gcc/c-family/c-opts.c (working copy)
@@ -1338,10 +1338,14 @@ c_finish_options (void)
/* Give CPP the next file given by -include, if any. */
static void
push_command_line_include (void)
{
+ // This can happen if disabled by -imacros for example.
+ if (include_cursor > deferred_count)
+ return;
+
if (!done_preinclude)
{
done_preinclude = true;
if (flag_hosted && std_inc && !cpp_opts->preprocessed)
{

View File

@ -1,71 +0,0 @@
diff -Naur gcc-4.9-20140604-old/gcc/graphite-clast-to-gimple.c gcc-4.9-20140604/gcc/graphite-clast-to-gimple.c
--- gcc-4.9-20140604-old/gcc/graphite-clast-to-gimple.c 2014-03-03 21:39:22.000000000 +1000
+++ gcc-4.9-20140604/gcc/graphite-clast-to-gimple.c 2014-06-25 15:07:57.958697105 +1000
@@ -28,6 +28,8 @@
#include <isl/constraint.h>
#include <isl/ilp.h>
#include <isl/aff.h>
+#include <isl/deprecated/int.h>
+#include <isl/deprecated/ilp_int.h>
#include <cloog/cloog.h>
#include <cloog/isl/domain.h>
#endif
diff -Naur gcc-4.9-20140604-old/gcc/graphite-interchange.c gcc-4.9-20140604/gcc/graphite-interchange.c
--- gcc-4.9-20140604-old/gcc/graphite-interchange.c 2014-01-03 08:23:26.000000000 +1000
+++ gcc-4.9-20140604/gcc/graphite-interchange.c 2014-06-25 15:10:06.882899243 +1000
@@ -29,6 +29,9 @@
#include <isl/map.h>
#include <isl/union_map.h>
#include <isl/ilp.h>
+#include <isl/deprecated/int.h>
+#include <isl/deprecated/ilp_int.h>
+#include <isl/deprecated/constraint_int.h>
#include <cloog/cloog.h>
#include <cloog/isl/domain.h>
#endif
diff -Naur gcc-4.9-20140604-old/gcc/graphite-optimize-isl.c gcc-4.9-20140604/gcc/graphite-optimize-isl.c
--- gcc-4.9-20140604-old/gcc/graphite-optimize-isl.c 2014-01-03 08:23:26.000000000 +1000
+++ gcc-4.9-20140604/gcc/graphite-optimize-isl.c 2014-06-25 15:16:57.038386166 +1000
@@ -28,6 +28,8 @@
#include <isl/band.h>
#include <isl/aff.h>
#include <isl/options.h>
+#include <isl/deprecated/int.h>
+#include <isl/deprecated/aff_int.h>
#endif
#include "system.h"
@@ -373,7 +375,7 @@
{
for (i = ScheduleDimensions - 1 ; i >= 0 ; i--)
{
- if (isl_band_member_is_zero_distance (Band, i))
+ if (isl_band_member_is_coincident (Band, i))
{
isl_map *TileMap;
isl_union_map *TileUMap;
diff -Naur gcc-4.9-20140604-old/gcc/graphite-poly.c gcc-4.9-20140604/gcc/graphite-poly.c
--- gcc-4.9-20140604-old/gcc/graphite-poly.c 2014-01-03 08:23:26.000000000 +1000
+++ gcc-4.9-20140604/gcc/graphite-poly.c 2014-06-25 15:18:01.207157796 +1000
@@ -28,6 +28,8 @@
#include <isl/constraint.h>
#include <isl/ilp.h>
#include <isl/aff.h>
+#include <isl/deprecated/int.h>
+#include <isl/deprecated/ilp_int.h>
#include <cloog/cloog.h>
#include <cloog/isl/domain.h>
#endif
diff -Naur gcc-4.9-20140604-old/gcc/graphite-sese-to-poly.c gcc-4.9-20140604/gcc/graphite-sese-to-poly.c
--- gcc-4.9-20140604-old/gcc/graphite-sese-to-poly.c 2014-04-08 20:59:40.000000000 +1000
+++ gcc-4.9-20140604/gcc/graphite-sese-to-poly.c 2014-06-25 15:19:46.575140398 +1000
@@ -26,6 +26,9 @@
#include <isl/union_map.h>
#include <isl/constraint.h>
#include <isl/aff.h>
+#include <isl/deprecated/int.h>
+#include <isl/deprecated/aff_int.h>
+#include <isl/deprecated/constraint_int.h>
#include <cloog/cloog.h>
#include <cloog/cloog.h>
#include <cloog/isl/domain.h>

View File

@ -1,228 +0,0 @@
---
gcc/config.in | 6 ++++++
gcc/configure | 31 +++++++++++++++++++++++++++++++
gcc/configure.ac | 14 ++++++++++++++
gcc/graphite-dependences.c | 14 +++++++-------
gcc/graphite-optimize-isl.c | 8 ++++++--
gcc/graphite-poly.h | 5 +++++
6 files changed, 69 insertions(+), 9 deletions(-)
diff --git a/gcc/config.in b/gcc/config.in
index b031a62..23e1757 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -1326,6 +1326,12 @@
#endif
+/* Define if isl_options_set_schedule_serialize_sccs exists. */
+#ifndef USED_FOR_TARGET
+#undef HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS
+#endif
+
+
/* Define if isl_schedule_constraints_compute_schedule exists. */
#ifndef USED_FOR_TARGET
#undef HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE
diff --git a/gcc/configure b/gcc/configure
index 9561e5c..6e81298 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -28456,6 +28456,8 @@ fi
# Check whether isl_schedule_constraints_compute_schedule is available;
# it's new in ISL-0.13.
+# Check whether isl_options_set_schedule_serialize_sccs is available;
+# it's new in ISL-0.15.
if test "x${ISLLIBS}" != "x" ; then
saved_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS $ISLINC"
@@ -28485,6 +28487,29 @@ rm -f core conftest.err conftest.$ac_objext \
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_has_isl_schedule_constraints_compute_schedule" >&5
$as_echo "$ac_has_isl_schedule_constraints_compute_schedule" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking Checking for isl_options_set_schedule_serialize_sccs" >&5
+$as_echo_n "checking Checking for isl_options_set_schedule_serialize_sccs... " >&6; }
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <isl/schedule.h>
+int
+main ()
+{
+isl_options_set_schedule_serialize_sccs (NULL, 0);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+ ac_has_isl_options_set_schedule_serialize_sccs=yes
+else
+ ac_has_isl_options_set_schedule_serialize_sccs=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_has_isl_options_set_schedule_serialize_sccs" >&5
+$as_echo "$ac_has_isl_options_set_schedule_serialize_sccs" >&6; }
+
LIBS="$saved_LIBS"
CXXFLAGS="$saved_CXXFLAGS"
@@ -28493,6 +28518,12 @@ $as_echo "$ac_has_isl_schedule_constraints_compute_schedule" >&6; }
$as_echo "#define HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE 1" >>confdefs.h
fi
+
+ if test x"$ac_has_isl_options_set_schedule_serialize_sccs" = x"yes"; then
+
+$as_echo "#define HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS 1" >>confdefs.h
+
+ fi
fi
# Check for plugin support
diff --git a/gcc/configure.ac b/gcc/configure.ac
index cb14639..7fb964a 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -5725,6 +5725,8 @@ fi
# Check whether isl_schedule_constraints_compute_schedule is available;
# it's new in ISL-0.13.
+# Check whether isl_options_set_schedule_serialize_sccs is available;
+# it's new in ISL-0.15.
if test "x${ISLLIBS}" != "x" ; then
saved_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS $ISLINC"
@@ -5738,6 +5740,13 @@ if test "x${ISLLIBS}" != "x" ; then
[ac_has_isl_schedule_constraints_compute_schedule=no])
AC_MSG_RESULT($ac_has_isl_schedule_constraints_compute_schedule)
+ AC_MSG_CHECKING([Checking for isl_options_set_schedule_serialize_sccs])
+ AC_TRY_LINK([#include <isl/schedule.h>],
+ [isl_options_set_schedule_serialize_sccs (NULL, 0);],
+ [ac_has_isl_options_set_schedule_serialize_sccs=yes],
+ [ac_has_isl_options_set_schedule_serialize_sccs=no])
+ AC_MSG_RESULT($ac_has_isl_options_set_schedule_serialize_sccs)
+
LIBS="$saved_LIBS"
CXXFLAGS="$saved_CXXFLAGS"
@@ -5745,6 +5754,11 @@ if test "x${ISLLIBS}" != "x" ; then
AC_DEFINE(HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE, 1,
[Define if isl_schedule_constraints_compute_schedule exists.])
fi
+
+ if test x"$ac_has_isl_options_set_schedule_serialize_sccs" = x"yes"; then
+ AC_DEFINE(HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS, 1,
+ [Define if isl_options_set_schedule_serialize_sccs exists.])
+ fi
fi
GCC_ENABLE_PLUGINS
diff --git a/gcc/graphite-dependences.c b/gcc/graphite-dependences.c
index 50fe73e..9a0986d 100644
--- a/gcc/graphite-dependences.c
+++ b/gcc/graphite-dependences.c
@@ -205,7 +205,7 @@ scop_get_transformed_schedule (scop_p scop, vec<poly_bb_p> pbbs)
/* Helper function used on each MAP of a isl_union_map. Computes the
maximal output dimension. */
-static int
+static isl_stat
max_number_of_out_dimensions (__isl_take isl_map *map, void *user)
{
int global_max = *((int *) user);
@@ -217,7 +217,7 @@ max_number_of_out_dimensions (__isl_take isl_map *map, void *user)
isl_map_free (map);
isl_space_free (space);
- return 0;
+ return isl_stat_ok;
}
/* Extends the output dimension of MAP to MAX dimensions. */
@@ -241,12 +241,12 @@ struct extend_schedule_str {
/* Helper function for extend_schedule. */
-static int
+static isl_stat
extend_schedule_1 (__isl_take isl_map *map, void *user)
{
struct extend_schedule_str *str = (struct extend_schedule_str *) user;
str->umap = isl_union_map_add_map (str->umap, extend_map (map, str->max));
- return 0;
+ return isl_stat_ok;
}
/* Return a relation that has uniform output dimensions. */
@@ -255,16 +255,16 @@ __isl_give isl_union_map *
extend_schedule (__isl_take isl_union_map *x)
{
int max = 0;
- int res;
+ isl_stat res;
struct extend_schedule_str str;
res = isl_union_map_foreach_map (x, max_number_of_out_dimensions, (void *) &max);
- gcc_assert (res == 0);
+ gcc_assert (res == isl_stat_ok);
str.max = max;
str.umap = isl_union_map_empty (isl_union_map_get_space (x));
res = isl_union_map_foreach_map (x, extend_schedule_1, (void *) &str);
- gcc_assert (res == 0);
+ gcc_assert (res == isl_stat_ok);
isl_union_map_free (x);
return str.umap;
diff --git a/gcc/graphite-optimize-isl.c b/gcc/graphite-optimize-isl.c
index f490401..388e25c 100644
--- a/gcc/graphite-optimize-isl.c
+++ b/gcc/graphite-optimize-isl.c
@@ -506,13 +506,13 @@ getScheduleMap (isl_schedule *Schedule, isl_union_map **map_sepcl)
return ScheduleMap;
}
-static int
+static isl_stat
getSingleMap (__isl_take isl_map *map, void *user)
{
isl_map **singleMap = (isl_map **) user;
*singleMap = map;
- return 0;
+ return isl_stat_ok;
}
static void
@@ -584,7 +584,11 @@ optimize_isl (scop_p scop)
isl_options_set_schedule_max_constant_term (scop->ctx, CONSTANT_BOUND);
isl_options_set_schedule_maximize_band_depth (scop->ctx, 1);
+#ifdef HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS
+ isl_options_set_schedule_serialize_sccs (scop->ctx, 1);
+#else
isl_options_set_schedule_fuse (scop->ctx, ISL_SCHEDULE_FUSE_MIN);
+#endif
isl_options_set_on_error (scop->ctx, ISL_ON_ERROR_CONTINUE);
#ifdef HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE
diff --git a/gcc/graphite-poly.h b/gcc/graphite-poly.h
index 7ffd18e..7022a1d 100644
--- a/gcc/graphite-poly.h
+++ b/gcc/graphite-poly.h
@@ -24,6 +24,11 @@ along with GCC; see the file COPYING3. If not see
#include "sese.h"
+#ifndef HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS
+# define isl_stat int
+# define isl_stat_ok 0
+#endif
+
typedef struct poly_dr *poly_dr_p;
typedef struct poly_bb *poly_bb_p;
--
2.4.4

View File

@ -1,112 +0,0 @@
diff --git a/graphite-blocking.c b/graphite-blocking.c
index dd3f03b..4557c9d 100644
--- a/graphite-blocking.c
+++ b/graphite-blocking.c
@@ -24,6 +24,7 @@ along with GCC; see the file COPYING3. If not see
#include "config.h"
#ifdef HAVE_isl
+#include <isl/constraint.h>
#include <isl/set.h>
#include <isl/map.h>
#include <isl/union_map.h>
diff --git a/graphite-dependences.c b/graphite-dependences.c
index daac777..45a85d9 100644
--- a/graphite-dependences.c
+++ b/graphite-dependences.c
@@ -22,6 +22,7 @@ along with GCC; see the file COPYING3. If not see
#include "config.h"
#ifdef HAVE_isl
+#include <isl/constraint.h>
#include <isl/set.h>
#include <isl/map.h>
#include <isl/union_map.h>
diff --git a/graphite-interchange.c b/graphite-interchange.c
index 4c1f908..374f944 100644
--- a/graphite-interchange.c
+++ b/graphite-interchange.c
@@ -24,6 +24,7 @@ along with GCC; see the file COPYING3. If not see
#include "config.h"
#ifdef HAVE_isl
+#include <isl/constraint.h>
#include <isl/aff.h>
#include <isl/set.h>
#include <isl/map.h>
diff --git a/graphite-isl-ast-to-gimple.c b/graphite-isl-ast-to-gimple.c
index 218c8c6..53adb6b 100644
--- a/graphite-isl-ast-to-gimple.c
+++ b/graphite-isl-ast-to-gimple.c
@@ -21,7 +21,9 @@ along with GCC; see the file COPYING3. If not see
#include "config.h"
#ifdef HAVE_isl
+#include <isl/constraint.h>
#include <isl/set.h>
+#include <isl/union_set.h>
#include <isl/map.h>
#include <isl/union_map.h>
#include <isl/ast_build.h>
diff --git a/graphite-optimize-isl.c b/graphite-optimize-isl.c
index f4506a2..f23c60f 100644
--- a/graphite-optimize-isl.c
+++ b/graphite-optimize-isl.c
@@ -21,7 +21,9 @@ along with GCC; see the file COPYING3. If not see
#include "config.h"
#ifdef HAVE_isl
+#include <isl/constraint.h>
#include <isl/set.h>
+#include <isl/union_set.h>
#include <isl/map.h>
#include <isl/union_map.h>
#include <isl/schedule.h>
diff --git a/graphite-poly.c b/graphite-poly.c
index a277a4f..1f8c60f 100644
--- a/graphite-poly.c
+++ b/graphite-poly.c
@@ -22,6 +22,7 @@ along with GCC; see the file COPYING3. If not see
#include "config.h"
#ifdef HAVE_isl
+#include <isl/constraint.h>
#include <isl/set.h>
#include <isl/map.h>
#include <isl/union_map.h>
diff --git a/graphite-scop-detection.c b/graphite-scop-detection.c
index 64e8c17..700f911 100644
--- a/graphite-scop-detection.c
+++ b/graphite-scop-detection.c
@@ -22,6 +22,7 @@ along with GCC; see the file COPYING3. If not see
#include "config.h"
#ifdef HAVE_isl
+#include <isl/constraint.h>
#include <isl/set.h>
#include <isl/map.h>
#include <isl/union_map.h>
diff --git a/graphite-sese-to-poly.c b/graphite-sese-to-poly.c
index e51db85..fc3c558 100644
--- a/graphite-sese-to-poly.c
+++ b/graphite-sese-to-poly.c
@@ -21,6 +21,7 @@ along with GCC; see the file COPYING3. If not see
#include "config.h"
#ifdef HAVE_isl
+#include <isl/constraint.h>
#include <isl/set.h>
#include <isl/map.h>
#include <isl/union_map.h>
diff --git a/graphite.c b/graphite.c
index c8f0617..a0cf455 100644
--- a/graphite.c
+++ b/graphite.c
@@ -35,6 +35,7 @@ along with GCC; see the file COPYING3. If not see
#include "config.h"
#ifdef HAVE_isl
+#include <isl/constraint.h>
#include <isl/set.h>
#include <isl/map.h>
#include <isl/options.h>

View File

@ -1,48 +0,0 @@
--- a/gcc/fortran/trans-expr.c
+++ a/gcc/fortran/trans-expr.c
@@ -6897,6 +6897,30 @@ alloc_scalar_allocatable_for_subcomponent_assignment (stmtblock_t *block,
TREE_TYPE (tmp), tmp,
fold_convert (TREE_TYPE (tmp), size));
}
+ else if (cm->ts.type == BT_CLASS)
+ {
+ gcc_assert (expr2->ts.type == BT_CLASS || expr2->ts.type == BT_DERIVED);
+ if (expr2->ts.type == BT_DERIVED)
+ {
+ tmp = gfc_get_symbol_decl (gfc_find_vtab (&expr2->ts));
+ tmp = gfc_build_addr_expr (NULL_TREE, tmp);
+ size = fold_convert (size_type_node, gfc_vptr_size_get (tmp));
+ }
+ else
+ {
+ gfc_expr *e2vtab;
+ gfc_se se;
+ e2vtab = gfc_find_and_cut_at_last_class_ref (expr2);
+ gfc_add_vptr_component (e2vtab);
+ gfc_add_size_component (e2vtab);
+ gfc_init_se (&se, NULL);
+ gfc_conv_expr (&se, e2vtab);
+ gfc_add_block_to_block (block, &se.pre);
+ size = fold_convert (size_type_node, se.expr);
+ gfc_free_expr (e2vtab);
+ }
+ size_in_bytes = size;
+ }
else
{
/* Otherwise use the length in bytes of the rhs. */
@@ -7068,6 +7092,14 @@ gfc_trans_subcomponent_assign (tree dest, gfc_component * cm, gfc_expr * expr,
tmp = gfc_build_memcpy_call (tmp, se.expr, size);
gfc_add_expr_to_block (&block, tmp);
}
+ else if (cm->ts.type == BT_CLASS && expr->ts.type == BT_CLASS)
+ {
+ tmp = gfc_copy_class_to_class (se.expr, dest, integer_one_node,
+ CLASS_DATA (cm)->attr.unlimited_polymorphic);
+ gfc_add_expr_to_block (&block, tmp);
+ gfc_add_modify (&block, gfc_class_vptr_get (dest),
+ gfc_class_vptr_get (se.expr));
+ }
else
gfc_add_modify (&block, tmp,
fold_convert (TREE_TYPE (tmp), se.expr));

View File

@ -1,99 +0,0 @@
From c903d7992134802ada495c137a4f1a2ac85af86e Mon Sep 17 00:00:00 2001
From: Allan McRae <allan@archlinux.org>
Date: Mon, 31 Oct 2016 15:10:23 +1000
Subject: [PATCH] Revert "Avoid an extra branch to PLT for -z now"
This reverts commit 6901def689b5c77465d34f07822989ec67e80c1e.
---
ChangeLog | 8 --------
config.h.in | 3 ---
configure | 4 ----
configure.ac | 3 ---
sysdeps/x86_64/sysdep.h | 8 ++------
5 files changed, 2 insertions(+), 24 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index b2f6372..e2119a3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2806,14 +2806,6 @@
(huge): Remove variable.
(__ceill): Do not force "inexact" exception.
-2016-05-24 H.J. Lu <hongjiu.lu@intel.com>
-
- * config.h.in (BIND_NOW): New.
- * configure.ac (BIND_NOW): New. Defined for --enable-bind-now.
- * configure: Regenerated.
- * sysdeps/x86_64/sysdep.h (JUMPTARGET)[BIND_NOW]: Defined to
- indirect branch via the GOT slot.
-
2016-05-24 Stefan Liebler <stli@linux.vnet.ibm.com>
[BZ #19765]
diff --git a/config.h.in b/config.h.in
index 856ef6a..b96a4ce 100644
--- a/config.h.in
+++ b/config.h.in
@@ -91,9 +91,6 @@
include/libc-symbols.h that avoid PLT slots in the shared objects. */
#undef NO_HIDDEN
-/* Define this to disable lazy relocations in DSOs. */
-#undef BIND_NOW
-
/* AArch64 big endian ABI */
#undef HAVE_AARCH64_BE
diff --git a/configure b/configure
index 17625e1..5cad071 100755
--- a/configure
+++ b/configure
@@ -3417,10 +3417,6 @@ else
fi
-if test "x$bindnow" = xyes; then
- $as_echo "#define BIND_NOW 1" >>confdefs.h
-
-fi
# Check whether --enable-static-nss was given.
if test "${enable_static_nss+set}" = set; then :
diff --git a/configure.ac b/configure.ac
index 33bcd62..33701fa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -231,9 +231,6 @@ AC_ARG_ENABLE([bind-now],
[bindnow=$enableval],
[bindnow=no])
AC_SUBST(bindnow)
-if test "x$bindnow" = xyes; then
- AC_DEFINE(BIND_NOW)
-fi
dnl On some platforms we cannot use dynamic loading. We must provide
dnl static NSS modules.
diff --git a/sysdeps/x86_64/sysdep.h b/sysdeps/x86_64/sysdep.h
index 75ac747..fbe3560 100644
--- a/sysdeps/x86_64/sysdep.h
+++ b/sysdeps/x86_64/sysdep.h
@@ -90,13 +90,9 @@ lose: \
#undef JUMPTARGET
#ifdef PIC
-# ifdef BIND_NOW
-# define JUMPTARGET(name) *name##@GOTPCREL(%rip)
-# else
-# define JUMPTARGET(name) name##@PLT
-# endif
+#define JUMPTARGET(name) name##@PLT
#else
-# define JUMPTARGET(name) name
+#define JUMPTARGET(name) name
#endif
/* Local label name for asm code. */
--
2.10.1

View File

@ -1,47 +1,37 @@
# maintainer: Manuel Tortosa <manutortosa[at]chakra-project[dot]org>
pkgname=glibc
pkgver=2.24
pkgver=2.25
pkgrel=1
_commit=69e0a87cc4c570e3b7218392fc3e743b5bddcce2
pkgdesc="GNU C Library"
arch=('x86_64')
url="http://www.gnu.org/software/libc"
license=('GPL' 'LGPL')
groups=('base')
depends=('linux-api-headers>=4.7' 'tzdata' 'filesystem>=2014.07')
depends=('linux-api-headers>=4.8' 'tzdata' 'filesystem>=2014.07')
makedepends=('gcc>=5.2' 'git')
backup=(etc/gai.conf
etc/locale.gen
etc/nscd.conf)
options=('!strip' 'staticlibs')
install=glibc.install
source=(git://sourceware.org/git/glibc.git#commit=fdfc9260
glibc-2.24-CVE-2016-6323.patch
0001-Revert-Avoid-an-extra-branch-to-PLT-for-z-now.patch
dtv_surplus.patch
source=(git+https://sourceware.org/git/glibc.git#commit=${_commit}
locale.gen.txt
locale-gen)
md5sums=('SKIP'
'489c4569da0ec0cce9fb73734a31323c'
'aa0c0742ea5de00c25dfae8868c1bc9b'
'6469cba12e2252e16e32db0353ed3f21'
'07ac979b6ab5eeb778d55f041529d623'
'476e9113489f93b348b21e144b6a8fcf')
prepare() {
cd ${srcdir}/${pkgname}
# build fails with PIE enabled toolchain
# https://sourceware.org/bugzilla/show_bug.cgi?id=20621
patch -p1 -i $srcdir/0001-Revert-Avoid-an-extra-branch-to-PLT-for-z-now.patch
# http://chakraos.org/bugtracker/index.php?do=details&task_id=1060&project=8
patch -p1 -i $srcdir/dtv_surplus.patch
mkdir glibc-build
# https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2016-6323
patch -p1 -i $srcdir/glibc-2.24-CVE-2016-6323.patch
mkdir ${srcdir}/glibc-build
cd glibc
# avoid crashes on i686 memchr-sse2.S
# https://sourceware.org/bugzilla/show_bug.cgi?id=21182
_revert_commit="23d27709a423aec32821e9a5198a10267107bae2"
_revert_file="sysdeps/i386/i686/multiarch/memchr-sse2.S"
git show ${_revert_commit} -- ${_revert_file} | git apply -R
}
build() {
@ -52,48 +42,50 @@ build() {
echo "sbindir=/usr/sbin" >> configparms
echo "rootsbindir=/usr/sbin" >> configparms
# remove hardening options for building libraries
CFLAGS=${CFLAGS/-fstack-protector-strong/}
# remove fortify for building libraries
CPPFLAGS=${CPPFLAGS/-D_FORTIFY_SOURCE=2/}
# this is handled properly by --enable-bind-now
LDFLAGS=${LDFLAGS/,-z,now/}
${srcdir}/${pkgname}/configure --prefix=/usr \
--libdir=/usr/lib --libexecdir=/usr/lib \
../${pkgname}/configure \
--prefix=/usr \
--libdir=/usr/lib \
--libexecdir=/usr/lib \
--with-headers=/usr/include \
--with-bugurl=https://chakralinux.org/bugtracker \
--enable-add-ons \
--enable-obsolete-rpc \
--enable-kernel=2.6.32 \
--enable-bind-now --disable-profile \
--enable-bind-now \
--disable-profile \
--enable-stackguard-randomization \
--enable-stack-protector=strong \
--enable-lock-elision \
--enable-multi-arch \
--disable-werror \
--enable-lock-elision
--disable-werror
# build libraries with hardening disabled
# build libraries with fortify disabled
echo "build-programs=no" >> configparms
make
# re-enable hardening for programs
# re-enable fortify 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
make
echo "CC += -D_FORTIFY_SOURCE=2" >> configparms
echo "CXX += -D_FORTIFY_SOURCE=2" >> configparms
make
}
check() {
cd ${srcdir}/glibc-build
cd glibc-build
# remove harding in preparation to run test-suite
# remove fortify in preparation to run test-suite
sed -i '/FORTIFY/d' configparms
make check &> ${srcdir}/checked || true
# some failures are "expected"
make check || true
}
package() {
cd ${srcdir}/glibc-build
cd glibc-build
install -dm755 ${pkgdir}/etc
touch ${pkgdir}/etc/ld.so.conf
@ -120,11 +112,6 @@ package() {
sed -e '1,3d' -e 's|/| |g' -e 's|\\| |g' -e 's|^|#|g' \
${srcdir}/glibc/localedata/SUPPORTED >> ${pkgdir}/etc/locale.gen
# 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/lib/lib{anl,BrokenLocale,nsl,resolv,rt,util}.a
# Do not strip the following files for improved debugging support
# ("improved" as in not breaking gdb and valgrind...):
# ld-${pkgver}.so
@ -139,14 +126,18 @@ package() {
usr/bin/{pcprofiledump,pldd,rpcgen,sprof} \
usr/lib/getconf/*
strip $STRIP_STATIC usr/lib/*.a
strip $STRIP_STATIC usr/lib/lib{anl,BrokenLocale,c{,_nonshared},crypt}.a \
usr/lib/lib{dl,g,ieee,mcheck,nsl,pthread{,_nonshared}}.a \
usr/lib/lib{resolv,rpcsvc,rt,util}.a
strip $STRIP_SHARED usr/lib/{libanl,libBrokenLocale,libcidn,libcrypt}-*.so \
strip $STRIP_SHARED usr/lib/lib{anl,BrokenLocale,cidn,crypt}-${pkgver}.so \
usr/lib/libnss_{compat,db,dns,files,hesiod,nis,nisplus}-*.so \
usr/lib/{libdl,libm,libnsl,libresolv,librt,libutil}-*.so \
usr/lib/{libmemusage,libpcprofile,libSegFault}.so \
usr/lib/{audit,gconv}/*.so \
usr/lib/libmvec-*.so || true
usr/lib/lib{dl,m,nsl,resolv,rt,util}-${pkgver}.so \
usr/lib/lib{memusage,pcprofile,SegFault}.so \
usr/lib/{audit,gconv}/*.so || true
strip $STRIP_STATIC usr/lib/lib{m-${pkgver},mvec{,_nonshared}}.a
strip $STRIP_SHARED usr/lib/libmvec-*.so
#
# add lib symlinks

View File

@ -1,32 +0,0 @@
#
# This is an experimental patch that should go into rawhide and
# Fedora 21 to fix failures where python applications fail to
# load graphics applications because of the slot usages for TLS.
# This should eventually go upstream.
#
# - Carlos O'Donell
#
diff -urN glibc-2.19-886-gdd763fd/sysdeps/generic/ldsodefs.h glibc-2.19-886-gdd763fd.mod/sysdeps/generic/ldsodefs.h
--- glibc-2.19-886-gdd763fd/sysdeps/generic/ldsodefs.h 2014-08-21 01:00:55.000000000 -0400
+++ glibc-2.19-886-gdd763fd.mod/sysdeps/generic/ldsodefs.h 2014-09-04 19:29:42.929692810 -0400
@@ -388,8 +388,18 @@
have to iterate beyond the first element in the slotinfo list. */
#define TLS_SLOTINFO_SURPLUS (62)
-/* Number of additional slots in the dtv allocated. */
-#define DTV_SURPLUS (14)
+/* Number of additional allocated dtv slots. This was initially
+ 14, but problems with python, MESA, and X11's uses of static TLS meant
+ that most distributions were very close to this limit when they loaded
+ dynamically interpreted languages that used graphics. The simplest
+ solution was to roughly double the number of slots. The actual static
+ image space usage was relatively small, for example in MESA you
+ had only two dispatch pointers for a total of 16 bytes. If we hit up
+ against this limit again we should start a campaign with the
+ distributions to coordinate the usage of static TLS. Any user of this
+ resource is effectively coordinating a global resource since this
+ surplus is allocated for each thread at startup. */
+#define DTV_SURPLUS (32)
/* Initial dtv of the main thread, not allocated with normal malloc. */
EXTERN void *_dl_initial_dtv;

View File

@ -1,88 +0,0 @@
Intel TSX is broken on Haswell based processors (erratum HSD136/HSW136)
and a microcode update is available to simply disable the corresponding
instructions.
While the responsability to continue or not using TSX should be left to
the users, a live microcode update will disable the TSX instructions
causing already started binaries to segfault. This patch simply disable
Intel TSX (HLE and RTM) on processors which might receive a microcode
update, so that it doesn't happen. We might expect newer steppings to
fix the issue, and if it is not the case the corresponding processors
will be shipped with TSX already disabled.
Author: Henrique de Moraes Holschuh <hmh@debian.org>
diff --git a/sysdeps/x86_64/multiarch/init-arch.c b/sysdeps/x86_64/multiarch/init-arch.c
index db74d97..6f61ae6 100644
--- a/sysdeps/x86_64/multiarch/init-arch.c
+++ b/sysdeps/x86_64/multiarch/init-arch.c
@@ -26,7 +26,7 @@ struct cpu_features __cpu_features attribute_hidden;
static void
-get_common_indeces (unsigned int *family, unsigned int *model)
+get_common_indeces (unsigned int *family, unsigned int *model, unsigned int *stepping)
{
__cpuid (1, __cpu_features.cpuid[COMMON_CPUID_INDEX_1].eax,
__cpu_features.cpuid[COMMON_CPUID_INDEX_1].ebx,
@@ -36,6 +36,7 @@ get_common_indeces (unsigned int *family, unsigned int *model)
unsigned int eax = __cpu_features.cpuid[COMMON_CPUID_INDEX_1].eax;
*family = (eax >> 8) & 0x0f;
*model = (eax >> 4) & 0x0f;
+ *stepping = eax & 0x0f;
}
@@ -47,6 +48,7 @@ __init_cpu_features (void)
unsigned int edx;
unsigned int family = 0;
unsigned int model = 0;
+ unsigned int stepping = 0;
enum cpu_features_kind kind;
__cpuid (0, __cpu_features.max_cpuid, ebx, ecx, edx);
@@ -56,7 +58,7 @@ __init_cpu_features (void)
{
kind = arch_kind_intel;
- get_common_indeces (&family, &model);
+ get_common_indeces (&family, &model, &stepping);
unsigned int eax = __cpu_features.cpuid[COMMON_CPUID_INDEX_1].eax;
unsigned int extended_family = (eax >> 20) & 0xff;
@@ -131,7 +133,7 @@ __init_cpu_features (void)
{
kind = arch_kind_amd;
- get_common_indeces (&family, &model);
+ get_common_indeces (&family, &model, &stepping);
ecx = __cpu_features.cpuid[COMMON_CPUID_INDEX_1].ecx;
@@ -179,6 +181,14 @@ __init_cpu_features (void)
}
}
+ /* Disable Intel TSX (HLE and RTM) due to erratum HSD136/HSW136
+ on Haswell processors, to work around outdated microcode that
+ doesn't disable the broken feature by default */
+ if (kind == arch_kind_intel && family == 6 &&
+ ((model == 63 && stepping <= 2) || (model == 60 && stepping <= 3) ||
+ (model == 69 && stepping <= 1) || (model == 70 && stepping <= 1)))
+ __cpu_features.cpuid[COMMON_CPUID_INDEX_7].ebx &= ~(bit_RTM | bit_HLE);
+
__cpu_features.family = family;
__cpu_features.model = model;
atomic_write_barrier ();
diff --git a/sysdeps/x86_64/multiarch/init-arch.h b/sysdeps/x86_64/multiarch/init-arch.h
index 793707a..e2745cb 100644
--- a/sysdeps/x86_64/multiarch/init-arch.h
+++ b/sysdeps/x86_64/multiarch/init-arch.h
@@ -41,6 +41,7 @@ #define bit_FMA4 (1 << 16)
/* COMMON_CPUID_INDEX_7. */
#define bit_RTM (1 << 11)
+#define bit_HLE (1 << 4)
#define bit_AVX2 (1 << 5)
/* XCR0 Feature flags. */

View File

@ -1,12 +0,0 @@
diff --git a/libio/wfileops.c b/libio/wfileops.c
index f123add..ebc06e8 100644
--- a/libio/wfileops.c
+++ b/libio/wfileops.c
@@ -711,6 +711,7 @@ do_ftell_wide (_IO_FILE *fp)
return WEOF;
offset += outstop - out;
+ free (out);
}
/* We don't trust _IO_read_end to represent the current file offset

View File

@ -1,29 +0,0 @@
diff --git a/sysdeps/unix/sysv/linux/ifaddrs.c b/sysdeps/unix/sysv/linux/ifaddrs.c
index 2c04e17..a47b2ed 100644
--- a/sysdeps/unix/sysv/linux/ifaddrs.c
+++ b/sysdeps/unix/sysv/linux/ifaddrs.c
@@ -770,20 +770,17 @@ getifaddrs_internal (struct ifaddrs **ifap)
if (cp != NULL)
{
- char c;
unsigned int preflen;
- if ((max_prefixlen > 0) &&
- (ifam->ifa_prefixlen > max_prefixlen))
+ if (ifam->ifa_prefixlen > max_prefixlen)
preflen = max_prefixlen;
else
preflen = ifam->ifa_prefixlen;
- for (i = 0; i < ((preflen - 1) / 8); i++)
+ for (i = 0; i < preflen / 8; i++)
*cp++ = 0xff;
- c = 0xff;
- c <<= ((128 - preflen) % 8);
- *cp = c;
+ if (preflen % 8)
+ *cp = 0xff << (8 - preflen % 8);
}
}
}

View File

@ -1,15 +0,0 @@
diff --git a/sysdeps/gnu/netinet/udp.h b/sysdeps/gnu/netinet/udp.h
index 32159cd..8cc1c60 100644
--- a/sysdeps/gnu/netinet/udp.h
+++ b/sysdeps/gnu/netinet/udp.h
@@ -78,6 +78,10 @@ struct udphdr
#define UDP_CORK 1 /* Never send partially complete segments. */
#define UDP_ENCAP 100 /* Set the socket to accept
encapsulated packets. */
+#define UDP_NO_CHECK6_TX 101 /* Disable sending checksum for UDP
+ over IPv6. */
+#define UDP_NO_CHECK6_RX 102 /* Disable accepting checksum for UDP
+ over IPv6. */
/* UDP encapsulation types */
#define UDP_ENCAP_ESPINUDP_NON_IKE 1 /* draft-ietf-ipsec-nat-t-ike-00/01 */

View File

@ -1,571 +0,0 @@
CVE-2015-7547
2016-02-15 Carlos O'Donell <carlos@redhat.com>
[BZ #18665]
* resolv/nss_dns/dns-host.c (gaih_getanswer_slice): Always set
*herrno_p.
(gaih_getanswer): Document functional behviour. Return tryagain
if any result is tryagain.
* resolv/res_query.c (__libc_res_nsearch): Set buffer size to zero
when freed.
* resolv/res_send.c: Add copyright text.
(__libc_res_nsend): Document that MAXPACKET is expected.
(send_vc): Document. Remove buffer reuse.
(send_dg): Document. Remove buffer reuse. Set *thisanssizp to set the
size of the buffer. Add Dprint for truncated UDP buffer.
diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
index a255d5e..47cfe27 100644
--- a/resolv/nss_dns/dns-host.c
+++ b/resolv/nss_dns/dns-host.c
@@ -1031,7 +1031,10 @@ gaih_getanswer_slice (const querybuf *answer, int anslen, const char *qname,
int h_namelen = 0;
if (ancount == 0)
- return NSS_STATUS_NOTFOUND;
+ {
+ *h_errnop = HOST_NOT_FOUND;
+ return NSS_STATUS_NOTFOUND;
+ }
while (ancount-- > 0 && cp < end_of_message && had_error == 0)
{
@@ -1208,7 +1211,14 @@ gaih_getanswer_slice (const querybuf *answer, int anslen, const char *qname,
/* Special case here: if the resolver sent a result but it only
contains a CNAME while we are looking for a T_A or T_AAAA record,
we fail with NOTFOUND instead of TRYAGAIN. */
- return canon == NULL ? NSS_STATUS_TRYAGAIN : NSS_STATUS_NOTFOUND;
+ if (canon != NULL)
+ {
+ *h_errnop = HOST_NOT_FOUND;
+ return NSS_STATUS_NOTFOUND;
+ }
+
+ *h_errnop = NETDB_INTERNAL;
+ return NSS_STATUS_TRYAGAIN;
}
@@ -1222,11 +1232,101 @@ gaih_getanswer (const querybuf *answer1, int anslen1, const querybuf *answer2,
enum nss_status status = NSS_STATUS_NOTFOUND;
+ /* Combining the NSS status of two distinct queries requires some
+ compromise and attention to symmetry (A or AAAA queries can be
+ returned in any order). What follows is a breakdown of how this
+ code is expected to work and why. We discuss only SUCCESS,
+ TRYAGAIN, NOTFOUND and UNAVAIL, since they are the only returns
+ that apply (though RETURN and MERGE exist). We make a distinction
+ between TRYAGAIN (recoverable) and TRYAGAIN' (not-recoverable).
+ A recoverable TRYAGAIN is almost always due to buffer size issues
+ and returns ERANGE in errno and the caller is expected to retry
+ with a larger buffer.
+
+ Lastly, you may be tempted to make significant changes to the
+ conditions in this code to bring about symmetry between responses.
+ Please don't change anything without due consideration for
+ expected application behaviour. Some of the synthesized responses
+ aren't very well thought out and sometimes appear to imply that
+ IPv4 responses are always answer 1, and IPv6 responses are always
+ answer 2, but that's not true (see the implemetnation of send_dg
+ and send_vc to see response can arrive in any order, particlarly
+ for UDP). However, we expect it holds roughly enough of the time
+ that this code works, but certainly needs to be fixed to make this
+ a more robust implementation.
+
+ ----------------------------------------------
+ | Answer 1 Status / | Synthesized | Reason |
+ | Answer 2 Status | Status | |
+ |--------------------------------------------|
+ | SUCCESS/SUCCESS | SUCCESS | [1] |
+ | SUCCESS/TRYAGAIN | TRYAGAIN | [5] |
+ | SUCCESS/TRYAGAIN' | SUCCESS | [1] |
+ | SUCCESS/NOTFOUND | SUCCESS | [1] |
+ | SUCCESS/UNAVAIL | SUCCESS | [1] |
+ | TRYAGAIN/SUCCESS | TRYAGAIN | [2] |
+ | TRYAGAIN/TRYAGAIN | TRYAGAIN | [2] |
+ | TRYAGAIN/TRYAGAIN' | TRYAGAIN | [2] |
+ | TRYAGAIN/NOTFOUND | TRYAGAIN | [2] |
+ | TRYAGAIN/UNAVAIL | TRYAGAIN | [2] |
+ | TRYAGAIN'/SUCCESS | SUCCESS | [3] |
+ | TRYAGAIN'/TRYAGAIN | TRYAGAIN | [3] |
+ | TRYAGAIN'/TRYAGAIN' | TRYAGAIN' | [3] |
+ | TRYAGAIN'/NOTFOUND | TRYAGAIN' | [3] |
+ | TRYAGAIN'/UNAVAIL | UNAVAIL | [3] |
+ | NOTFOUND/SUCCESS | SUCCESS | [3] |
+ | NOTFOUND/TRYAGAIN | TRYAGAIN | [3] |
+ | NOTFOUND/TRYAGAIN' | TRYAGAIN' | [3] |
+ | NOTFOUND/NOTFOUND | NOTFOUND | [3] |
+ | NOTFOUND/UNAVAIL | UNAVAIL | [3] |
+ | UNAVAIL/SUCCESS | UNAVAIL | [4] |
+ | UNAVAIL/TRYAGAIN | UNAVAIL | [4] |
+ | UNAVAIL/TRYAGAIN' | UNAVAIL | [4] |
+ | UNAVAIL/NOTFOUND | UNAVAIL | [4] |
+ | UNAVAIL/UNAVAIL | UNAVAIL | [4] |
+ ----------------------------------------------
+
+ [1] If the first response is a success we return success.
+ This ignores the state of the second answer and in fact
+ incorrectly sets errno and h_errno to that of the second
+ answer. However because the response is a success we ignore
+ *errnop and *h_errnop (though that means you touched errno on
+ success). We are being conservative here and returning the
+ likely IPv4 response in the first answer as a success.
+
+ [2] If the first response is a recoverable TRYAGAIN we return
+ that instead of looking at the second response. The
+ expectation here is that we have failed to get an IPv4 response
+ and should retry both queries.
+
+ [3] If the first response was not a SUCCESS and the second
+ response is not NOTFOUND (had a SUCCESS, need to TRYAGAIN,
+ or failed entirely e.g. TRYAGAIN' and UNAVAIL) then use the
+ result from the second response, otherwise the first responses
+ status is used. Again we have some odd side-effects when the
+ second response is NOTFOUND because we overwrite *errnop and
+ *h_errnop that means that a first answer of NOTFOUND might see
+ its *errnop and *h_errnop values altered. Whether it matters
+ in practice that a first response NOTFOUND has the wrong
+ *errnop and *h_errnop is undecided.
+
+ [4] If the first response is UNAVAIL we return that instead of
+ looking at the second response. The expectation here is that
+ it will have failed similarly e.g. configuration failure.
+
+ [5] Testing this code is complicated by the fact that truncated
+ second response buffers might be returned as SUCCESS if the
+ first answer is a SUCCESS. To fix this we add symmetry to
+ TRYAGAIN with the second response. If the second response
+ is a recoverable error we now return TRYAGIN even if the first
+ response was SUCCESS. */
+
if (anslen1 > 0)
status = gaih_getanswer_slice(answer1, anslen1, qname,
&pat, &buffer, &buflen,
errnop, h_errnop, ttlp,
&first);
+
if ((status == NSS_STATUS_SUCCESS || status == NSS_STATUS_NOTFOUND
|| (status == NSS_STATUS_TRYAGAIN
/* We want to look at the second answer in case of an
@@ -1242,8 +1342,15 @@ gaih_getanswer (const querybuf *answer1, int anslen1, const querybuf *answer2,
&pat, &buffer, &buflen,
errnop, h_errnop, ttlp,
&first);
+ /* Use the second response status in some cases. */
if (status != NSS_STATUS_SUCCESS && status2 != NSS_STATUS_NOTFOUND)
status = status2;
+ /* Do not return a truncated second response (unless it was
+ unavoidable e.g. unrecoverable TRYAGAIN). */
+ if (status == NSS_STATUS_SUCCESS
+ && (status2 == NSS_STATUS_TRYAGAIN
+ && *errnop == ERANGE && *h_errnop != NO_RECOVERY))
+ status = NSS_STATUS_TRYAGAIN;
}
return status;
diff --git a/resolv/res_query.c b/resolv/res_query.c
index 4a9b3b3..95470a9 100644
--- a/resolv/res_query.c
+++ b/resolv/res_query.c
@@ -396,6 +396,7 @@ __libc_res_nsearch(res_state statp,
{
free (*answerp2);
*answerp2 = NULL;
+ *nanswerp2 = 0;
*answerp2_malloced = 0;
}
}
@@ -447,6 +448,7 @@ __libc_res_nsearch(res_state statp,
{
free (*answerp2);
*answerp2 = NULL;
+ *nanswerp2 = 0;
*answerp2_malloced = 0;
}
@@ -521,6 +523,7 @@ __libc_res_nsearch(res_state statp,
{
free (*answerp2);
*answerp2 = NULL;
+ *nanswerp2 = 0;
*answerp2_malloced = 0;
}
if (saved_herrno != -1)
diff --git a/resolv/res_send.c b/resolv/res_send.c
index a968b95..21843f1 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -1,3 +1,20 @@
+/* Copyright (C) 2016 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/>. */
+
/*
* Copyright (c) 1985, 1989, 1993
* The Regents of the University of California. All rights reserved.
@@ -355,6 +372,8 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen,
#ifdef USE_HOOKS
if (__glibc_unlikely (statp->qhook || statp->rhook)) {
if (anssiz < MAXPACKET && ansp) {
+ /* Always allocate MAXPACKET, callers expect
+ this specific size. */
u_char *buf = malloc (MAXPACKET);
if (buf == NULL)
return (-1);
@@ -630,6 +649,77 @@ get_nsaddr (res_state statp, int n)
return (struct sockaddr *) (void *) &statp->nsaddr_list[n];
}
+/* The send_vc function is responsible for sending a DNS query over TCP
+ to the nameserver numbered NS from the res_state STATP i.e.
+ EXT(statp).nssocks[ns]. The function supports sending both IPv4 and
+ IPv6 queries at the same serially on the same socket.
+
+ Please note that for TCP there is no way to disable sending both
+ queries, unlike UDP, which honours RES_SNGLKUP and RES_SNGLKUPREOP
+ and sends the queries serially and waits for the result after each
+ sent query. This implemetnation should be corrected to honour these
+ options.
+
+ Please also note that for TCP we send both queries over the same
+ socket one after another. This technically violates best practice
+ since the server is allowed to read the first query, respond, and
+ then close the socket (to service another client). If the server
+ does this, then the remaining second query in the socket data buffer
+ will cause the server to send the client an RST which will arrive
+ asynchronously and the client's OS will likely tear down the socket
+ receive buffer resulting in a potentially short read and lost
+ response data. This will force the client to retry the query again,
+ and this process may repeat until all servers and connection resets
+ are exhausted and then the query will fail. It's not known if this
+ happens with any frequency in real DNS server implementations. This
+ implementation should be corrected to use two sockets by default for
+ parallel queries.
+
+ The query stored in BUF of BUFLEN length is sent first followed by
+ the query stored in BUF2 of BUFLEN2 length. Queries are sent
+ serially on the same socket.
+
+ Answers to the query are stored firstly in *ANSP up to a max of
+ *ANSSIZP bytes. If more than *ANSSIZP bytes are needed and ANSCP
+ is non-NULL (to indicate that modifying the answer buffer is allowed)
+ then malloc is used to allocate a new response buffer and ANSCP and
+ ANSP will both point to the new buffer. If more than *ANSSIZP bytes
+ are needed but ANSCP is NULL, then as much of the response as
+ possible is read into the buffer, but the results will be truncated.
+ When truncation happens because of a small answer buffer the DNS
+ packets header feild TC will bet set to 1, indicating a truncated
+ message and the rest of the socket data will be read and discarded.
+
+ Answers to the query are stored secondly in *ANSP2 up to a max of
+ *ANSSIZP2 bytes, with the actual response length stored in
+ *RESPLEN2. If more than *ANSSIZP bytes are needed and ANSP2
+ is non-NULL (required for a second query) then malloc is used to
+ allocate a new response buffer, *ANSSIZP2 is set to the new buffer
+ size and *ANSP2_MALLOCED is set to 1.
+
+ The ANSP2_MALLOCED argument will eventually be removed as the
+ change in buffer pointer can be used to detect the buffer has
+ changed and that the caller should use free on the new buffer.
+
+ Note that the answers may arrive in any order from the server and
+ therefore the first and second answer buffers may not correspond to
+ the first and second queries.
+
+ It is not supported to call this function with a non-NULL ANSP2
+ but a NULL ANSCP. Put another way, you can call send_vc with a
+ single unmodifiable buffer or two modifiable buffers, but no other
+ combination is supported.
+
+ It is the caller's responsibility to free the malloc allocated
+ buffers by detecting that the pointers have changed from their
+ original values i.e. *ANSCP or *ANSP2 has changed.
+
+ If errors are encountered then *TERRNO is set to an appropriate
+ errno value and a zero result is returned for a recoverable error,
+ and a less-than zero result is returned for a non-recoverable error.
+
+ If no errors are encountered then *TERRNO is left unmodified and
+ a the length of the first response in bytes is returned. */
static int
send_vc(res_state statp,
const u_char *buf, int buflen, const u_char *buf2, int buflen2,
@@ -639,11 +729,7 @@ send_vc(res_state statp,
{
const HEADER *hp = (HEADER *) buf;
const HEADER *hp2 = (HEADER *) buf2;
- u_char *ans = *ansp;
- int orig_anssizp = *anssizp;
- // XXX REMOVE
- // int anssiz = *anssizp;
- HEADER *anhp = (HEADER *) ans;
+ HEADER *anhp = (HEADER *) *ansp;
struct sockaddr *nsap = get_nsaddr (statp, ns);
int truncating, connreset, n;
/* On some architectures compiler might emit a warning indicating
@@ -731,6 +817,8 @@ send_vc(res_state statp,
* Receive length & response
*/
int recvresp1 = 0;
+ /* Skip the second response if there is no second query.
+ To do that we mark the second response as received. */
int recvresp2 = buf2 == NULL;
uint16_t rlen16;
read_len:
@@ -767,40 +855,14 @@ send_vc(res_state statp,
u_char **thisansp;
int *thisresplenp;
if ((recvresp1 | recvresp2) == 0 || buf2 == NULL) {
+ /* We have not received any responses
+ yet or we only have one response to
+ receive. */
thisanssizp = anssizp;
thisansp = anscp ?: ansp;
assert (anscp != NULL || ansp2 == NULL);
thisresplenp = &resplen;
} else {
- if (*anssizp != MAXPACKET) {
- /* No buffer allocated for the first
- reply. We can try to use the rest
- of the user-provided buffer. */
-#if __GNUC_PREREQ (4, 7)
- DIAG_PUSH_NEEDS_COMMENT;
- DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
-#endif
-#if _STRING_ARCH_unaligned
- *anssizp2 = orig_anssizp - resplen;
- *ansp2 = *ansp + resplen;
-#else
- int aligned_resplen
- = ((resplen + __alignof__ (HEADER) - 1)
- & ~(__alignof__ (HEADER) - 1));
- *anssizp2 = orig_anssizp - aligned_resplen;
- *ansp2 = *ansp + aligned_resplen;
-#endif
-#if __GNUC_PREREQ (4, 7)
- DIAG_POP_NEEDS_COMMENT;
-#endif
- } else {
- /* The first reply did not fit into the
- user-provided buffer. Maybe the second
- answer will. */
- *anssizp2 = orig_anssizp;
- *ansp2 = *ansp;
- }
-
thisanssizp = anssizp2;
thisansp = ansp2;
thisresplenp = resplen2;
@@ -804,10 +870,14 @@ send_vc(res_state statp,
anhp = (HEADER *) *thisansp;
*thisresplenp = rlen;
- if (rlen > *thisanssizp) {
- /* Yes, we test ANSCP here. If we have two buffers
- both will be allocatable. */
- if (__glibc_likely (anscp != NULL)) {
+ /* Is the answer buffer too small? */
+ if (*thisanssizp < rlen) {
+ /* If the current buffer is not the the static
+ user-supplied buffer then we can reallocate
+ it. */
+ if (thisansp != NULL && thisansp != ansp) {
+ /* Always allocate MAXPACKET, callers expect
+ this specific size. */
u_char *newp = malloc (MAXPACKET);
if (newp == NULL) {
*terrno = ENOMEM;
@@ -819,6 +889,9 @@ send_vc(res_state statp,
if (thisansp == ansp2)
*ansp2_malloced = 1;
anhp = (HEADER *) newp;
+ /* A uint16_t can't be larger than MAXPACKET
+ thus it's safe to allocate MAXPACKET but
+ read RLEN bytes instead. */
len = rlen;
} else {
Dprint(statp->options & RES_DEBUG,
@@ -948,6 +1021,66 @@ reopen (res_state statp, int *terrno, int ns)
return 1;
}
+/* The send_dg function is responsible for sending a DNS query over UDP
+ to the nameserver numbered NS from the res_state STATP i.e.
+ EXT(statp).nssocks[ns]. The function supports IPv4 and IPv6 queries
+ along with the ability to send the query in parallel for both stacks
+ (default) or serially (RES_SINGLKUP). It also supports serial lookup
+ with a close and reopen of the socket used to talk to the server
+ (RES_SNGLKUPREOP) to work around broken name servers.
+
+ The query stored in BUF of BUFLEN length is sent first followed by
+ the query stored in BUF2 of BUFLEN2 length. Queries are sent
+ in parallel (default) or serially (RES_SINGLKUP or RES_SNGLKUPREOP).
+
+ Answers to the query are stored firstly in *ANSP up to a max of
+ *ANSSIZP bytes. If more than *ANSSIZP bytes are needed and ANSCP
+ is non-NULL (to indicate that modifying the answer buffer is allowed)
+ then malloc is used to allocate a new response buffer and ANSCP and
+ ANSP will both point to the new buffer. If more than *ANSSIZP bytes
+ are needed but ANSCP is NULL, then as much of the response as
+ possible is read into the buffer, but the results will be truncated.
+ When truncation happens because of a small answer buffer the DNS
+ packets header feild TC will bet set to 1, indicating a truncated
+ message, while the rest of the UDP packet is discarded.
+
+ Answers to the query are stored secondly in *ANSP2 up to a max of
+ *ANSSIZP2 bytes, with the actual response length stored in
+ *RESPLEN2. If more than *ANSSIZP bytes are needed and ANSP2
+ is non-NULL (required for a second query) then malloc is used to
+ allocate a new response buffer, *ANSSIZP2 is set to the new buffer
+ size and *ANSP2_MALLOCED is set to 1.
+
+ The ANSP2_MALLOCED argument will eventually be removed as the
+ change in buffer pointer can be used to detect the buffer has
+ changed and that the caller should use free on the new buffer.
+
+ Note that the answers may arrive in any order from the server and
+ therefore the first and second answer buffers may not correspond to
+ the first and second queries.
+
+ It is not supported to call this function with a non-NULL ANSP2
+ but a NULL ANSCP. Put another way, you can call send_vc with a
+ single unmodifiable buffer or two modifiable buffers, but no other
+ combination is supported.
+
+ It is the caller's responsibility to free the malloc allocated
+ buffers by detecting that the pointers have changed from their
+ original values i.e. *ANSCP or *ANSP2 has changed.
+
+ If an answer is truncated because of UDP datagram DNS limits then
+ *V_CIRCUIT is set to 1 and the return value non-zero to indicate to
+ the caller to retry with TCP. The value *GOTSOMEWHERE is set to 1
+ if any progress was made reading a response from the nameserver and
+ is used by the caller to distinguish between ECONNREFUSED and
+ ETIMEDOUT (the latter if *GOTSOMEWHERE is 1).
+
+ If errors are encountered then *TERRNO is set to an appropriate
+ errno value and a zero result is returned for a recoverable error,
+ and a less-than zero result is returned for a non-recoverable error.
+
+ If no errors are encountered then *TERRNO is left unmodified and
+ a the length of the first response in bytes is returned. */
static int
send_dg(res_state statp,
const u_char *buf, int buflen, const u_char *buf2, int buflen2,
@@ -957,8 +1090,6 @@ send_dg(res_state statp,
{
const HEADER *hp = (HEADER *) buf;
const HEADER *hp2 = (HEADER *) buf2;
- u_char *ans = *ansp;
- int orig_anssizp = *anssizp;
struct timespec now, timeout, finish;
struct pollfd pfd[1];
int ptimeout;
@@ -991,6 +1122,8 @@ send_dg(res_state statp,
int need_recompute = 0;
int nwritten = 0;
int recvresp1 = 0;
+ /* Skip the second response if there is no second query.
+ To do that we mark the second response as received. */
int recvresp2 = buf2 == NULL;
pfd[0].fd = EXT(statp).nssocks[ns];
pfd[0].events = POLLOUT;
@@ -1154,55 +1287,56 @@ send_dg(res_state statp,
int *thisresplenp;
if ((recvresp1 | recvresp2) == 0 || buf2 == NULL) {
+ /* We have not received any responses
+ yet or we only have one response to
+ receive. */
thisanssizp = anssizp;
thisansp = anscp ?: ansp;
assert (anscp != NULL || ansp2 == NULL);
thisresplenp = &resplen;
} else {
- if (*anssizp != MAXPACKET) {
- /* No buffer allocated for the first
- reply. We can try to use the rest
- of the user-provided buffer. */
-#if _STRING_ARCH_unaligned
- *anssizp2 = orig_anssizp - resplen;
- *ansp2 = *ansp + resplen;
-#else
- int aligned_resplen
- = ((resplen + __alignof__ (HEADER) - 1)
- & ~(__alignof__ (HEADER) - 1));
- *anssizp2 = orig_anssizp - aligned_resplen;
- *ansp2 = *ansp + aligned_resplen;
-#endif
- } else {
- /* The first reply did not fit into the
- user-provided buffer. Maybe the second
- answer will. */
- *anssizp2 = orig_anssizp;
- *ansp2 = *ansp;
- }
-
thisanssizp = anssizp2;
thisansp = ansp2;
thisresplenp = resplen2;
}
if (*thisanssizp < MAXPACKET
- /* Yes, we test ANSCP here. If we have two buffers
- both will be allocatable. */
- && anscp
+ /* If the current buffer is not the the static
+ user-supplied buffer then we can reallocate
+ it. */
+ && (thisansp != NULL && thisansp != ansp)
#ifdef FIONREAD
+ /* Is the size too small? */
&& (ioctl (pfd[0].fd, FIONREAD, thisresplenp) < 0
|| *thisanssizp < *thisresplenp)
#endif
) {
+ /* Always allocate MAXPACKET, callers expect
+ this specific size. */
u_char *newp = malloc (MAXPACKET);
if (newp != NULL) {
- *anssizp = MAXPACKET;
- *thisansp = ans = newp;
+ *thisanssizp = MAXPACKET;
+ *thisansp = newp;
if (thisansp == ansp2)
*ansp2_malloced = 1;
}
}
+ /* We could end up with truncation if anscp was NULL
+ (not allowed to change caller's buffer) and the
+ response buffer size is too small. This isn't a
+ reliable way to detect truncation because the ioctl
+ may be an inaccurate report of the UDP message size.
+ Therefore we use this only to issue debug output.
+ To do truncation accurately with UDP we need
+ MSG_TRUNC which is only available on Linux. We
+ can abstract out the Linux-specific feature in the
+ future to detect truncation. */
+ if (__glibc_unlikely (*thisanssizp < *thisresplenp)) {
+ Dprint(statp->options & RES_DEBUG,
+ (stdout, ";; response may be truncated (UDP)\n")
+ );
+ }
+
HEADER *anhp = (HEADER *) *thisansp;
socklen_t fromlen = sizeof(struct sockaddr_in6);
assert (sizeof(from) <= fromlen);

View File

@ -1,24 +0,0 @@
diff --git a/sysdeps/unix/sysv/linux/arm/setcontext.S b/sysdeps/unix/sysv/linux/arm/setcontext.S
index 603e508..d1f168f 100644
--- a/sysdeps/unix/sysv/linux/arm/setcontext.S
+++ b/sysdeps/unix/sysv/linux/arm/setcontext.S
@@ -86,12 +86,19 @@ weak_alias(__setcontext, setcontext)
/* Called when a makecontext() context returns. Start the
context in R4 or fall through to exit(). */
+ /* Unwind descriptors are looked up based on PC - 2, so we have to
+ make sure to mark the instruction preceding the __startcontext
+ label as .cantunwind. */
+ .fnstart
+ .cantunwind
+ nop
ENTRY(__startcontext)
movs r0, r4
bne PLTJMP(__setcontext)
@ New context was 0 - exit
b PLTJMP(HIDDEN_JUMPTARGET(exit))
+ .fnend
END(__startcontext)
#ifdef PIC