about summary refs log tree commit diff
path: root/sysdeps/s390
Commit message (Collapse)AuthorAgeFilesLines
* Fix the inaccuracy of j0f/j1f/y0f/y1f [BZ #14469, #14470, #14471, #14472]Paul Zimmermann2021-04-021-34/+34
| | | | | | | | | | | | | | | | | | | | | | | For j0f/j1f/y0f/y1f, the largest error for all binary32 inputs is reduced to at most 9 ulps for all rounding modes. The new code is enabled only when there is a cancellation at the very end of the j0f/j1f/y0f/y1f computation, or for very large inputs, thus should not give any visible slowdown on average. Two different algorithms are used: * around the first 64 zeros of j0/j1/y0/y1, approximation polynomials of degree 3 are used, computed using the Sollya tool (https://www.sollya.org/) * for large inputs, an asymptotic formula from [1] is used [1] Fast and Accurate Bessel Function Computation, John Harrison, Proceedings of Arith 19, 2009. Inputs yielding the new largest errors are added to auto-libm-test-in, and ulps are regenerated for various targets (thanks Adhemerval Zanella). Tested on x86_64 with --disable-multi-arch and on powerpc64le-linux-gnu. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* S390: Allow "v" constraint for long double math_opt_barrier and ↵Stefan Liebler2021-04-011-2/+19
| | | | | | | | | | | math_force_eval with GCC 11. Starting with GCC 11, long double values can also be processed in vector registers if build with -march >= z14. Then GCC defines the __LONG_DOUBLE_VX__ macro. FYI: GCC commit "IBM Z: Introduce __LONG_DOUBLE_VX__ macro" https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=f47df2af313d2ce7f9149149010a142c2237beda
* S390: Also check vector support in memmove ifunc-selector [BZ #27511]Stefan Liebler2021-03-264-6/+15
| | | | | | | | | | | | | | | The arch13 memmove variant is currently selected by the ifunc selector if the Miscellaneous-Instruction-Extensions Facility 3 facility bit is present, but the function is also using vector instructions. If the vector support is not present, one is receiving an operation exception. Therefore this patch also checks for vector support in the ifunc selector and in ifunc-impl-list.c. Just to be sure, the configure check is now also testing an arch13 vector instruction and an arch13 Miscellaneous-Instruction-Extensions Facility 3 instruction.
* s390x: Regenerate ULPs.Stefan Liebler2021-03-121-1/+3
| | | | | | | Updates needed after recent commit: db3f7bb5586392d9809fc6397c7184983aed6008 "math: Remove slow paths from asin and acos [BZ #15267]" Compre to the required ulps update for x86_64.
* s390x: Regenerate ulpsArjun Shankar2021-03-031-15/+17
| | | | For new test cases in commit 5a051454a9b5.
* Implement <unwind-link.h> for dynamically loading the libgcc_s unwinderFlorian Weimer2021-03-011-0/+28
| | | | | | | | | | This will be used to consolidate the libgcc_s access for backtrace and pthread_cancel. Unlike the existing backtrace implementations, it provides some hardening based on pointer mangling. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* Reduce the statically linked startup code [BZ #23323]Florian Weimer2021-02-252-10/+4
| | | | | | | | | | | | | | | | | | | 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.
* S390: Add new hwcap values.Stefan Liebler2021-02-162-3/+6
| | | | The new hwcap values indicate support for arch14 architecture.
* Remove dbl-64/wordsize-64 (part 2)Wilco Dijkstra2021-01-071-1/+0
| | | | | | | | Remove the wordsize-64 implementations by merging them into the main dbl-64 directory. The second patch just moves all wordsize-64 files and removes a few wordsize-64 uses in comments and Implies files. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Update copyright dates with scripts/update-copyrightsPaul Eggert2021-01-02302-302/+302
| | | | | | | | | | | | | | | | 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
* s390x: Regenerate ulpsFlorian Weimer2020-12-221-10/+12
| | | | | For new inputs added in commit cad5ad81d2f7f58a7ad0d8afa8c1b710, as seen on a z13 system.
* s390x: Require GCC 7.1 or later to build glibc.Stefan Liebler2020-12-172-0/+52
| | | | | | | | | | | | | | | | | | | | | | | GCC 6.5 fails to correctly build ldconfig with recent ld.so.cache commits, e.g.: 785969a047ad2f23f758901c6816422573544453 elf: Implement a string table for ldconfig, with tail merging If glibc is build with gcc 6.5.0: __builtin_add_overflow is used in <glibc>/elf/stringtable.c:stringtable_finalize() which leads to ldconfig failing with "String table is too large". This is also recognizable in following tests: FAIL: elf/tst-glibc-hwcaps-cache FAIL: elf/tst-glibc-hwcaps-prepend-cache FAIL: elf/tst-ldconfig-X FAIL: elf/tst-ldconfig-bad-aux-cache FAIL: elf/tst-ldconfig-ld_so_conf-update FAIL: elf/tst-stringtable See gcc "Bug 98269 - gcc 6.5.0 __builtin_add_overflow() with small uint32_t values incorrectly detects overflow" (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98269)
* s390x: Add glibc-hwcaps supportFlorian Weimer2020-12-103-0/+175
| | | | | | | Subdirectories z13, z14, z15 can be selected, mostly based on the level of support for vector instructions. Co-Authored-By: Stefan Liebler <stli@linux.ibm.com>
* S390: Derive float_t from FLT_EVAL_METHODMarius Hillenbrand2020-12-091-24/+0
| | | | | | | | | | | | | | | | | | float_t supposedly represents the type that is used to evaluate float expressions internally. While the isa supports single-precision float operations, the port of glibc to s390 incorrectly deferred to the generic definitions which, back then, tied float_t to double. gcc by default evaluates float in single precision, so that scenario violates the C standard (sections 5.2.4.2.2 and 7.12 in C11/C17). With -fexcess-precision=standard, gcc evaluates float in double precision, which aligns with the standard yet at the cost of added conversion instructions. With this patch, we drop the s390-specific definition of float_t and defer to the default behavior, which aligns float_t with the compiler-defined FLT_EVAL_METHOD in a standard-compliant way. Checked on s390x-linux-gnu with 31-bit and 64-bit builds.
* nptl: Move stack list variables into _rtld_globalFlorian Weimer2020-11-161-2/+0
| | | | | | | | | Now __thread_gscope_wait (the function behind THREAD_GSCOPE_WAIT, formerly __wait_lookup_done) can be implemented directly in ld.so, eliminating the unprotected GL (dl_wait_lookup_done) function pointer. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* aarch64: enforce >=64K guard size [BZ #26691]Szabolcs Nagy2020-10-021-0/+3
| | | | | | | | | | | | | | | | | | | | | | | There are several compiler implementations that allow large stack allocations to jump over the guard page at the end of the stack and corrupt memory beyond that. See CVE-2017-1000364. Compilers can emit code to probe the stack such that the guard page cannot be skipped, but on aarch64 the probe interval is 64K by default instead of the minimum supported page size (4K). This patch enforces at least 64K guard on aarch64 unless the guard is disabled by setting its size to 0. For backward compatibility reasons the increased guard is not reported, so it is only observable by exhausting the address space or parsing /proc/self/maps on linux. On other targets the patch has no effect. If the stack probe interval is larger than a page size on a target then ARCH_MIN_GUARD_SIZE can be defined to get large enough stack guard on libc allocated stacks. The patch does not affect threads with user allocated stacks. Fixes bug 26691.
* S390: Sync HWCAP names with kernel by adding aliases [BZ #25971]Stefan Liebler2020-08-211-0/+3
| | | | | | | Unfortunately some HWCAP names like HWCAP_S390_VX differs between kernel (see <kernel>/arch/s390/include/asm/elf.h) and glibc. Therefore, those HWCAP names from kernel are now introduced as alias
* S390: Regenerate ULPs.Stefan Liebler2020-08-121-1/+1
| | | | | | Updates needed after new j0 test: commit 9bfc225078219521439ec8b0f665915e769d40c2 math: Regenerate auto-libm-test-out-j0
* S390: Optimize __memset_z196.Stefan Liebler2020-06-261-10/+9
| | | | | | | | It turned out that an 256b-mvc instruction which depends on the result of a previous 256b-mvc instruction is counterproductive. Therefore this patch adjusts the 256b-loop by storing the first byte with stc and setting the remaining 255b with mvc. Now the 255b-mvc instruction depends on the stc instruction.
* S390: Optimize __memcpy_z196.Stefan Liebler2020-06-261-6/+15
| | | | | | This patch introduces an extra loop without pfd instructions as it turned out that the pfd instructions are usefull for copies >=64KB but are counterproductive for smaller copies.
* S390: Regenerate ULPs.Stefan Liebler2020-06-241-0/+2
| | | | Updates needed after recent exp10f commits.
* s390: Use sqrt{f} builtinAdhemerval Zanella2020-06-223-60/+4
| | | | Checked on s390x-linux-gnu.
* s390x: Use fma{f} builtinAdhemerval Zanella2020-06-223-64/+4
| | | | Checked on s390x-linux-gnu.
* math: Decompose math-use-builtins.hAdhemerval Zanella2020-06-227-119/+90
| | | | | | | | | | | Each symbol definitions are moved on a separated file and it cover all symbol type definitions (float, double, long double, and float128). It allows to set support for architectures without the boiler place of copying default values. Checked with a build on the affected ABIs.
* ieee754: provide gcc builtins based generic fma functionsVineet Gupta2020-06-031-0/+5
| | | | Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* ieee754: provide gcc builtins based generic sqrt functionsVineet Gupta2020-06-031-0/+3
| | | | Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* semaphore: consolidate arch headers into a generic oneVineet Gupta2020-05-061-39/+0
| | | | | | | | | | | | | | | | | | This consolidates the copy-pasted arch specific semaphore header into single version (based on s390) which suffices 32-bit and and 64-bit arch/ABI based on the canonical WORDSIZE. For now I've left out arches which use alternate defines to choose for 32 vs 64-bit builds (aarch64, mips) which in theory can also use the same header. Passes build-many for aarch64-linux-gnu arm-linux-gnueabi arm-linux-gnueabihf riscv64-linux-gnu-rv64imac-lp64 riscv64-linux-gnu-rv64imafdc-lp64 x86_64-linux-gnu microblaze-linux-gnu nios2-linux-gnu Suggested-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Remove most gmp-mparam.h headers.Joseph Myers2020-04-241-30/+0
| | | | | | | | | | | | | | Most gmp-mparam.h headers in glibc define various macros to the same values they would be defined to by the generic version of that header, plus macros IEEE_DOUBLE_BIG_ENDIAN or IEEE_DOUBLE_MIXED_ENDIAN related to the representation of double. The latter macros are in turn only used in gmp-impl.h to define union ieee_double_extract, which is not used in glibc. Thus all of these headers, except for the generic one and those that define _LONG_LONG_LIMB for ILP32 configurations with 64-bit registers, are redundant, and this patch removes them. Tested with build-many-glibcs.py that installed stripped shared libraries are unchanged by this patch.
* S390: Regenerate ULPs.Stefan Liebler2020-04-031-15/+19
| | | | | | Updates needed after recent commit a9d42c09a327540a99f2eac25a98fd2ad6d0b540 math: Add inputs that yield larger errors for float type (x86_64)
* math: Remove inline math testsAdhemerval Zanella2020-03-191-817/+0
| | | | | | | | | | | | | With mathinline removal there is no need to keep building and testing inline math tests. The gen-libm-tests.py support to generate ULP_I_* is removed and all libm-test-ulps files are updated to longer have the i{float,double,ldouble} entries. The support for no-test-inline is also removed from both gen-auto-libm-tests and the auto-libm-test-out-* were regenerated. Checked on x86_64-linux-gnu and i686-linux-gnu.
* S390: Remove backchain-based fallback and use generic backtrace.c.Stefan Liebler2020-03-052-295/+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.
* Introduce <elf-initfini.h> and ELF_INITFINI for all architecturesFlorian Weimer2020-02-181-0/+20
| | | | | | | | | | | | | | | | This supersedes the init_array sysdeps directory. It allows us to check for ELF_INITFINI in both C and assembler code, and skip DT_INIT and DT_FINI processing completely on newer architectures. A new header file is needed because <dl-machine.h> is incompatible with assembler code. <sysdep.h> is compatible with assembler code, but it cannot be included in all assembler files because on some architectures, it redefines register names, and some assembler files conflict with that. <elf-initfini.h> is replicated for legacy architectures which need DT_INIT/DT_FINI support. New architectures follow the generic default and disable it.
* S390: Fix non-ascii character in fenv.h.Stefan Liebler2020-02-121-2/+2
| | | | | | | | | | | | | | | | | The comment "isn't" contained a non-ascii character which leads to an error if compiled with -finput-charset=ascii: error: failure to convert ascii to UTF-8 This is observable in GCC testsuite: FAIL: 17_intro/headers/c++1998/charset.cc (test for excess errors) FAIL: 17_intro/headers/c++2011/charset.cc (test for excess errors) FAIL: 17_intro/headers/c++2014/charset.cc (test for excess errors) FAIL: 17_intro/headers/c++2017/charset.cc (test for excess errors) FAIL: 17_intro/headers/c++2020/charset.cc (test for excess errors) Also rewrite the comment above. Reported-by: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
* Add libm_alias_finite for _finite symbolsWilco Dijkstra2020-01-033-3/+6
| | | | | | | | | | | | | | | | | | | This patch adds a new macro, libm_alias_finite, to define all _finite symbol. It sets all _finite symbol as compat symbol based on its first version (obtained from the definition at built generated first-versions.h). The <fn>f128_finite symbols were introduced in GLIBC 2.26 and so need special treatment in code that is shared between long double and float128. It is done by adding a list, similar to internal symbol redifinition, on sysdeps/ieee754/float128/float128_private.h. Alpha also needs some tricky changes to ensure we still emit 2 compat symbols for sqrt(f). Passes buildmanyglibc. Co-authored-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* Update copyright dates with scripts/update-copyrights.Joseph Myers2020-01-01309-309/+309
|
* S390: Use sysdeps/ieee754/dbl-64/wordsize-64 on s390x.Stefan Liebler2019-12-111-0/+1
| | | | | This patch enables the usage of implementations in sysdeps/ieee754/dbl-64/wordsize-64 on 64bit s390x.
* S390: Implement roundtoint and converttoint and define TOINT_INTRINSICS.Stefan Liebler2019-12-111-0/+53
| | | | | | | This patch implements roundtoint and convertoint for s390 by using the load-fp-integer and convert-to-fixed instructions. Both functions are using "round to nearest with ties away from zero" rounding mode and do not raise inexact exceptions.
* S390: Implement math-barriers math_opt_barrier and math_force_eval.Stefan Liebler2019-12-111-0/+46
| | | | | This patch implements the s390 specific math barriers in order to omit the store and load from stack if possible.
* S390: Use libc_fe* macros in fe* functions.Stefan Liebler2019-12-119-124/+27
| | | | | | | | | | | This patch updates the s390 specific functions fegetround, fesetround, feholdexcept, fesetenv, feupdateenv, fegetexceptflag, fetestexcept, fesetexceptflag, fetestexceptflag. Now those functions are using the libc_fe* macros if possible. Furthermore fegetexceptflag is now returning the exception from dxc field shifted to the usual exception-flags. Thus a special fetestexceptflag implementation is not needed anymore.
* S390: Implement libc_fe* macros.Stefan Liebler2019-12-111-0/+250
| | | | | | | | This patch provides the s390 specific implementation for libc_feholdexcept, libc_fesetround, libc_feholdexcept_setround, libc_fetestexcept, libc_fesetenv, libc_feupdateenv_test, libc_feupdateenv, libc_feholdsetround_ctx, libc_feresetround_ctx, libc_feholdsetround_noex_ctx and libc_feresetround_noex_ctx.
* S390: Use convert-to-fixed instruction for llround functions.Stefan Liebler2019-12-113-0/+127
| | | | | | If compiled with z196 zarch support, the convert-to-fixed instruction is used to implement llround, llroundf, llroundl. Otherwise the common-code implementation is used.
* S390: Use convert-to-fixed instruction for lround functions.Stefan Liebler2019-12-113-0/+142
| | | | | | If compiled with z196 zarch support, the convert-to-fixed instruction is used to implement lround, lroundf, lroundl. Otherwise the common-code implementation is used.
* S390: Use convert-to-fixed instruction for llrint functions.Stefan Liebler2019-12-113-0/+151
| | | | | | If compiled with z196 zarch support, the convert-to-fixed instruction is used to implement llrint, llrintf, llrintl. Otherwise the common-code implementation is used.
* S390: Use convert-to-fixed instruction for lrint functions.Stefan Liebler2019-12-113-0/+166
| | | | | | If compiled with z196 zarch support, the convert-to-fixed instruction is used to implement lrint, lrintf, lrintl. Otherwise the common-code implementation is used.
* S390: Use load-fp-integer instruction for roundeven functions.Stefan Liebler2019-12-113-0/+116
| | | | | | If compiled with z196 zarch support, the load-fp-integer instruction is used to implement roundeven, roundevenf, roundevenl. Otherwise the common-code implementation is used.
* Use GCC builtins for copysign functions if desired.Stefan Liebler2019-12-111-0/+7
| | | | | | | | | | | | This patch is always using the corresponding GCC builtin for copysignf, copysign, and is using the builtin for copysignl, copysignf128 if the USE_FUNCTION_BUILTIN macros are defined to one in math-use-builtins.h. Altough the long double version is enabled by default we still need the macro and the alternative implementation as the _Float128 version of the builtin is not available with all supported GCC versions. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Use GCC builtins for round functions if desired.Stefan Liebler2019-12-111-0/+11
| | | | | | | | | | | | This patch is using the corresponding GCC builtin for roundf, round, roundl and roundf128 if the USE_FUNCTION_BUILTIN macros are defined to one in math-use-builtins.h. This is the case for s390 if build with at least --march=z196 --mzarch. Otherwise the generic implementation is used. The code of the generic implementation is not changed. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Use GCC builtins for trunc functions if desired.Stefan Liebler2019-12-111-0/+11
| | | | | | | | | | | | This patch is using the corresponding GCC builtin for truncf, trunc, truncl and truncf128 if the USE_FUNCTION_BUILTIN macros are defined to one in math-use-builtins.h. This is the case for s390 if build with at least --march=z196 --mzarch. Otherwise the generic implementation is used. The code of the generic implementation is not changed. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Use GCC builtins for ceil functions if desired.Stefan Liebler2019-12-111-0/+11
| | | | | | | | | | | | This patch is using the corresponding GCC builtin for ceilf, ceil, ceill and ceilf128 if the USE_FUNCTION_BUILTIN macros are defined to one in math-use-builtins.h. This is the case for s390 if build with at least --march=z196 --mzarch. Otherwise the generic implementation is used. The code of the generic implementation is not changed. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Use GCC builtins for floor functions if desired.Stefan Liebler2019-12-111-0/+11
| | | | | | | | | | | | This patch is using the corresponding GCC builtin for floorf, floor, floorl and floorf128 if the USE_FUNCTION_BUILTIN macros are defined to one in math-use-builtins.h. This is the case for s390 if build with at least --march=z196 --mzarch. Otherwise the generic implementation is used. The code of the generic implementation is not changed. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>