glibc: Upgrade to 2.23

Drop kconfig and options-group support
Forward port cross-localedef support
Assume ssp support in libc when building gcc-initial

(From OE-Core rev: 9c3d461c4d54d684b38ec4c038a1c3c2fb9923f0)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Khem Raj 2016-01-02 21:37:22 +00:00 committed by Richard Purdie
parent c1f9507c69
commit 91a1baaf57
47 changed files with 816 additions and 20510 deletions

View File

@ -22,11 +22,11 @@ PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}libc-initial = "${TCLIBC}-initial"
PREFERRED_PROVIDER_virtual/nativesdk-${SDK_PREFIX}libc-initial ?= "nativesdk-glibc-initial"
PREFERRED_PROVIDER_virtual/gettext ??= "gettext"
GCCVERSION ?= "5.%"
GCCVERSION ?= "5.3%"
SDKGCCVERSION ?= "${GCCVERSION}"
BINUVERSION ?= "2.26%"
GDBVERSION ?= "7.10%"
GLIBCVERSION ?= "2.22"
GLIBCVERSION ?= "2.23"
UCLIBCVERSION ?= "1.0%"
LINUXLIBCVERSION ?= "4.4"

View File

@ -24,22 +24,19 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
${EGLIBCPATCHES} \
"
EGLIBCPATCHES = "\
file://0017-timezone-re-written-tzselect-as-posix-sh.patch \
file://0016-timezone-re-written-tzselect-as-posix-sh.patch \
file://0017-Remove-bash-dependency-for-nscd-init-script.patch \
file://0018-eglibc-Cross-building-and-testing-instructions.patch \
file://0019-eglibc-Bring-Eglibc-option-group-infrastructure-to-g.patch \
file://0020-eglibc-Help-bootstrap-cross-toolchain.patch \
file://0021-eglibc-cherry-picked-from-http-www.eglibc.org-archiv.patch \
file://0022-eglibc-Clear-cache-lines-on-ppc8xx.patch \
file://0023-eglibc-Resolve-__fpscr_values-on-SH4.patch \
file://0024-eglibc-Forward-port-eglibc-options-groups-support.patch \
file://0025-eglibc-Install-PIC-archives.patch \
file://0026-eglibc-dl_debug_mask-is-controlled-by-__OPTION_EGLIB.patch \
file://0027-eglibc-use-option-groups-Conditionally-exclude-c-tes.patch \
file://strcoll-Remove-incorrect-STRDIFF-based-optimization-.patch \
file://0019-eglibc-Help-bootstrap-cross-toolchain.patch \
file://0020-eglibc-cherry-picked-from.patch \
file://0021-eglibc-Clear-cache-lines-on-ppc8xx.patch \
file://0022-eglibc-Resolve-__fpscr_values-on-SH4.patch \
file://0023-eglibc-Install-PIC-archives.patch \
file://0025-eglibc-Forward-port-cross-locale-generation-support.patch \
"
SRCREV_glibc ?= "a34d1c6afc86521d6ad17662a3b5362d8481514c"
SRCREV_localedef ?= "c833367348d39dad7ba018990bfdaffaec8e9ed3"
SRCREV_glibc ?= "e742928c1592b43db6809db4f39e67be151cdd27"
SRCREV_localedef ?= "5a81ff9f06a7a808d4c3d37bbf34077a4c5902ed"
# Makes for a rather long rev (22 characters), but...
#

View File

@ -16,7 +16,6 @@ do_configure () {
--prefix=/usr \
--without-cvs --disable-sanity-checks \
--with-headers=${STAGING_DIR_TARGET}${includedir} \
--with-kconfig=${STAGING_BINDIR_NATIVE} \
--enable-hacker-mode --enable-addons
}

View File

@ -1,8 +1,6 @@
require glibc_${PV}.bb
require glibc-initial.inc
DEPENDS += "kconfig-frontends-native"
# main glibc recipes muck with TARGET_CPPFLAGS to point into
# final target sysroot but we
# are not there when building glibc-initial

View File

@ -1,162 +0,0 @@
def glibc_cfg(feature, tokens, cnf):
if type(tokens) == type(""):
tokens = [tokens]
if feature:
cnf.extend([token + '=y' for token in tokens])
else:
for token in tokens:
cnf.extend([token + '=n'])
if token == 'OPTION_EGLIBC_NSSWITCH':
cnf.extend(["OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG=\"${S}/nss/nsswitch.conf\""])
cnf.extend(["OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS=\"${S}/nss/fixed-nsswitch.functions\""])
# Map distro features to glibc options settings
def features_to_glibc_settings(d):
cnf = ([])
ipv4 = bb.utils.contains('DISTRO_FEATURES', 'ipv4', True, False, d)
ipv6 = bb.utils.contains('DISTRO_FEATURES', 'ipv6', True, False, d)
libc_backtrace = bb.utils.contains('DISTRO_FEATURES', 'libc-backtrace', True, False, d)
libc_big_macros = bb.utils.contains('DISTRO_FEATURES', 'libc-big-macros', True, False, d)
libc_bsd = bb.utils.contains('DISTRO_FEATURES', 'libc-bsd', True, False, d)
libc_cxx_tests = bb.utils.contains('DISTRO_FEATURES', 'libc-cxx-tests', True, False, d)
libc_catgets = bb.utils.contains('DISTRO_FEATURES', 'libc-catgets', True, False, d)
libc_charsets = bb.utils.contains('DISTRO_FEATURES', 'libc-charsets', True, False, d)
libc_crypt = bb.utils.contains('DISTRO_FEATURES', 'libc-crypt', True, False, d)
libc_crypt_ufc = bb.utils.contains('DISTRO_FEATURES', 'libc-crypt-ufc', True, False, d)
libc_db_aliases = bb.utils.contains('DISTRO_FEATURES', 'libc-db-aliases', True, False, d)
libc_envz = bb.utils.contains('DISTRO_FEATURES', 'libc-envz', True, False, d)
libc_fcvt = bb.utils.contains('DISTRO_FEATURES', 'libc-fcvt', True, False, d)
libc_fmtmsg = bb.utils.contains('DISTRO_FEATURES', 'libc-fmtmsg', True, False, d)
libc_fstab = bb.utils.contains('DISTRO_FEATURES', 'libc-fstab', True, False, d)
libc_ftraverse = bb.utils.contains('DISTRO_FEATURES', 'libc-ftraverse', True, False, d)
libc_getlogin = bb.utils.contains('DISTRO_FEATURES', 'libc-getlogin', True, False, d)
libc_idn = bb.utils.contains('DISTRO_FEATURES', 'libc-idn', True, False, d)
libc_inet_anl = bb.utils.contains('DISTRO_FEATURES', 'libc-inet-anl', True, False, d)
libc_libm = bb.utils.contains('DISTRO_FEATURES', 'libc-libm', True, False, d)
libc_locales = bb.utils.contains('DISTRO_FEATURES', 'libc-locales', True, False, d)
libc_locale_code = bb.utils.contains('DISTRO_FEATURES', 'libc-locale-code', True, False, d)
libc_memusage = bb.utils.contains('DISTRO_FEATURES', 'libc-memusage', True, False, d)
libc_nis = bb.utils.contains('DISTRO_FEATURES', 'libc-nis', True, False, d)
libc_nsswitch = bb.utils.contains('DISTRO_FEATURES', 'libc-nsswitch', True, False, d)
libc_rcmd = bb.utils.contains('DISTRO_FEATURES', 'libc-rcmd', True, False, d)
libc_rtld_debug = bb.utils.contains('DISTRO_FEATURES', 'libc-rtld-debug', True, False, d)
libc_spawn = bb.utils.contains('DISTRO_FEATURES', 'libc-spawn', True, False, d)
libc_streams = bb.utils.contains('DISTRO_FEATURES', 'libc-streams', True, False, d)
libc_sunrpc = bb.utils.contains('DISTRO_FEATURES', 'libc-sunrpc', True, False, d)
libc_utmp = bb.utils.contains('DISTRO_FEATURES', 'libc-utmp', True, False, d)
libc_utmpx = bb.utils.contains('DISTRO_FEATURES', 'libc-utmpx', True, False, d)
libc_wordexp = bb.utils.contains('DISTRO_FEATURES', 'libc-wordexp', True, False, d)
libc_posix_clang_wchar = bb.utils.contains('DISTRO_FEATURES', 'libc-posix-clang-wchar', True, False, d)
libc_posix_regexp = bb.utils.contains('DISTRO_FEATURES', 'libc-posix-regexp', True, False, d)
libc_posix_regexp_glibc = bb.utils.contains('DISTRO_FEATURES', 'libc-posix-regexp-glibc', True, False, d)
libc_posix_wchar_io = bb.utils.contains('DISTRO_FEATURES', 'libc-posix-wchar-io', True, False, d)
# arrange the dependencies among glibc configuable options according to file option-groups.def from glibc source code
new_dep = True
while new_dep:
new_dep = False
if ipv6 and not ipv4:
new_dep = True
ipv4 = True
if ipv4 and not libc_nsswitch:
new_dep = True
libc_nsswitch = True
if libc_cxx_tests:
if not libc_posix_wchar_io:
new_dep = True
libc_posix_wchar_io = True
if not libc_libm:
new_dep = True
libc_libm = True
if libc_catgets and not libc_locale_code:
new_dep = True
libc_locale_code = True
if libc_crypt_ufc and not libc_crypt:
new_dep = True
libc_crypt = True
if libc_getlogin and not libc_utmp:
new_dep = True
libc_utmp = True
if libc_inet_anl and not ipv4:
new_dep = True
ipv4 = True
if libc_locale_code and not libc_posix_clang_wchar:
new_dep = True
libc_posix_clang_wchar = True
if libc_nis:
if not ipv4:
new_dep = True
ipv4 = True
if not libc_sunrpc:
new_dep = True
libc_sunrpc = True
if libc_rcmd and not ipv4:
new_dep = True
ipv4 = True
if libc_sunrpc and not ipv4:
new_dep = True
ipv4 = True
if libc_utmpx and not libc_utmp:
new_dep = True
libc_utmp = True
if libc_posix_regexp_glibc and not libc_posix_regexp:
new_dep = True
libc_posix_regexp = True
if libc_posix_wchar_io and not libc_posix_clang_wchar:
new_dep = True
libc_posix_clang_wchar = True
glibc_cfg(ipv6, 'OPTION_EGLIBC_ADVANCED_INET6', cnf)
glibc_cfg(libc_backtrace, 'OPTION_EGLIBC_BACKTRACE', cnf)
glibc_cfg(libc_big_macros, 'OPTION_EGLIBC_BIG_MACROS', cnf)
glibc_cfg(libc_bsd, 'OPTION_EGLIBC_BSD', cnf)
glibc_cfg(libc_cxx_tests, 'OPTION_EGLIBC_CXX_TESTS', cnf)
glibc_cfg(libc_catgets, 'OPTION_EGLIBC_CATGETS', cnf)
glibc_cfg(libc_charsets, 'OPTION_EGLIBC_CHARSETS', cnf)
glibc_cfg(libc_crypt, 'OPTION_EGLIBC_CRYPT', cnf)
glibc_cfg(libc_crypt_ufc, 'OPTION_EGLIBC_CRYPT_UFC', cnf)
glibc_cfg(libc_db_aliases, 'OPTION_EGLIBC_DB_ALIASES', cnf)
glibc_cfg(libc_envz, 'OPTION_EGLIBC_ENVZ', cnf)
glibc_cfg(libc_fcvt, 'OPTION_EGLIBC_FCVT', cnf)
glibc_cfg(libc_fmtmsg, 'OPTION_EGLIBC_FMTMSG', cnf)
glibc_cfg(libc_fstab, 'OPTION_EGLIBC_FSTAB', cnf)
glibc_cfg(libc_ftraverse, 'OPTION_EGLIBC_FTRAVERSE', cnf)
glibc_cfg(libc_getlogin, 'OPTION_EGLIBC_GETLOGIN', cnf)
glibc_cfg(libc_idn, 'OPTION_EGLIBC_IDN', cnf)
glibc_cfg(ipv4, 'OPTION_EGLIBC_INET', cnf)
glibc_cfg(libc_inet_anl, 'OPTION_EGLIBC_INET_ANL', cnf)
glibc_cfg(libc_libm, 'OPTION_EGLIBC_LIBM', cnf)
glibc_cfg(libc_locales, 'OPTION_EGLIBC_LOCALES', cnf)
glibc_cfg(libc_locale_code, 'OPTION_EGLIBC_LOCALE_CODE', cnf)
glibc_cfg(libc_memusage, 'OPTION_EGLIBC_MEMUSAGE', cnf)
glibc_cfg(libc_nis, 'OPTION_EGLIBC_NIS', cnf)
glibc_cfg(libc_nsswitch, 'OPTION_EGLIBC_NSSWITCH', cnf)
glibc_cfg(libc_rcmd, 'OPTION_EGLIBC_RCMD', cnf)
glibc_cfg(libc_rtld_debug, 'OPTION_EGLIBC_RTLD_DEBUG', cnf)
glibc_cfg(libc_spawn, 'OPTION_EGLIBC_SPAWN', cnf)
glibc_cfg(libc_streams, 'OPTION_EGLIBC_STREAMS', cnf)
glibc_cfg(libc_sunrpc, 'OPTION_EGLIBC_SUNRPC', cnf)
glibc_cfg(libc_utmp, 'OPTION_EGLIBC_UTMP', cnf)
glibc_cfg(libc_utmpx, 'OPTION_EGLIBC_UTMPX', cnf)
glibc_cfg(libc_wordexp, 'OPTION_EGLIBC_WORDEXP', cnf)
glibc_cfg(libc_posix_clang_wchar, 'OPTION_POSIX_C_LANG_WIDE_CHAR', cnf)
glibc_cfg(libc_posix_regexp, 'OPTION_POSIX_REGEXP', cnf)
glibc_cfg(libc_posix_regexp_glibc, 'OPTION_POSIX_REGEXP_GLIBC', cnf)
glibc_cfg(libc_posix_wchar_io, 'OPTION_POSIX_WIDE_CHAR_DEVICE_IO', cnf)
return "\n".join(cnf)

View File

@ -44,12 +44,6 @@ DEPENDS = "virtual/${TARGET_PREFIX}gcc-initial libgcc-initial linux-libc-headers
PROVIDES = "virtual/libc virtual/${TARGET_PREFIX}libc-for-gcc"
PROVIDES += "virtual/libintl virtual/libiconv"
inherit autotools texinfo distro_features_check systemd
require glibc-options.inc
# The main purpose of setting this variable is to prevent users from accidently
# overriding DISTRO_FEATRUES, causing obscure build failures because of lack
# of libc functions.
REQUIRED_DISTRO_FEATURES = "${DISTRO_FEATURES_LIBC}"
LEAD_SONAME = "libc.so"
@ -58,6 +52,7 @@ CACHED_CONFIGUREVARS += " \
libc_cv_slibdir=${base_libdir} \
libc_cv_rootsbindir=${base_sbindir} \
libc_cv_localedir=${localedir} \
libc_cv_ssp_strong=no \
libc_cv_ssp=no \
"
@ -82,18 +77,8 @@ PARALLEL_MAKE = ""
# ensure make uses /bin/bash
EXTRA_OEMAKE += "SHELL=/bin/bash"
OE_FEATURES = "${@features_to_glibc_settings(d)}"
do_configure_prepend() {
sed -e "s#@BASH@#/bin/sh#" -i ${S}/elf/ldd.bash.in
echo '${OE_FEATURES}' > ${B}/option-groups.config
}
do_configure_append() {
yes '' | oe_runmake config
# Remove quotation marks from OPTION_EGLIBC_NSSWITCH_FIXED_*. This will
# avoid install error.
sed -i 's/^OPTION_EGLIBC_NSSWITCH_FIXED_\(.*\)="\(.*\)"$/OPTION_EGLIBC_NSSWITCH_FIXED_\1=\2/' option-groups.config
}
GLIBC_ADDONS ?= "nptl,libidn"

View File

