glibc:hjl/pr14995

Last commit made on 2017-06-28
Get this branch:
git clone -b hjl/pr14995 https://git.launchpad.net/glibc

Branch merges

Branch information

Name:
hjl/pr14995
Repository:
lp:glibc

Recent commits

0bece22... by "H.J. Lu" <email address hidden>

Check linker support for INSERT in linker script

Since gold doesn't support INSERT in linker script:

https://sourceware.org/bugzilla/show_bug.cgi?id=15373

tst-split-dynreloc fails to link with gold. Check if linker supports
INSERT in linker script before using it.

 * config.make.in (have-insert): New.
 * configure.ac (libc_cv_insert): New. Set to yes if linker
 supports INSERT in linker script.
 (AC_SUBST(libc_cv_insert): New.
 * configure: Regenerated.
 * sysdeps/x86_64/Makefile (tests): Add tst-split-dynreloc only
 if $(have-insert) == yes.

82c62e7... by "H.J. Lu" <email address hidden>

Run vismain only if linker supports protected data symbol

Gold doesn't support protected data symbol:

configure:5672: checking linker support for protected data symbol
configure:5682: gcc -fuse-ld=gold -nostdlib -nostartfiles -fno-stack-protector -fPIC -shared conftest.c -o conftest.so
configure:5685: $? = 0
configure:5692: gcc -fuse-ld=gold -nostdlib -nostartfiles -fno-stack-protector conftest.c -o conftest conftest.so
/usr/local/bin/ld.gold: error: /tmp/ccXWoofs.o: cannot make copy relocation for protected symbol 'bar', defined in conftest.so
collect2: error: ld returned 1 exit status

Run vismain only if linker supports protected data symbol.

 * elf/Makefile (tests): Add vismain only if
 $(have-protected-data) == yes.
 (tests-pie): Likewise.

614d15f... by Joseph Myers <email address hidden>

Support _Float128 in tgmath.h.

This patch adds tgmath.h support for _Float128, so eliminating the
awkward caveat in NEWS about the type not being supported there. This
does inevitably increase the size of macro expansions (which grows
particularly fast when you have nested calls to tgmath.h macros), but
only when _Float128 is supported and the declarations of _Float128
interfaces are visible; otherwise the expansions are unchanged.

Tested for x86_64 and arm.

 * math/tgmath.h: Include <bits/libc-header-start.h> and
 <bits/floatn.h>.
 (__TGMATH_F128): New macro.
 (__TGMATH_CF128): Likewise.
 (__TGMATH_UNARY_REAL_ONLY): Use __TGMATH_F128.
 (__TGMATH_UNARY_REAL_RET_ONLY): Likewise.
 (__TGMATH_BINARY_FIRST_REAL_ONLY): Likewise.
 (__TGMATH_BINARY_FIRST_REAL_STD_ONLY): New macro.
 (__TGMATH_BINARY_REAL_ONLY): Use __TGMATH_F128.
 (__TGMATH_BINARY_REAL_STD_ONLY): New macro.
 (__TGMATH_BINARY_REAL_RET_ONLY): Use __TGMATH_F128.
 (__TGMATH_TERNARY_FIRST_SECOND_REAL_ONLY): Likewise.
 (__TGMATH_TERNARY_REAL_ONLY): Likewise.
 (__TGMATH_TERNARY_FIRST_REAL_RET_ONLY): Likewise.
 (__TGMATH_UNARY_REAL_IMAG): Use __TGMATH_CF128.
 (__TGMATH_UNARY_IMAG): Use __TGMATH_F128.
 (__TGMATH_UNARY_REAL_IMAG_RET_REAL): Use __TGMATH_CF128.
 (__TGMATH_BINARY_REAL_IMAG): Likewise.
 (nexttoward): Use __TGMATH_BINARY_FIRST_REAL_STD_ONLY.
 [__USE_MISC] (scalb): Use __TGMATH_BINARY_REAL_STD_ONLY.
 * math/gen-tgmath-tests.py (Type.init_types): Enable _FloatN and
 _FloatNx types if the corresponding HUGE_VAL macros are defined.

0908a38... by Joseph Myers <email address hidden>

Use clog10 not __clog10 in tgmath.h log10 macro.

As a GNU extension, for _GNU_SOURCE glibc's complex.h provides a
clog10 function and tgmath.h supports complex arguments to the log10
macro. However, tgmath.h uses __clog10 not clog10 in defining the
macro.

There is no namespace reason (ignoring the block-scope namespace
issues that would apply equally to *every* function called by tgmath.h
macros) for using __clog10 here, since this is only for _GNU_SOURCE so
clog10 is always visible when this macro definition is used.
Furthermore, __clog10f128 is not exported, so supporting _Float128 in
tgmath.h implies using clog10 not __clog10 there. (__clog10 and
clog10 aren't used in libstdc++ either, although that library would
have a good case for using the __clog10 reserved-namespace export: the
standard C++ library includes log10 of a complex number.) This patch
duly changes the header to use clog10, and enables tests of the macro
for complex arguments.

Tested for x86_64.

 * math/tgmath.h [__USE_GNU] (log10): Use clog10 not __clog10.
 * math/gen-tgmath-tests.py (Tests.add_all_tests): Test log10 for
 complex arguments.

d12a22c... by Joseph Myers <email address hidden>

Fix tgmath.h totalorder, totalordermag return type (bug 21687).

The tgmath.h totalorder and totalordermag macros wrongly return a
floating-point type. They should return int, like the underlying
functions. This patch fixes them accordingly, updating tests
including enabling tests of those functions from gen-tgmath-tests.py.

Tested for x86_64.

 [BZ #21687]
 * math/tgmath.h (__TGMATH_BINARY_REAL_RET_ONLY): New macro.
 (totalorder): Use it.
 (totalordermag): Likewise.
 * math/gen-tgmath-tests.py (Tests.add_all_tests): Enable tests of
 totalorder and totalordermag.
 * math/test-tgmath.c (F(compile_test)): Do not call totalorder or
 totalordermag in arguments of calls to those functions.
 (NCALLS): Change to 134.

cfa4434... by Joseph Myers <email address hidden>

Simplify tgmath.h for integer return types.

The tgmath.h macros for function with integer return types generate
unnecessary casts to the return type. Since in those cases the return
type does not depend on the argument type, all the cases in the
conditional expressions already have the right type, and no casts are
needed; this patch removes them.

Tested for x86_64.

 * math/tgmath.h (__TGMATH_UNARY_REAL_RET_ONLY): Do not take or
 cast to return type argument.
 (__TGMATH_TERNARY_FIRST_REAL_RET_ONLY): Likewise.
 (lrint): Update call to __TGMATH_UNARY_REAL_RET_ONLY.
 (llrint): Likewise.
 (lround): Likewise.
 (llround): Likewise.
 (ilogb): Likewise.
 (llogb): Likewise.
 (fromfp): Update call to __TGMATH_TERNARY_FIRST_REAL_RET_ONLY.
 (ufromfp): Likewise.
 (fromfpx): Likewise.
 (ufromfpx): Likewise.

5173719... by Joseph Myers <email address hidden>

Remove NO_LONG_DOUBLE conditionals in libm tests (bug 21607).

As noted in bug 21607, NO_LONG_DOUBLE conditionals in libm tests are
no longer effective. For most this is harmless - they were only
present because of long double functions not being declared with _LIBC
defined, and _LIBC is no longer defined for building most tests. For
the few where this is actually relevant to the test, testing
LDBL_MANT_DIG > DBL_MANT_DIG is more appropriate as that limits the
test to public APIs. This patch fixes the tests accordingly.

Tested for x86_64 and arm.

 [BZ #21607]
 * math/basic-test.c [!NO_LONG_DOUBLE]: Change conditionals to
 [LDBL_MANT_DIG > DBL_MANT_DIG].
 * math/bug-nextafter.c [!NO_LONG_DOUBLE]: Remove conditionals.
 * math/bug-nexttoward.c [!NO_LONG_DOUBLE]: Likewise.
 * math/test-math-isinff.cc [!NO_LONG_DOUBLE]: Likewise.
 * math/test-math-iszero.cc [!NO_LONG_DOUBLE]: Likewise.
 * math/test-nan-overflow.c [!NO_LONG_DOUBLE]: Likewise.
 * math/test-nan-payload.c [!NO_LONG_DOUBLE]: Likewise.
 * math/test-nearbyint-except-2.c [!NO_LONG_DOUBLE]: Likewise.
 * math/test-nearbyint-except.c [!NO_LONG_DOUBLE]: Likewise.
 * math/test-powl.c [!NO_LONG_DOUBLE]: Likewise.
 * math/test-signgam-finite-c99.c [!NO_LONG_DOUBLE]: Likewise.
 * math/test-signgam-finite.c [!NO_LONG_DOUBLE]: Likewise.
 * math/test-signgam-main.c [!NO_LONG_DOUBLE]: Likewise.
 * math/test-snan.c [!NO_LONG_DOUBLE]: Likewise.
 * math/test-tgmath-ret.c [!NO_LONG_DOUBLE]: Likewise.
 * math/test-tgmath.c: Include <float.h>.
 [!NO_LONG_DOUBLE]: Change conditionals to [LDBL_MANT_DIG >
 DBL_MANT_DIG].
 * math/test-tgmath2.c: Include <float.h>.
 [!NO_LONG_DOUBLE]: Change conditionals to [LDBL_MANT_DIG >
 DBL_MANT_DIG].

2dd0aec... by Joseph Myers <email address hidden>

Add more thorough generated tgmath.h test.

This patch adds a more thorough test of tgmath.h macros, verifying
both the return type and the function called for all the cases of
valid argument types. (Cases with current problems - I've just filed
four bugs - are disabled or omitted pending fixing those problems.)
The test uses a Python generator (works with both Python 2 and 3) to
generate a C file which is then built and run as a test in the usual
way (and that C file includes its own dummy definitions of libm
functions similar to existing tgmath.h tests). The motivation is to
make it easier to add tests of tgmath.h for _Float128 when adding
tgmath.h support for that type; the _FloatN / _FloatNx support is
present in the script, but disabled until the tgmath.h support is
written.

Tested for x86_64, and for arm to check things in the long double =
double case. (In that case, it's OK to call either double or long
double functions when the selected type is double or long double, as
long as the return type of the macro is exactly correct.)

 * math/gen-tgmath-tests.py: New file.
 * math/Makefile [PYTHON] (tests): Add test-tgmath3.
 [PYTHON] (generated): Add test-tgmath3.c.
 [PYTHON] (CFLAGS-test-tgmath3.c): New variable.
 [PYTHON] ($(objpfx)test-tgmath3.c): New rule.

073e8fa... by Joseph Myers <email address hidden>

Require binutils 2.25 or later to build glibc.

This patch implements a requirement of binutils >= 2.25 (up from 2.22)
to build glibc. Tests for 2.24 or later on x86_64 and s390 are
removed. It was already the case, as indicated by buildbot results,
that 2.24 was too old for building tests for 32-bit x86 (produced
internal linker errors linking elf/tst-gnu2-tls1mod.so). I don't know
if any configure tests for binutils features are obsolete given the
increased version requirement.

Tested for x86_64.

 * configure.ac (AS): Require binutils 2.25 or later.
 (LD): Likewise.
 * configure: Regenerated.
 * sysdeps/s390/configure.ac (AS): Remove version check.
 * sysdeps/s390/configure: Regenerated.
 * sysdeps/x86_64/configure.ac (AS): Remove version check.
 * sysdeps/x86_64/configure: Regenerated.
 * manual/install.texi (Tools for Compilation): Document
 requirement for binutils 2.25 or later.
 * INSTALL: Regenerated.

f300dc7... by "H.J. Lu" <email address hidden>

Support building glibc with gold 1.14 or above [BZ #14995]

This patch changes configure.ac to allow gold 1.14 or above to be used
to configire glibc so that gold glibc bugs can be fixed. Tested with

CC="gcc -fuse-ld=gold" CXX="g++ -fuse-ld=gold"

on Fedora 25 with gold 1.14 (20170623). Gold 1.14 was first released
in binutils 2.28.

On x86-64, for "make check", I got

Error in `/export/build/gnu/glibc-gold/build-x86_64-linux/elf/constload1': double free or corruption (fasttop): 0x00000000008755f0 ***
======= Backtrace: =========
/export/build/gnu/glibc-gold/build-x86_64-linux/libc.so.6(+0x772fb)[0x7f85225b52fb]
/export/build/gnu/glibc-gold/build-x86_64-linux/libc.so.6(+0x7d6c6)[0x7f85225bb6c6]
/export/build/gnu/glibc-gold/build-x86_64-linux/libc.so.6(+0x7df0e)[0x7f85225bbf0e]
/export/build/gnu/glibc-gold/build-x86_64-linux/dlfcn/libdl.so.2(+0x182d)[0x7f85226e682d]
/export/build/gnu/glibc-gold/build-x86_64-linux/dlfcn/libdl.so.2(dlclose+0x1f)[0x7f85226e623f]
/export/build/gnu/glibc-gold/build-x86_64-linux/elf/constload2.so(+0x933)[0x7f8522539933]
/export/build/gnu/glibc-gold/build-x86_64-linux/elf/ld.so(+0xfd1a)[0x7f85226fbd1a]
/export/build/gnu/glibc-gold/build-x86_64-linux/libc.so.6(+0x3c5e0)[0x7f852257a5e0]
/export/build/gnu/glibc-gold/build-x86_64-linux/libc.so.6(+0x3c63a)[0x7f852257a63a]
/export/build/gnu/glibc-gold/build-x86_64-linux/elf/constload2.so(+0x9aa)[0x7f85225399aa]
/export/build/gnu/glibc-gold/build-x86_64-linux/elf/ld.so(+0xf74a)[0x7f85226fb74a]
/export/build/gnu/glibc-gold/build-x86_64-linux/elf/ld.so(+0xf85b)[0x7f85226fb85b]
/export/build/gnu/glibc-gold/build-x86_64-linux/elf/ld.so(+0x13e98)[0x7f85226ffe98]
/export/build/gnu/glibc-gold/build-x86_64-linux/libc.so.6(_dl_catch_error+0x71)[0x7f85226643c1]
/export/build/gnu/glibc-gold/build-x86_64-linux/elf/ld.so(+0x13639)[0x7f85226ff639]
/export/build/gnu/glibc-gold/build-x86_64-linux/dlfcn/libdl.so.2(+0x1156)[0x7f85226e6156]
/export/build/gnu/glibc-gold/build-x86_64-linux/libc.so.6(_dl_catch_error+0x71)[0x7f85226643c1]
/export/build/gnu/glibc-gold/build-x86_64-linux/dlfcn/libdl.so.2(+0x1789)[0x7f85226e6789]
/export/build/gnu/glibc-gold/build-x86_64-linux/dlfcn/libdl.so.2(dlopen+0x32)[0x7f85226e61e2]
/export/build/gnu/glibc-gold/build-x86_64-linux/elf/constload1[0x4009ca]
/export/build/gnu/glibc-gold/build-x86_64-linux/libc.so.6(__libc_start_main+0xf1)[0x7f8522565231]
/export/build/gnu/glibc-gold/build-x86_64-linux/elf/constload1[0x400a5a]
======= Memory map: ========
00400000-00401000 r-xp 00000000 08:11 26334965 /export/build/gnu/glibc-gold/build-x86_64-linux/elf/constload1
00401000-00402000 r--p 00000000 08:11 26334965 /export/build/gnu/glibc-gold/build-x86_64-linux/elf/constload1
00402000-00403000 rw-p 00001000 08:11 26334965 /export/build/gnu/glibc-gold/build-x86_64-linux/elf/constload1
00875000-00896000 rw-p 00000000 00:00 0 [heap]
7f851c000000-7f851c021000 rw-p 00000000 00:00 0
7f851c021000-7f8520000000 ---p 00000000 00:00 0
7f85222f3000-7f8522309000 r-xp 00000000 08:02 136658 /usr/lib64/libgcc_s-6.3.1-20170216.so.1
7f8522309000-7f8522508000 ---p 00016000 08:02 136658 /usr/lib64/libgcc_s-6.3.1-20170216.so.1
7f8522508000-7f8522509000 r--p 00015000 08:02 136658 /usr/lib64/libgcc_s-6.3.1-20170216.so.1
7f8522509000-7f852250a000 rw-p 00016000 08:02 136658 /usr/lib64/libgcc_s-6.3.1-20170216.so.1
7f8522539000-7f852253a000 r-xp 00000000 08:11 26334619 /export/build/gnu/glibc-gold/build-x86_64-linux/elf/constload2.so
7f852253a000-7f852253b000 r--p 00000000 08:11 26334619 /export/build/gnu/glibc-gold/build-x86_64-linux/elf/constload2.so
7f852253b000-7f852253c000 rw-p 00001000 08:11 26334619 /export/build/gnu/glibc-gold/build-x86_64-linux/elf/constload2.so
7f852253c000-7f852253e000 rw-p 00000000 00:00 0
7f852253e000-7f85226da000 r-xp 00000000 08:11 26309973 /export/build/gnu/glibc-gold/build-x86_64-linux/libc.so
7f85226da000-7f85226db000 ---p 0019c000 08:11 26309973 /export/build/gnu/glibc-gold/build-x86_64-linux/libc.so
7f85226db000-7f85226de000 r--p 0019c000 08:11 26309973 /export/build/gnu/glibc-gold/build-x86_64-linux/libc.so
7f85226de000-7f85226e1000 rw-p 0019f000 08:11 26309973 /export/build/gnu/glibc-gold/build-x86_64-linux/libc.so
7f85226e1000-7f85226e5000 rw-p 00000000 00:00 0
7f85226e5000-7f85226e8000 r-xp 00000000 08:11 26313777 /export/build/gnu/glibc-gold/build-x86_64-linux/dlfcn/libdl.so
7f85226e8000-7f85226e9000 r--p 00002000 08:11 26313777 /export/build/gnu/glibc-gold/build-x86_64-linux/dlfcn/libdl.so
7f85226e9000-7f85226ea000 rw-p 00003000 08:11 26313777 /export/build/gnu/glibc-gold/build-x86_64-linux/dlfcn/libdl.so
7f85226ea000-7f85226ec000 rw-p 00000000 00:00 0
7f85226ec000-7f8522711000 r-xp 00000000 08:11 26309972 /export/build/gnu/glibc-gold/build-x86_64-linux/elf/ld.so
7f8522711000-7f8522712000 rw-p 00000000 00:00 0
7f8522712000-7f8522713000 r--p 00025000 08:11 26309972 /export/build/gnu/glibc-gold/build-x86_64-linux/elf/ld.so
7f8522713000-7f8522714000 rw-p 00026000 08:11 26309972 /export/build/gnu/glibc-gold/build-x86_64-linux/elf/ld.so
7f8522714000-7f8522715000 rw-p 00000000 00:00 0
7ffc5a2bd000-7ffc5a2df000 rw-p 00000000 00:00 0 [stack]
7ffc5a32c000-7ffc5a32e000 r--p 00000000 00:00 0 [vvar]
7ffc5a32e000-7ffc5a330000 r-xp 00000000 00:00 0 [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]

and

make[4]: *** [/export/build/gnu/glibc-gold/build-x86_64-linux/elf/vismain] Error 1

This is because gold doesn't support protected data symbols:

configure:5672: checking linker support for protected data symbol
configure:5682: gcc -fuse-ld=gold -nostdlib -nostartfiles -fno-stack-protector -fPIC -shared conftest.c -o conftest.so
configure:5685: $? = 0
configure:5692: gcc -fuse-ld=gold -nostdlib -nostartfiles -fno-stack-protector conftest.c -o conftest conftest.so
/usr/local/bin/ld.gold: error: /tmp/ccXWoofs.o: cannot make copy relocation for protected symbol 'bar', defined in conftest.so
collect2: error: ld returned 1 exit status

make[4]: *** [/export/build/gnu/glibc-gold/build-x86_64-linux/elf/tst-split-dynreloc] Error 1

This is because gold doesn't support INSERT in linker script:

https://sourceware.org/bugzilla/show_bug.cgi?id=21676

The total failures are

FAIL: dlfcn/bug-dl-leaf
FAIL: elf/constload1
FAIL: elf/global
FAIL: elf/ifuncmain1
FAIL: elf/ifuncmain1pic
FAIL: elf/ifuncmain1pie
FAIL: elf/ifuncmain1vis
FAIL: elf/ifuncmain1vispic
FAIL: elf/ifuncmain1vispie
FAIL: elf/ifuncmain3
FAIL: elf/initfirst
FAIL: elf/preloadtest
FAIL: elf/tst-audit11
FAIL: elf/tst-audit12
FAIL: elf/tst-audit4
FAIL: elf/tst-audit5
FAIL: elf/tst-audit6
FAIL: elf/tst-audit7
FAIL: elf/tst-dlmodcount
FAIL: elf/tst-dlmopen1
FAIL: elf/tst-dlmopen3
FAIL: elf/tst-dlopenrpath
FAIL: elf/tst-latepthread
FAIL: elf/tst-leaks1-mem
FAIL: elf/tst-nodelete-dlclose
FAIL: elf/unload6
FAIL: nss/test-netdb
FAIL: nss/tst-nss-test1
FAIL: posix/tst-getaddrinfo5

 [BZ #14995]
 * configure.ac: Allow gold 1.14 or above to configire glibc
 * configure: Regenerated.