about summary refs log tree commit diff
path: root/sysdeps/s390/s390-32
Commit message (Collapse)AuthorAgeFilesLines
* rtld: Remove DL_ARGV_NOT_RELRO and make _dl_skip_args constSzabolcs Nagy2022-05-171-23/+0
| | | | | | | | | | | _dl_skip_args is always 0, so the target specific code that modifies argv after relro protection is applied is no longer used. After the patch relro protection is applied to _dl_argv consistently on all targets. Reviewed-by: Florian Weimer <fweimer@redhat.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Remove -z combreloc and HAVE_Z_COMBRELOCFangrui Song2022-04-041-16/+2
| | | | | | | | | | | | | -z combreloc has been the default regadless of the architecture since binutils commit f4d733664aabd7bd78c82895e030ec9779a92809 (2002). The configure check added in commit fdde83499a05 (2001) has long been unneeded. We can therefore treat HAVE_Z_COMBRELOC as always 1 and delete dead code paths in dl-machine.h files (many were copied from commit a711b01d34ca and ee0cb67ec238). Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* elf: Remove prelink supportAdhemerval Zanella2022-02-101-14/+8
| | | | | | | | | | | | | Prelinked binaries and libraries still work, the dynamic tags DT_GNU_PRELINKED, DT_GNU_LIBLIST, DT_GNU_CONFLICT just ignored (meaning the process is reallocated as default). The loader environment variable TRACE_PRELINKING is also removed, since it used solely on prelink. Checked on x86_64-linux-gnu, i686-linux-gnu, and aarch64-linux-gnu. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* Update copyright dates with scripts/update-copyrightsPaul Eggert2022-01-0118-18/+18
| | | | | | | | | | | | | | | | | | | | | | | I used these shell commands: ../glibc/scripts/update-copyrights $PWD/../gnulib/build-aux/update-copyright (cd ../glibc && git commit -am"[this commit message]") and then ignored the output, which consisted lines saying "FOO: warning: copyright statement not found" for each of 7061 files FOO. I then removed trailing white space from math/tgmath.h, support/tst-support-open-dev-null-range.c, and sysdeps/x86_64/multiarch/strlen-vec.S, to work around the following obscure pre-commit check failure diagnostics from Savannah. I don't know why I run into these diagnostics whereas others evidently do not. remote: *** 912-#endif remote: *** 913: remote: *** 914- remote: *** error: lines with trailing whitespace found ... remote: *** error: sysdeps/unix/sysv/linux/statx_cp.c: trailing lines
* elf: Add _dl_audit_pltexitAdhemerval Zanella2021-12-281-2/+2
| | | | | | | | | It consolidates the code required to call la_pltexit audit callback. Checked on x86_64-linux-gnu, i686-linux-gnu, and aarch64-linux-gnu. Reviewed-by: Florian Weimer <fweimer@redhat.com>
* elf: Fix dynamic-link.h usage on rtld.cAdhemerval Zanella2021-10-141-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The 4af6982e4c fix does not fully handle RTLD_BOOTSTRAP usage on rtld.c due two issues: 1. RTLD_BOOTSTRAP is also used on dl-machine.h on various architectures and it changes the semantics of various machine relocation functions. 2. The elf_get_dynamic_info() change was done sideways, previously to 490e6c62aa get-dynamic-info.h was included by the first dynamic-link.h include *without* RTLD_BOOTSTRAP being defined. It means that the code within elf_get_dynamic_info() that uses RTLD_BOOTSTRAP is in fact unused. To fix 1. this patch now includes dynamic-link.h only once with RTLD_BOOTSTRAP defined. The ELF_DYNAMIC_RELOCATE call will now have the relocation fnctions with the expected semantics for the loader. And to fix 2. part of 4af6982e4c is reverted (the check argument elf_get_dynamic_info() is not required) and the RTLD_BOOTSTRAP pieces are removed. To reorganize the includes the static TLS definition is moved to its own header to avoid a circular dependency (it is defined on dynamic-link.h and dl-machine.h requires it at same time other dynamic-link.h definition requires dl-machine.h defitions). Also ELF_MACHINE_NO_REL, ELF_MACHINE_NO_RELA, and ELF_MACHINE_PLT_REL are moved to its own header. Only ancient ABIs need special values (arm, i386, and mips), so a generic one is used as default. The powerpc Elf64_FuncDesc is also moved to its own header, since csu code required its definition (which would require either include elf/ folder or add a full path with elf/). Checked on x86_64, i686, aarch64, armhf, powerpc64, powerpc32, and powerpc64le. Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
* elf: Avoid nested functions in the loader [BZ #27220]Fangrui Song2021-10-071-8/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | dynamic-link.h is included more than once in some elf/ files (rtld.c, dl-conflict.c, dl-reloc.c, dl-reloc-static-pie.c) and uses GCC nested functions. This harms readability and the nested functions usage is the biggest obstacle prevents Clang build (Clang doesn't support GCC nested functions). The key idea for unnesting is to add extra parameters (struct link_map *and struct r_scope_elm *[]) to RESOLVE_MAP, ELF_MACHINE_BEFORE_RTLD_RELOC, ELF_DYNAMIC_RELOCATE, elf_machine_rel[a], elf_machine_lazy_rel, and elf_machine_runtime_setup. (This is inspired by Stan Shebs' ppc64/x86-64 implementation in the google/grte/v5-2.27/master which uses mixed extra parameters and static variables.) Future simplification: * If mips elf_machine_runtime_setup no longer needs RESOLVE_GOTSYM, elf_machine_runtime_setup can drop the `scope` parameter. * If TLSDESC no longer need to be in elf_machine_lazy_rel, elf_machine_lazy_rel can drop the `scope` parameter. Tested on aarch64, i386, x86-64, powerpc64le, powerpc64, powerpc32, sparc64, sparcv9, s390x, s390, hppa, ia64, armhf, alpha, and mips64. In addition, tested build-many-glibcs.py with {arc,csky,microblaze,nios2}-linux-gnu and riscv64-linux-gnu-rv64imafdc-lp64d. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Remove "Contributed by" linesSiddhesh Poyarekar2021-09-0311-11/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | We stopped adding "Contributed by" or similar lines in sources in 2012 in favour of git logs and keeping the Contributors section of the glibc manual up to date. Removing these lines makes the license header a bit more consistent across files and also removes the possibility of error in attribution when license blocks or files are copied across since the contributed-by lines don't actually reflect reality in those cases. Move all "Contributed by" and similar lines (Written by, Test by, etc.) into a new file CONTRIBUTED-BY to retain record of these contributions. These contributors are also mentioned in manual/contrib.texi, so we just maintain this additional record as a courtesy to the earlier developers. The following scripts were used to filter a list of files to edit in place and to clean up the CONTRIBUTED-BY file respectively. These were not added to the glibc sources because they're not expected to be of any use in future given that this is a one time task: https://gist.github.com/siddhesh/b5ecac94eabfd72ed2916d6d8157e7dc https://gist.github.com/siddhesh/15ea1f5e435ace9774f485030695ee02 Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* Remove sysdeps/*/tls-macros.hFangrui Song2021-08-181-106/+0
| | | | | | | | They provide TLS_GD/TLS_LD/TLS_IE/TLS_IE macros for TLS testing. Now that we have migrated to __thread and tls_model attributes, these macros are unused and the tls-macros.h files can retire. Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
* Reduce the statically linked startup code [BZ #23323]Florian Weimer2021-02-251-8/+2
| | | | | | | | | | | | | | | | | | | It turns out the startup code in csu/elf-init.c has a perfect pair of ROP gadgets (see Marco-Gisbert and Ripoll-Ripoll, "return-to-csu: A New Method to Bypass 64-bit Linux ASLR"). These functions are not needed in dynamically-linked binaries because DT_INIT/DT_INIT_ARRAY are already processed by the dynamic linker. However, the dynamic linker skipped the main program for some reason. For maximum backwards compatibility, this is not changed, and instead, the main map is consulted from __libc_start_main if the init function argument is a NULL pointer. For statically linked binaries, the old approach based on linker symbols is still used because there is nothing else available. A new symbol version __libc_start_main@@GLIBC_2.34 is introduced because new binaries running on an old libc would not run their ELF constructors, leading to difficult-to-debug issues.
* Update copyright dates with scripts/update-copyrightsPaul Eggert2021-01-0218-18/+18
| | | | | | | | | | | | | | | | I used these shell commands: ../glibc/scripts/update-copyrights $PWD/../gnulib/build-aux/update-copyright (cd ../glibc && git commit -am"[this commit message]") and then ignored the output, which consisted lines saying "FOO: warning: copyright statement not found" for each of 6694 files FOO. I then removed trailing white space from benchtests/bench-pthread-locks.c and iconvdata/tst-iconv-big5-hkscs-to-2ucs4.c, to work around this diagnostic from Savannah: remote: *** pre-commit check failed ... remote: *** error: lines with trailing whitespace found remote: error: hook declined to update refs/heads/master
* S390: Remove backchain-based fallback and use generic backtrace.c.Stefan Liebler2020-03-051-148/+0
| | | | | | | | | | | | | | | | | | | | | | After recent discussions: - "[PATCH] s390: Remove backchain-based fallback from backtrace" https://www.sourceware.org/ml/libc-alpha/2020-02/msg00287.html - "Re: [PATCH 07/11] s390: Implement backtrace on top of <unwind-link.h>" https://www.sourceware.org/ml/libc-alpha/2020-02/msg00637.html We've checked and decided to remove the backchain: We don't know of any environments without libgcc. Thus the backchain unwinder is not used. If somebody builds with -mbackchain and without fasynchronous-unwind-tables and has libgcc installed, then the libgcc unwinder is called but not the backchain-based fallback. This step allows to get rid of the s390x specific backtrace.c files at all. Furthermore the now used debug/backtrace.c version has some more advantages: - Free all resources if necessary. (libc_freeres_fn) - Remove NULL address above _start. - Check whether we make any progress while getting addresses.
* Update copyright dates with scripts/update-copyrights.Joseph Myers2020-01-0119-19/+19
|
* Prefer https to http for gnu.org and fsf.org URLsPaul Eggert2019-09-0719-19/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also, change sources.redhat.com to sourceware.org. This patch was automatically generated by running the following shell script, which uses GNU sed, and which avoids modifying files imported from upstream: sed -ri ' s,(http|ftp)(://(.*\.)?(gnu|fsf|sourceware)\.org($|[^.]|\.[^a-z])),https\2,g s,(http|ftp)(://(.*\.)?)sources\.redhat\.com($|[^.]|\.[^a-z]),https\2sourceware.org\4,g ' \ $(find $(git ls-files) -prune -type f \ ! -name '*.po' \ ! -name 'ChangeLog*' \ ! -path COPYING ! -path COPYING.LIB \ ! -path manual/fdl-1.3.texi ! -path manual/lgpl-2.1.texi \ ! -path manual/texinfo.tex ! -path scripts/config.guess \ ! -path scripts/config.sub ! -path scripts/install-sh \ ! -path scripts/mkinstalldirs ! -path scripts/move-if-change \ ! -path INSTALL ! -path locale/programs/charmap-kw.h \ ! -path po/libc.pot ! -path sysdeps/gnu/errlist.c \ ! '(' -name configure \ -execdir test -f configure.ac -o -f configure.in ';' ')' \ ! '(' -name preconfigure \ -execdir test -f preconfigure.ac ';' ')' \ -print) and then by running 'make dist-prepare' to regenerate files built from the altered files, and then executing the following to cleanup: chmod a+x sysdeps/unix/sysv/linux/riscv/configure # Omit irrelevant whitespace and comment-only changes, # perhaps from a slightly-different Autoconf version. git checkout -f \ sysdeps/csky/configure \ sysdeps/hppa/configure \ sysdeps/riscv/configure \ sysdeps/unix/sysv/linux/csky/configure # Omit changes that caused a pre-commit check to fail like this: # remote: *** error: sysdeps/powerpc/powerpc64/ppc-mcount.S: trailing lines git checkout -f \ sysdeps/powerpc/powerpc64/ppc-mcount.S \ sysdeps/unix/sysv/linux/s390/s390-64/syscall.S # Omit change that caused a pre-commit check to fail like this: # remote: *** error: sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: last line does not end in newline git checkout -f sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S
* S390: Increase function alignment to 16 bytes.Stefan Liebler2019-03-041-1/+1
| | | | | | | | | | | | | Set the default function alignment to 16 bytes in order to get rid of some unwanted performance effects. Please see also GCC commit "S/390: Set default function alignment to 16." (Subversion revision 262817) ChangeLog: * sysdeps/s390/s390-64/sysdep.h(ENTRY): Use alignment of 16byte. * sysdeps/s390/s390-32/sysdep.h: Likewise.
* Update copyright dates with scripts/update-copyrights.Joseph Myers2019-01-0119-19/+19
| | | | | | | * All files with FSF copyright notices: Update copyright dates using scripts/update-copyrights. * locale/programs/charmap-kw.h: Regenerated. * locale/programs/locfile-kw.h: Likewise.
* S390: Refactor memchr ifunc handling.Stefan Liebler2018-12-182-62/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ifunc handling for memchr is adjusted in order to omit ifunc variants if those will never be used as the minimum architecture level already supports newer CPUs by default. Glibc internal calls will then also use the "newer" ifunc variant. Note: The fallback s390-32/s390-64 ifunc variants with srst instruction are now moved to the unified memchr-z900.S file which can be used for 31/64bit. The s390-32/s390-64 files multiarch/memchr.c and memchr.S are deleted. ChangeLog: * sysdeps/s390/multiarch/Makefile (sysdep_routines): Remove memchr variants. * sysdeps/s390/Makefile (sysdep_routines): Add memchr variants. * sysdeps/s390/multiarch/ifunc-impl-list.c (__libc_ifunc_impl_list): Refactor ifunc handling for memchr. * sysdeps/s390/multiarch/memchr-vx.S: Move to ... * sysdeps/s390/memchr-vx.S: ... here and adjust ifunc handling. * sysdeps/s390/multiarch/memchr.c: Move to ... * sysdeps/s390/memchr.c: ... here and adjust ifunc handling. * sysdeps/s390/ifunc-memchr.h: New file. * sysdeps/s390/s390-64/memchr.S: Move to ... * sysdeps/s390/memchr-z900.S: ... here and adjust to be usable for 31/64bit and ifunc handling. * sysdeps/s390/s390-32/multiarch/memchr.c: Delete file. * sysdeps/s390/s390-64/multiarch/memchr.c: Likewise. * sysdeps/s390/s390-32/memchr.S: Likewise.
* S390: Refactor strcmp ifunc handling.Stefan Liebler2018-12-182-62/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ifunc handling for strcmp is adjusted in order to omit ifunc variants if those will never be used as the minimum architecture level already supports newer CPUs by default. Glibc internal calls will then also use the "newer" ifunc variant. Note: The fallback s390-32/s390-64 ifunc variants with clst instruction are now moved to the unified strcmp-z900.S file which can be used for 31/64bit. The s390-32/s390-64 files multiarch/strcmp.c and strcmp.S are deleted. ChangeLog: * sysdeps/s390/multiarch/Makefile (sysdep_routines): Remove strcmp variants. * sysdeps/s390/Makefile (sysdep_routines): Add strcmp variants. * sysdeps/s390/multiarch/ifunc-impl-list.c (__libc_ifunc_impl_list): Refactor ifunc handling for strcmp. * sysdeps/s390/multiarch/strcmp-vx.S: Move to ... * sysdeps/s390/strcmp-vx.S: ... here and adjust ifunc handling. * sysdeps/s390/multiarch/strcmp.c: Move to ... * sysdeps/s390/strcmp.c: ... here and adjust ifunc handling. * sysdeps/s390/ifunc-strcmp.h: New file. * sysdeps/s390/s390-64/strcmp.S: Move to ... * sysdeps/s390/strcmp-z900.S: ... here and adjust to be usable for 31/64bit and ifunc handling. * sysdeps/s390/s390-32/multiarch/strcmp.c: Delete file. * sysdeps/s390/s390-64/multiarch/strcmp.c: Likewise. * sysdeps/s390/s390-32/strcmp.S: Likewise.
* S390: Refactor strncpy ifunc handling.Stefan Liebler2018-12-182-24/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ifunc handling for strncpy is adjusted in order to omit ifunc variants if those will never be used as the minimum architecture level already supports newer CPUs by default. Glibc internal calls will then also use the "newer" ifunc variant. Note: The fallback s390-32/s390-64 ifunc variants are now moved to the strncpy-z900.S files. The s390-32/s390-64 files multiarch/strncpy.c and strncpy.S are deleted. ChangeLog: * sysdeps/s390/multiarch/Makefile (sysdep_routines): Remove strncpy variants. * sysdeps/s390/Makefile (sysdep_routines): Add strncpy variants. * sysdeps/s390/multiarch/ifunc-impl-list.c (__libc_ifunc_impl_list): Refactor ifunc handling for strncpy. * sysdeps/s390/multiarch/strncpy-vx.S: Move to ... * sysdeps/s390/strncpy-vx.S: ... here and adjust ifunc handling. * sysdeps/s390/multiarch/strncpy.c: Move to ... * sysdeps/s390/strncpy.c: ... here and adjust ifunc handling. * sysdeps/s390/ifunc-strncpy.h: New file. * sysdeps/s390/s390-64/strncpy.S: Move to ... * sysdeps/s390/s390-64/strncpy-z900.S: ... here and adjust ifunc handling. * sysdeps/s390/s390-32/strncpy.S: Move to ... * sysdeps/s390/s390-32/strncpy-z900.S: ... here and adjust ifunc handling. * sysdeps/s390/s390-32/multiarch/strncpy.c: Delete file. * sysdeps/s390/s390-64/multiarch/strncpy.c: Likewise.
* S390: Refactor strcpy ifunc handling.Stefan Liebler2018-12-182-57/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ifunc handling for strcpy is adjusted in order to omit ifunc variants if those will never be used as the minimum architecture level already supports newer CPUs by default. Glibc internal calls will then also use the "newer" ifunc variant. Note: The fallback s390-32/s390-64 ifunc variants with mvst instruction are now moved to the unified strcpy-z900.S file which can be used for 31/64bit. The s390-32/s390-64 files multiarch/strcpy.c and strcpy.S are deleted. ChangeLog: * sysdeps/s390/multiarch/Makefile (sysdep_routines): Remove strcpy variants. * sysdeps/s390/Makefile (sysdep_routines): Add strcpy variants. * sysdeps/s390/multiarch/ifunc-impl-list.c (__libc_ifunc_impl_list): Refactor ifunc handling for strcpy. * sysdeps/s390/multiarch/strcpy-vx.S: Move to ... * sysdeps/s390/strcpy-vx.S: ... here and adjust ifunc handling. * sysdeps/s390/multiarch/strcpy.c: Move to ... * sysdeps/s390/strcpy.c: ... here and adjust ifunc handling. * sysdeps/s390/ifunc-strcpy.h: New file. * sysdeps/s390/s390-64/strcpy.S: Move to ... * sysdeps/s390/strcpy-z900.S: ... here and adjust to be usable for 31/64bit and ifunc handling. * sysdeps/s390/s390-32/multiarch/strcpy.c: Delete file. * sysdeps/s390/s390-64/multiarch/strcpy.c: Likewise. * sysdeps/s390/s390-32/strcpy.S: Likewise.
* S390: Remove s390 specific implementation of bcopy.Stefan Liebler2018-12-181-85/+0
| | | | | | | | | | | | | | | | | Nowadays gcc is automatically replacing a call to bcopy with a call to memmove. Thus only old binaries will call the s390 specific bcopy implementation. The s390 specific implementation is using an own implementation for memcpy in the forward case and is relying on memmove in the backward case. After removing the s390 specific bcopy, the common code bcopy is used. It just performs a tail call to memmove. ChangeLog: * sysdeps/s390/s390-32/bcopy.S: Remove. * sysdeps/s390/s390-64/bcopy.S: Likewise.
* S390: Unify 31/64bit memcpy.Stefan Liebler2018-12-184-247/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The implementation of memcpy/mempcpy for s390-32 (31bit) and s390-64 (64bit) is nearly the same. This patch unifies it for maintability reasons. __mem[p]cpy_z10 and __mem[p]cpy_z196 differs between 31 and 64bit: -31bit needs .machinemode "zarch_nohighgprs" and llgfr %r4,%r4 -lr vs lgr; lgr can be also used on 31bit as this ifunc variant is only called if we are on a zarch machine. __mem[p]cpy_default differs between 31 and 64bit: -Some 31bit vs 64bit instructions (e.g. ltr vs ltgr. Solved with 31/64 specific instruction macros). -The address of mvc instruction is setup in different ways (larl vs bras). Solved with #if defined __s390x__. __memcpy_mvcle differs between 31 and 64bit: -lr vs lgr; ahi vs aghi; Solved with 31/64bit specific instruction macros. Otherwise 31/64bit implementation has the same structure of the code. ChangeLog: * sysdeps/s390/s390-64/memcpy.S: Move to ... * sysdeps/s390/memcpy.S: ... here. Adjust to be usable for 31/64bit. * sysdeps/s390/s390-32/memcpy.S: Delete File. * sysdeps/s390/multiarch/Makefile (sysdep_routines): Add memcpy. * sysdeps/s390/s390-32/multiarch/Makefile: Delete file. * sysdeps/s390/s390-64/multiarch/Makefile: Likewise. * sysdeps/s390/s390-64/multiarch/memcpy-s390x.S: Move to ... * sysdeps/s390/multiarch/memcpy-s390x.S: ... here. Adjust to be usable for 31/64bit. * sysdeps/s390/s390-32/multiarch/memcpy-s390.S: Delete File. * sysdeps/s390/s390-64/multiarch/memcpy.c: Move to ... * sysdeps/s390/multiarch/memcpy.c: ... here. * sysdeps/s390/s390-32/multiarch/memcpy.c: Delete File.
* S390: Unify 31/64bit memcmp.Stefan Liebler2018-12-184-201/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The implementation of memcmp for s390-32 (31bit) and s390-64 (64bit) is nearly the same. This patch unifies it for maintability reasons. __memcmp_z10 and __memcmp_z196 differs between 31 and 64bit: -31bit needs .machinemode "zarch_nohighgprs" and llgfr %r4,%r4 -lr vs lgr and some other instructions: But lgr and co can be also used on 31bit as this ifunc variant is only called if we are on a zarch machine. __memcmp_default differs between 31 and 64bit: -Some 31bit vs 64bit instructions (e.g. ltr vs ltgr. Solved with 31/64 specific instruction macros). -The address of mvc instruction is setup in different ways (larl vs bras). Solved with #if defined __s390x__. Otherwise 31/64bit implementation has the same structure of the code. ChangeLog: * sysdeps/s390/s390-64/memcmp.S: Move to ... * sysdeps/s390/memcmp.S: ... here. Adjust to be usable for 31/64bit. * sysdeps/s390/s390-32/memcmp.S: Delete File. * sysdeps/s390/multiarch/Makefile (sysdep_routines): Add memcmp. * sysdeps/s390/s390-32/multiarch/Makefile (sysdep_routines): Remove memcmp. * sysdeps/s390/s390-64/multiarch/Makefile: Likewise. * sysdeps/s390/s390-64/multiarch/memcmp-s390x.S: Move to ... * sysdeps/s390/multiarch/memcmp-s390x.S: ... here. Adjust to be usable for 31/64bit. * sysdeps/s390/s390-32/multiarch/memcmp-s390.S: Delete File. * sysdeps/s390/s390-64/multiarch/memcmp.c: Move to ... * sysdeps/s390/multiarch/memcmp.c: ... here. * sysdeps/s390/s390-32/multiarch/memcmp.c: Delete File.
* S390: Implement bzero with memset.Stefan Liebler2018-12-181-42/+0
| | | | | | | | | | | | | | | | | This patch removes the bzero s390 implementation with mvcle and adds entry points for bzero in memset ifunc variants. Therefore an ifunc resolver is implemented for bzero, too. ChangeLog: * sysdeps/s390/s390-32/bzero.S: Delete file. * sysdeps/s390/s390-64/bzero.S: Likewise. * sysdeps/s390/Makefile (sysdep_routines): Add bzero. * sysdeps/s390/bzero.c: New file. * sysdeps/s390/memset-z900.S: Add bzero entry points. * sysdeps/s390/ifunc-memset.h: Add bzero function macros. * sysdeps/s390/multiarch/ifunc-impl-list.c (__libc_ifunc_impl_list): Add bzero ifunc variants.
* S390: Unify 31/64bit memset.Stefan Liebler2018-12-184-209/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The implementation of memset for s390-32 (31bit) and s390-64 (64bit) is nearly the same. This patch unifies it for maintability reasons. __memset_z10 and __memset_z196 differs between 31 and 64bit: -31bit needs .machinemode "zarch_nohighgprs" and llgfr %r4,%r4 -lr vs lgr and some other instructions: But lgr and co can be also used on 31bit as this ifunc variant is only called if we are on a zarch machine. __memset_default differs between 31 and 64bit: -Some 31bit vs 64bit instructions (e.g. ltr vs ltgr. Solved with 31/64 specific instruction macros). -The address of mvc instruction is setup in different ways (larl vs bras). Solved with #if defined __s390x__. Otherwise 31/64bit implementation has the same structure of the code. ChangeLog: * sysdeps/s390/s390-64/memset.S: Move to ... * sysdeps/s390/memset.S: ... here. Adjust to be usable for 31/64bit. * sysdeps/s390/s390-32/memset.S: Delete File. * sysdeps/s390/multiarch/Makefile (sysdep_routines): Add memset. * sysdeps/s390/s390-32/multiarch/Makefile (sysdep_routines): Remove memset. * sysdeps/s390/s390-64/multiarch/Makefile: Likewise. * sysdeps/s390/s390-64/multiarch/memset-s390x.S: Move to ... * sysdeps/s390/multiarch/memset-s390x.S: ... here. Adjust to be usable for 31/64bit. * sysdeps/s390/s390-32/multiarch/memset-s390.S: Delete File. * sysdeps/s390/s390-64/multiarch/memset.c: Move to ... * sysdeps/s390/multiarch/memset.c: ... here. * sysdeps/s390/s390-32/multiarch/memset.c: Delete File.
* S390: Fix unwind in 32-bit _mcountIlya Leoshkevich2018-08-101-2/+6
| | | | | | | | | | * Fix CFI offset for %r14. * Fix unwound value of %r15 being off by 128 bytes. ChangeLog: * sysdeps/s390/s390-32/s390-mcount.S (_mcount): Fix unwind.
* S390: Do not clobber R0 in 32-bit _dl_runtime_profileIlya Leoshkevich2018-08-101-0/+6
| | | | | | | | | Preparation for the usage of R0 by __fentry__. ChangeLog: * sysdeps/s390/s390-32/dl-trampoline.h (_dl_runtime_profile): Do not clobber R0.
* S390: Do not clobber R0 in 32-bit _dl_runtime_resolveIlya Leoshkevich2018-08-101-2/+8
| | | | | | | | | Preparation for the usage of R0 by __fentry__. ChangeLog: * sysdeps/s390/s390-32/dl-trampoline.h (_dl_runtime_resolve): Do not clobber R0.
* S390: Use symbolic offsets for stack variables in 32-bit _dl_runtime_profileIlya Leoshkevich2018-08-101-78/+135
| | | | | | | | | Maintainability improvement. ChangeLog: * sysdeps/s390/s390-32/dl-trampoline.h (_dl_runtime_profile): Use symbolic offsets for stack variables.
* S390: Use symbolic offsets for stack variables in 32-bit _dl_runtime_resolveIlya Leoshkevich2018-08-101-36/+73
| | | | | | | | | Maintainability improvement. ChangeLog: * sysdeps/s390/s390-32/dl-trampoline.h (_dl_runtime_resolve): Use symbolic offsets for stack variables.
* Mark _init and _fini as hidden [BZ #23145]H.J. Lu2018-06-081-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | _init and _fini are special functions provided by glibc for linker to define DT_INIT and DT_FINI in executable and shared library. They should never be put in dynamic symbol table. This patch marks them as hidden to remove them from dynamic symbol table. Tested with build-many-glibcs.py. [BZ #23145] * elf/Makefile (tests-special): Add $(objpfx)check-initfini.out. ($(all-built-dso:=.dynsym): New target. (common-generated): Add $(all-built-dso:$(common-objpfx)%=%.dynsym). ($(objpfx)check-initfini.out): New target. (generated): Add check-initfini.out. * scripts/check-initfini.awk: New file. * sysdeps/aarch64/crti.S (_init): Mark as hidden. (_fini): Likewise. * sysdeps/alpha/crti.S (_init): Mark as hidden. (_fini): Likewise. * sysdeps/arm/crti.S (_init): Mark as hidden. (_fini): Likewise. * sysdeps/hppa/crti.S (_init): Mark as hidden. (_fini): Likewise. * sysdeps/i386/crti.S (_init): Mark as hidden. (_fini): Likewise. * sysdeps/ia64/crti.S (_init): Mark as hidden. (_fini): Likewise. * sysdeps/m68k/crti.S (_init): Mark as hidden. (_fini): Likewise. * sysdeps/microblaze/crti.S (_init): Mark as hidden. (_fini): Likewise. * sysdeps/mips/mips32/crti.S (_init): Mark as hidden. (_fini): Likewise. * sysdeps/mips/mips64/n32/crti.S (_init): Mark as hidden. (_fini): Likewise. * sysdeps/mips/mips64/n64/crti.S (_init): Mark as hidden. (_fini): Likewise. * sysdeps/nios2/crti.S (_init): Mark as hidden. (_fini): Likewise. * sysdeps/powerpc/powerpc32/crti.S (_init): Mark as hidden. (_fini): Likewise. * sysdeps/powerpc/powerpc64/crti.S (_init): Mark as hidden. (_fini): Likewise. * sysdeps/s390/s390-32/crti.S (_init): Mark as hidden. (_fini): Likewise. * sysdeps/s390/s390-64/crti.S (_init): Mark as hidden. (_fini): Likewise. * sysdeps/sh/crti.S (_init): Mark as hidden. (_fini): Likewise. * sysdeps/sparc/crti.S (_init): Mark as hidden. (_fini): Likewise. * sysdeps/x86_64/crti.S (_init): Mark as hidden. (_fini): Likewise.
* elf: Unify symbol address run-time calculation [BZ #19818]Maciej W. Rozycki2018-04-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Wrap symbol address run-time calculation into a macro and use it throughout, replacing inline calculations. There are a couple of variants, most of them different in a functionally insignificant way. Most calculations are right following RESOLVE_MAP, at which point either the map or the symbol returned can be checked for validity as the macro sets either both or neither. In some places both the symbol and the map has to be checked however. My initial implementation therefore always checked both, however that resulted in code larger by as much as 0.3%, as many places know from elsewhere that no check is needed. I have decided the size growth was unacceptable. Having looked closer I realized that it's the map that is the culprit. Therefore I have modified LOOKUP_VALUE_ADDRESS to accept an additional boolean argument telling it to access the map without checking it for validity. This in turn has brought quite nice results, with new code actually being smaller for i686, and MIPS o32, n32 and little-endian n64 targets, unchanged in size for x86-64 and, unusually, marginally larger for big-endian MIPS n64, as follows: i686: text data bss dec hex filename 152255 4052 192 156499 26353 ld-2.27.9000-base.so 152159 4052 192 156403 262f3 ld-2.27.9000-elf-symbol-value.so MIPS/o32/el: text data bss dec hex filename 142906 4396 260 147562 2406a ld-2.27.9000-base.so 142890 4396 260 147546 2405a ld-2.27.9000-elf-symbol-value.so MIPS/n32/el: text data bss dec hex filename 142267 4404 260 146931 23df3 ld-2.27.9000-base.so 142171 4404 260 146835 23d93 ld-2.27.9000-elf-symbol-value.so MIPS/n64/el: text data bss dec hex filename 149835 7376 408 157619 267b3 ld-2.27.9000-base.so 149787 7376 408 157571 26783 ld-2.27.9000-elf-symbol-value.so MIPS/o32/eb: text data bss dec hex filename 142870 4396 260 147526 24046 ld-2.27.9000-base.so 142854 4396 260 147510 24036 ld-2.27.9000-elf-symbol-value.so MIPS/n32/eb: text data bss dec hex filename 142019 4404 260 146683 23cfb ld-2.27.9000-base.so 141923 4404 260 146587 23c9b ld-2.27.9000-elf-symbol-value.so MIPS/n64/eb: text data bss dec hex filename 149763 7376 408 157547 2676b ld-2.27.9000-base.so 149779 7376 408 157563 2677b ld-2.27.9000-elf-symbol-value.so x86-64: text data bss dec hex filename 148462 6452 400 155314 25eb2 ld-2.27.9000-base.so 148462 6452 400 155314 25eb2 ld-2.27.9000-elf-symbol-value.so [BZ #19818] * sysdeps/generic/ldsodefs.h (LOOKUP_VALUE_ADDRESS): Add `set' parameter. (SYMBOL_ADDRESS): New macro. [!ELF_FUNCTION_PTR_IS_SPECIAL] (DL_SYMBOL_ADDRESS): Use SYMBOL_ADDRESS for symbol address calculation. * elf/dl-runtime.c (_dl_fixup): Likewise. (_dl_profile_fixup): Likewise. * elf/dl-symaddr.c (_dl_symbol_address): Likewise. * elf/rtld.c (dl_main): Likewise. * sysdeps/aarch64/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/alpha/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/arm/dl-machine.h (elf_machine_rel): Likewise. (elf_machine_rela): Likewise. * sysdeps/hppa/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/hppa/dl-symaddr.c (_dl_symbol_address): Likewise. * sysdeps/i386/dl-machine.h (elf_machine_rel): Likewise. (elf_machine_rela): Likewise. * sysdeps/ia64/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/m68k/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/microblaze/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/mips/dl-machine.h (ELF_MACHINE_BEFORE_RTLD_RELOC): Likewise. (elf_machine_reloc): Likewise. (elf_machine_got_rel): Likewise. * sysdeps/mips/dl-trampoline.c (__dl_runtime_resolve): Likewise. * sysdeps/nios2/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/powerpc/powerpc32/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/powerpc/powerpc64/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/riscv/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/s390/s390-32/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/s390/s390-64/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/sh/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/sparc/sparc32/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/sparc/sparc64/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/tile/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/x86_64/dl-machine.h (elf_machine_rela): Likewise. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Update copyright dates with scripts/update-copyrights.Joseph Myers2018-01-0137-37/+37
| | | | | | | * All files with FSF copyright notices: Update copyright dates using scripts/update-copyrights. * locale/programs/charmap-kw.h: Regenerated. * locale/programs/locfile-kw.h: Likewise.
* S390: Add CFI rule in _dl_runtime_resolve[_vx] for unwinding.Stefan Liebler2017-12-111-7/+6
| | | | | | | | | | | | | | | | | | | In _dl_runtime_resolve[_vx], unwinding fails after the new stack frame is created as there is no CFI rule for r15. This is also observeable in GDB: Backtrace stopped: previous frame inner to this frame (corrupt stack?) Therefore this patch is now storing r15 on stack and is using cfi_offset rule. The stmg/lmg instruction is used to store/load r14 and r15 with one instruction. On 64bit, the offsets of the fprs have moved to store r15 directly after r14. On 31bit, the r14/r15 is now stored between the other gprs and fprs as the space wasn't used. ChangeLog: * sysdeps/s390/s390-64/dl-trampoline.h (_dl_runtime_resolve): Store r15 on stack and add cfi rule. * sysdeps/s390/s390-32/dl-trampoline.h (_dl_runtime_resolve): Likewise.
* S390: Add cfi information for start routines in order to stop unwinding.Stefan Liebler2017-11-211-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GDB failed to detect the outermost frame while showing the backtrace within a thread: Backtrace stopped: previous frame identical to this frame (corrupt stack?) Before this patch, the start routines like thread_start had no cfi information. GDB is then using the prologue unwinder if no cfi information is available. This unwinder tries to unwind r15 and stops e.g. if r15 was updated or on some jump-instructions. On older glibc-versions (before commit "Remove cached PID/TID in clone" c579f48edba88380635ab98cb612030e3ed8691e), the thread_start function used such a jump-instruction and GDB did not fail with an error. This patch adds cfi information for _start, thread_start and __makecontext_ret and marks r14 as undefined which marks the frame as outermost frame and GDB stops the backtrace. Also tested different gcc versions in order to test _Unwind_Backtrace() in libgcc as this is used by backtrace() in glibc. ChangeLog: * sysdeps/s390/s390-64/start.S (_start): Add cfi information for r14. * sysdeps/s390/s390-32/start.S: (_start): Likewise * sysdeps/unix/sysv/linux/s390/s390-64/clone.S (thread_start): Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/clone.S (thread_start): Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/__makecontext_ret.S (__makecontext_ret): Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/__makecontext_ret.S (__makecontext_ret): Likewise.
* S390: Save and restore r12 in TLS_IE macro.Stefan Liebler2017-06-271-5/+7
| | | | | | | | | | | | | | | | | | | | | The testcases elf/tst-tls1-static and elf/tst-tls2-static are failing on s390 if gcc is configured with --enable-default-pie. According to binutils, there are only four valid cases for IE -> LE transition: lg %rx,(0,%ry) -> sllg %rx,%ry,0 lg %rx,(%ry,0) -> sllg %rx,%ry,0 lg %rx,(%ry,%r12) -> sllg %rx,%ry,0 lg %rx,(%r12,%ry) -> sllg %rx,%ry,0 Thus I've adjusted the TLS_IE macro in s390 tls-macros.h files in PIC case in order to use r12 for the address of global offset table. The adjusted macro definition is not used if gcc is not configured with --enable-default-pie. ChangeLog: * sysdeps/s390/s390-32/tls-macros.h (TLS_IE): Use r12 for GOT address. * sysdeps/s390/s390-64/tls-macros.h (TLS_IE): Likewise.
* S390: Fix build with gcc configured with --enable-default-pie. [BZ #21537]Stefan Liebler2017-06-191-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* PowerPC64 ELFv2 PPC64_OPT_LOCALENTRYAlan Modra2017-06-141-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Build divdi3 only for architecture that required itAdhemerval Zanella2017-04-061-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As noted in [1], divdi3 object is only exported in a handful ABIs (i386, m68k, powerpc32, s390-32, and ia64), however it is built for all current architectures regardless. This patch refact the make rules for this object to so only the aforementioned architectures that actually require it builds it. Also, to avoid internal PLT calls to the exported symbol from the module, glibc uses an internal header (symbol-hacks.h) which is unrequired (and in fact breaks the build for architectures that intend to get symbol definitions from libgcc.a). The patch also changes it to create its own header (divdi3-symbol-hacks.h) and adjust the architectures that require it accordingly. I checked the build/check (with run-built-tests=no) on the following architectures (which I think must cover all supported ABI/builds) using GCC 6.3: aarch64-linux-gnu alpha-linux-gnu arm-linux-gnueabihf hppa-linux-gnu ia64-linux-gnu m68k-linux-gnu microblaze-linux-gnu mips64-n32-linux-gnu mips-linux-gnu mips64-linux-gnu nios2-linux-gnu powerpc-linux-gnu powerpc-linux-gnu-power4 powerpc64-linux-gnu powerpc64le-linux-gnu s390x-linux-gnu s390-linux-gnu sh4-linux-gnu sh4-linux-gnu-soft sparc64-linux-gnu sparcv9-linux-gnu tilegx-linux-gnu tilegx-linux-gnu-32 tilepro-linux-gnu x86_64-linux-gnu x86_64-linux-gnu-x32 i686-linux-gnu I only saw one regression on sparcv9-linux-gnu (extra PLT call to .udiv) which I address in next patch in the set. It also correctly build SH with GCC 7.0.1 (without any regression from c89721e25d). [1] https://sourceware.org/ml/libc-alpha/2017-03/msg00243.html * sysdeps/i386/symbol-hacks.h: New file. * sysdeps/m68k/symbol-hacks.h: New file. * sysdeps/powerpc/powerpc32/symbol-hacks.h: New file. * sysdeps/s390/s390-32/symbol-hacks.h: New file. * sysdeps/unix/sysv/linux/i386/Makefile [$(subdir) = csu] (sysdep_routines): New rule: divdi3 object. [$(subdir) = csu] (sysdep-only-routines): Likewise. [$(subdir) = csu] (CFLAGS-divdi3.c): Likewise. * sysdeps/unix/sysv/linux/m68k/Makefile [$(subdir) = csu] (sysdep_routines): Likewise. [$(subdir) = csu] (sysdep-only-routines): Likewise. [$(subdir) = csu] (CFLAGS-divdi3.c): Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/Makefile [$(subdir) = csu] (sysdep_routines): Likewise. [$(subdir) = csu] (sysdep-only-routines): Likewise. [$(subdir) = csu] (CFLAGS-divdi3.c): Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/Makefile [$(subdir) = csu] (sysdep_routines): Likewise. [$(subdir) = csu] (sysdep-only-routines): Likewise. [$(subdir) = csu] (CFLAGS-divdi3.c): Likewise. * sysdeps/wordsize-32/Makefile: Remove file. * sysdeps/wordsize-32/symbol-hacks.h: Definitions move to ... * sysdeps/wordsize-32/divdi3-symbol-hacks.h: ... here.
* S390: Clobber also r14 in TLS_LD, TLS_GD macros on 31bit.Stefan Liebler2017-04-041-4/+6
| | | | | | | | | | | | | | | | | | This patch also clobbers r14 in TLS_LD, TLS_GD macros on 31bit. This ensures that r14 isn't used to save and restore r12 while r14 is clobbered by the bas-instruction. As note: r12 can't be added to clobber list as gcc would fail with: error: PIC register clobbered by ‘12’ in ‘asm’ For 64bit this fix was already done in 2004 in the commit b80af23ac6973e69df6cd23d221fa44fffb21e17. ChangeLog: * sysdeps/s390/s390-32/tls-macros.h (TLS_LD, TLS_GD): Clobber also r14.
* Update copyright dates with scripts/update-copyrights.Joseph Myers2017-01-0136-36/+36
|
* Fix typos in the spelling of "implementation"Dmitry V. Levin2016-12-271-1/+1
| | | | | | | | | | | | | Apply the following spelling fix: $ git grep -El 'implemetn?ation' | xargs sed -ri 's/implemetn?ation/implementation/g' [BZ #19514] * resolv/res_send.c: Fix typo in comment. * sysdeps/i386/i386-mcount.S: Likewise. * sysdeps/s390/s390-32/s390-mcount.S: Likewise. * sysdeps/s390/s390-64/s390x-mcount.S: Likewise. * sysdeps/sparc/sparc-mcount.S: Likewise.
* Refactor long double information into bits/long-double.h.Joseph Myers2016-12-141-11/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Information about whether the ABI of long double is the same as that of double is split between bits/mathdef.h and bits/wordsize.h. When the ABIs are the same, bits/mathdef.h defines __NO_LONG_DOUBLE_MATH. In addition, in the case where the same glibc binary supports both -mlong-double-64 and -mlong-double-128, bits/wordsize.h defines __LONG_DOUBLE_MATH_OPTIONAL, along with __NO_LONG_DOUBLE_MATH if this particular compilation is with -mlong-double-64. As part of the refactoring I proposed in <https://sourceware.org/ml/libc-alpha/2016-11/msg00745.html>, this patch puts all that information in a single header, bits/long-double.h. It is included from sys/cdefs.h alongside the include of bits/wordsize.h, so other headers generally do not need to include bits/long-double.h directly. Previously, various bits/mathdef.h headers and bits/wordsize.h headers had this long double information (including implicitly in some bits/mathdef.h headers through not having the defines present in the default version). After the patch, it's all in six bits/long-double.h headers. Furthermore, most of those new headers are not architecture-specific. Architectures with optional long double all use the ldbl-opt sysdeps directory, either in the order (ldbl-64-128, ldbl-opt, ldbl-128) or (ldbl-128ibm, ldbl-opt). Thus a generic header for the case where long double = double, and headers in ldbl-128, ldbl-96 and ldbl-opt, suffices to cover every architecture except for cases where long double properties vary between different ABIs sharing a set of installed headers; fortunately all the ldbl-opt cases share a single compiler-predefined macro __LONG_DOUBLE_128__ that can be used to tell whether this compilation is -mlong-double-64 or -mlong-double-128. The two cases where a set of headers is shared between ABIs with different long double properties, MIPS (o32 has long double = double, other ABIs use ldbl-128) and SPARC (32-bit has optional long double, 64-bit has required long double), need their own bits/long-double.h headers. As with bits/wordsize.h, multiple-include protection for this header is generally implicit through the include guards on sys/cdefs.h, and multiple inclusion is harmless in any case. There is one subtlety: the header must not define __LONG_DOUBLE_MATH_OPTIONAL if __NO_LONG_DOUBLE_MATH was defined before its inclusion, because doing so breaks how sysdeps/ieee754/ldbl-opt/nldbl-compat.h defines __NO_LONG_DOUBLE_MATH itself before including system headers. Subject to keeping that working, it would be reasonable to move these macros from defined/undefined #ifdef to always-defined 1/0 #if semantics, but this patch does not attempt to do so, just rearranges where the macros are defined. After this patch, the only use of bits/mathdef.h is the alpha one for modifying complex function ABIs for old GCC. Thus, all versions of the header other than the default and alpha versions are removed, as is the include from math.h. Tested for x86_64 and x86. Also did compilation-only testing with build-many-glibcs.py. * bits/long-double.h: New file. * sysdeps/ieee754/ldbl-128/bits/long-double.h: Likewise. * sysdeps/ieee754/ldbl-96/bits/long-double.h: Likewise. * sysdeps/ieee754/ldbl-opt/bits/long-double.h: Likewise. * sysdeps/mips/bits/long-double.h: Likewise. * sysdeps/unix/sysv/linux/sparc/bits/long-double.h: Likewise. * math/Makefile (headers): Add bits/long-double.h. * misc/sys/cdefs.h: Include <bits/long-double.h>. * stdlib/strtold.c: Include <bits/long-double.h> instead of <bits/wordsize.h>. * bits/mathdef.h [!_COMPLEX_H]: Do not allow inclusion. [!__NO_LONG_DOUBLE_MATH]: Remove conditional code. * math/math.h: Do not include <bits/mathdef.h>. * sysdeps/aarch64/bits/mathdef.h: Remove file. * sysdeps/alpha/bits/mathdef.h [!_COMPLEX_H]: Do not allow inclusion. * sysdeps/ia64/bits/mathdef.h: Remove file. * sysdeps/m68k/m680x0/bits/mathdef.h: Likewise. * sysdeps/mips/bits/mathdef.h: Likewise. * sysdeps/powerpc/bits/mathdef.h: Likewise. * sysdeps/s390/bits/mathdef.h: Likewise. * sysdeps/sparc/bits/mathdef.h: Likewise. * sysdeps/x86/bits/mathdef.h: Likewise. * sysdeps/s390/s390-32/bits/wordsize.h [!__NO_LONG_DOUBLE_MATH && !__LONG_DOUBLE_MATH_OPTIONAL]: Remove conditional code. * sysdeps/s390/s390-64/bits/wordsize.h [!__NO_LONG_DOUBLE_MATH && !__LONG_DOUBLE_MATH_OPTIONAL]: Likewise. * sysdeps/unix/sysv/linux/alpha/bits/wordsize.h [!__NO_LONG_DOUBLE_MATH && !__LONG_DOUBLE_MATH_OPTIONAL]: Likewise. * sysdeps/unix/sysv/linux/powerpc/bits/wordsize.h [!__NO_LONG_DOUBLE_MATH && !__LONG_DOUBLE_MATH_OPTIONAL]: Likewise. * sysdeps/unix/sysv/linux/sparc/bits/wordsize.h [!__NO_LONG_DOUBLE_MATH && !__LONG_DOUBLE_MATH_OPTIONAL]: Likewise.
* s390x: Add hidden definition for __sigsetjmpFlorian Weimer2016-11-151-18/+24
|
* Define wordsize.h macros everywhereSteve Ellcey2016-11-041-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * bits/wordsize.h: Add documentation. * sysdeps/aarch64/bits/wordsize.h : New file * sysdeps/generic/stdint.h (PTRDIFF_MIN, PTRDIFF_MAX): Update definitions. (SIZE_MAX): Change ifdef to if in __WORDSIZE32_SIZE_ULONG check. * sysdeps/gnu/bits/utmp.h (__WORDSIZE_TIME64_COMPAT32): Check with #if instead of #ifdef. * sysdeps/gnu/bits/utmpx.h (__WORDSIZE_TIME64_COMPAT32): Ditto. * sysdeps/mips/bits/wordsize.h (__WORDSIZE32_SIZE_ULONG, __WORDSIZE32_PTRDIFF_LONG, __WORDSIZE_TIME64_COMPAT32): Add or change defines. * sysdeps/powerpc/powerpc32/bits/wordsize.h: Likewise. * sysdeps/powerpc/powerpc64/bits/wordsize.h: Likewise. * sysdeps/s390/s390-32/bits/wordsize.h: Likewise. * sysdeps/s390/s390-64/bits/wordsize.h: Likewise. * sysdeps/sparc/sparc32/bits/wordsize.h: Likewise. * sysdeps/sparc/sparc64/bits/wordsize.h: Likewise. * sysdeps/tile/tilegx/bits/wordsize.h: Likewise. * sysdeps/tile/tilepro/bits/wordsize.h: Likewise. * sysdeps/unix/sysv/linux/alpha/bits/wordsize.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/bits/wordsize.h: Likewise. * sysdeps/unix/sysv/linux/sparc/bits/wordsize.h: Likewise. * sysdeps/wordsize-32/bits/wordsize.h: Likewise. * sysdeps/wordsize-64/bits/wordsize.h: Likewise. * sysdeps/x86/bits/wordsize.h: Likewise.
* s390: Refactor ifunc resolvers due to false debuginfo.Stefan Liebler2016-10-073-4/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adjusts the s390 specific ifunc helper macros in ifunc-resolve.h to use the common __ifunc macro, which uses gcc attribute ifunc to get rid of the false debuginfo. Therefore the redirection construct is applied where needed. Perhaps in future we can switch some of the internal symbols __GI_* from the fallback variant to the ifunc function. But this change is not straightforward due to a segmentation fault while linking libc.so with older binutils on s390. ChangeLog: [BZ #20478] * sysdeps/s390/multiarch/ifunc-resolve.h (s390_vx_libc_ifunc2, s390_libc_ifunc): Use __ifunc from libc-symbols.h to create ifunc symbols. (s390_vx_libc_ifunc_init, s390_vx_libc_ifunc_redirected , s390_vx_libc_ifunc2_redirected, s390_libc_ifunc_init): New define. * sysdeps/s390/multiarch/memchr.c: Redirect ifunced function in header for using it as type for ifunc function. * sysdeps/s390/multiarch/mempcpy.c: Likewise. * sysdeps/s390/multiarch/rawmemchr.c: Likewise. * sysdeps/s390/multiarch/stpcpy.c: Likewise. * sysdeps/s390/multiarch/stpncpy.c: Likewise. * sysdeps/s390/multiarch/strcat.c: Likewise. * sysdeps/s390/multiarch/strchr.c: Likewise. * sysdeps/s390/multiarch/strcmp.c: Likewise. * sysdeps/s390/multiarch/strcpy.c: Likewise. * sysdeps/s390/multiarch/strcspn.c: Likewise. * sysdeps/s390/multiarch/strlen.c: Likewise. * sysdeps/s390/multiarch/strncmp.c: Likewise. * sysdeps/s390/multiarch/strncpy.c: Likewise. * sysdeps/s390/multiarch/strnlen.c: Likewise. * sysdeps/s390/multiarch/strpbrk.c: Likewise. * sysdeps/s390/multiarch/strrchr.c: Likewise. * sysdeps/s390/multiarch/strspn.c: Likewise. * sysdeps/s390/multiarch/wcschr.c: Likewise. * sysdeps/s390/multiarch/wcscmp.c: Likewise. * sysdeps/s390/multiarch/wcspbrk.c: Likewise. * sysdeps/s390/multiarch/wcsspn.c: Likewise. * sysdeps/s390/multiarch/wmemchr.c: Likewise. * sysdeps/s390/multiarch/wmemset.c: Likewise. * sysdeps/s390/s390-32/multiarch/memcmp.c: Likewise. * sysdeps/s390/s390-32/multiarch/memcpy.c: Likewise. * sysdeps/s390/s390-32/multiarch/memset.c: Likewise. * sysdeps/s390/s390-64/multiarch/memcmp.c: Likewise. * sysdeps/s390/s390-64/multiarch/memcpy.c: Likewise. * sysdeps/s390/s390-64/multiarch/memset.c: Likewise.
* S390: Do not clobber r13 with memcpy on 31bit with copies >1MB.Stefan Liebler2016-07-201-8/+5
| | | | | | | | | | | | | | | | | | | | | | | | | If the default memcpy variant is called with a length of >1MB on 31bit, r13 is clobbered as the algorithm is switching to mvcle. The mvcle code returns without restoring r13. All other cases are restoring r13. If memcpy is called from outside libc the ifunc resolver will only select this variant if running on machines older than z10. Otherwise or if memcpy is called from inside libc, this default memcpy variant is called. The testcase timezone/tst-tzset is triggering this issue in some combinations of gcc versions and optimization levels. This bug was introduced in commit 04bb21ac93e90d7696bcaf8febe2b2dd2d83585a and thus is a regression compared to former glibc 2.23 release. This patch removes the usage of r13 at all. Thus it is not saved and restored. The base address for execute-instruction is now stored in r5 which is obtained after r5 is not needed anymore as 256byte block counter. ChangeLog: * sysdeps/s390/s390-32/memcpy.S (memcpy): Eliminate the usage of r13 as it is not restored in mvcle case.
* S390: Use DT_JUMPREL in prelink undo code.Stefan Liebler2016-07-061-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On s390, the current prelink undo code in elf_machine_lazy_rel() has the requirement, that the plt stubs use the first got slots after the 3 reserved ones. In case of undoing prelink, the plt got slots are reset to the correct addresses whithin the corresponding plt-stub. Therefore the address is calculated by the address of the first plt-stub-address which was written by prelink (see l->l_mach.plt) to got[1] and index of current relocation multiplied with 32 (=size of one plt slot). The index was calculated with &current-got-slot - &got[3]. This patch removes the requirement, that the plt-got-slots are starting at got[3]. The index is now calculated with &current-reloc - &reloc[0]. The first struct Elf64_Rela is stored at DT_JMPREL. This patch is needed to prepare for partial relro support. Ulrich Weigand suggested this approach to use DT_JMPREL - Thanks. ChangeLog: * sysdeps/s390/linkmap.h (struct link_map_machine): Remove member gotplt and add member jmprel. * sysdeps/s390/s390-32/dl-machine.h (elf_machine_runtime_setup): Setup member jmprel with DT_JMPREL instead of gotplt with &got[3]. (elf_machine_lazy_rel): Calculate address with reloc and jmprel. * sysdeps/s390/s390-64/dl-machine.h: Likewise.
* S390: Implement mempcpy with help of memcpy. [BZ #19765]Stefan Liebler2016-05-242-22/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There exist optimized memcpy functions on s390, but no optimized mempcpy. This patch adds mempcpy entry points in memcpy.S files, which use the memcpy implementation. Now mempcpy itself is also an IFUNC function as memcpy is and the variants are listed in ifunc-impl-list.c. The s390 string.h does not define _HAVE_STRING_ARCH_mempcpy. Instead mempcpy string/string.h inlines memcpy() + n. If n is constant and small enough, GCC emits instructions like mvi or mvc and avoids the function call to memcpy. If n is not constant, then memcpy is called and n is added afterwards. If _HAVE_STRING_ARCH_mempcpy would be defined, mempcpy would be called in every case. According to PR70140 "Inefficient expansion of __builtin_mempcpy" (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70140) GCC should handle a call to mempcpy in the same way as memcpy. Then either the mempcpy macro in string/string.h has to be removed or _HAVE_STRING_ARCH_mempcpy has to be defined for S390. ChangeLog: [BZ #19765] * sysdeps/s390/mempcpy.S: New File. * sysdeps/s390/multiarch/mempcpy.c: Likewise. * sysdeps/s390/multiarch/Makefile (sysdep_routines): Add mempcpy. * sysdeps/s390/multiarch/ifunc-impl-list.c (__libc_ifunc_impl_list): Add mempcpy variants. * sysdeps/s390/s390-32/memcpy.S: Add mempcpy entry point. (memcpy): Adjust to be usable from mempcpy entry point. (__memcpy_mvcle): Likewise. * sysdeps/s390/s390-64/memcpy.S: Likewise. * sysdeps/s390/s390-32/multiarch/memcpy-s390.S: Add entry points ____mempcpy_z196, ____mempcpy_z10 and add __GI_ symbols for mempcpy. (__memcpy_z196): Adjust to be usable from mempcpy entry point. (__memcpy_z10): Likewise. * sysdeps/s390/s390-64/multiarch/memcpy-s390x.S: Likewise.
* S390: Do not call memcpy, memcmp, memset within libc.so via ifunc-plt.Stefan Liebler2016-05-243-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | On s390, the memcpy, memcmp, memset functions are IFUNC symbols, which are created with s390_libc_ifunc-macro. This macro creates a __GI_ symbol which is set to the ifunced symbol. Thus calls within libc.so to e.g. memcpy result in a call to *ABS*+0x954c0@plt stub and afterwards to the resolved memcpy-ifunc-variant. This patch sets the __GI_ symbol to the default-ifunc-variant to avoid the plt call. The __GI_ symbols are now created at the default variant of ifunced function. ChangeLog: * sysdeps/s390/multiarch/ifunc-resolve.h (s390_libc_ifunc): Remove __GI_ symbol. * sysdeps/s390/s390-32/multiarch/memcmp-s390.S: Add __GI_memcmp symbol. * sysdeps/s390/s390-64/multiarch/memcmp-s390x.S: Likewise. * sysdeps/s390/s390-32/multiarch/memcpy-s390.S: Add __GI_memcpy symbol. * sysdeps/s390/s390-64/multiarch/memcpy-s390x.S: Likewise. * sysdeps/s390/s390-32/multiarch/memset-s390.S: Add __GI_memset symbol. * sysdeps/s390/s390-64/multiarch/memset-s390x.S: Likewise.