@ -1,7 +1,7 @@
From 0876fea1b5b26da84f298714a2e23ba696607dba Mon Sep 17 00:00:00 2001
From 66d04e2cd8badb0984050e4e9f2732f47151fbbf Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 18 Mar 2015 01:48:24 +0000
Subject: [PATCH 01/27] nativesdk-glibc: Look for host system ld.so.cache as
Subject: [PATCH 01/24] nativesdk-glibc: Look for host system ld.so.cache as
well
Upstream-Status: Inappropriate [embedded specific]
@ -27,18 +27,17 @@ RP 14/10/2010
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
elf/dl-load.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
elf/dl-load.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 0c052e4..f45085a 100644
index 6fb615e..ee3d1e6 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -2040,7 +2040,14 @@ _dl_map_object (struct link_map *loader, const char *name,
fd = open_path (name, namelen, mode,
&loader->l_runpath_dirs, &realname, &fb, loader,
LA_SER_RUNPATH, &found_other_class);
-
@@ -2094,6 +2094,14 @@ _dl_map_object (struct link_map *loader, const char *name,
}
}
+ /* try the default path. */
+ if (fd == -1
+ && ((l = loader ?: GL(dl_ns)[nsid]._ns_loaded) == NULL
@ -50,7 +49,7 @@ index 0c052e4..f45085a 100644
#ifdef USE_LDCONFIG
if (fd == -1
&& (__glibc_likely ((mode & __RTLD_SECURE) == 0)
@@ -2099,14 +2106,6 @@ _dl_map_object (struct link_map *loader, const char *name,
@@ -2152,14 +2160,6 @@ _dl_map_object (struct link_map *loader, const char *name,
}
#endif
@ -66,5 +65,5 @@ index 0c052e4..f45085a 100644
if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS))
_dl_debug_printf ("\n");
--
2.1.4
2.6.4

View File

@ -1,7 +1,7 @@
From 086b65d9aacffc47fcd8df68818a476a5ae76fa1 Mon Sep 17 00:00:00 2001
From 179dc5f1e13c3ff96d5f21a2a78c089cf120ceb8 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 18 Mar 2015 01:50:00 +0000
Subject: [PATCH 02/27] nativesdk-glibc: Fix buffer overrun with a relocated
Subject: [PATCH 02/24] nativesdk-glibc: Fix buffer overrun with a relocated
SDK
When ld-linux-*.so.2 is relocated to a path that is longer than the
@ -22,10 +22,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
1 file changed, 12 insertions(+)
diff --git a/elf/dl-load.c b/elf/dl-load.c
index f45085a..f1eb5ed 100644
index ee3d1e6..c4a42e9 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -1765,7 +1765,19 @@ open_path (const char *name, size_t namelen, int mode,
@@ -1793,7 +1793,19 @@ open_path (const char *name, size_t namelen, int mode,
given on the command line when rtld is run directly. */
return -1;
@ -46,5 +46,5 @@ index f45085a..f1eb5ed 100644
{
struct r_search_path_elem *this_dir = *dirs;
--
2.1.4
2.6.4

View File

@ -1,7 +1,7 @@
From fd595a5ec885bcb4c14417daa21c2e61c5b72e42 Mon Sep 17 00:00:00 2001
From e76048898ae9aa49dc70d6f9b1bbc22082e61fe3 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 18 Mar 2015 01:51:38 +0000
Subject: [PATCH 03/27] nativesdk-glibc: Raise the size of arrays containing dl
Subject: [PATCH 03/24] nativesdk-glibc: Raise the size of arrays containing dl
paths
This patch puts the dynamic loader path in the binaries, SYSTEM_DIRS strings
@ -40,10 +40,10 @@ index dec49bc..862f1d8 100644
internal_function
_dl_cache_libcmp (const char *p1, const char *p2)
diff --git a/elf/dl-load.c b/elf/dl-load.c
index f1eb5ed..f664f50 100644
index c4a42e9..acf6c03 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -104,8 +104,8 @@ static size_t max_capstrlen attribute_relro;
@@ -106,8 +106,8 @@ static size_t max_capstrlen attribute_relro;
/* Get the generated information about the trusted directories. */
#include "trusted-dirs.h"
@ -80,7 +80,7 @@ index f54ec22..0e78a83 100644
a platform. */
static int
diff --git a/elf/rtld.c b/elf/rtld.c
index 69873c2..6d3add7 100644
index 52160df..80f0582 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -99,6 +99,7 @@ uintptr_t __pointer_chk_guard_local
@ -91,7 +91,7 @@ index 69873c2..6d3add7 100644
/* List of auditing DSOs. */
static struct audit_list
@@ -877,12 +878,12 @@ of this helper program; chances are you did not intend to run this program.\n\
@@ -873,12 +874,12 @@ of this helper program; chances are you did not intend to run this program.\n\
--list list all dependencies and how they are resolved\n\
--verify verify that given object really is a dynamically linked\n\
object we can handle\n\
@ -107,7 +107,7 @@ index 69873c2..6d3add7 100644
++_dl_skip_args;
--_dl_argc;
diff --git a/sysdeps/generic/dl-cache.h b/sysdeps/generic/dl-cache.h
index 4b49869..1800d03 100644
index 70d4aeb..5c726d0 100644
--- a/sysdeps/generic/dl-cache.h
+++ b/sysdeps/generic/dl-cache.h
@@ -27,10 +27,6 @@
@ -122,5 +122,5 @@ index 4b49869..1800d03 100644
# define add_system_dir(dir) add_dir (dir)
#endif
--
2.1.4
2.6.4

View File

@ -1,34 +0,0 @@
From 2560b564b5674bf2990e5607f6342c1647a5dc4f Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sun, 8 Mar 2015 04:01:01 +0000
Subject: [PATCH 04/27] Backport
https://sourceware.org/ml/libc-ports/2007-12/msg00000.html
Upstream-Status: Pending
2007-12-03 Kristian Van Der Vliet <vanders@liqwyd.com>
* bits/stdio-lock.h (_IO_acquire_lock_clear_flags2): Define
Signed-off-by: Kristian Van Der Vliet <vanders@liqwyd.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
bits/stdio-lock.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/bits/stdio-lock.h b/bits/stdio-lock.h
index 0c5bb65..66304a6 100644
--- a/bits/stdio-lock.h
+++ b/bits/stdio-lock.h
@@ -49,6 +49,8 @@ __libc_lock_define_recursive (typedef, _IO_lock_t)
_IO_cleanup_region_start ((void (*) (void *)) _IO_funlockfile, (_fp)); \
_IO_flockfile (_fp)
+# define _IO_acquire_lock_clear_flags2(_fp) _IO_acquire_lock (_fp)
+
# define _IO_release_lock(_fp) \
_IO_funlockfile (_fp); \
_IO_cleanup_region_end (0)
--
2.1.4

View File

@ -0,0 +1,32 @@
From 2e1638115f0f924ee8235eee9265047054c15cfd Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Thu, 31 Dec 2015 14:35:35 -0800
Subject: [PATCH 04/24] nativesdk-glibc: Allow 64 bit atomics for x86
The fix consist of allowing 64bit atomic ops for x86.
This should be safe for i586 and newer CPUs.
It also makes the synchronization more efficient.
Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
sysdeps/i386/atomic-machine.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sysdeps/i386/atomic-machine.h b/sysdeps/i386/atomic-machine.h
index 59f3d34..6f6b7ff 100644
--- a/sysdeps/i386/atomic-machine.h
+++ b/sysdeps/i386/atomic-machine.h
@@ -54,7 +54,7 @@ typedef uintmax_t uatomic_max_t;
# endif
#endif
-#define __HAVE_64B_ATOMICS 0
+#define __HAVE_64B_ATOMICS 1
#define USE_ATOMIC_COMPILER_BUILTINS 0
--
2.6.4

View File

@ -1,7 +1,7 @@
From aa0cd82892f32e58602143c697ef0524696a6428 Mon Sep 17 00:00:00 2001
From 7ff57edfe24b4243373fcb896ee0b613938c1ec9 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 18 Mar 2015 00:01:50 +0000
Subject: [PATCH 05/27] fsl e500/e5500/e6500/603e fsqrt implementation
Subject: [PATCH 05/24] fsl e500/e5500/e6500/603e fsqrt implementation
Upstream-Status: Pending
Signed-off-by: Edmar Wienskoski <edmar@freescale.com>
@ -1580,5 +1580,5 @@ index 0000000..04ff8cc
@@ -0,0 +1 @@
+powerpc/powerpc64/e6500/fpu
--
2.1.4
2.6.4

View File

@ -1,7 +1,7 @@
From 5ec1bc5172851278231ce940b68b35ce9cbf8500 Mon Sep 17 00:00:00 2001
From 61129ef3ee735b300604f75d50e01cb29f4387f4 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 18 Mar 2015 00:11:22 +0000
Subject: [PATCH 06/27] readlib: Add OECORE_KNOWN_INTERPRETER_NAMES to known
Subject: [PATCH 06/24] readlib: Add OECORE_KNOWN_INTERPRETER_NAMES to known
names
This bolts in a hook for OE to pass its own version of interpreter
@ -29,5 +29,5 @@ index 7fd5b8a..2f5da9f 100644
static struct known_names known_libs[] =
--
2.1.4
2.6.4

View File

@ -1,7 +1,7 @@
From ea98b1a12b5f779fd79478ff930a79ef60387851 Mon Sep 17 00:00:00 2001
From f936548decac99501f9a4c522a3211d16542fa49 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 18 Mar 2015 00:15:07 +0000
Subject: [PATCH 07/27] ppc/sqrt: Fix undefined reference to `__sqrt_finite'
Subject: [PATCH 07/24] ppc/sqrt: Fix undefined reference to `__sqrt_finite'
on ppc fixes the errors like below
| ./.libs/libpulsecore-1.1.so: undefined reference to `__sqrt_finite'
@ -204,5 +204,5 @@ index 26fa067..9d17512 100644
}
+strong_alias (__ieee754_sqrtf, __sqrtf_finite)
--
2.1.4
2.6.4

View File

@ -1,7 +1,7 @@
From 2456ea44aeeedae87edb522f77a7969d636399b0 Mon Sep 17 00:00:00 2001
From d02704895fdce917e337619a4414042f63edd88b Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 18 Mar 2015 00:16:38 +0000
Subject: [PATCH 08/27] __ieee754_sqrt{,f} are now inline functions and call
Subject: [PATCH 08/24] __ieee754_sqrt{,f} are now inline functions and call
out __slow versions
Upstream-Status: Pending
@ -383,5 +383,5 @@ index 9d17512..10de1f0 100644
+
strong_alias (__ieee754_sqrtf, __sqrtf_finite)
--
2.1.4
2.6.4

View File

@ -1,7 +1,7 @@
From acf7a028817e71eb99d785037659abd4d120ffe2 Mon Sep 17 00:00:00 2001
From 502f061d846e58aac7aca67e4e0d6ba9e0763b17 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 18 Mar 2015 00:20:09 +0000
Subject: [PATCH 09/27] Quote from bug 1443 which explains what the patch does
Subject: [PATCH 09/24] Quote from bug 1443 which explains what the patch does
:
We build some random program and link it with -lust. When we run it,
@ -58,5 +58,5 @@ index 6fb20bd..8805537 100644
case R_ARM_TLS_TPOFF32:
--
2.1.4
2.6.4

View File

@ -1,7 +1,7 @@
From 017322ee28c1579ce6c81904842aaada9c82403c Mon Sep 17 00:00:00 2001
From 69a3e30b49d28a7386d18725528652931510cbfc Mon Sep 17 00:00:00 2001
From: Ting Liu <b28495@freescale.com>
Date: Wed, 19 Dec 2012 04:39:57 -0600
Subject: [PATCH 10/27] eglibc: run libm-err-tab.pl with specific dirs in ${S}
Subject: [PATCH 10/24] eglibc: run libm-err-tab.pl with specific dirs in ${S}
libm-err-tab.pl will parse all the files named "libm-test-ulps"
in the given dir recursively. To avoid parsing the one in
@ -18,7 +18,7 @@ Signed-off-by: Ting Liu <b28495@freescale.com>
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/manual/Makefile b/manual/Makefile
index 5382208..6b701b0 100644
index cdb6763..0b32a0a 100644
--- a/manual/Makefile
+++ b/manual/Makefile
@@ -105,7 +105,8 @@ $(objpfx)libm-err.texi: $(objpfx)stamp-libm-err
@ -32,5 +32,5 @@ index 5382208..6b701b0 100644
touch $@
--
2.1.4
2.6.4

View File

@ -1,7 +1,7 @@
From 1be45f870ebbb0259bea5250a6d2c2fbcb33409d Mon Sep 17 00:00:00 2001
From 4cf52971a841304aec30b2e975f81d7ad9d42ef0 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 18 Mar 2015 00:24:46 +0000
Subject: [PATCH 11/27] __ieee754_sqrt{,f} are now inline functions and call
Subject: [PATCH 11/24] __ieee754_sqrt{,f} are now inline functions and call
out __slow versions
Upstream-Status: Pending
@ -57,5 +57,5 @@ index 8126535..10de1f0 100644
#endif
{
--
2.1.4
2.6.4

View File

@ -1,7 +1,7 @@
From 49471ab1f90e392da9520eea831ce8731be9fc8b Mon Sep 17 00:00:00 2001
From b356816d6e005ecda7adbed9627a4315ad39de39 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 18 Mar 2015 00:25:45 +0000
Subject: [PATCH 12/27] Make ld --version output matching grok gold's output
Subject: [PATCH 12/24] Make ld --version output matching grok gold's output
adapted from from upstream branch roland/gold-vs-libc
@ -14,10 +14,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/configure b/configure
index 45cc7cb..7d7299a 100755
index aa05d49..6dabd11 100755
--- a/configure
+++ b/configure
@@ -4709,7 +4709,7 @@ else
@@ -4486,7 +4486,7 @@ else
# Found it, now check the version.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking version of $LD" >&5
$as_echo_n "checking version of $LD... " >&6; }
@ -27,10 +27,10 @@ index 45cc7cb..7d7299a 100755
'') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
2.1[0-9][0-9]*|2.2[2-9]*|2.[3-9][0-9]*|[3-9].*|[1-9][0-9]*)
diff --git a/configure.ac b/configure.ac
index 7e9383a..a467a69 100644
index ee7a3f1..b4b95b9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -941,7 +941,7 @@ AC_CHECK_PROG_VER(AS, $AS, --version,
@@ -948,7 +948,7 @@ AC_CHECK_PROG_VER(AS, $AS, --version,
[2.1[0-9][0-9]*|2.2[2-9]*|2.[3-9][0-9]*|[3-9].*|[1-9][0-9]*],
AS=: critic_missing="$critic_missing as")
AC_CHECK_PROG_VER(LD, $LD, --version,
@ -40,5 +40,5 @@ index 7e9383a..a467a69 100644
LD=: critic_missing="$critic_missing ld")
--
2.1.4
2.6.4

View File

@ -1,7 +1,7 @@
From b55e49b199c46a278ab66b6b1e3eab483b913197 Mon Sep 17 00:00:00 2001
From 10003d48f83f7a4f7fa562ed89af904a544b6323 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 18 Mar 2015 00:27:10 +0000
Subject: [PATCH 13/27] sysdeps/gnu/configure.ac: handle correctly
Subject: [PATCH 13/24] sysdeps/gnu/configure.ac: handle correctly
$libc_cv_rootsbindir
Upstream-Status:Pending
@ -14,7 +14,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sysdeps/gnu/configure b/sysdeps/gnu/configure
index 9239297..c5ed3ca 100644
index 71243ad..f578187 100644
--- a/sysdeps/gnu/configure
+++ b/sysdeps/gnu/configure
@@ -32,6 +32,6 @@ case "$prefix" in
@ -38,5 +38,5 @@ index 634fe4d..3db1697 100644
;;
esac
--
2.1.4
2.6.4

View File

@ -1,7 +1,7 @@
From 0229d6c9c0e7721773118d5ae1d172c269bc9826 Mon Sep 17 00:00:00 2001
From cafa8a7ef830e02cdbf928471e06d11054946940 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 18 Mar 2015 00:28:41 +0000
Subject: [PATCH 14/27] Add unused attribute
Subject: [PATCH 14/24] Add unused attribute
Helps in avoiding gcc warning when header is is included in
a source file which does not use both functions
@ -30,5 +30,5 @@ index 80290bc..7890a8e 100644
{
int slash_count = 0;
--
2.1.4
2.6.4

View File

@ -1,32 +0,0 @@
From f058c884dd26d10c94550ca5252ed6576614d659 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Thu, 19 Feb 2015 03:23:45 +0000
Subject: [PATCH 15/27] When disabling SSE also make sure that fpmath is not
set to use SSE as well
This fixes errors when we inject sse options through CFLAGS and now
that we have -Werror turned on by default this warning turns to become
error on x86
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Upstream-Status: Pending
---
sysdeps/x86/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sysdeps/x86/Makefile b/sysdeps/x86/Makefile
index 19f5eca..827ea71 100644
--- a/sysdeps/x86/Makefile
+++ b/sysdeps/x86/Makefile
@@ -1,6 +1,6 @@
ifeq ($(subdir),elf)
CFLAGS-.os += $(if $(filter $(@F),$(patsubst %,%.os,$(all-rtld-routines))),\
- -mno-sse -mno-mmx)
+ -mno-sse -mno-mmx -mfpmath=387)
tests-special += $(objpfx)tst-ld-sse-use.out
$(objpfx)tst-ld-sse-use.out: ../sysdeps/x86/tst-ld-sse-use.sh $(objpfx)ld.so
--
2.1.4

View File

@ -1,7 +1,7 @@
From 70199fe59c38b621ab4121d7a55719b2b29b36de Mon Sep 17 00:00:00 2001
From 4d6bead19874e519752ceeb2a15897ff2ffbe5e8 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 18 Mar 2015 00:31:06 +0000
Subject: [PATCH 16/27] 'yes' within the path sets wrong config variables
Subject: [PATCH 15/24] 'yes' within the path sets wrong config variables
It seems that the 'AC_EGREP_CPP(yes...' example is quite popular
but being such a short word to grep it is likely to produce
@ -63,7 +63,7 @@ index 7851dd4..6e92381 100644
], libc_cv_aarch64_be=yes, libc_cv_aarch64_be=no)])
if test $libc_cv_aarch64_be = yes; then
diff --git a/sysdeps/arm/configure b/sysdeps/arm/configure
index 158116b..5eaf54e 100644
index 431e843..e152461 100644
--- a/sysdeps/arm/configure
+++ b/sysdeps/arm/configure
@@ -151,12 +151,12 @@ else
@ -82,7 +82,7 @@ index 158116b..5eaf54e 100644
else
libc_cv_arm_pcs_vfp=no
diff --git a/sysdeps/arm/configure.ac b/sysdeps/arm/configure.ac
index 859c92a..2f4a6e2 100644
index 90cdd69..05a262b 100644
--- a/sysdeps/arm/configure.ac
+++ b/sysdeps/arm/configure.ac
@@ -15,8 +15,8 @@ AC_DEFINE(PI_STATIC_AND_HIDDEN)
@ -165,10 +165,10 @@ index f05f438..dc86399 100644
], libc_cv_nios2_be=yes, libc_cv_nios2_be=no)])
if test $libc_cv_nios2_be = yes; then
diff --git a/sysdeps/unix/sysv/linux/mips/configure b/sysdeps/unix/sysv/linux/mips/configure
index 83f8b13..2b6cbee 100644
index dee56aa..f2049ed 100644
--- a/sysdeps/unix/sysv/linux/mips/configure
+++ b/sysdeps/unix/sysv/linux/mips/configure
@@ -387,11 +387,11 @@ else
@@ -414,11 +414,11 @@ else
/* end confdefs.h. */
dnl
#ifdef __mips_nan2008
@ -183,10 +183,10 @@ index 83f8b13..2b6cbee 100644
else
libc_cv_mips_nan2008=no
diff --git a/sysdeps/unix/sysv/linux/mips/configure.ac b/sysdeps/unix/sysv/linux/mips/configure.ac
index 5039ec9..1035f76 100644
index 45147c5..4224af1 100644
--- a/sysdeps/unix/sysv/linux/mips/configure.ac
+++ b/sysdeps/unix/sysv/linux/mips/configure.ac
@@ -98,9 +98,9 @@ AC_COMPILE_IFELSE(
@@ -105,9 +105,9 @@ AC_COMPILE_IFELSE(
LIBC_CONFIG_VAR([mips-mode-switch],[${libc_mips_mode_switch}])
AC_CACHE_CHECK([whether the compiler is using the 2008 NaN encoding],
@ -199,7 +199,7 @@ index 5039ec9..1035f76 100644
libc_mips_nan=
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure b/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure
index 70bb18a..ffd9e3e 100644
index af06970..27b8c1b 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure
@@ -155,12 +155,12 @@ else
@ -259,5 +259,5 @@ index 0822915..9a32fdd 100644
], libc_cv_ppc64_def_call_elf=yes, libc_cv_ppc64_def_call_elf=no)])
if test $libc_cv_ppc64_def_call_elf = no; then
--
2.1.4
2.6.4

View File

@ -1,7 +1,7 @@
From c90306107fbbe2979012917e87747ce78c82ab88 Mon Sep 17 00:00:00 2001
From 3e8586eb3509e2f0d6dfb74be8f89a30b06b56e9 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 18 Mar 2015 00:33:03 +0000
Subject: [PATCH 17/27] timezone: re-written tzselect as posix sh
Subject: [PATCH 16/24] timezone: re-written tzselect as posix sh
To avoid the bash dependency.
@ -15,10 +15,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/timezone/Makefile b/timezone/Makefile
index 24c93c6..886b06e 100644
index 99566cb..b6e757e 100644
--- a/timezone/Makefile
+++ b/timezone/Makefile
@@ -126,7 +126,7 @@ $(testdata)/XT%: testdata/XT%
@@ -122,7 +122,7 @@ $(testdata)/XT%: testdata/XT%
cp $< $@
$(objpfx)tzselect: tzselect.ksh $(common-objpfx)config.make
@ -41,5 +41,5 @@ index 9d70691..25f45a8 100755
# Check for awk Posix compliance.
($AWK -v x=y 'BEGIN { exit 123 }') </dev/null >/dev/null 2>&1
--
2.1.4
2.6.4

View File

@ -1,7 +1,16 @@
Don't use bashisms (except for echo -n, which busybox supports) to avoid needing bash to start nscd.
From cd9d9fe7316f4ce4ca9d8e67e22f5718879535e4 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Thu, 31 Dec 2015 14:33:02 -0800
Subject: [PATCH 17/24] Remove bash dependency for nscd init script
The nscd init script uses #! /bin/bash but only really uses one bashism
(translated strings), so remove them and switch the shell to #!/bin/sh.
Upstream-Status: Pending
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
nscd/nscd.init | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/nscd/nscd.init b/nscd/nscd.init
index a882da7..b02986e 100644
@ -59,3 +68,6 @@ index a882da7..b02986e 100644
RETVAL=1
;;
esac
--
2.6.4

View File

@ -1,7 +1,7 @@
From eff048074ac7b5258bb615e5a5b221daa19b18ae Mon Sep 17 00:00:00 2001
From 8f554f4a1beb39182aad9cd9b5e1da69464dff7e Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 18 Mar 2015 00:42:58 +0000
Subject: [PATCH 18/27] eglibc: Cross building and testing instructions
Subject: [PATCH 18/24] eglibc: Cross building and testing instructions
Ported from eglibc
Upstream-Status: Pending
@ -615,5 +615,5 @@ index 0000000..b67b468
+ simply place copies of these libraries in the top GLIBC build
+ directory.
--
2.1.4
2.6.4

View File

@ -1,7 +1,7 @@
From 8fe0d29488b376011cdaaa462d557ffc0b31fb63 Mon Sep 17 00:00:00 2001
From c2d49eab20db4ab02b6de62092fedc623d757146 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 18 Mar 2015 00:49:28 +0000
Subject: [PATCH 20/27] eglibc: Help bootstrap cross toolchain
Subject: [PATCH 19/24] eglibc: Help bootstrap cross toolchain
Taken from EGLIBC, r1484 + r1525
@ -29,7 +29,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
create mode 100644 include/stubs-bootstrap.h
diff --git a/Makefile b/Makefile
index f906391..e4e149e 100644
index 9a01c93..a6ae003 100644
--- a/Makefile
+++ b/Makefile
@@ -69,9 +69,18 @@ subdir-dirs = include
@ -96,5 +96,5 @@ index 0000000..1d2b669
+ EGLIBC subdir 'stubs' make targets, on every .o file in EGLIBC, but
+ an empty stubs.h like this will do fine for GCC. */
--
2.1.4
2.6.4

View File

@ -1,30 +1,32 @@
From fe2ae4f877928dd6bff5bac3f15bce4b50d2bd12 Mon Sep 17 00:00:00 2001
From 588d936b9aa65e7cc8b1eb2cad1d209087db43a9 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 18 Mar 2015 00:51:16 +0000
Subject: [PATCH 21/27] eglibc: cherry-picked from
http://www.eglibc.org/archives/patches/msg00772.html
Date: Thu, 31 Dec 2015 15:10:33 -0800
Subject: [PATCH 20/24] eglibc: cherry-picked from
It hasn't yet been merged into glibc
http://www.eglibc.org/archives/patches/msg00772.html
Not yet merged into glibc
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
resolv/res_libc.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
resolv/res_libc.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/resolv/res_libc.c b/resolv/res_libc.c
index ee3fa21..29e2340 100644
index a8394e0..981ac7c 100644
--- a/resolv/res_libc.c
+++ b/resolv/res_libc.c
@@ -22,12 +22,13 @@
@@ -18,6 +18,7 @@
#include <atomic.h>
#include <limits.h>
#include <sys/types.h>
+#include <sys/stat.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <resolv.h>
#include <bits/libc-lock.h>
-
+#include <sys/stat.h>
/* The following bit is copied from res_data.c (where it is #ifdef'ed
@@ -28,6 +29,7 @@
out) since res_init() should go into libc.so but the rest of that
file should not. */
@ -32,7 +34,7 @@ index ee3fa21..29e2340 100644
extern unsigned long long int __res_initstamp attribute_hidden;
/* We have atomic increment operations on 64-bit platforms. */
#if __WORDSIZE == 64
@@ -35,7 +36,6 @@ extern unsigned long long int __res_initstamp attribute_hidden;
@@ -35,7 +37,6 @@ extern unsigned long long int __res_initstamp attribute_hidden;
# define atomicincunlock(lock) (void) 0
# define atomicinc(var) catomic_increment (&(var))
#else
@ -40,7 +42,7 @@ index ee3fa21..29e2340 100644
# define atomicinclock(lock) __libc_lock_lock (lock)
# define atomicincunlock(lock) __libc_lock_unlock (lock)
# define atomicinc(var) ++var
@@ -94,7 +94,18 @@ res_init(void) {
@@ -94,7 +95,18 @@ res_init(void) {
int
__res_maybe_init (res_state resp, int preinit)
{
@ -60,5 +62,5 @@ index ee3fa21..29e2340 100644
if (resp->nscount > 0)
__res_iclose (resp, true);
--
2.1.4
2.6.4

View File

@ -1,7 +1,7 @@
From be7273225698074347a71de58006977bb304d7f7 Mon Sep 17 00:00:00 2001
From b74e34e6f53816ad57b13ba6fd70a97db1bc1eae Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 18 Mar 2015 00:53:47 +0000
Subject: [PATCH 22/27] eglibc: Clear cache lines on ppc8xx
Date: Thu, 31 Dec 2015 15:15:09 -0800
Subject: [PATCH 21/24] eglibc: Clear cache lines on ppc8xx
2007-06-13 Nathan Sidwell <nathan@codesourcery.com>
Mark Shinwell <shinwell@codesourcery.com>
@ -13,11 +13,12 @@ Subject: [PATCH 22/27] eglibc: Clear cache lines on ppc8xx
(DL_PLATFORM_AUXV): Likewise.
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c | 14 +++++++++++++-
sysdeps/unix/sysv/linux/powerpc/libc-start.c | 15 ++++++++++++++-
2 files changed, 27 insertions(+), 2 deletions(-)
sysdeps/unix/sysv/linux/powerpc/libc-start.c | 16 +++++++++++++++-
2 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c b/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c
index c2504ff..d50f1cb 100644
@ -47,15 +48,16 @@ index c2504ff..d50f1cb 100644
break;
diff --git a/sysdeps/unix/sysv/linux/powerpc/libc-start.c b/sysdeps/unix/sysv/linux/powerpc/libc-start.c
index a9364c7..a3ed1d4 100644
index 209a16d..5d8572d 100644
--- a/sysdeps/unix/sysv/linux/powerpc/libc-start.c
+++ b/sysdeps/unix/sysv/linux/powerpc/libc-start.c
@@ -68,11 +68,24 @@ __libc_start_main (int argc, char **argv,
rtld_fini = NULL;
}
@@ -73,11 +73,25 @@ __libc_start_main (int argc, char **argv,
- /* Initialize the __cache_line_size variable from the aux vector. */
+ /* Initialize the __cache_line_size variable from the aux vector.
/* Initialize the __cache_line_size variable from the aux vector. For the
static case, we also need _dl_hwcap, _dl_hwcap2 and _dl_platform, so we
- can call __tcb_parse_hwcap_and_convert_at_platform (). */
+ can call __tcb_parse_hwcap_and_convert_at_platform ().
+
+ This is used by memset to optimize setting to zero. We have to
+ detect 8xx processors, which have buggy dcbz implementations that
+ cannot report page faults correctly. That requires reading SPR,
@ -75,7 +77,7 @@ index a9364c7..a3ed1d4 100644
+ }
__cache_line_size = av->a_un.a_val;
break;
}
#ifndef SHARED
--
2.1.4
2.6.4

View File

@ -1,7 +1,7 @@
From 718e7e5db1c8b073adb9a79ec6f167238c2d8bda Mon Sep 17 00:00:00 2001
From 8f483cb1f21ab6431ff99e8d30d56b91607ae918 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 18 Mar 2015 00:55:53 +0000
Subject: [PATCH 23/27] eglibc: Resolve __fpscr_values on SH4
Subject: [PATCH 22/24] eglibc: Resolve __fpscr_values on SH4
2010-09-29 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Andrew Stubbs <ams@codesourcery.com>
@ -52,5 +52,5 @@ index a02b7e2..b9be326 100644
+weak_alias (___fpscr_values, __fpscr_values)
+
--
2.1.4
2.6.4

View File

@ -1,7 +1,7 @@
From 5773417fa91a18cd39fb35c9907d72af0ed9ea33 Mon Sep 17 00:00:00 2001
From 58d424884eed7efde6c90af0cd7c6c37cf9b444a Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 18 Mar 2015 01:57:01 +0000
Subject: [PATCH 25/27] eglibc: Install PIC archives
Subject: [PATCH 23/24] eglibc: Install PIC archives
Forward port from eglibc
@ -29,10 +29,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
1 file changed, 40 insertions(+), 2 deletions(-)
diff --git a/Makerules b/Makerules
index 1dd41aa..41778e1 100644
index fa24030..1ff4634 100644
--- a/Makerules
+++ b/Makerules
@@ -713,6 +713,9 @@ ifeq ($(build-shared),yes)
@@ -694,6 +694,9 @@ ifeq ($(build-shared),yes)
$(common-objpfx)libc.so: $(common-objpfx)libc.map
endif
common-generated += libc.so libc_pic.os
@ -42,7 +42,7 @@ index 1dd41aa..41778e1 100644
ifdef libc.so-version
$(common-objpfx)libc.so$(libc.so-version): $(common-objpfx)libc.so
$(make-link)
@@ -955,6 +958,7 @@ endif
@@ -936,6 +939,7 @@ endif
install: check-install-supported
@ -50,7 +50,7 @@ index 1dd41aa..41778e1 100644
install: $(installed-libcs)
$(installed-libcs): $(inst_libdir)/lib$(libprefix)%: lib $(+force)
$(make-target-directory)
@@ -983,6 +987,22 @@ versioned := $(strip $(foreach so,$(install-lib.so),\
@@ -964,6 +968,22 @@ versioned := $(strip $(foreach so,$(install-lib.so),\
install-lib.so-versioned := $(filter $(versioned), $(install-lib.so))
install-lib.so-unversioned := $(filter-out $(versioned), $(install-lib.so))
@ -73,7 +73,7 @@ index 1dd41aa..41778e1 100644
# For versioned libraries, we install three files:
# $(inst_libdir)/libfoo.so -- for linking, symlink or ld script
# $(inst_slibdir)/libfoo.so.NN -- for loading by SONAME, symlink
@@ -1225,9 +1245,22 @@ $(addprefix $(inst_includedir)/,$(headers-nonh)): $(inst_includedir)/%: \
@@ -1206,9 +1226,22 @@ $(addprefix $(inst_includedir)/,$(headers-nonh)): $(inst_includedir)/%: \
endif # headers-nonh
endif # headers
@ -97,7 +97,7 @@ index 1dd41aa..41778e1 100644
install-bin-nosubdir: $(addprefix $(inst_bindir)/,$(install-bin))
install-bin-script-nosubdir: $(addprefix $(inst_bindir)/,$(install-bin-script))
install-rootsbin-nosubdir: \
@@ -1240,6 +1273,10 @@ install-data-nosubdir: $(addprefix $(inst_datadir)/,$(install-data))
@@ -1221,6 +1254,10 @@ install-data-nosubdir: $(addprefix $(inst_datadir)/,$(install-data))
install-headers-nosubdir: $(addprefix $(inst_includedir)/,$(headers))
install-others-nosubdir: $(install-others)
install-others-programs-nosubdir: $(install-others-programs)
@ -108,7 +108,7 @@ index 1dd41aa..41778e1 100644
# We need all the `-nosubdir' targets so that `install' in the parent
# doesn't depend on several things which each iterate over the subdirs.
@@ -1249,7 +1286,8 @@ install-%:: install-%-nosubdir ;
@@ -1230,7 +1267,8 @@ install-%:: install-%-nosubdir ;
.PHONY: install install-no-libc.a-nosubdir
install-no-libc.a-nosubdir: install-headers-nosubdir install-data-nosubdir \
@ -119,5 +119,5 @@ index 1dd41aa..41778e1 100644
install-no-libc.a-nosubdir: install-bin-nosubdir install-bin-script-nosubdir \
install-rootsbin-nosubdir install-sbin-nosubdir \
--
2.1.4
2.6.4

View File

@ -0,0 +1,566 @@
From a5695930aec68b3f501e475d8705cddbb63f695e Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 18 Mar 2015 01:33:49 +0000
Subject: [PATCH 25/25] eglibc: Forward port cross locale generation support
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
locale/Makefile | 3 ++-
locale/catnames.c | 48 +++++++++++++++++++++++++++++++++++
locale/localeinfo.h | 2 +-
locale/programs/charmap-dir.c | 6 +++++
locale/programs/ld-collate.c | 17 ++++++-------
locale/programs/ld-ctype.c | 27 ++++++++++----------
locale/programs/ld-time.c | 31 +++++++++++++++--------
locale/programs/linereader.c | 2 +-
locale/programs/localedef.c | 8 ++++++
locale/programs/locfile.c | 5 +++-
locale/programs/locfile.h | 59 +++++++++++++++++++++++++++++++++++++++++--
locale/setlocale.c | 30 ----------------------
12 files changed, 169 insertions(+), 69 deletions(-)
create mode 100644 locale/catnames.c
diff --git a/locale/Makefile b/locale/Makefile
index 75afbe1..d32523b 100644
--- a/locale/Makefile
+++ b/locale/Makefile
@@ -25,7 +25,8 @@ include ../Makeconfig
headers = locale.h bits/locale.h langinfo.h xlocale.h
routines = setlocale findlocale loadlocale loadarchive \
localeconv nl_langinfo nl_langinfo_l mb_cur_max \
- newlocale duplocale freelocale uselocale
+ newlocale duplocale freelocale uselocale \
+ catnames
tests = tst-C-locale tst-locname tst-duplocale
categories = ctype messages monetary numeric time paper name \
address telephone measurement identification collate
diff --git a/locale/catnames.c b/locale/catnames.c
new file mode 100644
index 0000000..9fad357
--- /dev/null
+++ b/locale/catnames.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2006 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include "localeinfo.h"
+
+/* Define an array of category names (also the environment variable names). */
+const union catnamestr_t _nl_category_names attribute_hidden =
+ {
+ {
+#define DEFINE_CATEGORY(category, category_name, items, a) \
+ category_name,
+#include "categories.def"
+#undef DEFINE_CATEGORY
+ }
+ };
+
+const uint8_t _nl_category_name_idxs[__LC_LAST] attribute_hidden =
+ {
+#define DEFINE_CATEGORY(category, category_name, items, a) \
+ [category] = offsetof (union catnamestr_t, CATNAMEMF (__LINE__)),
+#include "categories.def"
+#undef DEFINE_CATEGORY
+ };
+
+/* An array of their lengths, for convenience. */
+const uint8_t _nl_category_name_sizes[] attribute_hidden =
+ {
+#define DEFINE_CATEGORY(category, category_name, items, a) \
+ [category] = sizeof (category_name) - 1,
+#include "categories.def"
+#undef DEFINE_CATEGORY
+ [LC_ALL] = sizeof ("LC_ALL") - 1
+ };
diff --git a/locale/localeinfo.h b/locale/localeinfo.h
index 789da44..4ac9249 100644
--- a/locale/localeinfo.h
+++ b/locale/localeinfo.h
@@ -224,7 +224,7 @@ __libc_tsd_define (extern, __locale_t, LOCALE)
unused. We can manage this playing some tricks with weak references.
But with thread-local locale settings, it becomes quite ungainly unless
we can use __thread variables. So only in that case do we attempt this. */
-#ifndef SHARED
+#if !defined SHARED && !defined IN_GLIBC_LOCALEDEF
# include <tls.h>
# define NL_CURRENT_INDIRECT 1
#endif
diff --git a/locale/programs/charmap-dir.c b/locale/programs/charmap-dir.c
index cf7adea..ef3b811 100644
--- a/locale/programs/charmap-dir.c
+++ b/locale/programs/charmap-dir.c
@@ -19,7 +19,9 @@
#include <error.h>
#include <fcntl.h>
#include <libintl.h>
+#ifndef NO_UNCOMPRESS
#include <spawn.h>
+#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -156,6 +158,7 @@ charmap_closedir (CHARMAP_DIR *cdir)
return closedir (dir);
}
+#ifndef NO_UNCOMPRESS
/* Creates a subprocess decompressing the given pathname, and returns
a stream reading its output (the decompressed data). */
static
@@ -204,6 +207,7 @@ fopen_uncompressed (const char *pathname, const char *compressor)
}
return NULL;
}
+#endif
/* Opens a charmap for reading, given its name (not an alias name). */
FILE *
@@ -226,6 +230,7 @@ charmap_open (const char *directory, const char *name)
if (stream != NULL)
return stream;
+#ifndef NO_UNCOMPRESS
memcpy (p, ".gz", 4);
stream = fopen_uncompressed (pathname, "gzip");
if (stream != NULL)
@@ -235,6 +240,7 @@ charmap_open (const char *directory, const char *name)
stream = fopen_uncompressed (pathname, "bzip2");
if (stream != NULL)
return stream;
+#endif
return NULL;
}
diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c
index dc0fe30..3c88c6d 100644
--- a/locale/programs/ld-collate.c
+++ b/locale/programs/ld-collate.c
@@ -350,7 +350,7 @@ new_element (struct locale_collate_t *collate, const char *mbs, size_t mbslen,
}
if (wcs != NULL)
{
- size_t nwcs = wcslen ((wchar_t *) wcs);
+ size_t nwcs = wcslen_uint32 (wcs);
uint32_t zero = 0;
/* Handle <U0000> as a single character. */
if (nwcs == 0)
@@ -1776,8 +1776,7 @@ symbol `%s' has the same encoding as"), (*eptr)->name);
if ((*eptr)->nwcs == runp->nwcs)
{
- int c = wmemcmp ((wchar_t *) (*eptr)->wcs,
- (wchar_t *) runp->wcs, runp->nwcs);
+ int c = wmemcmp_uint32 ((*eptr)->wcs, runp->wcs, runp->nwcs);
if (c == 0)
{
@@ -2010,9 +2009,9 @@ add_to_tablewc (uint32_t ch, struct element_t *runp)
one consecutive entry. */
if (runp->wcnext != NULL
&& runp->nwcs == runp->wcnext->nwcs
- && wmemcmp ((wchar_t *) runp->wcs,
- (wchar_t *)runp->wcnext->wcs,
- runp->nwcs - 1) == 0
+ && wmemcmp_uint32 (runp->wcs,
+ runp->wcnext->wcs,
+ runp->nwcs - 1) == 0
&& (runp->wcs[runp->nwcs - 1]
== runp->wcnext->wcs[runp->nwcs - 1] + 1))
{
@@ -2036,9 +2035,9 @@ add_to_tablewc (uint32_t ch, struct element_t *runp)
runp = runp->wcnext;
while (runp->wcnext != NULL
&& runp->nwcs == runp->wcnext->nwcs
- && wmemcmp ((wchar_t *) runp->wcs,
- (wchar_t *)runp->wcnext->wcs,
- runp->nwcs - 1) == 0
+ && wmemcmp_uint32 (runp->wcs,
+ runp->wcnext->wcs,
+ runp->nwcs - 1) == 0
&& (runp->wcs[runp->nwcs - 1]
== runp->wcnext->wcs[runp->nwcs - 1] + 1));
diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c
index 3f464ef..b7b6b51 100644
--- a/locale/programs/ld-ctype.c
+++ b/locale/programs/ld-ctype.c
@@ -926,7 +926,7 @@ ctype_output (struct localedef_t *locale, const struct charmap_t *charmap,
allocate_arrays (ctype, charmap, ctype->repertoire);
default_missing_len = (ctype->default_missing
- ? wcslen ((wchar_t *) ctype->default_missing)
+ ? wcslen_uint32 (ctype->default_missing)
: 0);
init_locale_data (&file, nelems);
@@ -1937,7 +1937,7 @@ read_translit_entry (struct linereader *ldfile, struct locale_ctype_t *ctype,
ignore = 1;
else
/* This value is usable. */
- obstack_grow (ob, to_wstr, wcslen ((wchar_t *) to_wstr) * 4);
+ obstack_grow (ob, to_wstr, wcslen_uint32 (to_wstr) * 4);
first = 0;
}
@@ -2471,8 +2471,8 @@ with character code range values one must use the absolute ellipsis `...'"));
}
handle_tok_digit:
- class_bit = _ISwdigit;
- class256_bit = _ISdigit;
+ class_bit = BITw (tok_digit);
+ class256_bit = BIT (tok_digit);
handle_digits = 1;
goto read_charclass;
@@ -3929,8 +3929,7 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap,
while (idx < number)
{
- int res = wcscmp ((const wchar_t *) sorted[idx]->from,
- (const wchar_t *) runp->from);
+ int res = wcscmp_uint32 (sorted[idx]->from, runp->from);
if (res == 0)
{
replace = 1;
@@ -3967,11 +3966,11 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap,
for (size_t cnt = 0; cnt < number; ++cnt)
{
struct translit_to_t *srunp;
- from_len += wcslen ((const wchar_t *) sorted[cnt]->from) + 1;
+ from_len += wcslen_uint32 (sorted[cnt]->from) + 1;
srunp = sorted[cnt]->to;
while (srunp != NULL)
{
- to_len += wcslen ((const wchar_t *) srunp->str) + 1;
+ to_len += wcslen_uint32 (srunp->str) + 1;
srunp = srunp->next;
}
/* Plus one for the extra NUL character marking the end of
@@ -3995,18 +3994,18 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap,
ctype->translit_from_idx[cnt] = from_len;
ctype->translit_to_idx[cnt] = to_len;
- len = wcslen ((const wchar_t *) sorted[cnt]->from) + 1;
- wmemcpy ((wchar_t *) &ctype->translit_from_tbl[from_len],
- (const wchar_t *) sorted[cnt]->from, len);
+ len = wcslen_uint32 (sorted[cnt]->from) + 1;
+ wmemcpy_uint32 (&ctype->translit_from_tbl[from_len],
+ sorted[cnt]->from, len);
from_len += len;
ctype->translit_to_idx[cnt] = to_len;
srunp = sorted[cnt]->to;
while (srunp != NULL)
{
- len = wcslen ((const wchar_t *) srunp->str) + 1;
- wmemcpy ((wchar_t *) &ctype->translit_to_tbl[to_len],
- (const wchar_t *) srunp->str, len);
+ len = wcslen_uint32 (srunp->str) + 1;
+ wmemcpy_uint32 (&ctype->translit_to_tbl[to_len],
+ srunp->str, len);
to_len += len;
srunp = srunp->next;
}
diff --git a/locale/programs/ld-time.c b/locale/programs/ld-time.c
index db490c6..75dc505 100644
--- a/locale/programs/ld-time.c
+++ b/locale/programs/ld-time.c
@@ -215,8 +215,10 @@ No definition for %s category found"), "LC_TIME"));
}
else
{
+ static const uint32_t wt_fmt_ampm[]
+ = { '%','I',':','%','M',':','%','S',' ','%','p',0 };
time->t_fmt_ampm = "%I:%M:%S %p";
- time->wt_fmt_ampm = (const uint32_t *) L"%I:%M:%S %p";
+ time->wt_fmt_ampm = wt_fmt_ampm;
}
}
@@ -226,7 +228,7 @@ No definition for %s category found"), "LC_TIME"));
const int days_per_month[12] = { 31, 29, 31, 30, 31, 30,
31, 31, 30, 31 ,30, 31 };
size_t idx;
- wchar_t *wstr;
+ uint32_t *wstr;
time->era_entries =
(struct era_data *) xmalloc (time->num_era
@@ -464,18 +466,18 @@ No definition for %s category found"), "LC_TIME"));
}
/* Now generate the wide character name and format. */
- wstr = wcschr ((wchar_t *) time->wera[idx], L':');/* end direction */
- wstr = wstr ? wcschr (wstr + 1, L':') : NULL; /* end offset */
- wstr = wstr ? wcschr (wstr + 1, L':') : NULL; /* end start */
- wstr = wstr ? wcschr (wstr + 1, L':') : NULL; /* end end */
+ wstr = wcschr_uint32 (time->wera[idx], L':'); /* end direction */
+ wstr = wstr ? wcschr_uint32 (wstr + 1, L':') : NULL; /* end offset */
+ wstr = wstr ? wcschr_uint32 (wstr + 1, L':') : NULL; /* end start */
+ wstr = wstr ? wcschr_uint32 (wstr + 1, L':') : NULL; /* end end */
if (wstr != NULL)
{
- time->era_entries[idx].wname = (uint32_t *) wstr + 1;
- wstr = wcschr (wstr + 1, L':'); /* end name */
+ time->era_entries[idx].wname = wstr + 1;
+ wstr = wcschr_uint32 (wstr + 1, L':'); /* end name */
if (wstr != NULL)
{
*wstr = L'\0';
- time->era_entries[idx].wformat = (uint32_t *) wstr + 1;
+ time->era_entries[idx].wformat = wstr + 1;
}
else
time->era_entries[idx].wname =
@@ -530,7 +532,16 @@ No definition for %s category found"), "LC_TIME"));
if (time->date_fmt == NULL)
time->date_fmt = "%a %b %e %H:%M:%S %Z %Y";
if (time->wdate_fmt == NULL)
- time->wdate_fmt = (const uint32_t *) L"%a %b %e %H:%M:%S %Z %Y";
+ {
+ static const uint32_t wdate_fmt[] =
+ { '%','a',' ',
+ '%','b',' ',
+ '%','e',' ',
+ '%','H',':','%','M',':','%','S',' ',
+ '%','Z',' ',
+ '%','Y',0 };
+ time->wdate_fmt = wdate_fmt;
+ }
}
diff --git a/locale/programs/linereader.c b/locale/programs/linereader.c
index 2e05130..653b68c 100644
--- a/locale/programs/linereader.c
+++ b/locale/programs/linereader.c
@@ -595,7 +595,7 @@ get_string (struct linereader *lr, const struct charmap_t *charmap,
{
int return_widestr = lr->return_widestr;
char *buf;
- wchar_t *buf2 = NULL;
+ uint32_t *buf2 = NULL;
size_t bufact;
size_t bufmax = 56;
diff --git a/locale/programs/localedef.c b/locale/programs/localedef.c
index fd6ca51..328d36c 100644
--- a/locale/programs/localedef.c
+++ b/locale/programs/localedef.c
@@ -114,6 +114,7 @@ void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version;
#define OPT_LIST_ARCHIVE 309
#define OPT_LITTLE_ENDIAN 400
#define OPT_BIG_ENDIAN 401
+#define OPT_UINT32_ALIGN 402
/* Definitions of arguments for argp functions. */
static const struct argp_option options[] =
@@ -150,6 +151,8 @@ static const struct argp_option options[] =
N_("Generate little-endian output") },
{ "big-endian", OPT_BIG_ENDIAN, NULL, 0,
N_("Generate big-endian output") },
+ { "uint32-align", OPT_UINT32_ALIGN, "ALIGNMENT", 0,
+ N_("Set the target's uint32_t alignment in bytes (default 4)") },
{ NULL, 0, NULL, 0, NULL }
};
@@ -239,12 +242,14 @@ main (int argc, char *argv[])
ctype locale. (P1003.2 4.35.5.2) */
setlocale (LC_CTYPE, "POSIX");
+#ifndef NO_SYSCONF
/* Look whether the system really allows locale definitions. POSIX
defines error code 3 for this situation so I think it must be
a fatal error (see P1003.2 4.35.8). */
if (sysconf (_SC_2_LOCALEDEF) < 0)
WITH_CUR_LOCALE (error (3, 0, _("\
FATAL: system does not define `_POSIX2_LOCALEDEF'")));
+#endif
/* Process charmap file. */
charmap = charmap_read (charmap_file, verbose, 1, be_quiet, 1);
@@ -338,6 +343,9 @@ parse_opt (int key, char *arg, struct argp_state *state)
case OPT_BIG_ENDIAN:
set_big_endian (true);
break;
+ case OPT_UINT32_ALIGN:
+ uint32_align_mask = strtol (arg, NULL, 0) - 1;
+ break;
case 'c':
force_output = 1;
break;
diff --git a/locale/programs/locfile.c b/locale/programs/locfile.c
index 33da52e..f790c4c 100644
--- a/locale/programs/locfile.c
+++ b/locale/programs/locfile.c
@@ -544,6 +544,9 @@ compare_files (const char *filename1, const char *filename2, size_t size,
machine running localedef. */
bool swap_endianness_p;
+/* The target's value of __align__(uint32_t) - 1. */
+unsigned int uint32_align_mask = 3;
+
/* When called outside a start_locale_structure/end_locale_structure
or start_locale_prelude/end_locale_prelude block, record that the
next byte in FILE's obstack will be the first byte of a new element.
@@ -621,7 +624,7 @@ add_locale_string (struct locale_file *file, const char *string)
void
add_locale_wstring (struct locale_file *file, const uint32_t *string)
{
- add_locale_uint32_array (file, string, wcslen ((const wchar_t *) string) + 1);
+ add_locale_uint32_array (file, string, wcslen_uint32 (string) + 1);
}
/* Record that FILE's next element is the 32-bit integer VALUE. */
diff --git a/locale/programs/locfile.h b/locale/programs/locfile.h
index 6fc441b..118b171 100644
--- a/locale/programs/locfile.h
+++ b/locale/programs/locfile.h
@@ -71,6 +71,8 @@ extern void write_all_categories (struct localedef_t *definitions,
extern bool swap_endianness_p;
+extern unsigned int uint32_align_mask;
+
/* Change the output to be big-endian if BIG_ENDIAN is true and
little-endian otherwise. */
static inline void
@@ -89,7 +91,8 @@ maybe_swap_uint32 (uint32_t value)
}
/* Likewise, but munge an array of N uint32_ts starting at ARRAY. */
-static inline void
+static void
+__attribute__ ((unused))
maybe_swap_uint32_array (uint32_t *array, size_t n)
{
if (swap_endianness_p)
@@ -99,7 +102,8 @@ maybe_swap_uint32_array (uint32_t *array, size_t n)
/* Like maybe_swap_uint32_array, but the array of N elements is at
the end of OBSTACK's current object. */
-static inline void
+static void
+__attribute__ ((unused))
maybe_swap_uint32_obstack (struct obstack *obstack, size_t n)
{
maybe_swap_uint32_array ((uint32_t *) obstack_next_free (obstack) - n, n);
@@ -276,4 +280,55 @@ extern void identification_output (struct localedef_t *locale,
const struct charmap_t *charmap,
const char *output_path);
+static size_t wcslen_uint32 (const uint32_t *str) __attribute__ ((unused));
+static uint32_t * wmemcpy_uint32 (uint32_t *s1, const uint32_t *s2, size_t n) __attribute__ ((unused));
+static uint32_t * wcschr_uint32 (const uint32_t *s, uint32_t ch) __attribute__ ((unused));
+static int wcscmp_uint32 (const uint32_t *s1, const uint32_t *s2) __attribute__ ((unused));
+static int wmemcmp_uint32 (const uint32_t *s1, const uint32_t *s2, size_t n) __attribute__ ((unused));
+
+static size_t
+wcslen_uint32 (const uint32_t *str)
+{
+ size_t len = 0;
+ while (str[len] != 0)
+ len++;
+ return len;
+}
+
+static int
+wmemcmp_uint32 (const uint32_t *s1, const uint32_t *s2, size_t n)
+{
+ while (n-- != 0)
+ {
+ int diff = *s1++ - *s2++;
+ if (diff != 0)
+ return diff;
+ }
+ return 0;
+}
+
+static int
+wcscmp_uint32 (const uint32_t *s1, const uint32_t *s2)
+{
+ while (*s1 != 0 && *s1 == *s2)
+ s1++, s2++;
+ return *s1 - *s2;
+}
+
+static uint32_t *
+wmemcpy_uint32 (uint32_t *s1, const uint32_t *s2, size_t n)
+{
+ return memcpy (s1, s2, n * sizeof (uint32_t));
+}
+
+static uint32_t *
+wcschr_uint32 (const uint32_t *s, uint32_t ch)
+{
+ do
+ if (*s == ch)
+ return (uint32_t *) s;
+ while (*s++ != 0);
+ return 0;
+}
+
#endif /* locfile.h */
diff --git a/locale/setlocale.c b/locale/setlocale.c
index ead030d..b551332 100644
--- a/locale/setlocale.c
+++ b/locale/setlocale.c
@@ -64,36 +64,6 @@ static char *const _nl_current_used[] =
#endif
-/* Define an array of category names (also the environment variable names). */
-const union catnamestr_t _nl_category_names attribute_hidden =
- {
- {
-#define DEFINE_CATEGORY(category, category_name, items, a) \
- category_name,
-#include "categories.def"
-#undef DEFINE_CATEGORY
- }
- };
-
-const uint8_t _nl_category_name_idxs[__LC_LAST] attribute_hidden =
- {
-#define DEFINE_CATEGORY(category, category_name, items, a) \
- [category] = offsetof (union catnamestr_t, CATNAMEMF (__LINE__)),
-#include "categories.def"
-#undef DEFINE_CATEGORY
- };
-
-/* An array of their lengths, for convenience. */
-const uint8_t _nl_category_name_sizes[] attribute_hidden =
- {
-#define DEFINE_CATEGORY(category, category_name, items, a) \
- [category] = sizeof (category_name) - 1,
-#include "categories.def"
-#undef DEFINE_CATEGORY
- [LC_ALL] = sizeof ("LC_ALL") - 1
- };
-
-
#ifdef NL_CURRENT_INDIRECT
# define WEAK_POSTLOAD(postload) weak_extern (postload)
#else
--
2.6.4

View File

@ -0,0 +1,48 @@
From 97fe7f1b23ea1f17533884b8fa7f7eb40087d558 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 5 Jan 2016 17:50:00 -0800
Subject: [PATCH] When disabling SSE, make sure -fpmath is not set to use SSE
either
This fixes errors when we inject sse options through CFLAGS and now
that we have -Werror turned on by default this warning turns to become
error on x86
gcc -m32 -march=core2 -mtune=core2 -msse3 -mfpmath=sse -x c /dev/null -S
-mno-sse -mno-mmx
generates warning
/dev/null:1:0: warning: SSE instruction set disabled, using 387
arithmetics
where as
gcc -m32 -march=core2 -mtune=core2 -msse3 -mfpmath=sse -x c /dev/null -S
-mno-sse -mno-mmx -mfpmath=387
Generates no warnings
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
Upstream-Status: Submitted
ChangeLog | 5 +++++
sysdeps/i386/Makefile | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/sysdeps/i386/Makefile b/sysdeps/i386/Makefile
index 168512f..70153b3 100644
--- a/sysdeps/i386/Makefile
+++ b/sysdeps/i386/Makefile
@@ -89,7 +89,7 @@ ifeq ($(subdir),elf)
# the first 3 mm/xmm/ymm/zmm registers are used to pass vector parameters
# which must be preserved.
CFLAGS-.os += $(if $(filter $(@F),$(patsubst %,%.os,$(all-rtld-routines))),\
- -mno-sse -mno-mmx)
+ -mno-sse -mno-mmx -mfpmath=387)
tests-special += $(objpfx)tst-ld-sse-use.out
$(objpfx)tst-ld-sse-use.out: ../sysdeps/i386/tst-ld-sse-use.sh $(objpfx)ld.so
--
2.6.4

View File

@ -1,556 +0,0 @@
From ba069b3107f5ad200c4ab95e69cf368e2353b00a Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 18 Mar 2015 00:46:50 +0000
Subject: [PATCH 26/27] eglibc: dl_debug_mask is controlled by
__OPTION_EGLIBC_RTLD_DEBUG
use GLRO_dl_debug_mask
Singed-off-by: Khem Raj <raj.khem@gmail.com>
Upstream-Status: Pending
---
csu/libc-start.c | 4 ++--
elf/dl-cache.c | 4 ++--
elf/dl-close.c | 6 +++---
elf/dl-conflict.c | 2 +-
elf/dl-deps.c | 6 +++---
elf/dl-error.c | 2 +-
elf/dl-fini.c | 4 ++--
elf/dl-init.c | 4 ++--
elf/dl-load.c | 16 ++++++++--------
elf/dl-lookup.c | 14 +++++++-------
elf/dl-object.c | 2 +-
elf/dl-open.c | 10 +++++-----
elf/dl-reloc.c | 2 +-
elf/dl-version.c | 2 +-
elf/get-dynamic-info.h | 2 +-
elf/rtld.c | 22 +++++++++++-----------
16 files changed, 51 insertions(+), 51 deletions(-)
diff --git a/csu/libc-start.c b/csu/libc-start.c
index 0afa7c0..2151fb6 100644
--- a/csu/libc-start.c
+++ b/csu/libc-start.c
@@ -238,7 +238,7 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
/* Call the initializer of the program, if any. */
#ifdef SHARED
- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS, 0))
+ if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_IMPCALLS, 0))
GLRO(dl_debug_printf) ("\ninitialize program: %s\n\n", argv[0]);
#endif
if (init)
@@ -261,7 +261,7 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
#endif
#ifdef SHARED
- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS))
+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_IMPCALLS))
GLRO(dl_debug_printf) ("\ntransferring control: %s\n\n", argv[0]);
#endif
diff --git a/elf/dl-cache.c b/elf/dl-cache.c
index 862f1d8..dab9c51 100644
--- a/elf/dl-cache.c
+++ b/elf/dl-cache.c
@@ -194,7 +194,7 @@ _dl_load_cache_lookup (const char *name)
const char *best;
/* Print a message if the loading of libs is traced. */
- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS))
+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_LIBS))
_dl_debug_printf (" search cache=%s\n", LD_SO_CACHE);
if (cache == NULL)
@@ -292,7 +292,7 @@ _dl_load_cache_lookup (const char *name)
}
/* Print our result if wanted. */
- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_LIBS, 0)
+ if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_LIBS, 0)
&& best != NULL)
_dl_debug_printf (" trying file=%s\n", best);
diff --git a/elf/dl-close.c b/elf/dl-close.c
index c897247..b1b4bd5 100644
--- a/elf/dl-close.c
+++ b/elf/dl-close.c
@@ -125,7 +125,7 @@ _dl_close_worker (struct link_map *map, bool force)
dl_close_state = rerun;
/* There are still references to this object. Do nothing more. */
- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES))
+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_FILES))
_dl_debug_printf ("\nclosing file=%s; direct_opencount=%u\n",
map->l_name, map->l_direct_opencount);
@@ -269,7 +269,7 @@ _dl_close_worker (struct link_map *map, bool force)
if (imap->l_init_called)
{
/* When debugging print a message first. */
- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS,
+ if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_IMPCALLS,
0))
_dl_debug_printf ("\ncalling fini: %s [%lu]\n\n",
imap->l_name, nsid);
@@ -711,7 +711,7 @@ _dl_close_worker (struct link_map *map, bool force)
free (imap->l_reldeps);
/* Print debugging message. */
- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES))
+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_FILES))
_dl_debug_printf ("\nfile=%s [%lu]; destroying link map\n",
imap->l_name, imap->l_ns);
diff --git a/elf/dl-conflict.c b/elf/dl-conflict.c
index 47a946e..e6a3f21 100644
--- a/elf/dl-conflict.c
+++ b/elf/dl-conflict.c
@@ -32,7 +32,7 @@ _dl_resolve_conflicts (struct link_map *l, ElfW(Rela) *conflict,
ElfW(Rela) *conflictend)
{
#if ! ELF_MACHINE_NO_RELA
- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_RELOC))
+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_RELOC))
_dl_debug_printf ("\nconflict processing: %s\n", DSO_FILENAME (l->l_name));
{
diff --git a/elf/dl-deps.c b/elf/dl-deps.c
index eee146a..1a4b004 100644
--- a/elf/dl-deps.c
+++ b/elf/dl-deps.c
@@ -127,7 +127,7 @@ empty dynamic string token substitution")); \
else \
{ \
/* This is for DT_AUXILIARY. */ \
- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS)) \
+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_LIBS)) \
_dl_debug_printf (N_("\
cannot load auxiliary `%s' because of empty dynamic string token " \
"substitution\n"), __str); \
@@ -303,7 +303,7 @@ _dl_map_object_deps (struct link_map *map,
args.name = name;
/* Say that we are about to load an auxiliary library. */
- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_LIBS,
+ if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_LIBS,
0))
_dl_debug_printf ("load auxiliary object=%s"
" requested by file=%s\n",
@@ -520,7 +520,7 @@ _dl_map_object_deps (struct link_map *map,
runp->map->l_reserved = 0;
}
- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_PRELINK, 0) != 0
+ if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_PRELINK, 0) != 0
&& map == GL(dl_ns)[LM_ID_BASE]._ns_loaded)
{
/* If we are to compute conflicts, we have to build local scope
diff --git a/elf/dl-error.c b/elf/dl-error.c
index 0fc3fd8..ea82f4d 100644
--- a/elf/dl-error.c
+++ b/elf/dl-error.c
@@ -139,7 +139,7 @@ internal_function
_dl_signal_cerror (int errcode, const char *objname, const char *occation,
const char *errstring)
{
- if (__builtin_expect (GLRO(dl_debug_mask)
+ if (__builtin_expect (GLRO_dl_debug_mask
& ~(DL_DEBUG_STATISTICS|DL_DEBUG_PRELINK), 0))
_dl_debug_printf ("%s: error: %s: %s (%s)\n", objname, occation,
errstring, receiver ? "continued" : "fatal");
diff --git a/elf/dl-fini.c b/elf/dl-fini.c
index 6cfe651..f59f7fe 100644
--- a/elf/dl-fini.c
+++ b/elf/dl-fini.c
@@ -234,7 +234,7 @@ _dl_fini (void)
|| l->l_info[DT_FINI] != NULL)
{
/* When debugging print a message first. */
- if (__builtin_expect (GLRO(dl_debug_mask)
+ if (__builtin_expect (GLRO_dl_debug_mask
& DL_DEBUG_IMPCALLS, 0))
_dl_debug_printf ("\ncalling fini: %s [%lu]\n\n",
DSO_FILENAME (l->l_name),
@@ -286,7 +286,7 @@ _dl_fini (void)
goto again;
}
- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_STATISTICS))
+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_STATISTICS))
_dl_debug_printf ("\nruntime linker statistics:\n"
" final number of relocations: %lu\n"
"final number of relocations from cache: %lu\n",
diff --git a/elf/dl-init.c b/elf/dl-init.c
index 2f85731..e46e8b6 100644
--- a/elf/dl-init.c
+++ b/elf/dl-init.c
@@ -46,7 +46,7 @@ call_init (struct link_map *l, int argc, char **argv, char **env)
return;
/* Print a debug message if wanted. */
- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS))
+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_IMPCALLS))
_dl_debug_printf ("\ncalling init: %s\n\n",
DSO_FILENAME (l->l_name));
@@ -96,7 +96,7 @@ _dl_init (struct link_map *main_map, int argc, char **argv, char **env)
ElfW(Addr) *addrs;
unsigned int cnt;
- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS))
+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_IMPCALLS))
_dl_debug_printf ("\ncalling preinit: %s\n\n",
DSO_FILENAME (main_map->l_name));
diff --git a/elf/dl-load.c b/elf/dl-load.c
index f664f50..8c28744 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -943,7 +943,7 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
}
/* Print debugging message. */
- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES))
+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_FILES))
_dl_debug_printf ("file=%s [%lu]; generating link map\n", name, nsid);
/* This is the ELF header. We read it in `open_verify'. */
@@ -1347,7 +1347,7 @@ cannot enable executable stack as shared object requires");
l->l_entry += l->l_addr;
- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES))
+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_FILES))
_dl_debug_printf ("\
dynamic: 0x%0*lx base: 0x%0*lx size: 0x%0*Zx\n\
entry: 0x%0*lx phdr: 0x%0*lx phnum: %*u\n\n",
@@ -1789,7 +1789,7 @@ open_path (const char *name, size_t namelen, int mode,
/* If we are debugging the search for libraries print the path
now if it hasn't happened now. */
- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS)
+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_LIBS)
&& current_what != this_dir->what)
{
current_what = this_dir->what;
@@ -1810,7 +1810,7 @@ open_path (const char *name, size_t namelen, int mode,
- buf);
/* Print name we try if this is wanted. */
- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS))
+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_LIBS))
_dl_debug_printf (" trying file=%s\n", buf);
fd = open_verify (buf, fbp, loader, whatcode, mode,
@@ -1955,7 +1955,7 @@ _dl_map_object (struct link_map *loader, const char *name,
}
/* Display information if we are debugging. */
- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES)
+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_FILES)
&& loader != NULL)
_dl_debug_printf ((mode & __RTLD_CALLMAP) == 0
? "\nfile=%s [%lu]; needed by %s [%lu]\n"
@@ -1997,7 +1997,7 @@ _dl_map_object (struct link_map *loader, const char *name,
size_t namelen = strlen (name) + 1;
- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS))
+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_LIBS))
_dl_debug_printf ("find library=%s [%lu]; searching\n", name, nsid);
fd = -1;
@@ -2119,7 +2119,7 @@ _dl_map_object (struct link_map *loader, const char *name,
#endif
/* Add another newline when we are tracing the library loading. */
- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS))
+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_LIBS))
_dl_debug_printf ("\n");
}
else
@@ -2152,7 +2152,7 @@ _dl_map_object (struct link_map *loader, const char *name,
if (__glibc_unlikely (fd == -1))
{
if (trace_mode
- && __glibc_likely ((GLRO(dl_debug_mask) & DL_DEBUG_PRELINK) == 0))
+ && __glibc_likely ((GLRO_dl_debug_mask & DL_DEBUG_PRELINK) == 0))
{
/* We haven't found an appropriate library. But since we
are only interested in the list of libraries this isn't
diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c
index 11cb44b..588c3e4 100644
--- a/elf/dl-lookup.c
+++ b/elf/dl-lookup.c
@@ -302,7 +302,7 @@ do_lookup_unique (const char *undef_name, uint_fast32_t new_hash,
hash table. */
if (__glibc_unlikely (tab->size))
{
- assert (GLRO(dl_debug_mask) & DL_DEBUG_PRELINK);
+ assert (GLRO_dl_debug_mask & DL_DEBUG_PRELINK);
goto success;
}
#endif
@@ -378,7 +378,7 @@ do_lookup_x (const char *undef_name, uint_fast32_t new_hash,
continue;
/* Print some debugging info if wanted. */
- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_SYMBOLS))
+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_SYMBOLS))
_dl_debug_printf ("symbol=%s; lookup in file=%s [%lu]\n",
undef_name, DSO_FILENAME (map->l_name),
map->l_ns);
@@ -755,7 +755,7 @@ add_dependency (struct link_map *undef_map, struct link_map *map, int flags)
}
/* Display information if we are debugging. */
- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES))
+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_FILES))
_dl_debug_printf ("\
\nfile=%s [%lu]; needed by %s [%lu] (relocation dependency)\n\n",
DSO_FILENAME (map->l_name),
@@ -859,7 +859,7 @@ _dl_lookup_symbol_x (const char *undef_name, struct link_map *undef_map,
{
if ((*ref == NULL || ELFW(ST_BIND) ((*ref)->st_info) != STB_WEAK)
&& skip_map == NULL
- && !(GLRO(dl_debug_mask) & DL_DEBUG_UNUSED))
+ && !(GLRO_dl_debug_mask & DL_DEBUG_UNUSED))
{
/* We could find no value for a strong reference. */
const char *reference_name = undef_map ? undef_map->l_name : "";
@@ -935,7 +935,7 @@ _dl_lookup_symbol_x (const char *undef_name, struct link_map *undef_map,
if (__glibc_unlikely (current_value.m->l_used == 0))
current_value.m->l_used = 1;
- if (__glibc_unlikely (GLRO(dl_debug_mask)
+ if (__glibc_unlikely (GLRO_dl_debug_mask
& (DL_DEBUG_BINDINGS|DL_DEBUG_PRELINK)))
_dl_debug_bindings (undef_name, undef_map, ref,
&current_value, version, type_class, protected);
@@ -1000,7 +1000,7 @@ _dl_debug_bindings (const char *undef_name, struct link_map *undef_map,
{
const char *reference_name = undef_map->l_name;
- if (GLRO(dl_debug_mask) & DL_DEBUG_BINDINGS)
+ if (GLRO_dl_debug_mask & DL_DEBUG_BINDINGS)
{
_dl_debug_printf ("binding file %s [%lu] to %s [%lu]: %s symbol `%s'",
DSO_FILENAME (reference_name),
@@ -1014,7 +1014,7 @@ _dl_debug_bindings (const char *undef_name, struct link_map *undef_map,
_dl_debug_printf_c ("\n");
}
#ifdef SHARED
- if (GLRO(dl_debug_mask) & DL_DEBUG_PRELINK)
+ if (GLRO_dl_debug_mask & DL_DEBUG_PRELINK)
{
int conflict = 0;
struct sym_val val = { NULL, NULL };
diff --git a/elf/dl-object.c b/elf/dl-object.c
index 1d58bbc..938a257 100644
--- a/elf/dl-object.c
+++ b/elf/dl-object.c
@@ -98,7 +98,7 @@ _dl_new_object (char *realname, const char *libname, int type,
new->l_type = type;
/* If we set the bit now since we know it is never used we avoid
dirtying the cache line later. */
- if ((GLRO(dl_debug_mask) & DL_DEBUG_UNUSED) == 0)
+ if ((GLRO_dl_debug_mask & DL_DEBUG_UNUSED) == 0)
new->l_used = 1;
new->l_loader = loader;
#if NO_TLS_OFFSET != 0
diff --git a/elf/dl-open.c b/elf/dl-open.c
index 2db1c02..1288604 100644
--- a/elf/dl-open.c
+++ b/elf/dl-open.c
@@ -147,7 +147,7 @@ add_to_global (struct link_map *new)
ns->_ns_main_searchlist->r_list[new_nlist++] = map;
/* We modify the global scope. Report this. */
- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_SCOPES))
+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_SCOPES))
_dl_debug_printf ("\nadd %s [%lu] to global scope\n",
map->l_name, map->l_ns);
}
@@ -251,7 +251,7 @@ dl_open_worker (void *a)
if (__glibc_unlikely (new->l_searchlist.r_list != NULL))
{
/* Let the user know about the opencount. */
- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES))
+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_FILES))
_dl_debug_printf ("opening file=%s [%lu]; direct_opencount=%u\n\n",
new->l_name, new->l_ns, new->l_direct_opencount);
@@ -302,7 +302,7 @@ dl_open_worker (void *a)
LIBC_PROBE (map_complete, 3, args->nsid, r, new);
/* Print scope information. */
- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_SCOPES))
+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_SCOPES))
_dl_show_scope (new, 0);
/* Only do lazy relocation if `LD_BIND_NOW' is not set. */
@@ -519,7 +519,7 @@ dl_open_worker (void *a)
}
/* Print scope information. */
- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_SCOPES))
+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_SCOPES))
_dl_show_scope (imap, from_scope);
}
@@ -577,7 +577,7 @@ TLS generation counter wrapped! Please report this."));
#endif
/* Let the user know about the opencount. */
- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES))
+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_FILES))
_dl_debug_printf ("opening file=%s [%lu]; direct_opencount=%u\n\n",
new->l_name, new->l_ns, new->l_direct_opencount);
}
diff --git a/elf/dl-reloc.c b/elf/dl-reloc.c
index 61252d7..4c83815 100644
--- a/elf/dl-reloc.c
+++ b/elf/dl-reloc.c
@@ -178,7 +178,7 @@ _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[],
&& __builtin_expect (l->l_info[DT_BIND_NOW] != NULL, 0))
lazy = 0;
- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_RELOC))
+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_RELOC))
_dl_debug_printf ("\nrelocation processing: %s%s\n",
DSO_FILENAME (l->l_name), lazy ? " (lazy)" : "");
diff --git a/elf/dl-version.c b/elf/dl-version.c
index f6e5cd9..320628c 100644
--- a/elf/dl-version.c
+++ b/elf/dl-version.c
@@ -82,7 +82,7 @@ match_symbol (const char *name, Lmid_t ns, ElfW(Word) hash, const char *string,
int result = 0;
/* Display information about what we are doing while debugging. */
- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_VERSIONS))
+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_VERSIONS))
_dl_debug_printf ("\
checking for version `%s' in file %s [%lu] required by file %s [%lu]\n",
string, DSO_FILENAME (map->l_name),
diff --git a/elf/get-dynamic-info.h b/elf/get-dynamic-info.h
index dc8359d..7774fda 100644
--- a/elf/get-dynamic-info.h
+++ b/elf/get-dynamic-info.h
@@ -166,7 +166,7 @@ elf_get_dynamic_info (struct link_map *l, ElfW(Dyn) *temp)
them. Therefore to avoid breaking existing applications the
best we can do is add a warning during debugging with the
intent of notifying the user of the problem. */
- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0)
+ if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_FILES, 0)
&& l->l_flags_1 & ~DT_1_SUPPORTED_MASK)
_dl_debug_printf ("\nWARNING: Unsupported flag value(s) of 0x%x in DT_FLAGS_1.\n",
l->l_flags_1 & ~DT_1_SUPPORTED_MASK);
diff --git a/elf/rtld.c b/elf/rtld.c
index fc3a2db..59c4637 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -323,7 +323,7 @@ _dl_start_final (void *arg, struct dl_start_final_info *info)
}
#endif
- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_STATISTICS))
+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_STATISTICS))
{
#ifndef HP_TIMING_NONAVAIL
print_statistics (&rtld_total_time);
@@ -1701,7 +1701,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
after relocation. */
struct link_map *l;
- if (GLRO(dl_debug_mask) & DL_DEBUG_PRELINK)
+ if (GLRO_dl_debug_mask & DL_DEBUG_PRELINK)
{
struct r_scope_elem *scope = &main_map->l_searchlist;
@@ -1731,7 +1731,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
_dl_printf ("\n");
}
}
- else if (GLRO(dl_debug_mask) & DL_DEBUG_UNUSED)
+ else if (GLRO_dl_debug_mask & DL_DEBUG_UNUSED)
{
/* Look through the dependencies of the main executable
and determine which of them is not actually
@@ -1839,7 +1839,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
}
}
- if ((GLRO(dl_debug_mask) & DL_DEBUG_PRELINK)
+ if ((GLRO_dl_debug_mask & DL_DEBUG_PRELINK)
&& rtld_multiple_ref)
{
/* Mark the link map as not yet relocated again. */
@@ -1972,7 +1972,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
if (r_list == r_listend && liblist == liblistend)
prelinked = true;
- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS))
+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_LIBS))
_dl_debug_printf ("\nprelink checking: %s\n",
prelinked ? "ok" : "failed");
}
@@ -1990,7 +1990,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
GLRO(dl_init_all_dirs) = GL(dl_all_dirs);
/* Print scope information. */
- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_SCOPES))
+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_SCOPES))
{
_dl_debug_printf ("\nInitial object scopes\n");
@@ -2265,7 +2265,7 @@ process_dl_debug (const char *dl_debug)
if (debopts[cnt].len == len
&& memcmp (dl_debug, debopts[cnt].name, len) == 0)
{
- GLRO(dl_debug_mask) |= debopts[cnt].mask;
+ GLRO_dl_debug_mask |= debopts[cnt].mask;
any_debug = 1;
break;
}
@@ -2286,7 +2286,7 @@ warning: debug option `%s' unknown; try LD_DEBUG=help\n", copy);
++dl_debug;
}
- if (GLRO(dl_debug_mask) & DL_DEBUG_UNUSED)
+ if (GLRO_dl_debug_mask & DL_DEBUG_UNUSED)
{
/* In order to get an accurate picture of whether a particular
DT_NEEDED entry is actually used we have to process both
@@ -2294,7 +2294,7 @@ warning: debug option `%s' unknown; try LD_DEBUG=help\n", copy);
GLRO(dl_lazy) = 0;
}
- if (GLRO(dl_debug_mask) & DL_DEBUG_HELP)
+ if (GLRO_dl_debug_mask & DL_DEBUG_HELP)
{
size_t cnt;
@@ -2499,7 +2499,7 @@ process_envvars (enum mode *modep)
mode = trace;
GLRO(dl_verbose) = 1;
#if __OPTION_EGLIBC_RTLD_DEBUG
- GLRO(dl_debug_mask) |= DL_DEBUG_PRELINK;
+ GLRO_dl_debug_mask |= DL_DEBUG_PRELINK;
#endif
GLRO(dl_trace_prelink) = &envline[17];
}
@@ -2548,7 +2548,7 @@ process_envvars (enum mode *modep)
{
unsetenv ("MALLOC_CHECK_");
#if __OPTION_EGLIBC_RTLD_DEBUG
- GLRO(dl_debug_mask) = 0;
+ GLRO_dl_debug_mask = 0;
#endif
}
--
2.1.4

