glibc:hjl/pr19122

Last commit made on 2015-10-20
Get this branch:
git clone -b hjl/pr19122 https://git.launchpad.net/glibc

Branch merges

Branch information

Name:
hjl/pr19122
Repository:
lp:glibc

Recent commits

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

Mark internal unistd functions hidden in ld.so

Since internal unistd functions are only used internally in ld.so and
libc.so, they can be made hidden. Some functions can't be hidden in
ld.so on Hurd since they will be preempted by the ones in libc.so after
bootstrap.

 [BZ #19122]
 * include/unistd.h [IS_IN (rtld)]: Include <dl-unistd.h>.
 * sysdeps/generic/dl-unistd.h: New file.
 * sysdeps/mach/hurd/dl-unistd.h: Likewise.

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

Mark ld.so internal mmap functions hidden in ld.so

Since ld.so internal mmap functions are only used internally in ld.so,
they can be made hidden. Don't hide __mmap on Hurd, since __mmap in
ld.so will be preempted by the one in libc.so after bootstrap.

  [BZ #19122]
  * include/sys/mman.h [IS_IN (rtld)]: Include <dl-mman.h>.
  * sysdeps/generic/dl-mman.h: New file.
  * sysdeps/mach/hurd/dl-mman.h: Likewise.

9dd346f... by Joseph Myers <email address hidden>

Convert 113 more function definitions to prototype style (files with assertions).

This mostly automatically-generated patch converts 113 function
definitions in glibc from old-style K&R to prototype-style. Following
my other recent such patches, this one deals with the case of function
definitions in files that either contain assertions or where grep
suggested they might contain assertions - and thus where it isn't
possible to use a simple object code comparison as a sanity check on
the correctness of the patch, because line numbers are changed.

A few such automatically-generated changes needed to be supplemented
by manual changes for the result to compile. openat64 had a prototype
declaration with "..." but an old-style definition in
sysdeps/unix/sysv/linux/dl-openat64.c, and "..." needed adding to the
generated prototype in the definition (I've filed
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68024> for diagnosing
such cases in GCC; the old state was undefined behavior not requiring
a diagnostic, but one seems a good idea). In addition, as Florian has
noted regparm attribute mismatches between declaration and definition
are only diagnosed for prototype definitions, and five functions
needed internal_function added to their definitions (in the case of
__pthread_mutex_cond_lock, via the macro definition of
__pthread_mutex_lock) to compile on i386.

After this patch is in, remaining old-style definitions are probably
most readily fixed manually before we can turn on
-Wold-style-definition for all builds.

Tested for x86_64 and x86 (testsuite).

 * crypt/md5-crypt.c (__md5_crypt_r): Convert to prototype-style
 function definition.
 * crypt/sha256-crypt.c (__sha256_crypt_r): Likewise.
 * crypt/sha512-crypt.c (__sha512_crypt_r): Likewise.
 * debug/backtracesyms.c (__backtrace_symbols): Likewise.
 * elf/dl-minimal.c (_itoa): Likewise.
 * hurd/hurdmalloc.c (malloc): Likewise.
 (free): Likewise.
 (realloc): Likewise.
 * inet/inet6_option.c (inet6_option_space): Likewise.
 (inet6_option_init): Likewise.
 (inet6_option_append): Likewise.
 (inet6_option_alloc): Likewise.
 (inet6_option_next): Likewise.
 (inet6_option_find): Likewise.
 * io/ftw.c (FTW_NAME): Likewise.
 (NFTW_NAME): Likewise.
 (NFTW_NEW_NAME): Likewise.
 (NFTW_OLD_NAME): Likewise.
 * libio/iofwide.c (_IO_fwide): Likewise.
 * libio/strops.c (_IO_str_init_static_internal): Likewise.
 (_IO_str_init_static): Likewise.
 (_IO_str_init_readonly): Likewise.
 (_IO_str_overflow): Likewise.
 (_IO_str_underflow): Likewise.
 (_IO_str_count): Likewise.
 (_IO_str_seekoff): Likewise.
 (_IO_str_pbackfail): Likewise.
 (_IO_str_finish): Likewise.
 * libio/wstrops.c (_IO_wstr_init_static): Likewise.
 (_IO_wstr_overflow): Likewise.
 (_IO_wstr_underflow): Likewise.
 (_IO_wstr_count): Likewise.
 (_IO_wstr_seekoff): Likewise.
 (_IO_wstr_pbackfail): Likewise.
 (_IO_wstr_finish): Likewise.
 * locale/programs/localedef.c (normalize_codeset): Likewise.
 * locale/programs/locarchive.c (add_locale_to_archive): Likewise.
 (add_locales_to_archive): Likewise.
 (delete_locales_from_archive): Likewise.
 * malloc/malloc.c (__libc_mallinfo): Likewise.
 * math/gen-auto-libm-tests.c (init_fp_formats): Likewise.
 * misc/tsearch.c (__tfind): Likewise.
 * nptl/pthread_attr_destroy.c (__pthread_attr_destroy): Likewise.
 * nptl/pthread_attr_getdetachstate.c
 (__pthread_attr_getdetachstate): Likewise.
 * nptl/pthread_attr_getguardsize.c (pthread_attr_getguardsize):
 Likewise.
 * nptl/pthread_attr_getinheritsched.c
 (__pthread_attr_getinheritsched): Likewise.
 * nptl/pthread_attr_getschedparam.c
 (__pthread_attr_getschedparam): Likewise.
 * nptl/pthread_attr_getschedpolicy.c
 (__pthread_attr_getschedpolicy): Likewise.
 * nptl/pthread_attr_getscope.c (__pthread_attr_getscope):
 Likewise.
 * nptl/pthread_attr_getstack.c (__pthread_attr_getstack):
 Likewise.
 * nptl/pthread_attr_getstackaddr.c (__pthread_attr_getstackaddr):
 Likewise.
 * nptl/pthread_attr_getstacksize.c (__pthread_attr_getstacksize):
 Likewise.
 * nptl/pthread_attr_init.c (__pthread_attr_init_2_1): Likewise.
 (__pthread_attr_init_2_0): Likewise.
 * nptl/pthread_attr_setdetachstate.c
 (__pthread_attr_setdetachstate): Likewise.
 * nptl/pthread_attr_setguardsize.c (pthread_attr_setguardsize):
 Likewise.
 * nptl/pthread_attr_setinheritsched.c
 (__pthread_attr_setinheritsched): Likewise.
 * nptl/pthread_attr_setschedparam.c
 (__pthread_attr_setschedparam): Likewise.
 * nptl/pthread_attr_setschedpolicy.c
 (__pthread_attr_setschedpolicy): Likewise.
 * nptl/pthread_attr_setscope.c (__pthread_attr_setscope):
 Likewise.
 * nptl/pthread_attr_setstack.c (__pthread_attr_setstack):
 Likewise.
 * nptl/pthread_attr_setstackaddr.c (__pthread_attr_setstackaddr):
 Likewise.
 * nptl/pthread_attr_setstacksize.c (__pthread_attr_setstacksize):
 Likewise.
 * nptl/pthread_condattr_setclock.c (pthread_condattr_setclock):
 Likewise.
 * nptl/pthread_create.c (__find_in_stack_list): Likewise.
 * nptl/pthread_getattr_np.c (pthread_getattr_np): Likewise.
 * nptl/pthread_mutex_cond_lock.c (__pthread_mutex_lock): Define to
 use internal_function.
 * nptl/pthread_mutex_init.c (__pthread_mutex_init): Convert to
 prototype-style function definition.
 * nptl/pthread_mutex_lock.c (__pthread_mutex_lock): Likewise.
 (__pthread_mutex_cond_lock_adjust): Likewise. Use
 internal_function.
 * nptl/pthread_mutex_timedlock.c (pthread_mutex_timedlock):
 Convert to prototype-style function definition.
 * nptl/pthread_mutex_trylock.c (__pthread_mutex_trylock):
 Likewise.
 * nptl/pthread_mutex_unlock.c (__pthread_mutex_unlock_usercnt):
 Likewise.
 (__pthread_mutex_unlock): Likewise.
 * nptl_db/td_ta_clear_event.c (td_ta_clear_event): Likewise.
 * nptl_db/td_ta_set_event.c (td_ta_set_event): Likewise.
 * nptl_db/td_thr_clear_event.c (td_thr_clear_event): Likewise.
 * nptl_db/td_thr_event_enable.c (td_thr_event_enable): Likewise.
 * nptl_db/td_thr_set_event.c (td_thr_set_event): Likewise.
 * nss/makedb.c (process_input): Likewise.
 * posix/fnmatch.c (__strchrnul): Likewise.
 (__wcschrnul): Likewise.
 (fnmatch): Likewise.
 * posix/fnmatch_loop.c (FCT): Likewise.
 * posix/glob.c (globfree): Likewise.
 (__glob_pattern_type): Likewise.
 (__glob_pattern_p): Likewise.
 * posix/regcomp.c (re_compile_pattern): Likewise.
 (re_set_syntax): Likewise.
 (re_compile_fastmap): Likewise.
 (regcomp): Likewise.
 (regerror): Likewise.
 (regfree): Likewise.
 * posix/regexec.c (regexec): Likewise.
 (re_match): Likewise.
 (re_search): Likewise.
 (re_match_2): Likewise.
 (re_search_2): Likewise.
 (re_search_stub): Likewise. Use internal_function
 (re_copy_regs): Likewise.
 (re_set_registers): Convert to prototype-style function
 definition.
 (prune_impossible_nodes): Likewise. Use internal_function.
 * resolv/inet_net_pton.c (inet_net_pton): Convert to
 prototype-style function definition.
 (inet_net_pton_ipv4): Likewise.
 * stdlib/strtod_l.c (____STRTOF_INTERNAL): Likewise.
 * sysdeps/pthread/aio_cancel.c (aio_cancel): Likewise.
 * sysdeps/pthread/aio_suspend.c (aio_suspend): Likewise.
 * sysdeps/pthread/timer_delete.c (timer_delete): Likewise.
 * sysdeps/unix/sysv/linux/dl-openat64.c (openat64): Likewise.
 Make variadic.
 * time/strptime_l.c (localtime_r): Convert to prototype-style
 function definition.
 * wcsmbs/mbsnrtowcs.c (__mbsnrtowcs): Likewise.
 * wcsmbs/mbsrtowcs_l.c (__mbsrtowcs_l): Likewise.
 * wcsmbs/wcsnrtombs.c (__wcsnrtombs): Likewise.
 * wcsmbs/wcsrtombs.c (__wcsrtombs): Likewise.

41075ae... by Joseph Myers <email address hidden>

Convert 29 more function definitions to prototype style (multiple parameters in one K&R parameter declaration).

This automatically-generated patch converts 29 function definitions in
glibc (including one in an example in the manual) from old-style K&R
to prototype-style. Following my other recent such patches, this one
deals with the case of function definitions where one K&R parameter
declaration declares multiple parameters, as in:

void
foo (a, b)
     int a, *b;
{
}

Tested for x86_64 and x86 (testsuite, and that installed stripped
shared libraries are unchanged by the patch).

 * crypt/crypt.c (_ufc_doit_r): Convert to prototype-style function
 definition.
 (_ufc_doit_r): Likewise.
 * crypt/crypt_util.c (_ufc_copymem): Likewise.
 (_ufc_output_conversion_r): Likewise.
 * inet/inet_mkadr.c (__inet_makeaddr): Likewise.
 * inet/rcmd.c (rcmd_af): Likewise.
 (rcmd): Likewise.
 (ruserok_af): Likewise.
 (ruserok): Likewise.
 (ruserok2_sa): Likewise.
 (ruserok_sa): Likewise.
 (iruserok_af): Likewise.
 (iruserok): Likewise.
 (__ivaliduser): Likewise.
 (__validuser2_sa): Likewise.
 * inet/rexec.c (rexec_af): Likewise.
 (rexec): Likewise.
 * inet/ruserpass.c (ruserpass): Likewise.
 * locale/programs/xmalloc.c (xcalloc): Likewise.
 * manual/examples/timeval_subtract.c (timeval_subtract): Likewise.
 * math/w_drem.c (__drem): Likewise.
 * math/w_dremf.c (__dremf): Likewise.
 * math/w_dreml.c (__dreml): Likewise.
 * misc/daemon.c (daemon): Likewise.
 * resolv/res_debug.c (p_fqnname): Likewise.
 * stdlib/div.c (div): Likewise.
 * string/memcmp.c (memcmp_bytes): Likewise.
 * sunrpc/pmap_rmt.c (pmap_rmtcall): Likewise.
 * sunrpc/svc_udp.c (svcudp_bufcreate): Likewise.

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

Convert 24 more function definitions to prototype style (array parameters).

This automatically-generated patch converts 24 function definitions in
glibc from old-style K&R to prototype-style. Following my other
recent such patches, this one deals with the case of functions with
array parameters.

Tested for x86_64 and x86 (testsuite, and that installed stripped
shared libraries are unchanged by the patch).

 * crypt/cert.c (main): Convert to prototype-style function
 definition.
 * io/pipe.c (__pipe): Likewise.
 * io/pipe2.c (__pipe2): Likewise.
 * misc/futimesat.c (futimesat): Likewise.
 * misc/utimes.c (__utimes): Likewise.
 * posix/execve.c (__execve): Likewise.
 * posix/execvp.c (execvp): Likewise.
 * posix/execvpe.c (__execvpe): Likewise.
 * posix/fexecve.c (fexecve): Likewise.
 * socket/socketpair.c (socketpair): Likewise.
 * stdlib/drand48-iter.c (__drand48_iterate): Likewise.
 * stdlib/erand48.c (erand48): Likewise.
 * stdlib/erand48_r.c (__erand48_r): Likewise.
 * stdlib/jrand48.c (jrand48): Likewise.
 * stdlib/jrand48_r.c (__jrand48_r): Likewise.
 * stdlib/lcong48.c (lcong48): Likewise.
 * stdlib/lcong48_r.c (__lcong48_r): Likewise.
 * stdlib/nrand48.c (nrand48): Likewise.
 * stdlib/nrand48_r.c (__nrand48_r): Likewise.
 * stdlib/seed48.c (seed48): Likewise.
 * stdlib/seed48_r.c (__seed48_r): Likewise.
 * sysdeps/mach/hurd/execve.c (__execve): Likewise.
 * sysdeps/mach/hurd/utimes.c (__utimes): Likewise.
 * sysdeps/unix/sysv/linux/fexecve.c (fexecve): Likewise.

864198e... by Joseph Myers <email address hidden>

Remove gnu_unique_object configure test.

There is a configure test for assembler support for the
gnu_unique_object symbol type. This support was added in binutils
2.20, so is present in all versions supported for building glibc.

Thus, I think the configure test can be removed; this patch does so.
Now, there is a caveat that the gas NEWS entry refers to this as a
feature for GNU/Linux targets. But the condition is use of
ELFOSABI_GNU or ELFOSABI_NONE. ELFOSABI_GNU covers Hurd as well as
GNU/Linux (as was the case with the older ELFOSABI_LINUX name), and
ELFOSABI_NONE means this is effectively OS-independent. Furthermore,
I think a correct binutils port for any glibc target ought to support
this feature for use with glibc; glibc supports this as an
OS-independent feature (the configure test is only about glibc
testcases).

Tested for x86_64 (testsuite, and that installed shared libraries are
unchanged by the patch).

 * configure.ac (libc_cv_asm_unique_object): Remove configure test.
 * configure: Regenerated.
 * config.h.in (HAVE_ASM_UNIQUE_OBJECT): Remove #undef.
 * elf/tst-unique1.c (do_test) [HAVE_ASM_UNIQUE_OBJECT]: Make code
 unconditional.
 * elf/tst-unique1mod1.c [HAVE_ASM_UNIQUE_OBJECT]: Likewise.
 * elf/tst-unique1mod2.c [HAVE_ASM_UNIQUE_OBJECT]: Likewise.
 * elf/tst-unique2.c (do_test) [HAVE_ASM_UNIQUE_OBJECT]: Likewise.
 (do_test) [!HAVE_ASM_UNIQUE_OBJECT]: Remove conditional code.
 * elf/tst-unique2mod1.c [HAVE_ASM_UNIQUE_OBJECT]: Make code
 unconditional.
 * elf/tst-unique2mod2.c [HAVE_ASM_UNIQUE_OBJECT]: Likewise.

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

Do not use -Wno-strict-prototypes.

Two glibc makefiles use -Wno-strict-prototypes. I don't know if this
was needed before my recent conversion of many function definitions to
prototype style, but it's not needed now; this patch removes it.

Tested for x86_64 and x86 (testsuite, and that installed stripped
shared libraries are unchanged by the patch).

 * posix/Makefile (CFLAGS-regex.c): Remove variable.
 * resolv/Makefile (+cflags): Do not use -Wno-strict-prototypes.

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

Convert 69 more function definitions to prototype style (line wrap cases).

This automatically-generated patch converts 69 function definitions in
glibc from old-style K&R to prototype-style.

This patch, covering both sysdeps and non-sysdeps files, deals with
cases where the prototype needed to be wrapped over more than one
line. Otherwise, exclusions and caveats are as for
<https://sourceware.org/ml/libc-alpha/2015-10/msg00594.html> and
<https://sourceware.org/ml/libc-alpha/2015-10/msg00599.html>.

Tested for x86_64 and x86 (testsuite, and that installed stripped
shared libraries are unchanged by the patch).

 * crypt/crypt-entry.c (__crypt_r): Convert to prototype-style
 function definition.
 * crypt/crypt_util.c (__encrypt_r): Likewise.
 * libio/genops.c (_IO_no_init): Likewise.
 * libio/iofopncook.c (_IO_fopencookie): Likewise.
 (_IO_old_fopencookie): Likewise.
 * libio/iofwrite_u.c (fwrite_unlocked): Likewise.
 * libio/iogetline.c (_IO_getline): Likewise.
 (_IO_getline_info): Likewise.
 * libio/iogetwline.c (_IO_getwline): Likewise.
 (_IO_getwline_info): Likewise.
 * libio/vsnprintf.c (_IO_vsnprintf): Likewise.
 * libio/vswprintf.c (_IO_vswprintf): Likewise.
 * locale/programs/simple-hash.c (insert_entry_2): Likewise.
 (find_entry): Likewise.
 (iterate_table): Likewise.
 (lookup): Likewise.
 * login/forkpty.c (forkpty): Likewise.
 * misc/hsearch_r.c (__hsearch_r): Likewise.
 * misc/select.c (__select): Likewise.
 * nptl/cleanup_defer_compat.c (_pthread_cleanup_pop_restore):
 Likewise.
 * nptl/old_pthread_cond_init.c (__pthread_cond_init_2_0):
 Likewise.
 * nptl/old_pthread_cond_timedwait.c
 (__pthread_cond_timedwait_2_0): Likewise.
 * nptl/pthread_barrier_init.c (__pthread_barrier_init): Likewise.
 * nptl/pthread_barrierattr_getpshared.c
 (pthread_barrierattr_getpshared): Likewise.
 * nptl/pthread_getschedparam.c (__pthread_getschedparam):
 Likewise.
 * nptl/pthread_mutex_setprioceiling.c
 (pthread_mutex_setprioceiling): Likewise.
 * nptl/pthread_mutexattr_getprioceiling.c
 (pthread_mutexattr_getprioceiling): Likewise.
 * nptl/pthread_rwlock_init.c (__pthread_rwlock_init): Likewise.
 * nptl/pthread_rwlock_timedrdlock.c (pthread_rwlock_timedrdlock):
 Likewise.
 * nptl/pthread_rwlock_timedwrlock.c (pthread_rwlock_timedwrlock):
 Likewise.
 * nptl/pthread_setschedparam.c (__pthread_setschedparam):
 Likewise.
 * socket/recvfrom.c (__recvfrom): Likewise.
 * socket/sendto.c (__sendto): Likewise.
 * socket/setsockopt.c (__setsockopt): Likewise.
 * stdio-common/_itoa.c (_itoa): Likewise.
 * stdio-common/_itowa.c (_itowa): Likewise.
 * stdio-common/reg-printf.c (__register_printf_specifier):
 Likewise.
 (__register_printf_function): Likewise.
 * stdio-common/tempname.c (__path_search): Likewise.
 * stdlib/addmul_1.c (mpn_addmul_1): Likewise.
 * stdlib/mul_1.c (mpn_mul_1): Likewise.
 * stdlib/random_r.c (__initstate_r): Likewise.
 * stdlib/setenv.c (__add_to_environ): Likewise.
 * stdlib/submul_1.c (mpn_submul_1): Likewise.
 * streams/getpmsg.c (getpmsg): Likewise.
 * streams/putmsg.c (putmsg): Likewise.
 * streams/putpmsg.c (putpmsg): Likewise.
 * sunrpc/clnt_raw.c (clntraw_call): Likewise.
 * sunrpc/clnt_tcp.c (clnttcp_call): Likewise.
 * sunrpc/clnt_udp.c (clntudp_create): Likewise.
 * sunrpc/clnt_unix.c (clntunix_call): Likewise.
 * sunrpc/pm_getport.c (pmap_getport): Likewise.
 * sunrpc/svc_udp.c (cache_get): Likewise.
 * sunrpc/xdr_array.c (xdr_vector): Likewise.
 * sysdeps/mach/hurd/getcwd.c
 (__canonicalize_directory_name_internal): Likewise.
 * sysdeps/mach/hurd/pselect.c (__pselect): Likewise.
 * sysdeps/mach/hurd/recvfrom.c (__recvfrom): Likewise.
 * sysdeps/mach/hurd/select.c (__select): Likewise.
 * sysdeps/posix/ttyname_r.c (getttyname_r): Likewise.
 * sysdeps/pthread/timer_settime.c (timer_settime): Likewise.
 * sysdeps/sparc/nptl/pthread_barrier_init.c
 (__pthread_barrier_init): Likewise.
 * sysdeps/unix/sysv/linux/hppa/pthread_cond_timedwait.c
 (__pthread_cond_timedwait): Likewise.
 * sysdeps/unix/sysv/linux/i386/putmsg.c (putmsg): Likewise.
 * sysdeps/unix/sysv/linux/s390/semtimedop.c (semtimedop):
 Likewise.
 * sysdeps/unix/sysv/linux/semtimedop.c (semtimedop): Likewise.
 * sysdeps/unix/sysv/linux/timer_settime.c (timer_settime):
 Likewise.
 * sysvipc/semtimedop.c (semtimedop): Likewise.
 * time/setitimer.c (__setitimer): Likewise.
 * time/strftime_l.c (emacs_strftime): Likewise.

6ab674e... by Mike Frysinger

use -fstack-protector-strong when available

With gcc-4.9, a new -fstack-protector-strong flag is available that is
between -fstack-protector (pretty weak) and -fstack-protector-all (pretty
strong) that provides good trade-offs between overhead but still providing
good coverage. Update the places in glibc that use ssp to use this flag
when it's available.

This also kills off the indirection of hardcoding the flag name in the
Makefiles and adding it based on a have-ssp boolean. Instead, the build
always expands the $(stack-protector) variable to the best ssp setting.
This makes the build logic a bit simpler and allows people to easily set
to a diff flag like:
 make stack-protector=-fstack-protector-all

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

Mark ld.so internel __fxstatat64 hidden

Since ld.so internel __fxstatat64 is only used internally in ld.so, it
can be made hidden.

 [BZ #19122]
 * include/sys/stat.h [IS_IN (rtld)] (__fxstatat64): Add
 attribute_hidden.