about summary refs log tree commit diff
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix signal stack namespace (bug 21584).Joseph Myers2017-06-192-4/+13
| | | | | | | | | | | | | | | | | | | In POSIX.1:2008, various signal stack symbols - sigaltstack, SS_*, SIGSTKSZ, MINSIGSTKSZ - are all XSI-shaded. glibc wrongly makes them visible for non-XSI POSIX. This patch fixes the conditionals, leaving the symbols available for __USE_MISC as it seems likely some of them are widely used and should be visible by default. (Note that stack_t is *not* XSI-shaded and so the conditionals on that are correctly unchanged.) Tested for x86_64. [BZ #21584] * signal/signal.h: Make includes of <bits/sigstack.h> and <bits/ss_flags.h> conditional on [__USE_XOPEN_EXTENDED || __USE_MISC]. (sigaltstack): Make declaration conditional on [__USE_XOPEN_EXTENDED || __USE_MISC].
* Define struct rusage in sys/wait.h when required (bug 21575).Joseph Myers2017-06-1910-278/+162
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some older standards (XPG4.2 through POSIX.1:2001, XSI only) require sys/wait.h to include the definition of struct rusage. This is missing in glibc. This patch adds the required definition. struct rusage is moved to a new header bits/types/struct_rusage.h to avoid bringing in the whole of sys/resource.h (although the standards in question do allow the whole of sys/resource.h to be brought in). In the five bits/resource.h headers, the only variation between the definitions of struct rusage is that the sysdeps/unix/sysv/linux version is prepared for x32 (by having anonymous unions with __syscall_slong_t fields) and the others are not. Thus, this version is suitable for use generically (everything other than x32 simply has __syscall_slong_t the same as long int, so there are no API or ABI changes involved, and anonymous unions are already a required language feature for glibc headers elsewhere), and this patch uses it as a base for the single implementation of bits/types/struct_rusage.h. Tested for x86_64, and with build-many-glibcs.py. [BZ #21575] * resource/bits/types/struct_rusage.h: New file. * include/bits/types/struct_rusage.h: Likewise. * bits/resource.h (struct rusage): Include <bits/types/struct_rusage.h> instead of defining here. * sysdeps/unix/sysv/linux/bits/resource.h (struct rusage): Likewise. * sysdeps/unix/sysv/linux/alpha/bits/resource.h (struct rusage): Likewise. * sysdeps/unix/sysv/linux/mips/bits/resource.h (struct rusage): Likewise. * sysdeps/unix/sysv/linux/sparc/bits/resource.h (struct rusage): Likewise. * resource/Makefile (headers): Add bits/types/struct_rusage.h. * posix/sys/wait.h [__USE_XOPEN_EXTENDED && !__USE_XOPEN2K8]: Include <bits/types/struct_rusage.h>
* dynarray: Use libc_hidden_proto only for !_ISOMACFlorian Weimer2017-06-192-4/+11
| | | | | With this change, it is possible to use dynarray from non-internal tests.
* Fix typo when undefining weak_aliasSiddhesh Poyarekar2017-06-192-1/+5
| | | | | | The macro directive #undef was miswritten as #undefine. * sysdeps/x86_64/multiarch/rawmemchr-sse2.S: Fix typo.
* Fix gen-tunables.awk to work with older awkAdhemerval Zanella2017-06-192-34/+38
| | | | | | | Awk 3.1.x does not support multi-dimensional arrays, so fix up to make sure that gen-tunables.awk works on it. * scripts/gen-tunables.awk: Avoid multi-dimensional arrays.
* S390: Fix build with gcc configured with --enable-default-pie. [BZ #21537]Stefan Liebler2017-06-194-24/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Building glibc with gcc configured with --enable-default-pie failed on s390 due to assembler messages: ../sysdeps/unix/sysv/linux/s390/s390-32/__makecontext_ret.S:44: Error: junk at end of line, first unrecognized character is `@' HIDDEN_JUMPTARGET was expanded to exit@PLT@GOTOFF. If SHARED is not defined, HIDDEN_JUMPTARGET is defined to JUMPTARGET in sysdeps/s390/s390-32/sysdep.h. There it expanded to exit@PLT in non SHARED case as PIC is defined if gcc is configured with --enable-default-pie. Thus I've changed the "ifdef PIC" to "ifdef SHARED" as we do not want PLTs in the static obj files. I've also changed this in sysdeps/s390/s390-64/sysdep.h. I've also adjusted sysdeps/unix/sysv/linux/s390/s390-32/__makecontext_ret.S. If glibc is configured with --disable-hidden-plt, then NO_HIDDEN is defined. In SHARED case HIDDEN_JUMPTARGET would be expanded to exit@PLT@GOTOFF instead of __GI_exit@GOTOFF. Now we jump to: - __GI_exit if SHARED is defined - exit@PLT if SHARED and NO_HIDDEN is defined - exit if both are not defined. On s390 31bit we have to setup GOT pointer in r12 if we use a PLT stub. Therefore I use SYSCALL_PIC_SETUP from sysdep.h and added the missing semicolons. ChangeLog: [BZ #21537] * sysdeps/s390/s390-32/sysdep.h (JUMPTARGET, SYSCALL_PIC_SETUP): Check SHARED instead of PIC. (SYSCALL_PIC_SETUP): Add missing semicolons. * sysdeps/s390/s390-64/sysdep.h (JUMPTARGET, SYSCALL_PIC_SETUP): Check SHARED instead of PIC. * sysdeps/unix/sysv/linux/s390/s390-32/__makecontext_ret.S (__makecontext_ret): Adjust code to jump to exit.
* s390: optimize syscall functionChristian Borntraeger2017-06-193-18/+12
| | | | | | | | | | | | | | Since kernel 2.6.0 all Linux version accept the system call number in register 1 for svc 0. There is no need to have special handling that uses EX for system calls < 256. This will simplify and speed up that code. A microbenchmark doing "syscall(__NR_getpid);" in a loops gets faster by ~12%. * sysdeps/unix/sysv/linux/s390/s390-32/syscall.S: Simplify code by always using SVC 0 instead of EX. * sysdeps/unix/sysv/linux/s390/s390-64/syscall.S: Likewise.
* Remove _dl_out_of_memory from elf/VersionsH.J. Lu2017-06-162-1/+5
| | | | | | | | | | Since _dl_out_of_memory is static in elf/dl-error-skeleton.c: static const char _dl_out_of_memory[] = "out of memory"; remove _dl_out_of_memory from elf/Versions. * elf/Versions (ld): Remove _dl_out_of_memory.
* Update timezone code from tzcode 2017b.Joseph Myers2017-06-168-615/+877
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch updates files coming from tzcode to the versions in tzcode 2017b. A couple of changes to other glibc code are needed. time/tzset.c was using the SECSPERDAY macro from tzfile.h, which no longer defines that macro, so a local definition is added to tzset.c. Because timezone/private.h now defines the _ macro whenever HAVE_GETTEXT is true, even if it was previously defined, it is also necessary to avoid a conflict with the definition in include/libintl.h. Defining _ISOMAC is the obvious way to avoid such internal definitions being visible, together with defining TZ_DOMAIN so that zic and zdump continue to get the messages from the libc domain as desired. However, zic and zdump rely on PKGVERSION and REPORT_BUGS_TO from config.h, which is not included by default with _ISOMAC, so -include config.h needs adding to the options for these programs as well. Together those changes allow unmodified tzcode 2017b sources to work in glibc. Tested for x86_64. * timezone/private.h: Update from tzcode 2017b. * timezone/tzfile.h: Likewise. * timezone/tzselect.ksh: Likewise. * timezone/zdump.c: Likewise. * timezone/zic.c: Likewise. * timezone/Makefile (tz-cflags): Add -D_ISOMAC -DTZ_DOMAIN='"libc"' -include $(common-objpfx)config.h. * time/tzset.c (SECSPERDAY): New macro.
* manual: Complete @standards in string.texi.Rical Jasan2017-06-162-2/+8
| | | | | | * manual/string.texi (strdup): Complete header and standards annotation. (strncpy): Likewise.
* manual: Complete @standards in arith.texi.Rical Jasan2017-06-162-7/+27
| | | | | | | | | | | | | | | | | * manual/arith.texi (FP_NAN): Add or complete header and standard annotations. (FP_INFINITE): Likewise. (FP_ZERO): Likewise. (FP_SUBNORMAL): Likewise. (FP_NORMAL): Likewise. (SNAN): Likewise. (SNANL): Likewise. (totalorderf): Likewise. (totalorderl): Likewise. (totalordermagf): Likewise. (totalordermagl): Likewise. (_Complex_I): Likewise. (I): Likewise.
* manual: Complete @standards in argp.texi.Rical Jasan2017-06-162-0/+32
| | | | | | | | | | | | | | | | | | * manual/argp.texi (ARGP_HELP_USAGE): Add missing header and standard annotation. (ARGP_HELP_SHORT_USAGE): Likewise. (ARGP_HELP_SEE): Likewise. (ARGP_HELP_LONG): Likewise. (ARGP_HELP_PRE_DOC): Likewise. (ARGP_HELP_POST_DOC): Likewise. (ARGP_HELP_DOC): Likewise. (ARGP_HELP_BUG_ADDR): Likewise. (ARGP_HELP_LONG_ONLY): Likewise. (ARGP_HELP_EXIT_ERR): Likewise. (ARGP_HELP_EXIT_OK): Likewise. (ARGP_HELP_STD_ERR): Likewise. (ARGP_HELP_STD_USAGE): Likewise. (ARGP_HELP_STD_HELP): Likewise.
* manual: Replace summary.awk with summary.pl.Rical Jasan2017-06-1541-4870/+2611
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Summary is now generated from @standards, and syntax-checking is performed. If invalid @standards syntax is detected, summary.pl will fail, reporting all errors. Failure and error reporting is disabled for now, however, since much of the manual is still incomplete wrt. header and standards annotations. Note that the sorting order of the Summary has changed; summary.pl respects the locale, like summary.awk did, but the use of LC_ALL=C is introduced in the Makefile. Other notable deviations are improved detection of the annotated elements' names, which are used for sorting, and improved detection of the @node used to reference into the manual. The most noticeable difference in the rendered Summary is that entries may now contain multiple lines, one for each header and standard combination. summary.pl accepts a `--help' option, which details the expected syntax of @standards. If errors are reported, the user is directed to this feature for further information. * manual/Makefile: Generate summary.texi with summary.pl. Force use of the C locale. Update Perl dependency comment. * manual/header.texi: Update reference to summary.awk. * manual/macros.texi: Refer authors to `summary.pl --help'. * manual/summary.awk: Remove file. * manual/summary.pl: New file. Generate summary.texi, and check for @standards-related syntax errors. * manual/argp.texi: Convert header and standards @comments to @standards. * manual/arith.texi: Likewise. * manual/charset.texi: Likewise. * manual/conf.texi: Likewise. * manual/creature.texi: Likewise. * manual/crypt.texi: Likewise. * manual/ctype.texi: Likewise. * manual/debug.texi: Likewise. * manual/errno.texi: Likewise. * manual/filesys.texi: Likewise. * manual/getopt.texi: Likewise. * manual/job.texi: Likewise. * manual/lang.texi: Likewise. * manual/llio.texi: Likewise. * manual/locale.texi: Likewise. * manual/math.texi: Likewise. * manual/memory.texi: Likewise. * manual/message.texi: Likewise. * manual/pattern.texi: Likewise. * manual/pipe.texi: Likewise. * manual/process.texi: Likewise. * manual/resource.texi: Likewise. * manual/search.texi: Likewise. * manual/setjmp.texi: Likewise. * manual/signal.texi: Likewise. * manual/socket.texi: Likewise. * manual/startup.texi: Likewise. * manual/stdio.texi: Likewise. * manual/string.texi: Likewise. * manual/sysinfo.texi: Likewise. * manual/syslog.texi: Likewise. * manual/terminal.texi: Likewise. * manual/threads.texi: Likewise. * manual/time.texi: Likewise. * manual/users.texi: Likewise.
* manual: Create empty placeholder macros for @standards.Rical Jasan2017-06-152-0/+13
| | | | | | | | | | | | | | | | | | | Header and standards annotations are slated for standardization, including being rendered in the description of functions, variables, etc. (elements), and eventually required. This commit adds @standards dummy macros so we can convert all existing annotations to the new framework while maintaining the rendered status quo. There needs to be a way to disambiguate annotations in lists of @*x elements, where a common description is shared but some elements may have different headers or standards. The @standardsx macro fills this role by accepting an additional parameter: the name of the annotated element. * manual/macros.texi (@standards): New macro. Provide placeholder for header and standards annotations. (@standardsx): New macro. Likewise, for lists of @*x elements.
* linux: Consolidate sync_file_range implementationAdhemerval Zanella2017-06-154-2/+7
| | | | | | | | | | | | | | | This patch consolidates Linux sync_file_range at default sysdeps/unix/sysv/linux/sync_file_range.c implementation. It also moves the rules flags from generic io/Makefile to Linux one due the fact it is a Linux-only symbol. Checked on i686-linux-gnu and x86_64-linux-gnu. * io/Makefile (CFLAGS-sync_file_range.c): Remove rule. * sysdeps/unix/sysv/linux/Makefile (CFLAGS-sync_file_range.c): New rule. * sysdeps/unix/sysv/linux/wordsize-64/syscalls.list: Remove sync_file_range.
* support: Add optstring supportAdhemerval Zanella2017-06-154-1/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds an option to test to add small command line option through CMDLINE_OPTSTRING define. For instance: #define CMDLINE_OPTSTRING "vd" static void cmdline_process_function (int c) { switch (c): 'v': /* process '-v' option. */ break; 'd': /* process '-d' option. */ break; } #define CMDLINE_PROCESS cmdline_process_function It will add both '-v' and '-d' along with already default long options. * support/support_test_main.c (support_test_main): Use optstring member for option string in getopt_long. * support/test-driver.c: Add comment about CMDLINE_OPTSTRING. (CMDLINE_OPTSTRING): New define. * support/test-driver.h (test_config): Add optstring member.
* x86-64: Implement strcspn/strpbrk/strspn IFUNC selectors in CH.J. Lu2017-06-1514-115/+233
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement strcspn/strpbrk/strspn IFUNC selectors in C All internal calls within libc.so can use IFUNC on x86-64 since unlike x86, x86-64 supports PC-relative addressing to access the GOT entry so that it can call via PLT without using an extra register. For libc.a, we can't use IFUNC for functions which are called before IFUNC has been initialized. Use IFUNC internally reduces the icache footprint since libc.so and other codes in the process use the same implementations. This patch uses IFUNC for strcspn/strpbrk/strspn functions within libc. * sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Add strcspn-sse2, strpbrk-sse2 and strspn-sse2. * sysdeps/x86_64/strcspn.S (STRPBRK_P): Removed. Check USE_AS_STRPBRK instead of STRPBRK_P. * sysdeps/x86_64/strpbrk.S (USE_AS_STRPBRK): New. * sysdeps/x86_64/multiarch/ifunc-sse4_2.h: New file. * sysdeps/x86_64/multiarch/strcspn-sse2.S: Likewise. * sysdeps/x86_64/multiarch/strcspn.c: Likewise. * sysdeps/x86_64/multiarch/strpbrk-sse2.S: Likewise. * sysdeps/x86_64/multiarch/strpbrk.c: Likewise. * sysdeps/x86_64/multiarch/strspn-sse2.S: Likewise. * sysdeps/x86_64/multiarch/strspn.c: Likewise. * sysdeps/x86_64/multiarch/strcspn.S: Removed. * sysdeps/x86_64/multiarch/strpbrk.S: Likewise. * sysdeps/x86_64/multiarch/strspn.S: Likewise. * sysdeps/x86_64/multiarch/strpbrk-c.c: Remove "#ifdef SHARED" and "#endif".
* x86-64: Implement wcscpy IFUNC selector in CH.J. Lu2017-06-152-17/+26
| | | | | * sysdeps/x86_64/multiarch/wcscpy.S: Removed. * sysdeps/x86_64/multiarch/wcscpy.c: New file.
* x86-64: Implement strcat family IFUNC selectors in CH.J. Lu2017-06-157-90/+105
| | | | | | | | | | | | | | | | | | | | Implement strcat family IFUNC selectors in C. All internal calls within libc.so can use IFUNC on x86-64 since unlike x86, x86-64 supports PC-relative addressing to access the GOT entry so that it can call via PLT without using an extra register. For libc.a, we can't use IFUNC for functions which are called before IFUNC has been initialized. Use IFUNC internally reduces the icache footprint since libc.so and other codes in the process use the same implementations. This patch uses IFUNC for strcat family functions within libc. * sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Add strcat-sse2. * sysdeps/x86_64/multiarch/strcat-sse2.S: New file. * sysdeps/x86_64/multiarch/strcat.c: Likewise. * sysdeps/x86_64/multiarch/strncat.c: Likewise. * sysdeps/x86_64/multiarch/strcat.S: Removed. * sysdeps/x86_64/multiarch/strncat.S: Likewise.
* x86-64: Implement memcmp family IFUNC selectors in CH.J. Lu2017-06-158-113/+138
| | | | | | | | | | | | | | | | | | | | | Implement memcmp family IFUNC selectors in C. All internal calls within libc.so can use IFUNC on x86-64 since unlike x86, x86-64 supports PC-relative addressing to access the GOT entry so that it can call via PLT without using an extra register. For libc.a, we can't use IFUNC for functions which are called before IFUNC has been initialized. Use IFUNC internally reduces the icache footprint since libc.so and other codes in the process use the same implementations. This patch uses IFUNC for memcmp family functions within libc. * sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Add memcmp-sse2. * sysdeps/x86_64/multiarch/ifunc-memcmp.h: New file. * sysdeps/x86_64/multiarch/memcmp-sse2.S: Likewise. * sysdeps/x86_64/multiarch/memcmp.c: Likewise. * sysdeps/x86_64/multiarch/wmemcmp.c: Likewise. * sysdeps/x86_64/multiarch/memcmp.S: Removed. * sysdeps/x86_64/multiarch/wmemcmp.S: Likewise.
* x86-64: Implement memset family IFUNC selectors in CH.J. Lu2017-06-1513-147/+236
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement memset family IFUNC selectors in C. All internal calls within libc.so can use IFUNC on x86-64 since unlike x86, x86-64 supports PC-relative addressing to access the GOT entry so that it can call via PLT without using an extra register. For libc.a, we can't use IFUNC for functions which are called before IFUNC has been initialized. Use IFUNC internally reduces the icache footprint since libc.so and other codes in the process use the same implementations. This patch uses IFUNC for memset functions within libc. 2017-06-07 H.J. Lu <hongjiu.lu@intel.com> Erich Elsen <eriche@google.com> * sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Add memset-sse2-unaligned-erms, and memset_chk-nonshared. * sysdeps/x86_64/multiarch/ifunc-impl-list.c (__libc_ifunc_impl_list): Add test for __memset_chk_erms. Update comments. * sysdeps/x86_64/multiarch/ifunc-memset.h: New file. * sysdeps/x86_64/multiarch/memset-sse2-unaligned-erms.S: Likewise. * sysdeps/x86_64/multiarch/memset.c: Likewise. * sysdeps/x86_64/multiarch/memset_chk-nonshared.S: Likewise. * sysdeps/x86_64/multiarch/memset_chk.c: Likewise. * sysdeps/x86_64/multiarch/memset.S: Removed. * sysdeps/x86_64/multiarch/memset_chk.S: Likewise. * sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S (__memset_chk_erms): New function.
* Enable tunables by defaultSiddhesh Poyarekar2017-06-156-19/+27
| | | | | | | | | | | | | | | | | | | | All of the major architectures are adopting tunables as a way to add tuning to the library, from hwcap_mask for aarch64 to HLE for s390 and ifunc and cache geometry for x86. Given this adoption and the fact that we don't want additional tuning knobs to be added outside of tunables, it makes sense to enable tunables by default using this trivial patch. Smoke tested on x86 to ensure that tunables code was built without specifying it as a configure flag. I have kept it as --enabled and not changed it to --disable since we want to still keep the option of different kinds of front-ends for tunables. * configure.ac(--enable-tunables): Enable by default. * configure: Regenerate. * NEWS: Mention change. * manual/install.texi (enable-tunables): Adjust documentation. * INSTALL: Regenerate.
* nptl: Invert the mmap/mprotect logic on allocated stacks (BZ#18988)Adhemerval Zanella2017-06-148-9/+175
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Current allocate_stack logic for create stacks is to first mmap all the required memory with the desirable memory and then mprotect the guard area with PROT_NONE if required. Although it works as expected, it pessimizes the allocation because it requires the kernel to actually increase commit charge (it counts against the available physical/swap memory available for the system). The only issue is to actually check this change since side-effects are really Linux specific and to actually account them it would require a kernel specific tests to parse the system wide information. On the kernel I checked /proc/self/statm does not show any meaningful difference for vmm and/or rss before and after thread creation. I could only see really meaningful information checking on system wide /proc/meminfo between thread creation: MemFree, MemAvailable, and Committed_AS shows large difference without the patch. I think trying to use these kind of information on a testcase is fragile. The BZ#18988 reports shows that the commit pages are easily seen with mlockall (MCL_FUTURE) (with lock all pages that become mapped in the process) however a more straighfoward testcase shows that pthread_create could be faster using this patch: -- static const int inner_count = 256; static const int outer_count = 128; static void *thread1(void *arg) { return NULL; } static void *sleeper(void *arg) { pthread_t ts[inner_count]; for (int i = 0; i < inner_count; i++) pthread_create (&ts[i], &a, thread1, NULL); for (int i = 0; i < inner_count; i++) pthread_join (ts[i], NULL); return NULL; } int main(void) { pthread_attr_init(&a); pthread_attr_setguardsize(&a, 1<<20); pthread_attr_setstacksize(&a, 1134592); pthread_t ts[outer_count]; for (int i = 0; i < outer_count; i++) pthread_create(&ts[i], &a, sleeper, NULL); for (int i = 0; i < outer_count; i++) pthread_join(ts[i], NULL); assert(r == 0); } return 0; } -- On x86_64 (4.4.0-45-generic, gcc 5.4.0) running the small benchtests I see: $ time ./test real 0m3.647s user 0m0.080s sys 0m11.836s While with the patch I see: $ time ./test real 0m0.696s user 0m0.040s sys 0m1.152s So I added a pthread_create benchtest (thread_create) which check the thread creation latency. As for the simple benchtests, I saw improvements in thread creation on all architectures I tested the change. Checked on x86_64-linux-gnu, i686-linux-gnu, aarch64-linux-gnu, arm-linux-gnueabihf, powerpc64le-linux-gnu, sparc64-linux-gnu, and sparcv9-linux-gnu. [BZ #18988] * benchtests/thread_create-inputs: New file. * benchtests/thread_create-source.c: Likewise. * support/xpthread_attr_setguardsize.c: Likewise. * support/Makefile (libsupport-routines): Add xpthread_attr_setguardsize object. * support/xthread.h: Add xpthread_attr_setguardsize prototype. * benchtests/Makefile (bench-pthread): Add thread_create. * nptl/allocatestack.c (allocate_stack): Call mmap with PROT_NONE and then mprotect the required area.
* x86-64: Implement memmove family IFUNC selectors in CH.J. Lu2017-06-1421-474/+450
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement memmove family IFUNC selectors in C. All internal calls within libc.so can use IFUNC on x86-64 since unlike x86, x86-64 supports PC-relative addressing to access the GOT entry so that it can call via PLT without using an extra register. For libc.a, we can't use IFUNC for functions which are called before IFUNC has been initialized. Use IFUNC internally reduces the icache footprint since libc.so and other codes in the process use the same implementations. This patch uses IFUNC for memmove family functions within libc. * sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Add memmove-sse2-unaligned-erms, memcpy_chk-nonshared, mempcpy_chk-nonshared and memmove_chk-nonshared. * sysdeps/x86_64/multiarch/ifunc-impl-list.c (__libc_ifunc_impl_list): Add tests for __memmove_chk_erms, __memcpy_chk_erms and __mempcpy_chk_erms. Update comments. * sysdeps/x86_64/multiarch/ifunc-memmove.h: New file. * sysdeps/x86_64/multiarch/memcpy.c: Likewise. * sysdeps/x86_64/multiarch/memcpy_chk-nonshared.S: Likewise. * sysdeps/x86_64/multiarch/memcpy_chk.c: Likewise. * sysdeps/x86_64/multiarch/memmove-sse2-unaligned-erms.S: Likewise. * sysdeps/x86_64/multiarch/memmove.c: Likewise. * sysdeps/x86_64/multiarch/memmove_chk-nonshared.S: Likewise. * sysdeps/x86_64/multiarch/memmove_chk.c: Likewise. * sysdeps/x86_64/multiarch/mempcpy.c: Likewise. * sysdeps/x86_64/multiarch/mempcpy_chk-nonshared.S: Likewise. * sysdeps/x86_64/multiarch/mempcpy_chk.c: Likewise. * sysdeps/x86_64/multiarch/memcpy.S: Removed. * sysdeps/x86_64/multiarch/memcpy_chk.S: Likewise. * sysdeps/x86_64/multiarch/memmove.S: Likewise. * sysdeps/x86_64/multiarch/memmove_chk.S: Likewise. * sysdeps/x86_64/multiarch/mempcpy.S: Likewise. * sysdeps/x86_64/multiarch/mempcpy_chk.S: Likewise. * sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S (__mempcpy_chk_erms): New function. (__memmove_chk_erms): Likewise. (__memcpy_chk_erms): New alias.
* i686: Add missing IS_IN (libc) guards to vectorized strcspnFlorian Weimer2017-06-143-3/+12
| | | | | | | | | Since commit d957c4d3fa48d685ff2726c605c988127ef99395 (i386: Compile rtld-*.os with -mno-sse -mno-mmx -mfpmath=387), vector intrinsics can no longer be used in ld.so, even if the compiled code never makes it into the final ld.so link. This commit adds the missing IS_IN (libc) guard to the SSE 4.2 strcspn implementation, so that it can be used from ld.so in the future.
* Remove __need macros from errno.h (__need_Emath, __need_error_t).Zack Weinberg2017-06-1420-601/+713
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is fairly complicated, not because the users of __need_Emath and __need_error_t have complicated requirements, but because the core changes had a lot of fallout. __need_error_t exists for gnulib compatibility in argz.h and argp.h. error_t itself is a Hurdism, an enum containing all the E-constants, so you can do 'p (error_t) errno' in gdb and get a symbolic value. argz.h and argp.h use it for function return values, and they want to fall back to 'int' when that's not available. There is no reason why these nonstandard headers cannot just go ahead and include all of errno.h; so we do that. __need_Emath is defined only by .S files; what they _really_ need is for errno.h to avoid declaring anything other than the E-constants (e.g. 'extern int __errno_location(void);' is a syntax error in assembly language). This is replaced with a check for __ASSEMBLER__ in errno.h, plus a carefully documented requirement for bits/errno.h not to define anything other than macros. That in turn has the consequence that bits/errno.h must not define errno - fortunately, all live ports use the same definition of errno, so I've moved it to errno.h. The Hurd bits/errno.h must also take care not to define error_t when __ASSEMBLER__ is defined, which involves repeating all of the definitions twice, but it's a generated file so that's okay. * stdlib/errno.h: Remove __need_Emath and __need_error_t logic. Reorganize file. Declare errno here. When __ASSEMBLER__ is defined, don't declare anything other than the E-constants. * include/errno.h: Change conditional for exposing internal declarations to (not _ISOMAC and not __ASSEMBLER__). * bits/errno.h: Remove logic for __need_Emath. Document requirements for a port-specific bits/errno.h. * sysdeps/unix/sysv/linux/bits/errno.h * sysdeps/unix/sysv/linux/alpha/bits/errno.h * sysdeps/unix/sysv/linux/hppa/bits/errno.h * sysdeps/unix/sysv/linux/mips/bits/errno.h * sysdeps/unix/sysv/linux/sparc/bits/errno.h: Add multiple-include guard and check against improper inclusion. Remove __need_Emath logic. Don't declare errno here. Ensure all constants are defined as simple integer literals. Consistent formatting. * sysdeps/mach/hurd/errnos.awk: Likewise. Only define error_t and enum __error_t_codes if __ASSEMBLER__ is not defined. * sysdeps/mach/hurd/bits/errno.h: Regenerate. * argp/argp.h, string/argz.h: Don't define __need_error_t before including errno.h. * sysdeps/i386/i686/fpu/multiarch/s_cosf-sse2.S * sysdeps/i386/i686/fpu/multiarch/s_sincosf-sse2.S * sysdeps/i386/i686/fpu/multiarch/s_sinf-sse2.S * sysdeps/x86_64/fpu/s_cosf.S * sysdeps/x86_64/fpu/s_sincosf.S * sysdeps/x86_64/fpu/s_sinf.S: Just include errno.h; don't define __need_Emath or include bits/errno.h directly.
* Remove __need_IOV_MAX and __need_FOPEN_MAX.Zack Weinberg2017-06-1411-103/+164
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | __need_FOPEN_MAX wasn't being used anywhere. __need_IOV_MAX was more complicated; the basic deal is that sys/uio.h wants to define a constant named UIO_MAXIOV and bits/xopen_lim.h wants to define a constant named IOV_MAX, with the same meaning. For no apparent reason this was being handled via bits/stdio_lim.h -- stdio.h is NOT supposed to define IOV_MAX -- and some mess in Makerules. Also, bits/uio.h on Linux was being used as a dumping ground for extension functions. So now we have bits/uio_lim.h, which defines __IOV_MAX. bits/xopen_lim.h and sys/uio.h use that to define their respective constants. We also now have bits/uio-ext.h, which is the official Proper Home for extensions to sys/uio.h. bits/uio.h is removed, and stdio_lim.h doesn't define IOV_MAX at all. * bits/uio_lim.h, sysdeps/unix/sysv/linux/bits/uio_lim.h * bits/uio-ext.h, sysdeps/unix/sysv/linux/bits/uio-ext.h: New file. * bits/uio.h, sysdeps/unix/sysv/linux/bits/uio.h: Delete file. * include/bits/xopen_lim.h: Use bits/uio_lim.h to get the value for IOV_MAX. * misc/Makefile: Install bits/uio-ext.h and bits/uio_lim.h. Don't install bits/uio.h. * misc/sys/uio.h: Don't include bits/uio.h. Do include bits/types/struct_iovec.h and bits/uio_lim.h. Set UIO_MAXIOV based on __IOV_MAX. Under __USE_GNU, also include bits/uio-ext.h. * stdio-common/stdio_lim.h.in: Remove logic for __need_FOPEN_MAX and __need_IOV_MAX. Don't define IOV_MAX at all. * Makerules (stdio_lim.h): Remove logic for setting IOV_MAX. * sysdeps/unix/sysv/linux/bits/fcntl-linux.h: Include bits/types/struct_iovec.h, not bits/uio.h. Use __ssize_t, not ssize_t, in function prototypes. Don't use hard TAB for double space after period in comments.
* PowerPC64 ELFv2 PPC64_OPT_LOCALENTRYAlan Modra2017-06-1425-37/+124
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ELFv2 functions with localentry:0 are those with a single entry point, ie. global entry == local entry, that have no requirement on r2 or r12 and guarantee r2 is unchanged on return. Such an external function can be called via the PLT without saving r2 or restoring it on return, avoiding a common load-hit-store for small functions. This patch implements the ld.so changes necessary for this optimization. ld.so needs to check that an optimized plt call sequence is in fact calling a function implemented with localentry:0, end emit a fatal error otherwise. The elf/testobj6.c change is to stop "error while loading shared libraries: expected localentry:0 `preload'" when running elf/preloadtest, which we'd get otherwise. * elf/elf.h (PPC64_OPT_LOCALENTRY): Define. * sysdeps/alpha/dl-machine.h (elf_machine_fixup_plt): Add refsym and sym parameters. Adjust callers. * sysdeps/aarch64/dl-machine.h (elf_machine_fixup_plt): Likewise. * sysdeps/arm/dl-machine.h (elf_machine_fixup_plt): Likewise. * sysdeps/generic/dl-machine.h (elf_machine_fixup_plt): Likewise. * sysdeps/hppa/dl-machine.h (elf_machine_fixup_plt): Likewise. * sysdeps/i386/dl-machine.h (elf_machine_fixup_plt): Likewise. * sysdeps/ia64/dl-machine.h (elf_machine_fixup_plt): Likewise. * sysdeps/m68k/dl-machine.h (elf_machine_fixup_plt): Likewise. * sysdeps/microblaze/dl-machine.h (elf_machine_fixup_plt): Likewise. * sysdeps/mips/dl-machine.h (elf_machine_fixup_plt): Likewise. * sysdeps/nios2/dl-machine.h (elf_machine_fixup_plt): Likewise. * sysdeps/powerpc/powerpc32/dl-machine.h (elf_machine_fixup_plt): Likewise. * sysdeps/s390/s390-32/dl-machine.h (elf_machine_fixup_plt): Likewise. * sysdeps/s390/s390-64/dl-machine.h (elf_machine_fixup_plt): Likewise. * sysdeps/sh/dl-machine.h (elf_machine_fixup_plt): Likewise. * sysdeps/sparc/sparc32/dl-machine.h (elf_machine_fixup_plt): Likewise. * sysdeps/sparc/sparc64/dl-machine.h (elf_machine_fixup_plt): Likewise. * sysdeps/tile/dl-machine.h (elf_machine_fixup_plt): Likewise. * sysdeps/x86_64/dl-machine.h (elf_machine_fixup_plt): Likewise. * sysdeps/powerpc/powerpc64/dl-machine.c (_dl_error_localentry): New. (_dl_reloc_overflow): Increase buffser size. Formatting. * sysdeps/powerpc/powerpc64/dl-machine.h (ppc64_local_entry_offset): Delete reloc param, add refsym and sym. Check optimized plt call stubs for localentry:0 functions. Adjust callers. (elf_machine_fixup_plt, elf_machine_plt_conflict): Add refsym and sym parameters. Adjust callers. (_dl_reloc_overflow): Move attribute. (_dl_error_localentry): Declare. * elf/dl-runtime.c (_dl_fixup): Save original sym. Pass refsym and sym to elf_machine_fixup_plt. * elf/testobj6.c (preload): Call printf.
* PowerPC64 ENTRY_TOCLESSAlan Modra2017-06-14103-138/+286
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A number of functions in the sysdeps/powerpc/powerpc64/ tree don't use or change r2, yet declare a global entry that sets up r2. This patch fixes that problem, and consolidates the ENTRY and EALIGN macros. * sysdeps/powerpc/powerpc64/sysdep.h: Formatting. (NOPS, ENTRY_3): New macros. (ENTRY): Rewrite. (ENTRY_TOCLESS): Define. (EALIGN, EALIGN_W_0, EALIGN_W_1, EALIGN_W_2, EALIGN_W_4, EALIGN_W_5, EALIGN_W_6, EALIGN_W_7, EALIGN_W_8): Delete. * sysdeps/powerpc/powerpc64/a2/memcpy.S: Replace EALIGN with ENTRY. * sysdeps/powerpc/powerpc64/dl-trampoline.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_ceil.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_ceilf.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_floor.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_floorf.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_rint.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_rintf.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_round.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_roundf.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_trunc.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_truncf.S: Likewise. * sysdeps/powerpc/powerpc64/memset.S: Likewise. * sysdeps/powerpc/powerpc64/power7/fpu/s_finite.S: Likewise. * sysdeps/powerpc/powerpc64/power7/fpu/s_isinf.S: Likewise. * sysdeps/powerpc/powerpc64/power7/fpu/s_isnan.S: Likewise. * sysdeps/powerpc/powerpc64/power7/strstr.S: Likewise. * sysdeps/powerpc/powerpc64/power8/fpu/e_expf.S: Likewise. * sysdeps/powerpc/powerpc64/power8/fpu/s_cosf.S: Likewise. * sysdeps/powerpc/powerpc64/power8/fpu/s_sinf.S: Likewise. * sysdeps/powerpc/powerpc64/power8/strcasestr.S: Likewise. * sysdeps/powerpc/powerpc64/addmul_1.S: Use ENTRY_TOCLESS. * sysdeps/powerpc/powerpc64/cell/memcpy.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_copysign.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_copysignl.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_fabsl.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_isnan.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_llrint.S: Likewise. * sysdeps/powerpc/powerpc64/fpu/s_llrintf.S: Likewise. * sysdeps/powerpc/powerpc64/lshift.S: Likewise. * sysdeps/powerpc/powerpc64/memcpy.S: Likewise. * sysdeps/powerpc/powerpc64/mul_1.S: Likewise. * sysdeps/powerpc/powerpc64/power4/memcmp.S: Likewise. * sysdeps/powerpc/powerpc64/power4/memcpy.S: Likewise. * sysdeps/powerpc/powerpc64/power4/memset.S: Likewise. * sysdeps/powerpc/powerpc64/power4/strncmp.S: Likewise. * sysdeps/powerpc/powerpc64/power5+/fpu/s_ceil.S: Likewise. * sysdeps/powerpc/powerpc64/power5+/fpu/s_ceilf.S: Likewise. * sysdeps/powerpc/powerpc64/power5+/fpu/s_floor.S: Likewise. * sysdeps/powerpc/powerpc64/power5+/fpu/s_floorf.S: Likewise. * sysdeps/powerpc/powerpc64/power5+/fpu/s_llround.S: Likewise. * sysdeps/powerpc/powerpc64/power5+/fpu/s_round.S: Likewise. * sysdeps/powerpc/powerpc64/power5+/fpu/s_roundf.S: Likewise. * sysdeps/powerpc/powerpc64/power5+/fpu/s_trunc.S: Likewise. * sysdeps/powerpc/powerpc64/power5+/fpu/s_truncf.S: Likewise. * sysdeps/powerpc/powerpc64/power5/fpu/s_isnan.S: Likewise. * sysdeps/powerpc/powerpc64/power6/fpu/s_copysign.S: Likewise. * sysdeps/powerpc/powerpc64/power6/fpu/s_isnan.S: Likewise. * sysdeps/powerpc/powerpc64/power6/memcpy.S: Likewise. * sysdeps/powerpc/powerpc64/power6/memset.S: Likewise. * sysdeps/powerpc/powerpc64/power6x/fpu/s_isnan.S: Likewise. * sysdeps/powerpc/powerpc64/power6x/fpu/s_llrint.S: Likewise. * sysdeps/powerpc/powerpc64/power6x/fpu/s_llround.S: Likewise. * sysdeps/powerpc/powerpc64/power7/add_n.S: Likewise. * sysdeps/powerpc/powerpc64/power7/memchr.S: Likewise. * sysdeps/powerpc/powerpc64/power7/memcmp.S: Likewise. * sysdeps/powerpc/powerpc64/power7/memcpy.S: Likewise. * sysdeps/powerpc/powerpc64/power7/memmove.S: Likewise. * sysdeps/powerpc/powerpc64/power7/mempcpy.S: Likewise. * sysdeps/powerpc/powerpc64/power7/memrchr.S: Likewise. * sysdeps/powerpc/powerpc64/power7/memset.S: Likewise. * sysdeps/powerpc/powerpc64/power7/rawmemchr.S: Likewise. * sysdeps/powerpc/powerpc64/power7/strcasecmp.S (strcasecmp_l): Likewise. * sysdeps/powerpc/powerpc64/power7/strchr.S: Likewise. * sysdeps/powerpc/powerpc64/power7/strchrnul.S: Likewise. * sysdeps/powerpc/powerpc64/power7/strcmp.S: Likewise. * sysdeps/powerpc/powerpc64/power7/strlen.S: Likewise. * sysdeps/powerpc/powerpc64/power7/strncmp.S: Likewise. * sysdeps/powerpc/powerpc64/power7/strncpy.S: Likewise. * sysdeps/powerpc/powerpc64/power7/strnlen.S: Likewise. * sysdeps/powerpc/powerpc64/power7/strrchr.S: Likewise. * sysdeps/powerpc/powerpc64/power8/fpu/s_finite.S: Likewise. * sysdeps/powerpc/powerpc64/power8/fpu/s_isinf.S: Likewise. * sysdeps/powerpc/powerpc64/power8/fpu/s_isnan.S: Likewise. * sysdeps/powerpc/powerpc64/power8/fpu/s_llrint.S: Likewise. * sysdeps/powerpc/powerpc64/power8/fpu/s_llround.S: Likewise. * sysdeps/powerpc/powerpc64/power8/memcmp.S: Likewise. * sysdeps/powerpc/powerpc64/power8/memset.S: Likewise. * sysdeps/powerpc/powerpc64/power8/strchr.S: Likewise. * sysdeps/powerpc/powerpc64/power8/strcmp.S: Likewise. * sysdeps/powerpc/powerpc64/power8/strcpy.S: Likewise. * sysdeps/powerpc/powerpc64/power8/strlen.S: Likewise. * sysdeps/powerpc/powerpc64/power8/strncmp.S: Likewise. * sysdeps/powerpc/powerpc64/power8/strncpy.S: Likewise. * sysdeps/powerpc/powerpc64/power8/strnlen.S: Likewise. * sysdeps/powerpc/powerpc64/power8/strrchr.S: Likewise. * sysdeps/powerpc/powerpc64/power8/strspn.S: Likewise. * sysdeps/powerpc/powerpc64/power9/strcmp.S: Likewise. * sysdeps/powerpc/powerpc64/power9/strncmp.S: Likewise. * sysdeps/powerpc/powerpc64/strchr.S: Likewise. * sysdeps/powerpc/powerpc64/strcmp.S: Likewise. * sysdeps/powerpc/powerpc64/strlen.S: Likewise. * sysdeps/powerpc/powerpc64/strncmp.S: Likewise. * sysdeps/powerpc/powerpc64/ppc-mcount.S: Store LR earlier. Don't add nop when SHARED. * sysdeps/powerpc/powerpc64/start.S: Fix comment. * sysdeps/powerpc/powerpc64/multiarch/strrchr-power8.S (ENTRY): Don't define. (ENTRY_TOCLESS): Define. * sysdeps/powerpc/powerpc32/sysdep.h (ENTRY_TOCLESS): Define. * sysdeps/powerpc/fpu/s_fma.S: Use ENTRY_TOCLESS. * sysdeps/powerpc/fpu/s_fmaf.S: Likewise.
* PowerPC64 strncpy, stpncpy and strstr fixesAlan Modra2017-06-149-0/+56
| | | | | | | | | | | | | | | | | | | | | Makes __stpncpy_power8 call __memset_power8 directly rather than via an IFUNC. Fixes a missing _mcount, and removes some redundant NOPS. The *_is_local defines are also used in a followup patch. * sysdeps/powerpc/powerpc64/multiarch/strncpy-power7.S: Define MEMSET_is_local. * sysdeps/powerpc/powerpc64/multiarch/strncpy-power8.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/stpncpy-power7.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/stpncpy-power8.S: Likewise. Define MEMSET. * sysdeps/powerpc/powerpc64/multiarch/strstr-power7.S: Define STRLEN_is_local, STRNLEN_is_local, and STRCHR_is_local. * sysdeps/powerpc/powerpc64/power7/strstr.S: Likewise. Don't add nop after local calls. * sysdeps/powerpc/powerpc64/power7/strncpy.S: Define MEMSET_is_local. Don't add nop after local call. * sysdeps/powerpc/powerpc64/power8/strncpy.S: Likewise. Add missing CALL_MCOUNT.
* PowerPC64 sysdep.h tidyAlan Modra2017-06-143-59/+74
| | | | | | | | | | | | | | | | | | | | | | .align on some targets takes a byte alignment, on others like powerpc, log2 of the byte alignment. It's a good idea to avoid .align, particularly since x86 and powerpc are different. This patch fixes the occurrences of .align in powerpc64/sysdep.h, renames DOT_LABEL since the macro doesn't have anything to do with adding dots, removes extraneous semicolons, and fixes some formatting. * sysdeps/powerpc/powerpc64/sysdep.h: Formatting. (FUNC_LABEL): Rename from DOT_LABEL. (ENTRY_1): Use FUNC_LABEL and remove leading space from label. Use .p2align rather than .align. (TRACEBACK, TRACEBACK_MASK): Use .p2align rather than .align. (ABORT_TRANSACTION): Likewise. (ENTRY_1, ENTRY_2, END_2, LOCALENTRY): Remove unnecessary semicolons, particularly at end. Add semicolon at invocation as necessary. (TRACEBACK, TRACEBACK_MASK, PSEUDO, PSEUDO_NOERRNO): Likewise. (PSEUDO_ERRVAL, PPC64_LOAD_FUNCPTR, OPD_ENT): Likewise. * sysdeps/powerpc/powerpc64/multiarch/strrchr-power8.S (ENTRY, END): Adjust to suit.
* PowerPC64 FRAME_PARM_SAVEAlan Modra2017-06-143-37/+26
| | | | | | | | | | | | | I think FRAME_PARM[1-9]_SAVE confuse the code, particularly FRAME_PARM9_SAVE. There are only 8 parameter save slots! * sysdeps/powerpc/powerpc64/sysdep.h: (FRAME_BACKCHAIN, FRAME_CR_SAVE, FRAME_LR_SAVE): Move out of conditional. (FRAME_PARM1_SAVE, FRAME_PARM2_SAVE, FRAME_PARM3_SAVE, FRAME_PARM4_SAVE, FRAME_PARM5_SAVE, FRAME_PARM6_SAVE, FRAME_PARM7_SAVE, FRAME_PARM8_SAVE, FRAME_PARM9_SAVE): Delete. * sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S: Replace uses of FRAME_PARM[1-9]_SAVE with FRAME_PARM_SAVE plus offset.
* PowerPC64, fix calls to _mcountAlan Modra2017-06-142-8/+8
| | | | | | | The macros used in assembly were broken on powerpc64 ELFv1. * sysdeps/powerpc/powerpc64/sysdep.h: (call_mcount_parm_offset): Delete. (SAVE_ARG, REST_ARG, CFI_SAVE_ARG): Correct.
* mips: Fix store/load gp registers to/from ucontext_tGordana Cmiljanovic2017-06-137-81/+194
| | | | | | | | | | | | | | | | | | | | | | | | | | General purpose registers in mcontext_t structure are 8 bytes long for both MIPS32/MIPS64. get/set/make/swap context implementations for MIPS O32 incorrectly assume that general purpose registers in this structure are 4 bytes long. This patch is fixing that. Tested for MIPS O32 LE and BE. Compared objdump of modified functions for mips n32 and mips n64. [BZ #21548] * sysdeps/unix/sysv/linux/mips/getcontext.S: Define MCONTEXT_SZGREG as 8 and use it when copying general purpose registers. * sysdeps/unix/sysv/linux/mips/makecontext.S: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/Makefile: Include new test for mips o32. * sysdeps/unix/sysv/linux/mips/mips32/bug-getcontext-mips-gp.c: Added new test for mips o32. * sysdeps/unix/sysv/linux/mips/setcontext.S: Define MCONTEXT_SZGREG as 8 and use it when copying general purpose registers. * sysdeps/unix/sysv/linux/mips/swapcontext.S: Likewise.
* configure: Suppress expected compiler error messageFlorian Weimer2017-06-133-2/+8
|
* dynarray: Implement begin/end functions in the spirit of C++Florian Weimer2017-06-134-0/+63
|
* Make copy of <bits/std_abs.h> from GCC 7 [BZ #21573]H.J. Lu2017-06-135-2/+29
| | | | | | | | | | | | | | | | | | <bits/std_abs.h> from GCC 7 will include /usr/include/stdlib.h from "#include_next" (instead of stdlib/stdlib.h in the glibc source directory), and this turns up as a make dependency. Also make a copy of <bits/std_abs.h> to prevent it from including /usr/include/stdlib.h. [BZ #21573] * Makerules [$(c++-bits-std_abs-h) != ""] (before-compile): Add $(common-objpfx)bits/std_abs.h. [$(c++-bits-std_abs-h) != ""] ($(common-objpfx)bits/std_abs.h): New target. * config.make.in (c++-bits-std_abs-h): New. * configure.ac (find_cxx_header): Use "\,$1," with sed. (CXX_BITS_STD_ABS_H): New. (AC_SUBST(CXX_BITS_STD_ABS_H)): Likewise. * configure: Regenerated.
* localedata: ce_RU: update weekdays from CLDR [BZ #21207]Rafal Luzynski2017-06-132-14/+23
| | | | | | | | | [BZ #21207] * locales/ce_RU (day): Updated (imported) from CLDR. Uppercase letters left unchanged. * locales/ce_RU (abday): Minor updates to match (day): Latin uppercase "I" replaced with Cyrillic "Ӏ" ("Palochka", Unicode: U04C0). Trailing spaces removed.
* localedata: Remove trailing spaces [BZ #20275]Rafal Luzynski2017-06-1322-210/+242
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Many locales have strings that end with an unnecessary trailing space. Remove them. Also corrects some notational errors in passing. * localedata/locales/mag_IN (abday, day): Consistently use uppercase hexadecimal in <Uxxxx> notation. * localedata/locales/so_DJ (mon): Use "<U0020>" instead of " ". * localedata/locales/so_ET (mon): Likewise. * localedata/locales/so_KE (mon): Likewise. * localedata/locales/so_SO (mon): Likewise. [BZ #20275] * localedata/locales/anp_IN (abday, day): Remove trailing spaces. * localedata/locales/bho_IN (abday, day): Likewise. * localedata/locales/doi_IN (abday, day): Likewise. * localedata/locales/hi_IN (day, abday): Likewise. * localedata/locales/hne_IN (abday, day): Likewise. * localedata/locales/mag_IN (abday, day): Likewise. * localedata/locales/ne_NP (abday, day): Likewise. * localedata/locales/pa_IN (abday, day): Likewise. * localedata/locales/raj_IN (abday, day): Likewise. * localedata/locales/the_NP (abday, day): Likewise. * localedata/locales/sq_AL (abday, day): Likewise. * localedata/locales/ln_CD (name_ms): Likewise. * localedata/locales/quz_PE (lang_name): Likewise. * localedata/locales/ta_IN (name_mr, name_mrs, name_miss): Likewise. * localedata/locales/te_IN (name_mr, name_mrs, name_miss): Likewise. * localedata/locales/ht_HT (abday, day): Remove trailing space after "len" and "lendi". * localedata/locales/mt_MT (mon): Remove trailing space after "Diċembru".
* Correct indentation in posix/bits/cpu-set.h.Zack Weinberg2017-06-132-22/+27
| | | | | * posix/bits/cpu-set.h: Correct indentation of preprocessor directives.
* Remove __need_schedparam and __cpu_set_t_defined.Zack Weinberg2017-06-127-243/+163
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bits/sched.h has logic to expose only an impl-namespace variant of struct sched_param (i.e. struct __sched_param), but nothing uses it, and the only header that includes bits/sched.h is sched.h. The __need_schedparam logic can therefore be removed. bits/sched.h also has a great deal of code relating to cpu_set_t objects that was *almost* the same between the two versions of bits/sched.h in the tree; a little spelunking indicated that this is because some bug fixes got applied to the Linux-specific bits/sched.h but not the generic one. Introduce a new header, bits/cpu-set.h, containing the version of that code with the bugfixes, have sched.h include it directly, and delete all of the code from both versions of bits/sched.h. Also remove the unnecessary name mangling in the definition of struct sched_param -- POSIX specifies a field 'sched_priority', so there is no reason to define it as '__sched_priority' and then paper over that with a macro. (Just in case someone was using the internal name, 'sched_priority' remains a macro defined to expand to itself, and '__sched_priority' now expands to 'sched_priority'.) Finally, as long as I'm touching these files anyway, merge new constants from linux/sched.h into the Linux bits/sched.h. * bits/sched.h: Remove __need_schedparam logic and replace with a normal multiple-include guard. Change field name in struct sched_param from __sched_priority to sched_priority. Delete everything under #ifndef __cpu_set_t_defined. * sysdeps/unix/sysv/linux/bits/sched.h: Likewise. Also sync with kernel sched.h, adding SCHED_ISO and SCHED_DEADLINE constants. * posix/sched.h: Include bits/cpu-set.h as well as bits/sched.h. For compatibility, #define sched_priority to itself, and #define __sched_priority as sched_priority. * posix/bits/cpu-set.h: New file containing, verbatim, the code that was under #ifndef __cpu_set_t_defined in sysdeps/unix/sysv/linux/bits/sched.h. * include/bits/cpu-set.h: New wrapper. * posix/Makefile: Install bits/cpu-set.h.
* Fix build issue on x86.Wilco Dijkstra2017-06-122-0/+5
| | | | | | | Add an undef of __stpcpy in string-inlines.c to avoid a redefinition error on x86. * string/string-inlines.c: Add undef of __stpcpy to fix build issue.
* float128: Add test-{float128,ifloat128,float128-finite}Paul E. Murphy2017-06-1216-5/+112
| | | | | | | | | | | | | | | | | | | | | | | | | | This adds test support for float128, and lays some groundwork for future _FloatN types. * math/gen-libm-test.pl (@all_floats): Add ifloat128 and float128. (%all_floats_pfx): Add macro prefix for float128 (FLT128). * math/libm-test-exp10.inc (pow10_test): Do not test for _FloatN, * math/libm-test-isfinite.inc (finite_test): Likewise. * math/libm-test-lgamma.inc (gamma_test): Likewise. * math/libm-test-nexttoward.inc (nexttoward_test): Likewise. (nexttoward_test_data}: Likewise. * math/libm-test-remainder.inc (drem_test): Likewise. * math/libm-test-scalb.inc (scalb_test): Likewise. (scalb_test_data): Likewise. * math/libm-test-significand.inc (significand_test): Likewise. (significand_test_data): Likewise. * math/libm-test-support.c (check_complex): Replace __complex__ FLOAT with CFLOAT to get the support for old compiler. * math/libm-test-support.h (check_complex): Likewise. * math/test-double.h (CFLOAT, TEST_FLOATN): New macros. * math/test-float.h (CFLOAT, TEST_FLOATN): Likewise. * math/test-ldouble.h (CFLOAT, TEST_FLOATN): Likewise. * math/test-float128.h: New file. * math/test-math-floatn.h: New file.
* Allow macros prefixed with FLT128 in include/float.hGabriel F. T. Gomes2017-06-122-16/+21
| | | | | | | | | | | | | | TS 18661-3 specifies that macros prefixed with FLTN_ can be defined in float.h, only if __STDC_WANT_IEC_60559_TYPES_EXT__ is defined as a macro before the inclusion of float.h. Since GCC 7.0, these macros are provided under this condition, however, for older versions of GCC, these macros are not provided at all. This patch allows the definitions of such macros in include/float.h for older compilers, if the condition above is met, and even if _ISOMAC is defined. * include/float.h: Allow the definition of macros prefixed with FLT128 even if _ISOMAC is defined, but provided that __STDC_WANT_IEC_60559_TYPES_EXT__ is defined as a macro.
* float128: Add strfromf128, strtof128, and wcstof128 to the manualGabriel F. T. Gomes2017-06-123-7/+77
| | | | | | | | | | * manual/math.texi (Mathematics): Add description for _FloatN and _FloatNx types and mentions that they are not support in glibc for any architecture, so far. * manual/arith.texi (wcstof, wcstold): Replace the mention to stdlib.h with wchar.h. (Parsing of Floats): Add descriptions for strtofN and wcstofN. (Printing of Floats): Add description for strfromfN.
* float128: Add strtof128, wcstof128, and related functions.Paul E. Murphy2017-06-1221-29/+466
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The implementations are contained with sysdeps/ieee754/float128 as they are only built when _Float128 is enabled within libc/m. * include/gmp.h (__mpn_construct_float128): New declaration. * include/stdlib.h: Include bits/floatn.h for _Float128 tests. (__strtof128_l): New declaration. (__strtof128_nan): Likewise. (__wcstof128_nan): Likewise. (__strtof128_internal): Likewise. (____strtof128_l_internal): Likewise. * include/wchar.h: Include bits/floatn.h for _Float128 tests. (__wcstof128_l): New declaration. (__wcstof128_internal): Likewise. * stdlib/Makefile (bug-strtod2): Link libm too. * stdlib/stdlib.h (strtof128): New declaration. (strtof128_l): Likewise. * stdlib/tst-strtod-nan-locale-main.c: Updated to use tst-strtod.h macros to ensure float128 gets tested too. * stdlib/tst-strtod-round-skeleton.c (CHOOSE_f128): New macro. * stdlib/tst-strtod.h: Include bits/floatn.h for _Float128 tests. (IF_FLOAT128): New macro. (GEN_TEST_STRTOD): Update to optionally include _Float128 in the tests. (STRTOD_TEST_FOREACH): Likewise. * sysdeps/ieee754/float128/Makefile: Insert new strtof128 and wcstof128 functions into libc. * sysdeps/ieee754/float128/Versions: Add exports for the above new functions. * sysdeps/ieee754/float128/mpn2float128.c: New file. * sysdeps/ieee754/float128/strtod_nan_float128.h: New file. * sysdeps/ieee754/float128/strtof128.c: New file. * sysdeps/ieee754/float128/strtof128_l.c: New file. * sysdeps/ieee754/float128/strtof128_nan.c: New file. * sysdeps/ieee754/float128/wcstof128.c: New file. * sysdeps/ieee754/float128/wcstof128_l.c: New file. * sysdeps/ieee754/float128/wcstof128_nan.c: New fike. * wcsmbs/Makefile: (CFLAGS-wcstof128.c): Append strtox-CFLAGS. (CFLAGS-wcstof128_l): Likewise. * wcsmbs/wchar.h: Include bits/floatn.h for _Float128 tests. (wcstof128): New declaration. (wcstof128_l): Likewise.
* Fix XPG4 bsd_signal namespace (bug 21552).Joseph Myers2017-06-123-2/+6
| | | | | | | | | | | | | bsd_signal was added in XPG4.2, so should be declared for __USE_XOPEN_EXTENDED, instead of the present __USE_XOPEN condition. This patch fixes the condition accordingly. Tested for x86_64. [BZ #21552] * signal/signal.h (bsd_signal): Declare if [__USE_XOPEN_EXTENDED], not [__USE_XOPEN]. * conform/Makefile (test-xfail-XPG4/signal.h/conform): Remove.
* Fix sigwait namespace (bug 21550).Joseph Myers2017-06-122-0/+7
| | | | | | | | | | | | | | sigwait was added to POSIX in 1995; it is not in older POSIX versions or XPG4 / XPG4.2. Thus it should be declared only if __USE_POSIX199506; signal.h wrongly declares it for __USE_POSIX. (sigwaitinfo is correctly conditioned on __USE_POSIX199309.) This patch fixes the condition on the declaration of sigwait. Tested for x86_64. Because of other namespace problems this does not allow any conform/ XFAILs to be removed. [BZ #21550] * signal/signal.h (sigwait): Only declare if [__USE_POSIX199506].
* x86-64: Implement strcpy family IFUNC selectors in CH.J. Lu2017-06-1215-131/+278
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement strcpy family IFUNC selectors in C. All internal calls within libc.so can use IFUNC on x86-64 since unlike x86, x86-64 supports PC-relative addressing to access the GOT entry so that it can call via PLT without using an extra register. For libc.a, we can't use IFUNC for functions which are called before IFUNC has been initialized. Use IFUNC internally reduces the icache footprint since libc.so and other codes in the process use the same implementations. This patch uses IFUNC for strcpy family functions within libc. * sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Add strcpy-sse2 and stpcpy-sse2. * sysdeps/x86_64/multiarch/ifunc-unaligned-ssse3.h: New file. * sysdeps/x86_64/multiarch/stpcpy-sse2.S: Likewise. * sysdeps/x86_64/multiarch/stpcpy.c: Likewise. * sysdeps/x86_64/multiarch/stpncpy.c: Likewise. * sysdeps/x86_64/multiarch/strcpy-sse2.S: Likewise. * sysdeps/x86_64/multiarch/strcpy.c: Likewise. * sysdeps/x86_64/multiarch/strncpy.c: Likewise. * sysdeps/x86_64/multiarch/stpcpy.S: Removed. * sysdeps/x86_64/multiarch/stpncpy.S: Likewise. * sysdeps/x86_64/multiarch/strcpy.S: Likewise. * sysdeps/x86_64/multiarch/strncpy.S: Likewise. * sysdeps/x86_64/multiarch/stpncpy-c.c (weak_alias): New. (libc_hidden_def): Always defined as empty. * sysdeps/x86_64/multiarch/strncpy-c.c (libc_hidden_builtin_def): Always Defined as empty.
* 2017-06-12 Wilco Dijkstra <wdijkstr@arm.com>Wilco Dijkstra2017-06-126-134/+19
| | | | | | | | | | | | | | | There is no longer a need for string2.h, so remove it and all mention of it. Move the redirect for __stpcpy to include/string.h since it is still required until all internal uses have been renamed. This fixes several linknamespace/localplt failures when building with -Os. [BZ #15105] [BZ #19463] * include/string.h: Add internal redirect for __stpcpy. * string/Makefile: Remove bits/string2.h. * string/string.h: Update comment. * string/string-inlines.c: Remove bits/string2.h include and comment. * string/bits/string2.h: Remove file.