View File

@ -1,145 +0,0 @@
From e98779aa56fae0346dff2d0b72acadd0eaf01891 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 27 May 2015 16:10:50 -0700
Subject: [PATCH 27/27] eglibc-use-option-groups: Conditionally exclude c++
tests
Some test programs written in c++ are still included in spite of
"libc-cxx-tests" being omitted from DISTRO_FEATURES_LIBC.
All .cc programs are compiled with g++.
g++ automatically specifies linking against the C++ library.
This patch conditionally excludes the following tests as well:
bug-atexit3-lib.cc
tst-cancel24.cc
tst-cancel24-static.cc
tst-unique3lib.cc
tst-unique3lib2.cc
tst-unique4lib.cc
tst-unique3.cc
tst-unique4.cc
Tested with DISTRO_FEATURES_LIBC_remove = " libc-cxx-tests"
[YOCTO #7003]
Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
dlfcn/Makefile | 8 ++++++--
elf/Makefile | 19 ++++++++++++++-----
nptl/Makefile | 12 ++++++++++--
3 files changed, 30 insertions(+), 9 deletions(-)
diff --git a/dlfcn/Makefile b/dlfcn/Makefile
index 3827607..920bd58 100644
--- a/dlfcn/Makefile
+++ b/dlfcn/Makefile
@@ -39,16 +39,20 @@ ifeq (yes,$(build-shared))
tests = glrefmain failtest tst-dladdr default errmsg1 tstcxaatexit \
bug-dlopen1 bug-dlsym1 tst-dlinfo bug-atexit1 bug-atexit2 \
tstatexit bug-dl-leaf tst-rec-dlopen
-endif
-
tests-$(OPTION_EGLIBC_CXX_TESTS) += bug-atexit3
+endif
+
modules-names = glreflib1 glreflib2 glreflib3 failtestmod defaultmod1 \
defaultmod2 errmsg1mod modatexit modcxaatexit \
bug-dlsym1-lib1 bug-dlsym1-lib2 bug-atexit1-lib \
bug-atexit2-lib bug-dl-leaf-lib \
bug-dl-leaf-lib-cb moddummy1 moddummy2
+ifeq (y,$(OPTION_EGLIBC_CXX_TESTS))
+modules-names += bug-atexit3-lib
+endif
+
failtestmod.so-no-z-defs = yes
glreflib2.so-no-z-defs = yes
errmsg1mod.so-no-z-defs = yes
diff --git a/elf/Makefile b/elf/Makefile
index 71a18a1..26fe3c5 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -17,6 +17,8 @@
# Makefile for elf subdirectory of GNU C Library.
+include ../option-groups.mak
+
subdir := elf
include ../Makeconfig
@@ -145,12 +147,15 @@ tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
unload3 unload4 unload5 unload6 unload7 unload8 tst-global1 order2 \
tst-audit1 tst-audit2 tst-audit8 tst-audit9 \
tst-stackguard1 tst-addr1 tst-thrlock \
- tst-unique1 tst-unique2 $(if $(CXX),tst-unique3 tst-unique4 \
- tst-nodelete) \
+ tst-unique1 tst-unique2 \
tst-initorder tst-initorder2 tst-relsort1 tst-null-argv \
tst-ptrguard1 tst-tlsalign tst-tlsalign-extern tst-nodelete-opened \
tst-nodelete2
# reldep9
+ifeq (y,$(OPTION_EGLIBC_CXX_TESTS))
+tests += $(if $(CXX),tst-unique3 tst-unique4 tst-nodelete)
+endif
+
ifeq ($(build-hardcoded-path-in-tests),yes)
tests += tst-dlopen-aout
LDFLAGS-tst-dlopen-aout = $(no-pie-ldflag)
@@ -209,9 +214,6 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
tst-unique1mod1 tst-unique1mod2 \
tst-unique2mod1 tst-unique2mod2 \
tst-auditmod9a tst-auditmod9b \
- $(if $(CXX),tst-unique3lib tst-unique3lib2 tst-unique4lib \
- tst-nodelete-uniquemod tst-nodelete-rtldmod \
- tst-nodelete-zmod) \
tst-initordera1 tst-initorderb1 \
tst-initordera2 tst-initorderb2 \
tst-initordera3 tst-initordera4 \
@@ -220,6 +222,13 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
tst-relsort1mod1 tst-relsort1mod2 tst-array2dep \
tst-array5dep tst-null-argv-lib \
tst-tlsalign-lib tst-nodelete-opened-lib tst-nodelete2mod
+
+ifeq (y,$(OPTION_EGLIBC_CXX_TESTS))
+modules-names += $(if $(CXX),tst-unique3lib tst-unique3lib2 tst-unique4lib \
+ tst-nodelete-uniquemod tst-nodelete-rtldmod \
+ tst-nodelete-zmod)
+endif
+
ifeq (yes,$(have-protected-data))
modules-names += tst-protected1moda tst-protected1modb
tests += tst-protected1a tst-protected1b
diff --git a/nptl/Makefile b/nptl/Makefile
index 596ca3c..50a708b 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -390,12 +390,20 @@ link-libc-static := $(common-objpfx)libc.a $(static-gnulib) \
$(common-objpfx)libc.a
tests-static += tst-locale1 tst-locale2 tst-stackguard1-static \
- tst-cancel21-static tst-cancel24-static tst-cond8-static \
+ tst-cancel21-static tst-cond8-static \
tst-mutex8-static tst-mutexpi8-static tst-sem11-static \
tst-sem12-static
-tests += tst-stackguard1-static tst-cancel21-static tst-cancel24-static \
+
+ifeq (y,$(OPTION_EGLIBC_CXX_TESTS))
+tests-static += tst-cancel24-static
+endif
+
+tests += tst-stackguard1-static tst-cancel21-static \
tst-cond8-static tst-mutex8-static tst-mutexpi8-static \
tst-sem11-static tst-sem12-static
+
+tests-$(OPTION_EGLIBC_CXX_TESTS) += tst-cancel24-static
+
xtests-static += tst-setuid1-static
# These tests are linked with libc before libpthread
--
2.1.4

View File

@ -1,84 +0,0 @@
From cadaf1336332ca7bcdfe4a400776e5782a20e26d Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Wed, 28 Oct 2015 07:49:44 -0700
Subject: [PATCH] Keep only ELF_RTYPE_CLASS_{PLT|COPY} bits for prelink
prelink runs ld.so with the environment variable LD_TRACE_PRELINKING
set to dump the relocation type class from _dl_debug_bindings. prelink
has the following relocation type classes:
#define RTYPE_CLASS_VALID 8
#define RTYPE_CLASS_PLT (8|1)
#define RTYPE_CLASS_COPY (8|2)
#define RTYPE_CLASS_TLS (8|4)
where ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA has a conflict with
RTYPE_CLASS_TLS.
Since prelink only uses ELF_RTYPE_CLASS_PLT and ELF_RTYPE_CLASS_COPY
bits, we should clear the other bits when the DL_DEBUG_PRELINK bit is
set.
[BZ #19178]
* elf/dl-lookup.c (RTYPE_CLASS_VALID): New.
(RTYPE_CLASS_PLT): Likewise.
(RTYPE_CLASS_COPY): Likewise.
(RTYPE_CLASS_TLS): Likewise.
(_dl_debug_bindings): Use RTYPE_CLASS_TLS and RTYPE_CLASS_VALID
to set relocation type class for DL_DEBUG_PRELINK. Keep only
ELF_RTYPE_CLASS_PLT and ELF_RTYPE_CLASS_COPY bits for
DL_DEBUG_PRELINK.
Upstream-Status: submitted (https://sourceware.org/bugzilla/show_bug.cgi?id=19178)
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
---
elf/dl-lookup.c | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c
index 581fb20..6ae6cc3 100644
--- a/elf/dl-lookup.c
+++ b/elf/dl-lookup.c
@@ -1016,6 +1016,18 @@ _dl_debug_bindings (const char *undef_name, struct link_map *undef_map,
#ifdef SHARED
if (GLRO(dl_debug_mask) & DL_DEBUG_PRELINK)
{
+/* ELF_RTYPE_CLASS_XXX must match RTYPE_CLASS_XXX used by prelink with
+ LD_TRACE_PRELINKING. */
+#define RTYPE_CLASS_VALID 8
+#define RTYPE_CLASS_PLT (8|1)
+#define RTYPE_CLASS_COPY (8|2)
+#define RTYPE_CLASS_TLS (8|4)
+#if ELF_RTYPE_CLASS_PLT != 0 && ELF_RTYPE_CLASS_PLT != 1
+# error ELF_RTYPE_CLASS_PLT must be 0 or 1!
+#endif
+#if ELF_RTYPE_CLASS_COPY != 0 && ELF_RTYPE_CLASS_COPY != 2
+# error ELF_RTYPE_CLASS_COPY must be 0 or 2!
+#endif
int conflict = 0;
struct sym_val val = { NULL, NULL };
@@ -1071,12 +1083,17 @@ _dl_debug_bindings (const char *undef_name, struct link_map *undef_map,
if (value->s)
{
+ /* Keep only ELF_RTYPE_CLASS_PLT and ELF_RTYPE_CLASS_COPY
+ bits since since prelink only uses them. */
+ type_class &= ELF_RTYPE_CLASS_PLT | ELF_RTYPE_CLASS_COPY;
if (__glibc_unlikely (ELFW(ST_TYPE) (value->s->st_info)
== STT_TLS))
- type_class = 4;
+ /* Clear the RTYPE_CLASS_VALID bit in RTYPE_CLASS_TLS. */
+ type_class = RTYPE_CLASS_TLS & ~RTYPE_CLASS_VALID;
else if (__glibc_unlikely (ELFW(ST_TYPE) (value->s->st_info)
== STT_GNU_IFUNC))
- type_class |= 8;
+ /* Set the RTYPE_CLASS_VALID bit. */
+ type_class |= RTYPE_CLASS_VALID;
}
if (conflict
--
1.9.3

View File

@ -1,40 +0,0 @@
From b0e805fa0d6fea33745952df7b7f5442ca4c374f Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Fri, 28 Aug 2015 17:08:49 -0400
Subject: [PATCH] getmntent: fix memory corruption w/blank lines [BZ #18887]
The fix for BZ #17273 introduced a single byte of memory corruption when
the line is entirely blank. It would walk back past the start of the
buffer if the heap happened to be 0x20 or 0x09 and then write a NUL byte.
buffer = '\n';
end_ptr = buffer;
while (end_ptr[-1] == ' ' || end_ptr[-1] == '\t')
end_ptr--;
*end_ptr = '\0';
Fix that and rework the tests. Adding the testcase for BZ #17273 to the
existing \040 parser does not really make sense as it's unrelated, and
leads to confusing behavior: it implicitly relies on the new entry being
longer than the previous entry (since it just rewinds the FILE*). Split
it out into its own dedicated testcase instead.
The original patch is at link https://sourceware.org/git/gitweb.cgi?p=glibc.git;a=patch;h=b0e805fa0d6fea33745952df7b7f5442ca4c374f.
Only code to mntent_r.c is kept in this patch, Change log, NEWS, Makefile, and test cases are excluded.
Upstream-Status: Backport (upstreamed to 2.23)
Signed-off-by: Baoshan Pang <baoshan.pang@windriver.com>
diff --git a/misc/mntent_r.c b/misc/mntent_r.c
index 6159873..19af8a8 100644
--- a/misc/mntent_r.c
+++ b/misc/mntent_r.c
@@ -136,7 +136,8 @@ __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')
+ while (end_ptr != buffer
+ && (end_ptr[-1] == ' ' || end_ptr[-1] == '\t'))
end_ptr--;
*end_ptr = '\0';
}

View File

@ -1,642 +0,0 @@
From e9db92d3acfe1822d56d11abcea5bfc4c41cf6ca Mon Sep 17 00:00:00 2001
From: Carlos O'Donell <carlos@systemhalted.org>
Date: Tue, 16 Feb 2016 21:26:37 -0500
Subject: [PATCH] CVE-2015-7547: getaddrinfo() stack-based buffer overflow (Bug
18665).
* A stack-based buffer overflow was found in libresolv when invoked from
libnss_dns, allowing specially crafted DNS responses to seize control
of execution flow in the DNS client. The buffer overflow occurs in
the functions send_dg (send datagram) and send_vc (send TCP) for the
NSS module libnss_dns.so.2 when calling getaddrinfo with AF_UNSPEC
family. The use of AF_UNSPEC triggers the low-level resolver code to
send out two parallel queries for A and AAAA. A mismanagement of the
buffers used for those queries could result in the response of a query
writing beyond the alloca allocated buffer created by
_nss_dns_gethostbyname4_r. Buffer management is simplified to remove
the overflow. Thanks to the Google Security Team and Red Hat for
reporting the security impact of this issue, and Robert Holiday of
Ciena for reporting the related bug 18665. (CVE-2015-7547)
See also:
https://sourceware.org/ml/libc-alpha/2016-02/msg00416.html
https://sourceware.org/ml/libc-alpha/2016-02/msg00418.html
Upstream-Status: Backport
CVE: CVE-2015-7547
https://sourceware.org/git/?p=glibc.git;a=commit;h=e9db92d3acfe1822d56d11abcea5bfc4c41cf6ca
minor tweeking to apply to Changelog and res_send.c
Signed-off-by: Armin Kuster <akuster@mvista.com>
---
ChangeLog | 17 ++-
NEWS | 14 +++
resolv/nss_dns/dns-host.c | 111 +++++++++++++++++++-
resolv/res_query.c | 3 +
resolv/res_send.c | 260 +++++++++++++++++++++++++++++++++++-----------
5 files changed, 339 insertions(+), 66 deletions(-)
Index: git/NEWS
===================================================================
--- git.orig/NEWS
+++ git/NEWS
@@ -105,6 +105,20 @@ Security related changes:
depending on the length of the string passed as an argument to the
functions. Reported by Joseph Myers.
+* A stack-based buffer overflow was found in libresolv when invoked from
+ libnss_dns, allowing specially crafted DNS responses to seize control
+ of execution flow in the DNS client. The buffer overflow occurs in
+ the functions send_dg (send datagram) and send_vc (send TCP) for the
+ NSS module libnss_dns.so.2 when calling getaddrinfo with AF_UNSPEC
+ family. The use of AF_UNSPEC triggers the low-level resolver code to
+ send out two parallel queries for A and AAAA. A mismanagement of the
+ buffers used for those queries could result in the response of a query
+ writing beyond the alloca allocated buffer created by
+ _nss_dns_gethostbyname4_r. Buffer management is simplified to remove
+ the overflow. Thanks to the Google Security Team and Red Hat for
+ reporting the security impact of this issue, and Robert Holiday of
+ Ciena for reporting the related bug 18665. (CVE-2015-7547)
+
* The following bugs are resolved with this release:
6652, 10672, 12674, 12847, 12926, 13862, 14132, 14138, 14171, 14498,
Index: git/resolv/nss_dns/dns-host.c
===================================================================
--- git.orig/resolv/nss_dns/dns-host.c
+++ git/resolv/nss_dns/dns-host.c
@@ -1031,7 +1031,10 @@ gaih_getanswer_slice (const querybuf *an
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 *an
/* 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,
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 implementation of send_dg
+ and send_vc to see response can arrive in any order, particularly
+ 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,
&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;
Index: git/resolv/res_query.c
===================================================================
--- git.orig/resolv/res_query.c
+++ git/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)
Index: git/resolv/res_send.c
===================================================================
--- git.orig/resolv/res_send.c
+++ git/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.
@@ -363,6 +380,8 @@ __libc_res_nsend(res_state statp, const
#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);
@@ -638,6 +657,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 field 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,
@@ -647,11 +737,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
@@ -743,6 +829,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:
@@ -779,40 +867,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;
@@ -820,10 +882,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;
@@ -835,6 +901,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,
@@ -997,6 +1066,66 @@ reopen (res_state statp, int *terrno, in
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 field 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,
@@ -1006,8 +1135,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;
@@ -1040,6 +1167,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;
@@ -1203,55 +1332,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);
Index: git/ChangeLog
===================================================================
--- git.orig/ChangeLog
+++ git/ChangeLog
@@ -1,3 +1,18 @@
+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.
+
2015-09-26 Paul Pluzhnikov <ppluzhnikov@google.com>
[BZ #18985]

View File

@ -1,323 +0,0 @@
Upstream-Status: Backport
Signed-off-by: Li Xin <lixin.fnst@cn.fujitsu.com>
From https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=6c84109cfa26f35c3dfed3acb97d347361bd5849
Author: Carlos O'Donell <carlos@systemhalted.org>
Date: Thu Oct 8 16:34:53 2015 -0400
strcoll: Remove incorrect STRDIFF-based optimization (Bug 18589).
The optimization introduced in commit
f13c2a8dff2329c6692a80176262ceaaf8a6f74e, causes regressions in
sorting for languages that have digraphs that change sort order, like
cs_CZ which sorts ch between h and i.
My analysis shows the fast-forwarding optimization in STRCOLL advances
through a digraph while possibly stopping in the middle which results
in a subsequent skipping of the digraph and incorrect sorting. The
optimization is incorrect as implemented and because of that I'm
removing it for 2.23, and I will also commit this fix for 2.22 where
it was originally introduced.
This patch reverts the optimization, introduces a new bug-strcoll2.c
regression test that tests both cs_CZ.UTF-8 and da_DK.ISO-8859-1 and
ensures they sort one digraph each correctly. The optimization can't be
applied without regressing this test.
Checked on x86_64, bug-strcoll2.c fails without this patch and passes
after. This will also get a fix on 2.22 which has the same bug.
(cherry picked from commit 87701a58e291bd7ac3b407d10a829dac52c9c16e)
---
locale/C-collate.c | 4 +-
locale/categories.def | 1 -
locale/langinfo.h | 1 -
locale/localeinfo.h | 7 ----
locale/programs/ld-collate.c | 9 -----
string/bug-strcoll2.c | 95 ++++++++++++++++++++++++++++++++++++++++++++
string/strcoll_l.c | 39 +-----------------
wcsmbs/wcscoll_l.c | 1 -
8 files changed, 98 insertions(+), 59 deletions(-)
create mode 100644 string/bug-strcoll2.c
diff --git a/locale/C-collate.c b/locale/C-collate.c
index d7f3c55..06dfdfa 100644
--- a/locale/C-collate.c
+++ b/locale/C-collate.c
@@ -144,8 +144,6 @@ const struct __locale_data _nl_C_LC_COLLATE attribute_hidden =
/* _NL_COLLATE_COLLSEQWC */
{ .string = (const char *) collseqwc },
/* _NL_COLLATE_CODESET */
- { .string = _nl_C_codeset },
- /* _NL_COLLATE_ENCODING_TYPE */
- { .word = __cet_8bit }
+ { .string = _nl_C_codeset }
}
};
diff --git a/locale/categories.def b/locale/categories.def
index 045489d..a8dda53 100644
--- a/locale/categories.def
+++ b/locale/categories.def
@@ -58,7 +58,6 @@ DEFINE_CATEGORY
DEFINE_ELEMENT (_NL_COLLATE_COLLSEQMB, "collate-collseqmb", std, wstring)
DEFINE_ELEMENT (_NL_COLLATE_COLLSEQWC, "collate-collseqwc", std, wstring)
DEFINE_ELEMENT (_NL_COLLATE_CODESET, "collate-codeset", std, string)
- DEFINE_ELEMENT (_NL_COLLATE_ENCODING_TYPE, "collate-encoding-type", std, word)
), NO_POSTLOAD)
diff --git a/locale/langinfo.h b/locale/langinfo.h
index ffc5c7f..a565d9d 100644
--- a/locale/langinfo.h
+++ b/locale/langinfo.h
@@ -255,7 +255,6 @@ enum
_NL_COLLATE_COLLSEQMB,
_NL_COLLATE_COLLSEQWC,
_NL_COLLATE_CODESET,
- _NL_COLLATE_ENCODING_TYPE,
_NL_NUM_LC_COLLATE,
/* LC_CTYPE category: character classification.
diff --git a/locale/localeinfo.h b/locale/localeinfo.h
index a7516c0..c076d8e 100644
--- a/locale/localeinfo.h
+++ b/locale/localeinfo.h
@@ -110,13 +110,6 @@ enum coll_sort_rule
sort_mask
};
-/* Collation encoding type. */
-enum collation_encoding_type
-{
- __cet_other,
- __cet_8bit,
- __cet_utf8
-};
/* We can map the types of the entries into a few categories. */
enum value_type
diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c
index 16e9039..3c88c6d 100644
--- a/locale/programs/ld-collate.c
+++ b/locale/programs/ld-collate.c
@@ -32,7 +32,6 @@
#include "linereader.h"
#include "locfile.h"
#include "elem-hash.h"
-#include "../localeinfo.h"
/* Uncomment the following line in the production version. */
/* #define NDEBUG 1 */
@@ -2130,8 +2129,6 @@ collate_output (struct localedef_t *locale, const struct charmap_t *charmap,
/* The words have to be handled specially. */
if (idx == _NL_ITEM_INDEX (_NL_COLLATE_SYMB_HASH_SIZEMB))
add_locale_uint32 (&file, 0);
- else if (idx == _NL_ITEM_INDEX (_NL_COLLATE_ENCODING_TYPE))
- add_locale_uint32 (&file, __cet_other);
else
add_locale_empty (&file);
}
@@ -2495,12 +2492,6 @@ collate_output (struct localedef_t *locale, const struct charmap_t *charmap,
add_locale_raw_data (&file, collate->mbseqorder, 256);
add_locale_collseq_table (&file, &collate->wcseqorder);
add_locale_string (&file, charmap->code_set_name);
- if (strcmp (charmap->code_set_name, "UTF-8") == 0)
- add_locale_uint32 (&file, __cet_utf8);
- else if (charmap->mb_cur_max == 1)
- add_locale_uint32 (&file, __cet_8bit);
- else
- add_locale_uint32 (&file, __cet_other);
write_locale_data (output_path, LC_COLLATE, "LC_COLLATE", &file);
obstack_free (&weightpool, NULL);
diff --git a/string/bug-strcoll2.c b/string/bug-strcoll2.c
new file mode 100644
index 0000000..950b090
--- /dev/null
+++ b/string/bug-strcoll2.c
@@ -0,0 +1,95 @@
+/* Bug 18589: sort-test.sh fails at random.
+ * Copyright (C) 1998-2015 Free Software Foundation, Inc.
+ * This file is part of the GNU C Library.
+ * Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
+ *
+ * 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 <stdio.h>
+#include <string.h>
+#include <locale.h>
+
+/* An incorrect strcoll optimization resulted in incorrect
+ * results from strcoll for cs_CZ and da_DK. */
+
+int
+test_cs_CZ (void)
+{
+ const char t1[] = "config";
+ const char t2[] = "choose";
+ if (setlocale (LC_ALL, "cs_CZ.UTF-8") == NULL)
+ {
+ perror ("setlocale");
+ return 1;
+ }
+ /* In Czech the digraph ch sorts after c, therefore we expect
+ * config to sort before choose. */
+ int a = strcoll (t1, t2);
+ int b = strcoll (t2, t1);
+ printf ("strcoll (\"%s\", \"%s\") = %d\n", t1, t2, a);
+ printf ("strcoll (\"%s\", \"%s\") = %d\n", t2, t1, b);
+ if (a < 0 && b > 0)
+ {
+ puts ("PASS: config < choose");
+ return 0;
+ }
+ else
+ {
+ puts ("FAIL: Wrong sorting in cz_CZ.UTF-8.");
+ return 1;
+ }
+}
+
+int
+test_da_DK (void)
+{
+ const char t1[] = "AS";
+ const char t2[] = "AA";
+ if (setlocale (LC_ALL, "da_DK.ISO-8859-1") == NULL)
+ {
+ perror ("setlocale");
+ return 1;
+ }
+ /* AA should be treated as the last letter of the Danish alphabet,
+ * hence sorting after AS. */
+ int a = strcoll (t1, t2);
+ int b = strcoll (t2, t1);
+ printf ("strcoll (\"%s\", \"%s\") = %d\n", t1, t2, a);
+ printf ("strcoll (\"%s\", \"%s\") = %d\n", t2, t1, b);
+ if (a < 0 && b > 0)
+ {
+ puts ("PASS: AS < AA");
+ return 0;
+ }
+ else
+ {
+ puts ("FAIL: Wrong sorting in da_DK.ISO-8859-1");
+ return 1;
+ }
+}
+
+static int
+do_test (void)
+{
+ int err = 0;
+ err |= test_cs_CZ ();
+ err |= test_da_DK ();
+ return err;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
+
+
diff --git a/string/strcoll_l.c b/string/strcoll_l.c
index b36b18c..a18b65e 100644
--- a/string/strcoll_l.c
+++ b/string/strcoll_l.c
@@ -30,7 +30,6 @@
# define STRING_TYPE char
# define USTRING_TYPE unsigned char
# define STRCOLL __strcoll_l
-# define STRDIFF __strdiff
# define STRCMP strcmp
# define WEIGHT_H "../locale/weight.h"
# define SUFFIX MB
@@ -43,19 +42,6 @@
#include "../locale/localeinfo.h"
#include WEIGHT_H
-#define MASK_UTF8_7BIT (1 << 7)
-#define MASK_UTF8_START (3 << 6)
-
-size_t
-STRDIFF (const STRING_TYPE *s, const STRING_TYPE *t)
-{
- size_t n;
-
- for (n = 0; *s != '\0' && *s++ == *t++; ++n)
- continue;
-
- return n;
-}
/* Track status while looking for sequences in a string. */
typedef struct
@@ -274,29 +260,9 @@ STRCOLL (const STRING_TYPE *s1, const STRING_TYPE *s2, __locale_t l)
const USTRING_TYPE *extra;
const int32_t *indirect;
- /* In case there is no locale specific sort order (C / POSIX). */
if (nrules == 0)
return STRCMP (s1, s2);
- /* Fast forward to the position of the first difference. Needs to be
- encoding aware as the byte-by-byte comparison can stop in the middle
- of a char sequence for multibyte encodings like UTF-8. */
- uint_fast32_t encoding =
- current->values[_NL_ITEM_INDEX (_NL_COLLATE_ENCODING_TYPE)].word;
- if (encoding != __cet_other)
- {
- size_t diff = STRDIFF (s1, s2);
- if (diff > 0)
- {
- if (encoding == __cet_utf8 && (*(s1 + diff) & MASK_UTF8_7BIT) != 0)
- do
- diff--;
- while (diff > 0 && (*(s1 + diff) & MASK_UTF8_START) != MASK_UTF8_START);
- s1 += diff;
- s2 += diff;
- }
- }
-
/* Catch empty strings. */
if (__glibc_unlikely (*s1 == '\0') || __glibc_unlikely (*s2 == '\0'))
return (*s1 != '\0') - (*s2 != '\0');
@@ -363,9 +329,8 @@ STRCOLL (const STRING_TYPE *s1, const STRING_TYPE *s2, __locale_t l)
byte-level comparison to ensure that we don't waste time
going through multiple passes for totally equal strings
before proceeding to subsequent passes. */
- if (pass == 0 && encoding == __cet_other &&
- STRCMP (s1, s2) == 0)
- return result;
+ if (pass == 0 && STRCMP (s1, s2) == 0)
+ return result;
else
break;
}
diff --git a/wcsmbs/wcscoll_l.c b/wcsmbs/wcscoll_l.c
index 6d9384a..87f240d 100644
--- a/wcsmbs/wcscoll_l.c
+++ b/wcsmbs/wcscoll_l.c
@@ -23,7 +23,6 @@
#define STRING_TYPE wchar_t
#define USTRING_TYPE wint_t
#define STRCOLL __wcscoll_l
-#define STRDIFF __wcsdiff
#define STRCMP __wcscmp
#define WEIGHT_H "../locale/weightwc.h"
#define SUFFIX WC
--
1.8.4.2

View File

@ -1,24 +0,0 @@
This patch alows using 64 bit atomic instructions on a
32 bit platform. This is safe, providing x86 is Pentium or
later (would not work on i386, i486). Using 64 bit atomic
instructions bypasses code containing a bug as documented in
https://bugzilla.yoctoproject.org/show_bug.cgi?id=8140
Upstream-Status: Pending
Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
Index: libc/sysdeps/i386/i486/bits/atomic.h
===================================================================
--- libc.orig/sysdeps/i386/i486/bits/atomic.h
+++ libc/sysdeps/i386/i486/bits/atomic.h
@@ -54,7 +54,7 @@ typedef uintmax_t uatomic_max_t;
# endif
#endif
-#define __HAVE_64B_ATOMICS 0
+#define __HAVE_64B_ATOMICS 1
#define USE_ATOMIC_COMPILER_BUILTINS 0

View File

@ -5,9 +5,9 @@ LIC_FILES_CHKSUM = "file://LICENSES;md5=e9a558e243b36d3209f380deb394b213 \
file://posix/rxspencer/COPYRIGHT;md5=dc5485bb394a13b2332ec1c785f5d83a \
file://COPYING.LIB;md5=4fbd65380cdd255951079008b364516c"
DEPENDS += "gperf-native kconfig-frontends-native"
DEPENDS += "gperf-native"
SRCREV ?= "a34d1c6afc86521d6ad17662a3b5362d8481514c"
SRCREV ?= "e742928c1592b43db6809db4f39e67be151cdd27"
SRCBRANCH ?= "release/${PV}/master"
@ -15,7 +15,6 @@ GLIBC_GIT_URI ?= "git://sourceware.org/git/glibc.git"
UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>\d+\.\d+(\.\d+)*)"
SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
file://0004-Backport-https-sourceware.org-ml-libc-ports-2007-12-.patch \
file://0005-fsl-e500-e5500-e6500-603e-fsqrt-implementation.patch \
file://0006-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch \
file://0007-ppc-sqrt-Fix-undefined-reference-to-__sqrt_finite.patch \
@ -26,29 +25,17 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
file://0012-Make-ld-version-output-matching-grok-gold-s-output.patch \
file://0013-sysdeps-gnu-configure.ac-handle-correctly-libc_cv_ro.patch \
file://0014-Add-unused-attribute.patch \
file://0015-When-disabling-SSE-also-make-sure-that-fpmath-is-not.patch \
file://0016-yes-within-the-path-sets-wrong-config-variables.patch \
file://0017-timezone-re-written-tzselect-as-posix-sh.patch \
file://0015-yes-within-the-path-sets-wrong-config-variables.patch \
file://0016-timezone-re-written-tzselect-as-posix-sh.patch \
file://0017-Remove-bash-dependency-for-nscd-init-script.patch \
file://0018-eglibc-Cross-building-and-testing-instructions.patch \
file://0019-eglibc-Bring-Eglibc-option-group-infrastructure-to-g.patch \
file://0020-eglibc-Help-bootstrap-cross-toolchain.patch \
file://0021-eglibc-cherry-picked-from-http-www.eglibc.org-archiv.patch \
file://0022-eglibc-Clear-cache-lines-on-ppc8xx.patch \
file://0023-eglibc-Resolve-__fpscr_values-on-SH4.patch \
file://0024-eglibc-Forward-port-eglibc-options-groups-support.patch \
file://0025-eglibc-Install-PIC-archives.patch \
file://0026-eglibc-dl_debug_mask-is-controlled-by-__OPTION_EGLIB.patch \
file://0027-eglibc-use-option-groups-Conditionally-exclude-c-tes.patch \
file://nscd-no-bash.patch \
file://0028-Clear-ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA-for-prel.patch \
file://strcoll-Remove-incorrect-STRDIFF-based-optimization-.patch \
file://0029-fix-getmntent-empty-lines.patch \
file://CVE-2015-8777.patch \
file://CVE-2015-8779.patch \
file://CVE-2015-9761_1.patch \
file://CVE-2015-9761_2.patch \
file://CVE-2015-8776.patch \
file://CVE-2015-7547.patch \
file://0019-eglibc-Help-bootstrap-cross-toolchain.patch \
file://0020-eglibc-cherry-picked-from.patch \
file://0021-eglibc-Clear-cache-lines-on-ppc8xx.patch \
file://0022-eglibc-Resolve-__fpscr_values-on-SH4.patch \
file://0023-eglibc-Install-PIC-archives.patch \
file://0025-eglibc-Forward-port-cross-locale-generation-support.patch \
file://0026-When-disabling-SSE-make-sure-fpmath-is-not-set-to-us.patch \
"
SRC_URI += "\
@ -60,7 +47,7 @@ SRC_URI_append_class-nativesdk = "\
file://0001-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch \
file://0002-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch \
file://0003-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch \
file://use_64bit_atomics.patch \
file://0004-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch \
"
S = "${WORKDIR}/git"
@ -89,7 +76,6 @@ EXTRA_OECONF = "--enable-kernel=${OLDEST_KERNEL} \
--with-headers=${STAGING_INCDIR} \
--without-selinux \
--enable-obsolete-rpc \
--with-kconfig=${STAGING_BINDIR_NATIVE} \
${GLIBC_EXTRA_OECONF}"
EXTRA_OECONF += "${@get_libc_fpu_setting(bb, d)}"

View File

@ -118,13 +118,13 @@ EXTRA_OECONF_BASE = "\
EXTRA_OECONF_INITIAL = "\
--disable-libmudflap \
--disable-libgomp \
--disable-libssp \
--disable-libquadmath \
--with-system-zlib \
--disable-lto \
--disable-plugin \
--enable-decimal-float=no \
--without-isl \
gcc_cv_libc_provides_ssp=yes \
"
EXTRA_OECONF_append_libc-uclibc = " --disable-decimal-float "