about summary refs log tree commit diff
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* shlib-compat: Update documentation of the compat_symbol_reference macroCarlos O'Donell2017-10-161-2/+6
|
* Ensure C99 and C11 interfaces are available for C++ [BZ #21326]Jonathan Wakely2017-10-091-6/+11
| | | | | | | | | | | | | | This patch ensures that the C99 and C11 features required by C++ are defined according to the value of the __cplusplus macro, and not just because G++ always defines _GNU_SOURCE. This will allow G++ to stop defining _GNU_SOURCE some day, without causing the C99 and C11 interfaces to disappear for C++ programs. [BZ #21326] * include/features.h [__cplusplus >= 201103] (__USE_ISOC99): Define. [__cplusplus >= 201703] (__USE_ISOCXX17, __USE_ISOC11): Define. * math/Makefile (test-math-cxx11): New test. * math/test-math-cxx11.cc: New file.
* Don't use hidden visibility in libc.a with PIE on i386H.J. Lu2017-10-041-0/+1
| | | | | | | | | | | | | On i386, when multi-arch is enabled, all external functions must be called via PIC PLT in PIE, which requires setting up EBX register, since they may be IFUNC functions. * config.h.in (NO_HIDDEN_EXTERN_FUNC_IN_PIE): New. * include/libc-symbols.h (__hidden_proto_hiddenattr): Add check for PIC and NO_HIDDEN_EXTERN_FUNC_IN_PIE. * sysdeps/i386/configure.ac (NO_HIDDEN_EXTERN_FUNC_IN_PIE): New AC_DEFINE if multi-arch is enabled. * sysdeps/i386/configure: Regenerated.
* Introduce NO_RTLD_HIDDEN, make hurd use it instead of NO_HIDDENSamuel Thibault2017-10-0310-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On the Hurd, the rtld needs to see its own dumb versions of a few functions (defined in sysdeps/mach/hurd/dl-sysdep.c) overridden by libc's versions once loaded. rtld should thus not have hidden attribute for these. To achieve this, the Hurd port used to just define NO_HIDDEN, which disables it completely. For now, this changes that to disabling it for all rtld functions, for simplicity. See Roland's comment on https://sourceware.org/bugzilla/show_bug.cgi?id=15605#c5 The ld.so numbers remain at 8 .rel.plt 000000c8 00000c24 00000c24 00000c24 2**2 CONTENTS, ALLOC, LOAD, READONLY, DATA 9 .plt 000001a0 00000cf0 00000cf0 00000cf0 2**4 CONTENTS, ALLOC, LOAD, READONLY, CODE 10 .plt.got 00000010 00000e90 00000e90 00000e90 2**3 CONTENTS, ALLOC, LOAD, READONLY, CODE 18 .got.plt 00000070 0002d000 0002d000 0002c000 2**2 CONTENTS, ALLOC, LOAD, DATA which is about 3 times as much as on Linux. The libc.so numbers get divided by 3 (the remainings are mostly RPC stub calls) * include/libc-symbols.h [NO_RTLD_HIDDEN] (rtld_hidden_proto, rtld_hidden_tls_proto, rtld_hidden_def, rtld_hidden_weak, rtld_hidden_rtld_hidden_ver, data_def, rtld_hidden_data_weak, rtld_hidden_data_ver): Define to empty. * include/assert.h [IS_IN(rtld) && NO_RTLD_HIDDEN] (__assert_fail, __assert_perror_fail): Likewise. * include/dirent.h [IS_IN(rtld) && NO_RTLD_HIDDEN] (__rewinddir): Likewise. * include/libc-internal.h [IS_IN(rtld) && NO_RTLD_HIDDEN] (__profile_frequency): Likewise. * include/setjmp.h (__sigsetjmp): Likewise. * include/signal.h [IS_IN(rtld) && NO_RTLD_HIDDEN] (__sigaction, __libc_sigaction): Likewise. * include/stdlib.h [NO_RTLD_HIDDEN] (unsetenv, __strtoul_internal): Do not set hidden attribute. * include/string.h [IS_IN(rtld) && NO_RTLD_HIDDEN] (__stpcpy, __strdup, __strerror_t, __strsep_g, memchr, memcmp, memcpy, memmove, memset, rawmemchr, stpcpy, strchr, strcmp, strlen, strnlen, strsep): Likewise. * include/sys/stat.h [IS_IN(rtld) && NO_RTLD_HIDDEN] (__fxstat, __fxstat64, __lxstat, __lxstat64, __xstat, __xstat64, __fxstatat64): Likewise. * include/sys/utsname.h [IS_IN(rtld) && NO_RTLD_HIDDEN] (__uname): Likewise. * include/sysdeps/generic/_itoa.h [IS_IN(rtld) && NO_RTLD_HIDDEN] (_itoa_upper_digits, _itoa_lower_digits): Likewise. * sysdeps/mach/hurd/configure.ac (NO_HIDDEN): Do not set. (NO_RTLD_HIDDEN): Set. * sysdeps/mach/hurd/configure: Refresh. * config.h.in: Refresh.
* Hide internal __glob64 function [BZ #18822]H.J. Lu2017-10-011-0/+1
| | | | | | | | | | Hide internal __glob64 function to allow direct access within libc.so and libc.a without using GOT nor PLT. [BZ #18822] * include/glob.h (__glob64): Add libc_hidden_proto. * sysdeps/unix/sysv/linux/glob64.c (__glob64): Add libc_hidden_def.
* Hide internal __init_misc function [BZ #18822]H.J. Lu2017-10-011-1/+1
| | | | | | | | Hide internal __init_misc function to allow direct access within libc.so and libc.a without using GOT nor PLT. [BZ #18822] * include/libc-internal.h (__init_misc): Add attribute_hidden.
* Hide internal __setfpucw function [BZ #18822]H.J. Lu2017-10-011-1/+1
| | | | | | | | Hide internal __setfpucw function to allow direct access within libc.so and libc.a without using GOT nor PLT. [BZ #18822] * include/fpu_control.h (__setfpucw): Add attribute_hidden.
* Hide internal __tcgetattr function [BZ #18822]H.J. Lu2017-10-011-0/+1
| | | | | | | | | | | | Hide internal __tcgetattr function to allow direct access within libc.so and libc.a without using GOT nor PLT. [BZ #18822] * include/termios.h (__tcgetattr): Add libc_hidden_proto. * sysdeps/unix/bsd/tcgetattr.c (__tcgetattr): Add libc_hidden_def. * sysdeps/unix/sysv/linux/tcgetattr.c (__tcgetattr): Likewise. * termios/tcgetattr.c (__tcgetattr): Likewise.
* Hide internal __setrlimit function [BZ #18822]H.J. Lu2017-10-011-0/+1
| | | | | | | | | | | | Hide internal __setrlimit function to allow direct access within libc.so and libc.a without using GOT nor PLT. [BZ #18822] * include/sys/resource.h (__setrlimit): Add libc_hidden_proto. * resource/setrlimit.c (__setrlimit): Add libc_hidden_def. * sysdeps/mach/hurd/setrlimit.c (__setrlimit): Likewise. * sysdeps/unix/sysv/linux/setrlimit.c (__setrlimit): Likewise. * sysdeps/unix/sysv/linux/setrlimit64.c (__GI___setrlimit): New.
* Hide internal __vstrfmon_l function [BZ #18822]H.J. Lu2017-10-011-1/+2
| | | | | | | | Hide internal __vstrfmon_l function to allow direct access within libc.so and libc.a without using GOT nor PLT. [BZ #18822] * include/monetary.h (__vstrfmon_l): Add attribute_hidden.
* Hide internal __sched_setparam function [BZ #18822]H.J. Lu2017-10-011-0/+1
| | | | | | | | | | | | | Hide internal __sched_setparam function to allow direct access within libc.so and libc.a without using GOT nor PLT. __GI___sched_setparam is defined when sysdeps/unix/syscalls.list is used to generate sched_setparam. Otherwise libc_hidden_def is needed explicitly. [BZ #18822] * include/sched.h (__sched_setparam): Add libc_hidden_proto. * posix/sched_setp.c (__sched_setparam): Add libc_hidden_def.
* Hide internal __hasmntopt function [BZ #18822]H.J. Lu2017-10-011-0/+1
| | | | | | | | | Hide internal __hasmntopt function to allow direct access within libc.so and libc.a without using GOT nor PLT. [BZ #18822] * include/mntent.h (__hasmntopt): Add libc_hidden_proto. * misc/mntent_r.c (__hasmntopt): Add libc_hidden_def.
* Hide internal __ifreq function [BZ #18822]H.J. Lu2017-10-011-0/+14
| | | | | | | | | | | | Hide internal __ifreq function to allow direct access within libc.so and libc.a without using GOT nor PLT. [BZ #18822] * include/ifreq.h: New file. * sysdeps/generic/ifreq.h (__if_nextreq): Removed. (__ifreq): Likewise. * sysdeps/mach/hurd/ifreq.h (__if_nextreq): Removed. (__ifreq): Likewise.
* Hide internal idna functions [BZ #18822]H.J. Lu2017-10-011-0/+8
| | | | | | | | | | | | | | | Hide internal idna functions to allow direct access within libc.so and libc.a without using GOT nor PLT. [BZ #18822] * include/idna.h: New file. * inet/getnameinfo.c: Include <idna.h> instead of <libidn/idna.h>. (__idna_to_unicode_lzlz): Removed. * sysdeps/posix/getaddrinfo.c: Include <idna.h> instead of <libidn/idna.h>. (__idna_to_ascii_lz): Removed. (__idna_to_unicode_lzlz): Likewise.
* Hide internal __gettextparse function [BZ #18822]H.J. Lu2017-10-011-0/+8
| | | | | | | | | | Hide internal __gettextparse function to allow direct access within libc.so and libc.a without using GOT nor PLT. [BZ #18822] * include/plural-exp.h: New file. * intl/plural-exp.c: Include <plural-exp.h> instead of "plural-exp.h".
* Move hidden_proto (__dl_iterate_phdr) to include/link.h [BZ #18822]H.J. Lu2017-10-011-0/+1
| | | | | | | | | | __dl_iterate_phdr is hidden and should be accessed directly within libc.so and libc.a without using GOT nor PLT. [BZ #18822] * elf/dl-iteratephdr.c (hidden_proto (__dl_iterate_phdr)): Moved to ... * include/link.h (hidden_proto (__dl_iterate_phdr)): Here.
* Hide internal __tdestroy function [BZ #18822]H.J. Lu2017-10-011-0/+1
| | | | | | | | | Hide internal __tdestroy function to allow direct access within libc.so and libc.a without using GOT nor PLT. [BZ #18822] * include/search.h (__tdestroy): Add libc_hidden_proto. * misc/tsearch.c (__tdestroy): Add libc_hidden_def.
* Hide internal __assert_fail_base function [BZ #18822]H.J. Lu2017-10-011-1/+1
| | | | | | | | Hide internal __assert_fail_base function to allow direct access within libc.so and libc.a without using GOT nor PLT. [BZ #18822] * include/assert.h (__assert_fail_base): Add attribute_hidden.
* Hide internal signal functions [BZ #18822]H.J. Lu2017-10-011-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Hide internal signal functions to allow direct access within libc.so and libc.a without using GOT nor PLT. __GI___kill and __GI___sigaltstack are defined when syscalls.list is used to generate them. Otherwise libc_hidden_def is needed explicitly. [BZ #18822] * include/signal.h (__kill): Add libc_hidden_proto. (__sigblock): Likewise. (__sigprocmask): Likewise. (__sigaltstack): Likewise. * signal/kill.c (__kill): Add libc_hidden_def. * signal/sigblock.c (__sigblock): Likewise. * signal/sigprocmask.c (__sigprocmask): Likewise. * sysdeps/mach/hurd/kill.c (__kill): Likewise. * sysdeps/mach/hurd/sigaltstack.c (__sigaltstack): Likewise. * sysdeps/mach/hurd/sigprocmask.c (__sigprocmask): Likewise. * sysdeps/posix/sigblock.c (__sigblock): Likewise. * sysdeps/unix/sysv/linux/alpha/sigprocmask.c (__sigprocmask): Likewise. * sysdeps/unix/sysv/linux/ia64/sigprocmask.c (__sigprocmask): Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/sigprocmask.c (__sigprocmask): Likewise. * sysdeps/unix/sysv/linux/sigprocmask.c (__sigprocmask): Likewise. * /sysdeps/unix/sysv/linux/sparc/sparc64/sigprocmask.c (__sigprocmask): Likewise. * sysdeps/unix/sysv/linux/x86_64/sigprocmask.c (__sigprocmask): Likewise.
* Hide internal __strsep function [BZ #18822]H.J. Lu2017-10-011-0/+1
| | | | | | | | | Hide internal __strsep function to allow direct access within libc.so and libc.a without using GOT nor PLT. [BZ #18822] * include/string.h (__strsep): Add libc_hidden_proto. * string/strsep.c (__strsep): Add libc_hidden_def.
* Hide internal __mremap function [BZ #18822]H.J. Lu2017-10-011-0/+1
| | | | | | | | | | | | | Hide internal __mremap function to allow direct access within libc.so and libc.a without using GOT nor PLT. __GI___mremap is defined when sysdeps/unix/syscalls.list is used to generate mremap. Otherwise libc_hidden_def is needed explicitly. [BZ #18822] * include/sys/mman.h (__mremap): Add libc_hidden_proto. * sysdeps/unix/sysv/linux/m68k/mremap.S (__mremap): Add libc_hidden_def.
* Hide internal __malloc_check_init function [BZ #18822]H.J. Lu2017-10-011-0/+2
| | | | | | | | Hide internal __malloc_check_init function to allow direct access within libc.so and libc.a without using GOT nor PLT. [BZ #18822] * include/malloc.h (__malloc_check_init): Add attribute_hidden.
* Hide internal __ioctl function [BZ #18822]H.J. Lu2017-10-011-0/+1
| | | | | | | | | | | | | | | | | | Hide internal __ioctl function to allow direct access within libc.so and libc.a without using GOT nor PLT. __GI___ioctl is defined when sysdeps/unix/syscalls.list is used to generate ioctl. Otherwise libc_hidden_def is needed explicitly. [BZ #18822] * include/sys/ioctl.h (__ioctl): Add libc_hidden_proto. * misc/ioctl.c (__ioctl): Add libc_hidden_def. * sysdeps/mach/hurd/ioctl.c (__ioctl): Likewise. * sysdeps/unix/sysv/linux/aarch64/ioctl.S (__ioctl): Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/ioctl.S (__ioctl): Likewise. * sysdeps/unix/sysv/linux/powerpc/ioctl.c (__ioctl): Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/ioctl.S (__ioctl): Likewise.
* Hide internal sysinfo functions [BZ #18822]H.J. Lu2017-10-011-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | Hide internal sysinfo functions to allow direct access within libc.so and libc.a without using GOT nor PLT. [BZ #18822] * include/sys/sysinfo.h (__get_nprocs_conf): Add libc_hidden_proto. (__get_nprocs): Likewise. (__get_phys_pages): Likewise. (__get_avphys_pages): Likewise. (__get_child_max): Add attribute_hidden. * misc/getsysstats.c (__get_nprocs_conf): Add libc_hidden_def. (__get_nprocs): Likewise. (__get_phys_pages): Likewise. (__get_avphys_pages): Likewise. * sysdeps/mach/getsysstats.c (__get_nprocs_conf): Add libc_hidden_def. (__get_nprocs): Likewise. (__get_phys_pages): Likewise. (__get_avphys_pages): Likewise. * sysdeps/unix/sysv/linux/getsysstats.c (__get_nprocs): Add libc_hidden_def. (__get_nprocs_conf): Likewise. (__get_phys_pages): Likewise. (__get_avphys_pages): Likewise.
* Mark internal rpc functions with attribute_hidden [BZ #18822]H.J. Lu2017-10-011-4/+4
| | | | | | | | | | | | Mark internal rpc functions with attribute_hidden to allow direct access within libc.so and libc.a without using GOT nor PLT. [BZ #18822] * include/rpc/rpc.h (__rpc_thread_variables): Add attribute_hidden. (__rpc_thread_svc_cleanup): Likewise. (__rpc_thread_clnt_cleanup): Likewise. (__rpc_thread_key_cleanup): Likewise.
* Hide __readv and __writev [BZ #18822]H.J. Lu2017-10-011-0/+2
| | | | | | | | | | | | | | | | | Hide internal __readv and __writev functions to allow direct access within libc.so and libc.a without using GOT nor PLT. [BZ #18822] * include/sys/uio.h (__readv): Add libc_hidden_proto. (__writev): Likewise. * misc/readv.c (__readv): Add libc_hidden_def. * misc/writev.c (__writev): Likewise. * sysdeps/posix/readv.c (__readv): Likewise. * sysdeps/posix/writev.c (__writev): Likewise. * sysdeps/unix/sysv/linux/readv.c: Include <sys/uio.h>. (__readv): Likewise. * sysdeps/unix/sysv/linux/writev.c: Include <sys/uio.h>. (__writev): Likewise.
* Hide internal regex functions [BZ #18822]H.J. Lu2017-10-011-1/+5
| | | | | | | | | | | | | | Hide internal regex functions to allow direct access within libc.so and libc.a without using GOT nor PLT. [BZ #18822] * include/regex.h (__re_compile_fastmap): Add attribute_hidden. (__regcomp): Add libc_hidden_proto. (__regexec): Likewise. (__regfree): Likewise. * posix/regcomp.c (__regcomp): Add libc_hidden_def. (__regfree): Likewise. * posix/regexec.c (__regexec): Likewise.
* Mark internal utmp functions with attribute_hidden [BZ #18822]H.J. Lu2017-10-011-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | Mark internal utmp functions with attribute_hidden to allow direct access within libc.so and libc.a without using GOT nor PLT. [BZ #18822] * include/utmp.h (__updwtmp): Add libc_hidden_proto. (__getutent): Likewise. (__getutid): Likewise. (__getutline): Likewise. (__pututline): Likewise. (__getutent_r): Likewise. (__getutid_r): Likewise. (__getutline_r): Likewise. (__utmpname): Add attribute_hidden. (__setutent): Likewise. (__endutent): Likewise. * login/getutent.c (__getutent): Add libc_hidden_def. * login/getutent_r.c (__getutent_r): Likewise. (__pututline): Likewise. * login/getutid.c (__getutid): Likewise. * login/getutid_r.c (__getutid_r): Likewise. * login/getutline.c (__getutline): Likewise. * login/getutline_r.c (__getutline_r): Likewise. * login/updwtmp.c (__updwtmp): Likewise.
* Mark internal dirent functions with attribute_hidden [BZ #18822]H.J. Lu2017-10-011-8/+5
| | | | | | | | | | | | | | | | | | | Mark internal dirent functions with attribute_hidden to allow direct access within libc.so and libc.a without using GOT nor PLT. __readdir64 is hidden with libc_hidden_proto and libc_hidden_def since the exported readdir64 is an alias of __readdir64. [BZ #18822] * include/dirent.h (__opendir): Always add attribute_hidden. (__fdopendir): Likewise. (__closedir): Likewise. (__readdir): Likewise. (__readdir64): Add libc_hidden_proto. * sysdeps/mach/hurd/readdir64.c (__readdir64): Add libc_hidden_def. * sysdeps/unix/sysv/linux/i386/readdir64.c (__readdir64): Likewise. * sysdeps/unix/sysv/linux/readdir64.c (__readdir64): Likewise. * sysdeps/unix/sysv/linux/wordsize-64/readdir.c (__GI___readdir64): New alias.
* Mark internal getXXXbyYYY functions with attribute_hidden [BZ #18822]H.J. Lu2017-10-013-13/+24
| | | | | | | | | | | | | | | | | | | | | Mark internal getXXXbyYYY functions with attribute_hidden to allow direct access within libc.so and libc.a without using GOT nor PLT. [BZ #18822] * include/aliases.h (__getaliasbyname_r): Add attribute_hidden. * include/netdb.h (__gethostbyaddr_r): Likewise. (__gethostbyname_r): Likewise. (__gethostbyname2_r): Likewise. (__getnetbyaddr_r): Likewise. (__getnetbyname_r): Likewise. (__getservbyname_r): Likewise. (__getservbyport_r): Likewise. (__getprotobyname_r): Likewise. (__getprotobynumber_r): Likewise. (__getnetgrent_r): Likewise. * include/rpc/netdb.h (__getrpcbyname_r): Likewise. (__getrpcbynumber_r): Likewise. * nss/getXXbyYY.c (INTERNAL (REENTRANT_NAME)): Likewise.
* Mark internal stdio functions with attribute_hidden [BZ #18822]H.J. Lu2017-10-011-9/+9
| | | | | | | | | | | | | | | | Mark internal stdio functions with attribute_hidden to allow direct access within libc.so and libc.a without using GOT nor PLT. [BZ #18822] * include/stdio.h (__fcloseall): Add attribute_hidden. (__getline): Likewise. (__path_search): Likewise. (__gen_tempname): Likewise. (__libc_message): Likewise. (__flockfile): Likewise. (__funlockfile): Likewise. (__fxprintf): Likewise. (__fxprintf_nocancel): Likewise.
* Mark internal gshadow functions with attribute_hidden [BZ #18822]H.J. Lu2017-10-011-2/+4
| | | | | | | | | Mark internal gshadow functions with attribute_hidden to allow direct access within libc.so and libc.a without using GOT nor PLT. [BZ #18822] * include/gshadow.h (__fgetsgent_r): Add attribute_hidden. (__sgetsgent_r): Likewise.
* Mark internal statfs functions with attribute_hidden [BZ #18822]H.J. Lu2017-10-012-5/+10
| | | | | | | | | | | | | | | | Mark internal statfs functions with attribute_hidden to allow direct access within libc.so and libc.a without using GOT nor PLT. [BZ #18822] * include/sys/statfs.h (__fstatfs): Add attribute_hidden. (__statfs64): Likewise. (__fstatfs64): Likewise. * include/sys/statvfs.h (__statvfs64): Likewise. (__fstatvfs64): Likewise. * sysdeps/unix/sysv/linux/pathconf.h (__statfs_link_max): Likewise. (__statfs_filesize_max): Likewise. (__statfs_symlinks): Likewise. (__statfs_chown_restricted): Likewise.
* Mark internal time functions with attribute_hidden [BZ #18822]H.J. Lu2017-10-011-11/+15
| | | | | | | | | | | | | | | | | | Mark internal time functions with attribute_hidden to allow direct access within libc.so and libc.a without using GOT nor PLT. [BZ #18822] * include/time.h (__tzstring): Add attribute_hidden. (__tzfile_read): Likewise. (__tzfile_compute): Likewise. (__tzfile_default): Likewise. (__tzset_parse_tz): Likewise. (__offtime): Likewise. (__asctime_r): Likewise. (__tzset): Likewise. (__tz_convert): Likewise. (__getdate_r): Likewise. (__getclktck): Likewise.
* Mark internal gmp functions with attribute_hidden [BZ #18822]H.J. Lu2017-10-011-7/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Mark internal gmp functions with attribute_hidden to allow direct access within libc.so and libc.a without using GOT nor PLT. [BZ #18822] * include/gmp.h: Declare internal functions only if _ISOMAC is undefined. (__mpn_extract_double): Add attribute_hidden. (__mpn_extract_long_double): Likewise. (__mpn_extract_float128): Likewise. (__mpn_construct_float): Likewise. (__mpn_construct_double): Likewise. (__mpn_construct_long_double): Likewise. (__mpn_construct_float128): Likewise. (mpn_add_1): Likewise. (mpn_addmul_1): Likewise. (mpn_add_n): Likewise. (mpn_cmp): Likewise. (mpn_divrem): Likewise. (mpn_lshift): Likewise. (mpn_mul): Likewise. (mpn_mul_1): Likewise. (mpn_rshift): Likewise. (mpn_sub_1): Likewise. (mpn_submul_1): Likewise. (mpn_sub_n): Likewise.
* Mark internal wchar functions with attribute_hidden [BZ #18822]H.J. Lu2017-10-011-14/+24
| | | | | | | | | | | | | | | | | | | | | | | | | Mark internal wchar functions with attribute_hidden to allow direct access within libc.so and libc.a without using GOT nor PLT. [BZ #18822] * include/wchar.h (__wcsnlen): Add attribute_hidden. (__wcscat): Likewise. (__btowc): Likewise. (__wcrtomb): Likewise. (__mbsrtowcs): Likewise. (__wcsrtombs): Likewise. (__mbsnrtowcs): Likewise. (__wcsnrtombs): Likewise. (__wcsncpy): Likewise. (__wcpncpy): Likewise. (__wmemcpy): Likewise. (__wmempcpy): Likewise. (__wmemmove): Likewise. (__wcschrnul): Likewise. (__vfwscanf): Likewise. (__vswprintf): Likewise. (__fwprintf): Likewise. (__vfwprintf): Likewise.
* Mark internal grp/pwd/shadow functions with attribute_hidden [BZ #18822]H.J. Lu2017-10-013-9/+10
| | | | | | | | | | | | | | | | Mark internal grp/pwd/shadow functions with attribute_hidden to allow direct access within libc.so and libc.a without using GOT nor PLT. [BZ #18822] * include/grp.h (__fgetgrent_r): Add attribute_hidden. (__getgrgid_r): Likewise. (__getgrnam_r): Likewise. * include/pwd.h (__getpwuid_r): Likewise. (__getpwnam_r): Likewise. (__fgetpwent_r): Likewise. * include/shadow.h (__getspnam_r): Likewise. (__sgetspent_r): Likewise. (__fgetspent_r): Likewise.
* Mark internal unistd functions with attribute_hidden [BZ #18822]H.J. Lu2017-10-011-28/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Mark internal unistd functions with attribute_hidden to allow direct access to them within libc.so and libc.a without using GOT nor PLT. [BZ #18822] * include/unistd.h (__access): Add attribute_hidden. (__lseek64): Likewise. (__libc_pread64): Likewise. (__pipe2): Likewise. (__sleep): Likewise. (__chdir): Likewise. (__fchdir): Likewise. (__getcwd): Likewise. (__rmdir): Likewise. (__execvpe): Likewise. (__execve): Likewise. (__setsid): Likewise. (__getuid): Likewise. (__geteuid): Likewise. (__getgid): Likewise. (__getegid): Likewise. (__getgroups): Likewise. (__group_member): Likewise. (__ttyname_r): Likewise. (__isatty): Likewise. (__readlink): Likewise. (__unlink): Likewise. (__gethostname): Likewise. (__profil): Likewise. (__getdtablesize): Likewise. (__brk): Likewise. (__ftruncate): Likewise. (__ftruncate64): Likewise.
* Mark internal argp functions with attribute_hidden [BZ #18822]H.J. Lu2017-10-012-0/+29
| | | | | | | | | | | | | | | | | Mark internal argp functions with attribute_hidden to allow direct access to them within libc.so and libc.a without using GOT nor PLT. [BZ #18822] * argp/argp-fmtstream.c: Include <argp-fmtstream.h>. * argp/argp-fs-xinl.c: Likewise. * argp/argp-help.c: Include <argp.h> and <argp-fmtstream.h>. * argp/argp-parse.c: Include <argp.h>. * argp/argp-xinl.c: Likewise. * include/argp-fmtstream.h: New file. * include/argp.h (__argp_error): Add attribute_hidden. (__argp_failure): Likewise. (__argp_input): Likewise. (__argp_state_help): Likewise.
* Mark ____wcsto*_l_internal functions with attribute_hidden [BZ #18822]H.J. Lu2017-10-011-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Mark ____wcsto*_l_internal functions with attribute_hidden to allow direct access to them within libc.so and libc.a without using GOT nor PLT. [BZ #18822] * include/wchar.h (____wcstof_l_internal): New prototype. (____wcstod_l_internal): Likewise. (____wcstold_l_internal): Likewise. (____wcstol_l_internal): Likewise. (____wcstoul_l_internal): Likewise. (____wcstoll_l_internal): Likewise. (____wcstoull_l_internal): Likewise. (____wcstof128_l_internal): Likewise. * sysdeps/ieee754/float128/wcstof128.c (____wcstof128_l_internal): Removed. * sysdeps/ieee754/float128/wcstof128_l.c (____wcstof128_l_internal): Likewise. * wcsmbs/wcstod.c (____wcstod_l_internal): Likewise. * wcsmbs/wcstod_l.c (____wcstod_l_internal): Likewise. * wcsmbs/wcstof.c (____wcstof_l_internal): Likewise. * wcsmbs/wcstof_l.c (____wcstof_l_internal): Likewise. * wcsmbs/wcstol_l.c (____wcstol_l_internal): Likewise. * wcsmbs/wcstold.c (____wcstold_l_internal): Likewise. * wcsmbs/wcstold_l.c (____wcstold_l_internal): Likewise. * wcsmbs/wcstoll_l.c (____wcstoll_l_internal): Likewise. * wcsmbs/wcstoul_l.c (____wcstoul_l_internal): Likewise. * wcsmbs/wcstoull_l.c (____wcstoull_l_internal): Likewise.
* Mark internal functions with attribute_hidden [BZ #18822]H.J. Lu2017-10-013-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Mark internal functions with attribute_hidden to allow direct access to internal functions within libc.so and libc.a without using GOT nor PLT. Size comparison of libc.so: On x86-64: text data bss dec hex Before: 1728577 20584 17088 1766249 1af369 After : 1728593 20584 17088 1766265 1af379 The only change is __gconv_release_shlib in iconv/gconv_dl.c is inlined since it is hidden, which increases the code size of gconv_dl.os by 18 bytes. On i686: text data bss dec hex Before: 1869039 11444 11112 1891595 1cdd0b After : 1868635 11444 11112 1891191 1cdb77 The code size is decreased by avoiding GOT/PLT for hidden functions. [BZ #18822] * iconv/gconv_int.h (__gconv_open): Add attribute_hidden. (__gconv_close): Likewise. (__gconv): Likewise. (__gconv_find_transform): Likewise. (__gconv_lookup_cache): Likewise. (__gconv_compare_alias_cache): Likewise. (__gconv_load_cache): Likewise. (__gconv_get_path): Likewise. (__gconv_close_transform): Likewise. (__gconv_release_cache): Likewise. (__gconv_find_shlib): Likewise. (__gconv_release_shlib): Likewise. (__gconv_get_builtin_trans): Likewise. (__gconv_compare_alias): Likewise. * include/dlfcn.h (_dlerror_run): Likewise. * include/stdio.h (__fortify_fail_abort): Likewise. * include/time.h (__tz_compute): Likewise. (__strptime_internal): Likewise. * intl/gettextP.h (_nl_find_domain): Likewise. (_nl_load_domain): Likewise. (_nl_find_msg): Likewise. * intl/plural-exp.h (FREE_EXPRESSION): Likewise. (EXTRACT_PLURAL_EXPRESSION): Likewise. * locale/coll-lookup.h (__collidx_table_lookup): Likewise. * resolv/gai_misc.h (__gai_enqueue_request): Likewise. (__gai_find_request): Likewise. (__gai_remove_request): Likewise. (__gai_notify): Likewise. (__gai_notify_only): Likewise. * sysdeps/generic/aio_misc.h (__aio_sigqueue): Likewise. * sysdeps/generic/ldsodefs.h (_dl_fini): Likewise. (_dl_non_dynamic_init): Likewise. (_dl_aux_init): Likewise. * sysdeps/i386/machine-gmon.h (mcount_internal): Likewise. * sysdeps/unix/sysv/linux/i386/olddirent.h (__old_getdents64): Likewise. * wcsmbs/wcsmbsload.h (__wcsmbs_load_conv): Likewise. (__wcsmbs_clone_conv): Likewise. (__wcsmbs_named_conv): Likewise.
* Mark internal stdlib functions with attribute_hidden [BZ #18822]H.J. Lu2017-10-011-19/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Mark internal stdlib functions with attribute_hidden to allow direct access within libc.so and libc.a without using GOT nor PLT. __realpath is hidden with libc_hidden_proto and libc_hidden_def since the exported realpath is an alias of __realpath. [BZ #18822] * include/stdlib.h (__random): Add attribute_hidden. (__random_r): Likewise. (__srandom_r): Likewise. (__initstate_r): Likewise. (__setstate_r): Likewise. (__erand48_r): Likewise. (__nrand48_r): Likewise. (__jrand48_r): Likewise. (__srand48_r): Likewise. (__seed48_r): Likewise. (__lcong48_r): Likewise. (__drand48_iterate): Likewise. (__setenv): Likewise. (__unsetenv): Likewise. (__clearenv): Likewise. (__ptsname_r): Likewise. (__posix_openpt): Likewise. (__add_to_environ): Likewise. (__realpath): Add libc_hidden_proto. (__ecvt_r): Likewise. (__fcvt_r): Likewise. (__qecvt_r): Likewise. (__qfcvt_r): Likewise. * misc/efgcvt_r.c (cvt_symbol_1): Add libc_hidden_def (local). * stdlib/canonicalize.c (__realpath): Add libc_hidden_def.
* Mark 3 *_internal functions with attribute_hidden [BZ #18822]H.J. Lu2017-10-012-2/+2
| | | | | | | | | | | Mark __ptsname_internal, __mktime_internal and __fopen_internal with attribute_hidden to allow direct access to them within libc.so and libc.a without using GOT nor PLT. [BZ #18822] * include/stdlib.h (__ptsname_internal): Add attribute_hidden. * include/time.h (__mktime_internal): Likewise. * libio/iolibio.h (__fopen_internal): Likewise.
* hurd: Fix `getifaddrs' and `freeifaddrs' symbol expositionSamuel Thibault2017-09-281-0/+5
| | | | | | | | | | | | | | | from `freeaddrinfo'. `getifaddrs' and `freeifaddrs' are not in POSIX, they should not be exposed along `freeaddrinfo' (through `__check_pf') which is POSIX. * include/ifaddrs.h (__getifaddrs, __freeifaddrs): New declarations, and use libc_hidden_def on them. * inet/ifaddrs.c (__getifaddrs, __freeifaddrs): Use libc_hidden_def on them. * sysdeps/gnu/ifaddrs.c (__getifaddrs, __freeifaddrs): Likewise. * inet/check_pf.c (__check_pf): Use __getifaddrs and __freeifaddrs instead of getifaddrs and freeifaddrs.
* hurd: Fix `seekdir' symbol exposition from `rewinddir'Samuel Thibault2017-09-281-0/+1
| | | | | | | | | | | `seekdir' is MISC || XOPEN, it should not be exposed along `rewinddir' which is POSIX. * include/dirent.h (__seekdir): New declaration. * sysdeps/mach/hurd/seekdir.c (seekdir): Rename to __seekdir and redefine as weak alias. * sysdeps/mach/hurd/rewinddir.c (__rewinddir): Use __seekdir instead of seekdir.
* hurd: Fix `revoke' symbol exposition from `unlockpt'Samuel Thibault2017-09-281-0/+1
| | | | | | | | | | | | `revoke' is MISC only, it should not be exposed along `unlockpt' which is XOPEN. * include/unistd.h (__revoke): New declaration. * misc/revoke.c (revoke): Rename to __revoke, and redefine as weak alias. * sysdeps/mach/hurd/revoke.c (revoke): Likewise. * sysdeps/unix/bsd/unlockpt.c (unlockpt): Use __revoke instead of revoke.
* hurd: Fix dirfd symbol exposition from ftwSamuel Thibault2017-09-281-0/+1
| | | | | | | | | | | dirfd is XOPEN2K8 only, it should not be exposed along ftw which is earlier. * include/dirent.h (__dirfd): New declaration. * dirent/dirfd.c (dirfd): Rename to __dirfd, and redefine as weak alias. * sysdeps/posix/dirfd/dirfd.c (dirfd): Likewise. * sysdeps/mach/hurd/dirfd.c (dirfd): Likewise. * io/ftw.c (open_dir_stream, ftw_dir): Use __dirfd instead of dirfd.
* Mark __dso_handle as hidden [BZ #18822]H.J. Lu2017-09-261-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since __dso_handle is always defined by either crtbegin.o from GCC or dso_handle.c, it should be marked as hidden and be passed directly. [BZ #18822] * dlfcn/modatexit.c (foo): Remove __dso_handle check. * dlfcn/modcxaatexit.c: Include <dso_handle.h>. (__dso_handle): Remove declaration. * dlfcn/tstatexit.c (__dso_handle): Removed. (main): Don't check __dso_handle. * dlfcn/tstcxaatexit.c (__dso_handle): Removed. (main): Don't check __dso_handle. * include/dso_handle.h: New file. * malloc/mtrace.c: Include <dso_handle.h>. (mtrace): Pass __dso_handle directly. * nptl/pthread_atfork.c: Include <dso_handle.h>. (__dso_handle): Remove declaration. (__pthread_atfork): Pass __dso_handle directly. * nptl/tst-atfork2mod.c: Include <dso_handle.h>. (__dso_handle): Removed. * posix/wordexp-test.c: Include <dso_handle.h>. (__dso_handle): Remove declaration. (__app_register_atfork): Pass __dso_handle directly. * stdlib/at_quick_exit.c: Include <dso_handle.h>. (__dso_handle): Remove declaration. (at_quick_exit): Pass __dso_handle directly. * stdlib/atexit.c: Include <dso_handle.h>. (__dso_handle): Remove declaration. (atexit): Pass __dso_handle directly. * stdlib/tst-tls-atexit-lib.c: Include <dso_handle.h>. (__dso_handle): Removed.
* scratch_buffer: use union for internal bufferAdhemerval Zanella2017-09-251-3/+3
| | | | | | | | | | | | | | | | | Problem reported by Florian Weimer [1] and solution suggested by Andreas Schwab [2]. It also set the same buffer size independent of architecture max_align_t size. Checked on x86_64-linux-gnu and i686-linux-gnu. * lib/malloc/scratch_buffer.h (struct scratch_buffer): Use an union instead of a max_align_t array for __space, so that __space is the same size on all platforms. * malloc/scratch_buffer_grow_preserve.c (__libc_scratch_buffer_grow_preserve): Likewise. [1] https://sourceware.org/ml/libc-alpha/2017-09/msg00693.html [2] https://sourceware.org/ml/libc-alpha/2017-09/msg00695.html
* posix: Add compat glob symbol to not follow dangling symbolsAdhemerval Zanella2017-09-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch follows commit 5554304f0 (posix: Allow glob to match dangling symlinks [BZ #866]) by adding a compat symbol that follow previous semantic of not following dangling symlinks and thus avoiding call gl_lstat with GLOB_ALTDIRFUNC. It avoids failure with old binaries that not set the alternate function pointer for lstat (GNUmake for instance). The following scenario, for instance, fails with current GNUmake because glibc will access unitialized memory when calling gl_lstat: $ cat src/t/t.c int main () { return 0; } $ cat Makefile SRC = $(wildcard src/*/t.c) OBJ = $(patsubst src/%.c, obj/%.o, $(SRC)) prog: $(OBJ) $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) $(OBJ) -o prog obj/%.o: src/%.c $(CC) $(CFLAGS) -c $< -o $@ $ make This works as expected with the patch applied. Since it is for generic ABI, default compat symbols are added with override for Linux due LFS. Now we have two compat symbols for glob on Linux: 1. sysdeps/unix/sysv/linux/oldglob.c which implements glob64 with the old dirent layout. For this implementation I also set it to not follow dangling symlinks (which is the safest path). 2. sysdeps/unix/sysv/linux/glob{64}-lstat-compat.c which implements the compat symbol for dangling symlinks. As for generic glob, the implementation uses XSTAT_IS_XSTAT64 to define whether both __glob_lstat_compat and __glob64_lstat_compat should be different implementations. For archictures that define XSTAT_IS_XSTAT64, __glob_lstat_compat is aliased to __glob64_lstat_compat. 3. sysdeps/unix/sysv/linux/alpha/oldglob.c with a different glob_t layout. As for 1. this patch changes it to not follow dangling symlinks. The patch also bumps _GNU_GLOB_INTERFACE_VERSION to 2 to advertise the new semantic. On GNUmake, for instance, it will force to it use its internal glob implementation instead and avoiding triggering the same failure on builds against newer GLIBCs. Checked on x86_64-linux-gnu and i686-linux-gnu. I also checked with a build against the major ABIs required to check for the abilist. The changes should also work on gnulib (I run gnulib-tool.py check glob and it shown no regressions). [BZ #22183] * include/gnu-versions.h (_GNU_GLOB_INTERFACE_VERSION): Increase version to 2. * posix/Makefile (routines): Add glob-lstat-compat and glob64-lstat-compat. * posix/Versions (GLIBC_2.27, glob, glob64): Add symbol version. * posix/glob-lstat-compat.c: New file. * posix/glob64-lstat-compat.c: Likewise. * posix/tst-glob_lstat_compat.c: Likewise. * sysdeps/unix/sysv/linux/glob-lstat-compat.c: Likewise. * sysdeps/unix/sysv/linux/alpha/glob-lstat-compat.c: Likewise. * sysdeps/unix/sysv/linux/glob64-lstat-compat.c: Likewise. * sysdeps/unix/sysv/linux/alpha/glob.c: Remove file. * posix/glob.c (glob_lstat): New function. (glob): Rename to __glob and add versioned symbol to 2.27. (glob_in_dir): Use glob_lstat. * posix/glob64.c (glob64): Add GLOB_ATTRIBUTE. * sysdeps/unix/sysv/linux/arm/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/glob.c (glob): Add versioned symbol for 2.27. * sysdeps/unix/sysv/linux/glob64.c (glob64): Likewise. * sysdeps/unix/sysv/linux/oldglob.c (GLOB_NO_LSTAT): Define. * sysdeps/unix/sysv/linux/alpha/oldglob.c (__old_glob): Do not use gl_lstat on glob call. * sysdeps/unix/sysv/linux/aarch64/libc.abilist: Add GLIBC_2.27 glob and glob64 symbols. * sysdeps/unix/sysv/linux/alpha/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/hppa/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/i386/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/ia64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/microblaze/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/nios2/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist: Likewise. * sysdeps/unix/linux/powerpc/powerpc32/nofpu/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/sh/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist: Likewise.