Commit Graph

15 Commits

Author SHA1 Message Date
Paul Eggert 581c785bf3 Update copyright dates with scripts/update-copyrights
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
2022-01-01 11:40:24 -08:00
H.J. Lu 6e30181b4a math: Properly cast X_TLOSS to float [BZ #28713]
Add

 #define AS_FLOAT_CONSTANT_1(x) x##f
 #define AS_FLOAT_CONSTANT(x) AS_FLOAT_CONSTANT_1(x)

to cast X_TLOSS to float at compile-time to fix:

FAIL: math/test-float-j0
FAIL: math/test-float-jn
FAIL: math/test-float-y0
FAIL: math/test-float-y1
FAIL: math/test-float-yn
FAIL: math/test-float32-j0
FAIL: math/test-float32-jn
FAIL: math/test-float32-y0
FAIL: math/test-float32-y1
FAIL: math/test-float32-yn

when compiling with GCC 12.

Reviewed-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
2021-12-23 06:45:47 -08:00
Siddhesh Poyarekar 30891f35fa Remove "Contributed by" lines
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>
2021-09-03 22:06:44 +05:30
Paul Eggert 2b778ceb40 Update copyright dates with scripts/update-copyrights
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
2021-01-02 12:17:34 -08:00
Joseph Myers d614a75396 Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
Paul Eggert 5a82c74822 Prefer https to http for gnu.org and fsf.org URLs
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
2019-09-07 02:43:31 -07:00
Joseph Myers 04277e02d7 Update copyright dates with scripts/update-copyrights.
* 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.
2019-01-01 00:11:28 +00:00
Joseph Myers 418d99e622 Move fenv.h soft-float inlines from fenv_private.h to include/fenv.h.
<fenv_private.h> has inline versions of various <fenv.h> functions,
and their __fe* variants, for systems (generally soft-float) without
support for floating-point exceptions, rounding modes or both.

Having these inlines in a separate header introduces a risk of a
source file including <fenv.h> and compiling OK on x86_64, but failing
to compile (because the feraiseexcept inline is actually a macro that
discards its argument, to avoid the need for #ifdef FE_INVALID
conditionals), or not being properly optimized, on systems without the
exceptions and rounding modes support (when these inlines were in
math_private.h, we had a few cases where this broke the build because
there was no obvious reason for a file to need math_private.h and it
didn't need that header on x86_64).  By moving those inlines to
include/fenv.h, this risk can be avoided, and fenv_private.h becomes
more clearly defined as specifically the header for the internal
libc_fe* and SET_RESTORE_ROUND* interfaces.

This patch makes that move, removing fenv_private.h includes that are
no longer needed (or replacing them by fenv.h includes in a few cases
that didn't already have such an include).

Tested for x86_64 and x86, and tested with build-many-glibcs.py that
installed stripped shared libraries are unchanged by the patch.

	* sysdeps/generic/fenv_private.h [FE_ALL_EXCEPT == 0]: Move this
	code ....
	[!FE_HAVE_ROUNDING_MODES]: And this code ....
	* include/fenv.h [!_ISOMAC]: ... to here.
	* math/fraiseexcpt.c (__feraiseexcept): Undefine as macro.
	(feraiseexcept): Likewise.
	* math/fromfp.h: Do not include <fenv_private.h>.
	* math/s_cexp_template.c: Likewise.
	* math/s_csin_template.c: Likewise.
	* math/s_csinh_template.c: Likewise.
	* math/s_ctan_template.c: Likewise.
	* math/s_ctanh_template.c: Likewise.
	* math/s_iseqsig_template.c: Likewise.
	* math/w_acos_compat.c: Likewise.
	* math/w_acosf_compat.c: Likewise.
	* math/w_acosl_compat.c: Likewise.
	* math/w_asin_compat.c: Likewise.
	* math/w_asinf_compat.c: Likewise.
	* math/w_asinl_compat.c: Likewise.
	* math/w_j0_compat.c: Likewise.
	* math/w_j0f_compat.c: Likewise.
	* math/w_j0l_compat.c: Likewise.
	* math/w_j1_compat.c: Likewise.
	* math/w_j1f_compat.c: Likewise.
	* math/w_j1l_compat.c: Likewise.
	* math/w_jn_compat.c: Likewise.
	* math/w_jnf_compat.c: Likewise.
	* math/w_log10_compat.c: Likewise.
	* math/w_log10f_compat.c: Likewise.
	* math/w_log10l_compat.c: Likewise.
	* math/w_log2_compat.c: Likewise.
	* math/w_log2f_compat.c: Likewise.
	* math/w_log2l_compat.c: Likewise.
	* math/w_log_compat.c: Likewise.
	* math/w_logf_compat.c: Likewise.
	* math/w_logl_compat.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_llrint.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_llround.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_lrint.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_lround.c: Likewise.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_lround.c: Likewise.
	* sysdeps/ieee754/flt-32/s_llrintf.c: Likewise.
	* sysdeps/ieee754/flt-32/s_llroundf.c: Likewise.
	* sysdeps/ieee754/flt-32/s_lrintf.c: Likewise.
	* sysdeps/ieee754/flt-32/s_lroundf.c: Likewise.
	* sysdeps/ieee754/k_standardl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/e_expl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_fmal.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_llrintl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_llroundl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_lrintl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_lroundl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_nearbyintl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_llrintl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_llroundl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_lrintl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_lroundl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_fma.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_fmal.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_llrintl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_llroundl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_lrintl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_lroundl.c: Likewise.
	* math/w_ilogb_template.c: Include <fenv.h> instead of
	<fenv_private.h>.
	* math/w_llogb_template.c: Likewise.
	* sysdeps/powerpc/fpu/e_sqrt.c: Likewise.
	* sysdeps/powerpc/fpu/e_sqrtf.c: Likewise.
2018-09-04 19:52:06 +00:00
Joseph Myers 70e2ba332f Do not include fenv_private.h in math_private.h.
Continuing the clean-up related to the catch-all math_private.h
header, this patch stops math_private.h from including fenv_private.h.
Instead, fenv_private.h is included directly from those users of
math_private.h that also used interfaces from fenv_private.h.  No
attempt is made to remove unused includes of math_private.h, but that
is a natural followup.

(However, since math_private.h sometimes defines optimized versions of
math.h interfaces or __* variants thereof, as well as defining its own
interfaces, I think it might make sense to get all those optimized
versions included from include/math.h, not requiring a separate header
at all, before eliminating unused math_private.h includes - that
avoids a file quietly becoming less-optimized if someone adds a call
to one of those interfaces without restoring a math_private.h include
to that file.)

There is still a pitfall that if code uses plain fe* and __fe*
interfaces, but only includes fenv.h and not fenv_private.h or (before
this patch) math_private.h, it will compile on platforms with
exceptions and rounding modes but not get the optimized versions (and
possibly not compile) on platforms without exception and rounding mode
support, so making it easy to break the build for such platforms
accidentally.

I think it would be most natural to move the inlines / macros for fe*
and __fe* in the case of no exceptions and rounding modes into
include/fenv.h, so that all code including fenv.h with _ISOMAC not
defined automatically gets them.  Then fenv_private.h would be purely
the header for the libc_fe*, SET_RESTORE_ROUND etc. internal
interfaces and the risk of breaking the build on other platforms than
the one you tested on because of a missing fenv_private.h include
would be much reduced (and there would be some unused fenv_private.h
includes to remove along with unused math_private.h includes).

Tested for x86_64 and x86, and tested with build-many-glibcs.py that
installed stripped shared libraries are unchanged by this patch.

	* sysdeps/generic/math_private.h: Do not include <fenv_private.h>.
	* math/fromfp.h: Include <fenv_private.h>.
	* math/math-narrow.h: Likewise.
	* math/s_cexp_template.c: Likewise.
	* math/s_csin_template.c: Likewise.
	* math/s_csinh_template.c: Likewise.
	* math/s_ctan_template.c: Likewise.
	* math/s_ctanh_template.c: Likewise.
	* math/s_iseqsig_template.c: Likewise.
	* math/w_acos_compat.c: Likewise.
	* math/w_acosf_compat.c: Likewise.
	* math/w_acosl_compat.c: Likewise.
	* math/w_asin_compat.c: Likewise.
	* math/w_asinf_compat.c: Likewise.
	* math/w_asinl_compat.c: Likewise.
	* math/w_ilogb_template.c: Likewise.
	* math/w_j0_compat.c: Likewise.
	* math/w_j0f_compat.c: Likewise.
	* math/w_j0l_compat.c: Likewise.
	* math/w_j1_compat.c: Likewise.
	* math/w_j1f_compat.c: Likewise.
	* math/w_j1l_compat.c: Likewise.
	* math/w_jn_compat.c: Likewise.
	* math/w_jnf_compat.c: Likewise.
	* math/w_llogb_template.c: Likewise.
	* math/w_log10_compat.c: Likewise.
	* math/w_log10f_compat.c: Likewise.
	* math/w_log10l_compat.c: Likewise.
	* math/w_log2_compat.c: Likewise.
	* math/w_log2f_compat.c: Likewise.
	* math/w_log2l_compat.c: Likewise.
	* math/w_log_compat.c: Likewise.
	* math/w_logf_compat.c: Likewise.
	* math/w_logl_compat.c: Likewise.
	* sysdeps/aarch64/fpu/feholdexcpt.c: Likewise.
	* sysdeps/aarch64/fpu/fesetround.c: Likewise.
	* sysdeps/aarch64/fpu/fgetexcptflg.c: Likewise.
	* sysdeps/aarch64/fpu/ftestexcept.c: Likewise.
	* sysdeps/ieee754/dbl-64/e_atan2.c: Likewise.
	* sysdeps/ieee754/dbl-64/e_exp.c: Likewise.
	* sysdeps/ieee754/dbl-64/e_exp2.c: Likewise.
	* sysdeps/ieee754/dbl-64/e_gamma_r.c: Likewise.
	* sysdeps/ieee754/dbl-64/e_jn.c: Likewise.
	* sysdeps/ieee754/dbl-64/e_pow.c: Likewise.
	* sysdeps/ieee754/dbl-64/e_remainder.c: Likewise.
	* sysdeps/ieee754/dbl-64/e_sqrt.c: Likewise.
	* sysdeps/ieee754/dbl-64/gamma_product.c: Likewise.
	* sysdeps/ieee754/dbl-64/lgamma_neg.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_atan.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_fma.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_fmaf.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_llrint.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_llround.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_lrint.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_lround.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_nearbyint.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_sin.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_sincos.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_tan.c: Likewise.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_lround.c: Likewise.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_nearbyint.c: Likewise.
	* sysdeps/ieee754/dbl-64/x2y2m1.c: Likewise.
	* sysdeps/ieee754/float128/float128_private.h: Likewise.
	* sysdeps/ieee754/flt-32/e_gammaf_r.c: Likewise.
	* sysdeps/ieee754/flt-32/e_j1f.c: Likewise.
	* sysdeps/ieee754/flt-32/e_jnf.c: Likewise.
	* sysdeps/ieee754/flt-32/lgamma_negf.c: Likewise.
	* sysdeps/ieee754/flt-32/s_llrintf.c: Likewise.
	* sysdeps/ieee754/flt-32/s_llroundf.c: Likewise.
	* sysdeps/ieee754/flt-32/s_lrintf.c: Likewise.
	* sysdeps/ieee754/flt-32/s_lroundf.c: Likewise.
	* sysdeps/ieee754/flt-32/s_nearbyintf.c: Likewise.
	* sysdeps/ieee754/k_standardl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/e_expl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/e_gammal_r.c: Likewise.
	* sysdeps/ieee754/ldbl-128/e_j1l.c: Likewise.
	* sysdeps/ieee754/ldbl-128/e_jnl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/gamma_productl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/lgamma_negl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_fmal.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_llrintl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_llroundl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_lrintl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_lroundl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_nearbyintl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/x2y2m1l.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_expl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_j1l.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_jnl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/lgamma_negl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_fmal.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_llrintl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_llroundl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_lrintl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_lroundl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_rintl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/x2y2m1l.c: Likewise.
	* sysdeps/ieee754/ldbl-96/e_gammal_r.c: Likewise.
	* sysdeps/ieee754/ldbl-96/e_jnl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/gamma_productl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/lgamma_negl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_fma.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_fmal.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_llrintl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_llroundl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_lrintl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_lroundl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/x2y2m1l.c: Likewise.
	* sysdeps/powerpc/fpu/e_sqrt.c: Likewise.
	* sysdeps/powerpc/fpu/e_sqrtf.c: Likewise.
	* sysdeps/riscv/rv64/rvd/s_ceil.c: Likewise.
	* sysdeps/riscv/rv64/rvd/s_floor.c: Likewise.
	* sysdeps/riscv/rv64/rvd/s_nearbyint.c: Likewise.
	* sysdeps/riscv/rv64/rvd/s_round.c: Likewise.
	* sysdeps/riscv/rv64/rvd/s_roundeven.c: Likewise.
	* sysdeps/riscv/rv64/rvd/s_trunc.c: Likewise.
	* sysdeps/riscv/rvd/s_finite.c: Likewise.
	* sysdeps/riscv/rvd/s_fmax.c: Likewise.
	* sysdeps/riscv/rvd/s_fmin.c: Likewise.
	* sysdeps/riscv/rvd/s_fpclassify.c: Likewise.
	* sysdeps/riscv/rvd/s_isinf.c: Likewise.
	* sysdeps/riscv/rvd/s_isnan.c: Likewise.
	* sysdeps/riscv/rvd/s_issignaling.c: Likewise.
	* sysdeps/riscv/rvf/fegetround.c: Likewise.
	* sysdeps/riscv/rvf/feholdexcpt.c: Likewise.
	* sysdeps/riscv/rvf/fesetenv.c: Likewise.
	* sysdeps/riscv/rvf/fesetround.c: Likewise.
	* sysdeps/riscv/rvf/feupdateenv.c: Likewise.
	* sysdeps/riscv/rvf/fgetexcptflg.c: Likewise.
	* sysdeps/riscv/rvf/ftestexcept.c: Likewise.
	* sysdeps/riscv/rvf/s_ceilf.c: Likewise.
	* sysdeps/riscv/rvf/s_finitef.c: Likewise.
	* sysdeps/riscv/rvf/s_floorf.c: Likewise.
	* sysdeps/riscv/rvf/s_fmaxf.c: Likewise.
	* sysdeps/riscv/rvf/s_fminf.c: Likewise.
	* sysdeps/riscv/rvf/s_fpclassifyf.c: Likewise.
	* sysdeps/riscv/rvf/s_isinff.c: Likewise.
	* sysdeps/riscv/rvf/s_isnanf.c: Likewise.
	* sysdeps/riscv/rvf/s_issignalingf.c: Likewise.
	* sysdeps/riscv/rvf/s_nearbyintf.c: Likewise.
	* sysdeps/riscv/rvf/s_roundevenf.c: Likewise.
	* sysdeps/riscv/rvf/s_roundf.c: Likewise.
	* sysdeps/riscv/rvf/s_truncf.c: Likewise.
2018-09-03 21:09:04 +00:00
Joseph Myers 688903eb3e Update copyright dates with scripts/update-copyrights.
* 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.
2018-01-01 00:32:25 +00:00
Joseph Myers 5bcdb31529 Use libm_alias_float in math/.
This patch converts libm function implementations in math/ from using
weak_alias to using libm_alias_float to define public function names,
in cases where it would be appropriate to define _Float32 aliases for
those functions as well.  expf and exp2f are omitted from this patch,
given the in-progress patches that would change their symbol
versioning arrangements (at a later stage it will be necessary to add
macros that can be used for functions with such symbol versioning
arrangements - which will apply to lgammaf as well - but for the
initial patches in this area I'm just dealing with easy cases, and any
symbol versioning changes to these functions while the work is in
progress can effectively just undo the libm_alias_* changes as regards
those functions).

Tested for x86_64.  Also tested with build-many-glibcs.py that
installed stripped shared libraries are unchanged by the patch.

	* math/s_fmaf.c: Include <libm-alias-float.h>.
	(fmaf): Define using libm_alias_float.
	* math/w_acosf_compat.c: Include <libm-alias-float.h>.
	(acosf): Define using libm_alias_float.
	* math/w_acoshf_compat.c: Include <libm-alias-float.h>.
	(acoshf): Define using libm_alias_float.
	* math/w_asinf_compat.c: Include <libm-alias-float.h>.
	(asinf): Define using libm_alias_float.
	* math/w_atan2f_compat.c: Include <libm-alias-float.h>.
	(atan2f): Define using libm_alias_float.
	* math/w_atanhf_compat.c: Include <libm-alias-float.h>.
	(atanhf): Define using libm_alias_float.
	* math/w_coshf_compat.c: Include <libm-alias-float.h>.
	(coshf): Define using libm_alias_float.
	* math/w_exp10f_compat.c: Include <libm-alias-float.h>.
	(exp10f): Define using libm_alias_float.
	* math/w_fmodf_compat.c: Include <libm-alias-float.h>.
	(fmodf): Define using libm_alias_float.
	* math/w_hypotf_compat.c: Include <libm-alias-float.h>.
	(hypotf): Define using libm_alias_float.
	* math/w_j0f_compat.c: Include <libm-alias-float.h>.
	(j0f): Define using libm_alias_float.
	(y0f): Likewise.
	* math/w_j1f_compat.c: Include <libm-alias-float.h>.
	(j1f): Define using libm_alias_float.
	(y1f): Likewise.
	* math/w_jnf_compat.c: Include <libm-alias-float.h>.
	(jnf): Define using libm_alias_float.
	(ynf): Likewise.
	* math/w_log10f_compat.c: Include <libm-alias-float.h>.
	(log10f): Define using libm_alias_float.
	* math/w_log2f_compat.c: Include <libm-alias-float.h>.
	(log2f): Define using libm_alias_float.
	* math/w_logf_compat.c: Include <libm-alias-float.h>.
	(logf): Define using libm_alias_float.
	* math/w_powf_compat.c: Include <libm-alias-float.h>.
	(powf): Define using libm_alias_float.
	* math/w_remainderf_compat.c: Include <libm-alias-float.h>.
	(remainderf): Define using libm_alias_float.
	* math/w_sinhf_compat.c: Include <libm-alias-float.h>.
	(sinhf): Define using libm_alias_float.
	* math/w_sqrtf_compat.c: Include <libm-alias-float.h>.
	(sqrtf): Define using libm_alias_float.
	* math/w_tgammaf_compat.c: Include <libm-alias-float.h>.
	(tgammaf): Define using libm_alias_float.
2017-09-15 17:12:02 +00:00
Joseph Myers 01f2881245 Make more libm functions into weak aliases.
Many libm functions define the function as __<func> and then define
<func> as a weak alias.  This is not at all limited to cases where
there is an internal call that has namespace reasons to need to call
__<func> instead of <func>.

The common macros for creating libm function aliases work on the basis
of public function names all being aliases; that is, they define
aliases for functions using the above pattern.  Thus, where a function
just defines the public name <func> directly, changing that to be a
weak alias enables a subsequent conversion to the common macros to
retain the exact existing symbols (and so be testable by comparison of
stripped binaries).

This patch converts many existing functions to use the weak alias
pattern, as preparation for subsequent conversions to common macros.
I do expect that _FloatN/_FloatNx function aliases will end up needing
new variants of the common macros that do *not* create the original
float / double / long double name of a function - for cases where that
name is created specially to give it a particular symbol version, for
example - but for functions that can use the most common macros to
create all the public names as aliases, it makes sense for them to do
so.

Regarding the Bessel function wrappers in this patch: only float and
double wrappers are changed because the long double wrappers already
used the weak alias pattern.

Tested for x86_64, and with build-many-glibcs.py.

	* include/math.h (roundeven): Change hidden_proto call to
	__roundeven.
	* math/w_j0_compat.c (j0): Rename to __j0 and define as weak
	alias.
	[NO_LONG_DOUBLE] (__j0l): New strong alias.
	(y0): Rename to __y0 and define as weak alias.
	[NO_LONG_DOUBLE] (__y0l): New strong alias.
	* math/w_j0f_compat.c (j0f): Rename to __j0f and define as weak
	alias.
	(y0f): Rename to __y0f and define as weak alias.
	* math/w_j1_compat.c (j1): Rename to __j1 and define as weak
	alias.
	[NO_LONG_DOUBLE] (__j1l): New strong alias.
	(y1): Rename to __y1 and define as weak alias.
	[NO_LONG_DOUBLE] (__y1l): New strong alias.
	* math/w_j1f_compat.c (j1f): Rename to __j1f and define as weak
	alias.
	(y1f): Rename to __y1f and define as weak alias.
	* math/w_jn_compat.c (jn): Rename to __jn and define as weak
	alias.
	[NO_LONG_DOUBLE] (__jnl): New strong alias.
	(yn): Rename to __yn and define as weak alias.
	[NO_LONG_DOUBLE] (__ynl): New strong alias.
	* math/w_jnf_compat.c (jnf): Rename to __jnf and define as weak
	alias.
	(ynf): Rename to __ynf and define as weak alias.
	* sysdeps/ieee754/dbl-64/s_fromfp.c (FUNC): Define to __fromfp.
	(fromfp): Define as weak alias.
	[NO_LONG_DOUBLE] (__fromfpl): New strong alias.
	* sysdeps/ieee754/dbl-64/s_fromfpx.c (FUNC): Define to __fromfpx.
	(fromfpx): Define as weak alias.
	[NO_LONG_DOUBLE] (__fromfpxl): New strong alias.
	* sysdeps/ieee754/dbl-64/s_getpayload.c (getpayload): Rename to
	__getpayload and define as weak alias.
	[NO_LONG_DOUBLE] (__getpayloadl): New strong alias.
	* sysdeps/ieee754/dbl-64/s_roundeven.c (roundeven): Rename to
	__roundeven and define as weak alias.
	[NO_LONG_DOUBLE] (__roundevenl): New strong alias.
	* sysdeps/ieee754/dbl-64/s_setpayload.c (FUNC): Define to
	__setpayload.
	(setpayload): Define as weak alias.
	[NO_LONG_DOUBLE] (__setpayloadl): New strong alias.
	* sysdeps/ieee754/dbl-64/s_setpayloadsig.c (FUNC): Define to
	__setpayloadsig.
	(setpayloadsig): Define as weak alias.
	[NO_LONG_DOUBLE] (__setpayloadsigl): New strong alias.
	* sysdeps/ieee754/dbl-64/s_totalorder.c (totalorder): Rename to
	__totalorder and define as weak alias.
	[NO_LONG_DOUBLE] (__totalorderl): New strong alias.
	* sysdeps/ieee754/dbl-64/s_totalordermag.c (totalordermag): Rename
	to __totalordermag and define as weak alias.
	[NO_LONG_DOUBLE] (__totalordermagl): New strong alias.
	* sysdeps/ieee754/dbl-64/s_ufromfp.c (FUNC): Define to __ufromfp.
	(ufromfp): Define as weak alias.
	[NO_LONG_DOUBLE] (__ufromfpl): New strong alias.
	* sysdeps/ieee754/dbl-64/s_ufromfpx.c (FUNC): Define to
	__ufromfpx.
	(ufromfpx): Define as weak alias.
	[NO_LONG_DOUBLE] (__ufromfpxl): New strong alias.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_getpayload.c (getpayload):
	Rename to __getpayload and define as weak alias.
	[NO_LONG_DOUBLE] (__getpayloadl): New strong alias.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_roundeven.c (roundeven):
	Rename to __roundeven and define as weak alias.
	[NO_LONG_DOUBLE] (__roundevenl): New strong alias.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_totalorder.c (totalorder):
	Rename to __totalorder and define as weak alias.
	[NO_LONG_DOUBLE] (__totalorderl): New strong alias.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_totalordermag.c
	(totalordermag): Rename to __totalordermag and define as weak
	alias.
	[NO_LONG_DOUBLE] (__totalordermagl): New strong alias.
	* sysdeps/ieee754/float128/float128_private.h (__getpayloadl): New
	macro.
	(__roundevenl): Likewise.
	(__totalorderl): Likewise.
	(__totalordermagl): Likewise
	* sysdeps/ieee754/float128/s_fromfpf128.c (FUNC): Define to
	__fromfpf128.
	(fromfpf128): Define as weak alias.
	* sysdeps/ieee754/float128/s_fromfpxf128.c (FUNC): Define to
	__fromfpxf128.
	(fromfpxf128): Define as weak alias.
	* sysdeps/ieee754/float128/s_setpayloadf128.c (FUNC): Define to
	__setpayloadf128.
	(setpayloadf128): Define as weak alias.
	* sysdeps/ieee754/float128/s_setpayloadsigf128.c (FUNC): Define to
	__setpayloadsigf128.
	(setpayloadsigf128): Define as weak alias.
	* sysdeps/ieee754/float128/s_ufromfpf128.c (FUNC): Define to
	__ufromfpf128.
	(ufromfpf128): Define as weak alias.
	* sysdeps/ieee754/float128/s_ufromfpxf128.c (FUNC): Define to
	__ufromfpxf128.
	(ufromfpxf128): Define as weak alias.
	* sysdeps/ieee754/flt-32/s_fromfpf.c (FUNC): Define to __fromfpf.
	(fromfpf): Define as weak alias.
	* sysdeps/ieee754/flt-32/s_fromfpxf.c (FUNC): Define to
	__fromfpxf.
	(fromfpxf): Define as weak alias.
	* sysdeps/ieee754/flt-32/s_getpayloadf.c (getpayloadf): Rename to
	__getpayloadf and define as weak alias.
	* sysdeps/ieee754/flt-32/s_roundevenf.c (roundevenf): Rename to
	__roundevenf and define as weak alias.
	* sysdeps/ieee754/flt-32/s_setpayloadf.c (FUNC): Define to
	__setpayloadf.
	(setpayloadf): Define as weak alias.
	* sysdeps/ieee754/flt-32/s_setpayloadsigf.c (FUNC): Define to
	__setpayloadsigf.
	(setpayloadsigf): Define as weak alias.
	* sysdeps/ieee754/flt-32/s_totalorderf.c (totalorderf): Rename to
	__totalorderf and define as weak alias.
	* sysdeps/ieee754/flt-32/s_totalordermagf.c (totalordermagf):
	Rename to __totalordermagf and define as weak alias.
	* sysdeps/ieee754/flt-32/s_ufromfpf.c (FUNC): Define to
	__ufromfpf.
	(ufromfpf): Define as weak alias.
	* sysdeps/ieee754/flt-32/s_ufromfpxf.c (FUNC): Define to
	__ufromfpxf.
	(ufromfpxf): Define as weak alias.
	* sysdeps/ieee754/ldbl-128/s_fromfpl.c (FUNC): Define to
	__fromfpl.
	(fromfpl): Define as weak alias.
	* sysdeps/ieee754/ldbl-128/s_fromfpxl.c (FUNC): Define to
	__fromfpxl.
	(fromfpxl): Define as weak alias.
	* sysdeps/ieee754/ldbl-128/s_getpayloadl.c (getpayloadl): Rename
	to __getpayloadl and define as weak alias.
	* sysdeps/ieee754/ldbl-128/s_roundevenl.c (roundevenl): Rename to
	__roundevenl and define as weak alias.
	* sysdeps/ieee754/ldbl-128/s_setpayloadl.c (FUNC): Define to
	__setpayloadl.
	(setpayloadl): Define as weak alias.
	* sysdeps/ieee754/ldbl-128/s_setpayloadsigl.c (FUNC): Define to
	__setpayloadsigl.
	(setpayloadsigl): Define as weak alias.
	* sysdeps/ieee754/ldbl-128/s_totalorderl.c (totalorderl): Rename
	to __totalorderl and define as weak alias.
	* sysdeps/ieee754/ldbl-128/s_totalordermagl.c (totalordermagl):
	Rename to __totalordermagl and define as weak alias.
	* sysdeps/ieee754/ldbl-128/s_ufromfpl.c (FUNC): Define to
	__ufromfpl.
	(ufromfpl): Define as weak alias.
	* sysdeps/ieee754/ldbl-128/s_ufromfpxl.c (FUNC): Define to
	__ufromfpxl.
	(ufromfpxl): Define as weak alias.
	* sysdeps/ieee754/ldbl-128ibm/s_fromfpl.c (FUNC): Define to
	__fromfpl.
	(fromfpl): Define as weak alias.
	* sysdeps/ieee754/ldbl-128ibm/s_fromfpxl.c (FUNC): Define to
	__fromfpxl.
	(fromfpxl): Define as weak alias.
	* sysdeps/ieee754/ldbl-128ibm/s_getpayloadl.c (getpayloadl):
	Rename to __getpayloadl and define as weak alias.
	* sysdeps/ieee754/ldbl-128ibm/s_roundevenl.c (roundevenl): Rename
	to __roundevenl and define as weak alias.  Call __roundeven
	instead of roundeven.
	* sysdeps/ieee754/ldbl-128ibm/s_setpayloadl.c (FUNC): Define to
	__setpayloadl.
	(setpayloadl): Define as weak alias.
	* sysdeps/ieee754/ldbl-128ibm/s_setpayloadsigl.c (FUNC): Define to
	__setpayloadsigl.
	(setpayloadsigl): Define as weak alias.
	* sysdeps/ieee754/ldbl-128ibm/s_totalorderl.c (totalorderl):
	Rename to __totalorderl and define as weak alias.
	* sysdeps/ieee754/ldbl-128ibm/s_totalordermagl.c (totalordermagl):
	Rename to __totalordermagl and define as weak alias.
	* sysdeps/ieee754/ldbl-128ibm/s_ufromfpl.c (FUNC): Define to
	__ufromfpl.
	(ufromfpl): Define as weak alias.
	* sysdeps/ieee754/ldbl-128ibm/s_ufromfpxl.c (FUNC): Define to
	__ufromfpxl.
	(ufromfpxl): Define as weak alias.
	* sysdeps/ieee754/ldbl-96/s_fromfpl.c (FUNC): Define to
	__fromfpl.
	(fromfpl): Define as weak alias.
	* sysdeps/ieee754/ldbl-96/s_fromfpxl.c (FUNC): Define to
	__fromfpxl.
	(fromfpxl): Define as weak alias.
	* sysdeps/ieee754/ldbl-96/s_getpayloadl.c (getpayloadl): Rename to
	__getpayloadl and define as weak alias.
	* sysdeps/ieee754/ldbl-96/s_roundevenl.c (roundevenl): Rename to
	__roundevenl and define as weak alias.
	* sysdeps/ieee754/ldbl-96/s_setpayloadl.c (FUNC): Define to
	__setpayloadl.
	(setpayloadl): Define as weak alias.
	* sysdeps/ieee754/ldbl-96/s_setpayloadsigl.c (FUNC): Define to
	__setpayloadsigl.
	(setpayloadsigl): Define as weak alias.
	* sysdeps/ieee754/ldbl-96/s_totalorderl.c (totalorderl): Rename to
	__totalorderl and define as weak alias.
	* sysdeps/ieee754/ldbl-96/s_totalordermagl.c (totalordermagl):
	Rename to __totalordermagl and define as weak alias.
	* sysdeps/ieee754/ldbl-96/s_ufromfpl.c (FUNC): Define to
	__ufromfpl.
	(ufromfpl): Define as weak alias.
	* sysdeps/ieee754/ldbl-96/s_ufromfpxl.c (FUNC): Define to
	__ufromfpxl.
	(ufromfpxl): Define as weak alias.
2017-09-14 22:28:53 +00:00
Joseph Myers 4f3647e46e Prefer new libm function wrappers for !LIBM_SVID_COMPAT.
The initial obsoletion of SVID libm error handling left the old
wrappers and __kernel_standard still being used for new ports and
static linking, just with macro definitions of _LIB_VERSION and
matherr that meant symbols with those names were never actually used
and the code for different error handling variants could be optimized
out.

This patch cleans things up further by eliminating the
__kernel_standard use for new ports and static linking.  Now, the old
wrappers no longer generate any code in the !LIBM_SVID_COMPAT case,
while the new errno-only wrappers that were added for float128 support
are now also used for float, double and long double in that case.

The changes are generally straightforward.  The w_scalb*_compat
wrappers continue to be used (scalb is obsolescent in the sense of not
being supported for float128, but is present in supported standards -
the 2001 edition of POSIX and earlier XSI versions - so remains
supported for static linking and new ports, as do the float and long
double variants that are existing GNU extensions).  Those wrappers
would only call __kernel_standard in the _LIB_VERSION == _SVID_ case.
Since we would like to be able to compile most of glibc without
optimization, relying on a static function whose only use is under an
if (0) condition being optimized away to avoid an undefined
__kernel_standard reference may not be a good idea.  Thus, the
relevant code in the scalb wrappers has LIBM_SVID_COMPAT conditionals
added to guarantee it's not built at all in the case where
__kernel_standard does not exist.

Just as i386 has its own w_sqrt_compat.c, so w_sqrt.c is also added.
ia64 gets dummy w_*.c to prevent those files being built where they
would conflict with the ia64 libm, as with its existing w_*_compat.c.

Conditions disabling code for !LIBM_SVID_COMPAT are needed in both the
math/ wrappers and in the long double wrappers in ldbl-opt (to avoid
them setting up aliases and symbol versions for undefined symbols).  I
hope that future cleanups to how libm function aliases and symbol
versioning are done will eliminate the need for most of the ldbl-opt
wrappers.

Tested for x86_64 and x86, and with build-many-glibcs.py.

	* sysdeps/generic/math-type-macros-double.h: Include
	<math-svid-compat.h>.
	(__USE_WRAPPER_TEMPLATE): Define to !LIBM_SVID_COMPAT.
	* sysdeps/generic/math-type-macros-float.h: Include
	<math-svid-compat.h>.
	(__USE_WRAPPER_TEMPLATE): Define to !LIBM_SVID_COMPAT.
	* sysdeps/generic/math-type-macros-ldouble.h: Include
	<math-svid-compat.h>.
	(__USE_WRAPPER_TEMPLATE): Define to !LIBM_SVID_COMPAT.
	* math/lgamma-compat.h (BUILD_LGAMMA): Include LIBM_SVID_COMPAT
	condition.
	* math/w_acos_compat.c: Condition contents on [LIBM_SVID_COMPAT].
	* math/w_acosf_compat.c: Likewise.
	* math/w_acosh_compat.c: Likewise.
	* math/w_acoshf_compat.c: Likewise.
	* math/w_acoshl_compat.c: Likewise.
	* math/w_acosl_compat.c: Likewise.
	* math/w_asin_compat.c: Likewise.
	* math/w_asinf_compat.c: Likewise.
	* math/w_asinl_compat.c: Likewise.
	* math/w_atan2_compat.c: Likewise.
	* math/w_atan2f_compat.c: Likewise.
	* math/w_atan2l_compat.c: Likewise.
	* math/w_atanh_compat.c: Likewise.
	* math/w_atanhf_compat.c: Likewise.
	* math/w_atanhl_compat.c: Likewise.
	* math/w_cosh_compat.c: Likewise.
	* math/w_coshf_compat.c: Likewise.
	* math/w_coshl_compat.c: Likewise.
	* math/w_exp10_compat.c: Likewise.
	* math/w_exp10f_compat.c: Likewise.
	* math/w_exp10l_compat.c: Likewise.
	* math/w_exp2_compat.c: Likewise.
	* math/w_exp2f_compat.c: Likewise.
	* math/w_exp2l_compat.c: Likewise.
	* math/w_fmod_compat.c: Likewise.
	* math/w_fmodf_compat.c: Likewise.
	* math/w_fmodl_compat.c: Likewise.
	* math/w_hypot_compat.c: Likewise.
	* math/w_hypotf_compat.c: Likewise.
	* math/w_hypotl_compat.c: Likewise.
	* math/w_j0_compat.c: Likewise.
	* math/w_j0f_compat.c: Likewise.
	* math/w_j0l_compat.c: Likewise.
	* math/w_j1_compat.c: Likewise.
	* math/w_j1f_compat.c: Likewise.
	* math/w_j1l_compat.c: Likewise.
	* math/w_jn_compat.c: Likewise.
	* math/w_jnf_compat.c: Likewise.
	* math/w_jnl_compat.c: Likewise.
	* math/w_lgamma_r_compat.c: Likewise.
	* math/w_lgammaf_r_compat.c: Likewise.
	* math/w_lgammal_r_compat.c: Likewise.
	* math/w_log10_compat.c: Likewise.
	* math/w_log10f_compat.c: Likewise.
	* math/w_log10l_compat.c: Likewise.
	* math/w_log2_compat.c: Likewise.
	* math/w_log2f_compat.c: Likewise.
	* math/w_log2l_compat.c: Likewise.
	* math/w_log_compat.c: Likewise.
	* math/w_logf_compat.c: Likewise.
	* math/w_logl_compat.c: Likewise.
	* math/w_pow_compat.c: Likewise.
	* math/w_powf_compat.c: Likewise.
	* math/w_powl_compat.c: Likewise.
	* math/w_remainder_compat.c: Likewise.
	* math/w_remainderf_compat.c: Likewise.
	* math/w_remainderl_compat.c: Likewise.
	* math/w_sinh_compat.c: Likewise.
	* math/w_sinhf_compat.c: Likewise.
	* math/w_sinhl_compat.c: Likewise.
	* math/w_sqrt_compat.c: Likewise.
	* math/w_sqrtf_compat.c: Likewise.
	* math/w_sqrtl_compat.c: Likewise.
	* math/w_tgamma_compat.c: Likewise.
	* math/w_tgammaf_compat.c: Likewise.
	* math/w_tgammal_compat.c: Likewise.
	* math/w_scalb_compat.c (sysv_scalb): Condition definition on
	[LIBM_SVID_COMPAT].
	(__scalb): Condition call to sysv_scalb on [LIBM_SVID_COMPAT].
	* math/w_scalbf_compat.c (sysv_scalbf): Condition definition on
	[LIBM_SVID_COMPAT].
	(__scalbf): Condition call to sysv_scalbf on [LIBM_SVID_COMPAT].
	* math/w_scalbl_compat.c (sysv_scalbl): Condition definition on
	[LIBM_SVID_COMPAT].
	(__scalbl): Condition call to sysv_scalbl on [LIBM_SVID_COMPAT].
	* sysdeps/i386/fpu/w_sqrt.c: New file.
	* sysdeps/ia64/fpu/w_acos.c: Likewise.
	* sysdeps/ia64/fpu/w_acosf.c: Likewise.
	* sysdeps/ia64/fpu/w_acosh.c: Likewise.
	* sysdeps/ia64/fpu/w_acoshf.c: Likewise.
	* sysdeps/ia64/fpu/w_acoshl.c: Likewise.
	* sysdeps/ia64/fpu/w_acosl.c: Likewise.
	* sysdeps/ia64/fpu/w_asin.c: Likewise.
	* sysdeps/ia64/fpu/w_asinf.c: Likewise.
	* sysdeps/ia64/fpu/w_asinl.c: Likewise.
	* sysdeps/ia64/fpu/w_atan2.c: Likewise.
	* sysdeps/ia64/fpu/w_atan2f.c: Likewise.
	* sysdeps/ia64/fpu/w_atan2l.c: Likewise.
	* sysdeps/ia64/fpu/w_atanh.c: Likewise.
	* sysdeps/ia64/fpu/w_atanhf.c: Likewise.
	* sysdeps/ia64/fpu/w_atanhl.c: Likewise.
	* sysdeps/ia64/fpu/w_cosh.c: Likewise.
	* sysdeps/ia64/fpu/w_coshf.c: Likewise.
	* sysdeps/ia64/fpu/w_coshl.c: Likewise.
	* sysdeps/ia64/fpu/w_exp.c: Likewise.
	* sysdeps/ia64/fpu/w_exp10.c: Likewise.
	* sysdeps/ia64/fpu/w_exp10f.c: Likewise.
	* sysdeps/ia64/fpu/w_exp10l.c: Likewise.
	* sysdeps/ia64/fpu/w_exp2.c: Likewise.
	* sysdeps/ia64/fpu/w_exp2f.c: Likewise.
	* sysdeps/ia64/fpu/w_exp2l.c: Likewise.
	* sysdeps/ia64/fpu/w_expf.c: Likewise.
	* sysdeps/ia64/fpu/w_expl.c: Likewise.
	* sysdeps/ia64/fpu/w_fmod.c: Likewise.
	* sysdeps/ia64/fpu/w_fmodf.c: Likewise.
	* sysdeps/ia64/fpu/w_fmodl.c: Likewise.
	* sysdeps/ia64/fpu/w_hypot.c: Likewise.
	* sysdeps/ia64/fpu/w_hypotf.c: Likewise.
	* sysdeps/ia64/fpu/w_hypotl.c: Likewise.
	* sysdeps/ia64/fpu/w_lgamma_r.c: Likewise.
	* sysdeps/ia64/fpu/w_lgammaf_r.c: Likewise.
	* sysdeps/ia64/fpu/w_lgammal_r.c: Likewise.
	* sysdeps/ia64/fpu/w_log.c: Likewise.
	* sysdeps/ia64/fpu/w_log10.c: Likewise.
	* sysdeps/ia64/fpu/w_log10f.c: Likewise.
	* sysdeps/ia64/fpu/w_log10l.c: Likewise.
	* sysdeps/ia64/fpu/w_log2.c: Likewise.
	* sysdeps/ia64/fpu/w_log2f.c: Likewise.
	* sysdeps/ia64/fpu/w_log2l.c: Likewise.
	* sysdeps/ia64/fpu/w_logf.c: Likewise.
	* sysdeps/ia64/fpu/w_logl.c: Likewise.
	* sysdeps/ia64/fpu/w_pow.c: Likewise.
	* sysdeps/ia64/fpu/w_powf.c: Likewise.
	* sysdeps/ia64/fpu/w_powl.c: Likewise.
	* sysdeps/ia64/fpu/w_remainder.c: Likewise.
	* sysdeps/ia64/fpu/w_remainderf.c: Likewise.
	* sysdeps/ia64/fpu/w_remainderl.c: Likewise.
	* sysdeps/ia64/fpu/w_sinh.c: Likewise.
	* sysdeps/ia64/fpu/w_sinhf.c: Likewise.
	* sysdeps/ia64/fpu/w_sinhl.c: Likewise.
	* sysdeps/ia64/fpu/w_sqrt.c: Likewise.
	* sysdeps/ia64/fpu/w_sqrtf.c: Likewise.
	* sysdeps/ia64/fpu/w_sqrtl.c: Likewise.
	* sysdeps/ia64/fpu/w_tgamma.c: Likewise.
	* sysdeps/ia64/fpu/w_tgammaf.c: Likewise.
	* sysdeps/ia64/fpu/w_tgammal.c: Likewise.
	* sysdeps/ieee754/dbl-64/w_exp_compat.c: Condition contents on
	[LIBM_SVID_COMPAT].
	* sysdeps/ieee754/flt-32/w_expf_compat.c: Likewise.
	* sysdeps/ieee754/k_standard.c: Likewise.
	* sysdeps/ieee754/k_standardf.c: Likewise.
	* sysdeps/ieee754/k_standardl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/w_expl_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/w_expl_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-96/w_expl_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-64-128/w_expl_compat.c: Condition
	long_double_symbol call on [LIBM_SVID_COMPAT].
	* sysdeps/ieee754/ldbl-opt/w_acoshl_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_acosl_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_asinl_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_atan2l_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_atanhl_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_coshl_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_fmodl_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_hypotl_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_j0l_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_j1l_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_jnl_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_lgammal_r_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_log10l_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_log2l_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_logl_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_powl_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_remainderl_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_sinhl_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_sqrtl_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_tgammal_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/w_exp10l_compat.c: Condition
	long_double_symbol and compat_symbol calls on [LIBM_SVID_COMPAT].
2017-09-05 23:35:55 +00:00
Joseph Myers 813378e9fe Obsolete matherr, _LIB_VERSION, libieee.a.
This patch obsoletes support for SVID libm error handling (the system
where a user-defined function matherr is called on a libm function
error; only enabled if you also set _LIB_VERSION = _SVID_ or
_LIB_VERSION = _XOPEN_) and the use of the _LIB_VERSION global
variable to control libm error handling.  matherr and _LIB_VERSION are
made into compat symbols, not supported for new ports or for static
linking.  The libieee.a object file (which sets _LIB_VERSION = _IEEE_,
so disabling errno setting for some functions) is also removed, and
all the related definitions are removed from math.h.

The manual already recommends against using matherr, and it's already
not supported for _Float128 functions (those use new wrappers that
don't support matherr, only errno) - this patch means that it becomes
possible to e.g. add sinf32 as an alias to sinf without that resulting
in undesired matherr support in sinf32 for existing glibc ports.
matherr support is not part of any standard supported by glibc (it was
removed in XPG4).

Because matherr is a function to be defined by the user, of course
user programs defining such a function will still continue to link; it
just quietly won't be used.  If they try to write to the library's
copy of _LIB_VERSION to enable SVID error handling, however, they will
get a link error (but if they define their own _LIB_VERSION variable,
they won't).

I expect the most likely case of build failures from this patch to be
programs with unconditional cargo-culted uses of -lieee (based on a
notion of "I want IEEE floating point", not any actual requirement for
that library).

Ideally, the new-port-or-static-linking case would use the new
wrappers used for _Float128.  This is not implemented in this patch,
because of the complication of architecture-specific (powerpc32 and
sparc) sqrt wrappers that use _LIB_VERSION and __kernel_standard
directly.  Thus, the old wrappers and __kernel_standard are still
built unconditionally, and _LIB_VERSION still exists in static libm.
But when the old wrappers and __kernel_standard are built in the
non-compat case, _LIB_VERSION and matherr are defined as macros so
code to support those features isn't actually built into static libm
or new ports' shared libm after this patch.

I intend to move to the new wrappers for static libm and new ports in
followup patches.  I believe the sqrt wrappers for powerpc32 and sparc
can reasonably be removed.  GCC already optimizes the normal case of
sqrt by generating code that uses a hardware instruction and only
calls the sqrt function if the argument was negative (if
-fno-math-errno, of course, it just uses the hardware instruction
without any check for negative argument being needed).  Thus those
wrappers will only actually get called in the case of negative
arguments, which is not a case it makes sense to optimize for.  But
even without removing the powerpc32 and sparc wrappers it should still
be possible to move to the new wrappers for static libm and new ports,
just without having those dubious architecture-specific optimizations
in static libm.

Everything said about matherr equally applies to matherrf and matherrl
(IA64-specific, undocumented), except that the structure of IA64 libm
means it won't be converted to using the new wrappers (it doesn't use
the old ones either, but its own error-handling code instead).

As with other tests of compat symbols, I expect test-matherr and
test-matherr-2 to need to become appropriately conditional once we
have a system for disabling such tests for ports too new to have the
relevant symbols.

Tested for x86_64 and x86, and with build-many-glibcs.py.

	* math/math.h [__USE_MISC] (_LIB_VERSION_TYPE): Remove.
	[__USE_MISC] (_LIB_VERSION): Likewise.
	[__USE_MISC] (struct exception): Likewise.
	[__USE_MISC] (matherr): Likewise.
	[__USE_MISC] (DOMAIN): Likewise.
	[__USE_MISC] (SING): Likewise.
	[__USE_MISC] (OVERFLOW): Likewise.
	[__USE_MISC] (UNDERFLOW): Likewise.
	[__USE_MISC] (TLOSS): Likewise.
	[__USE_MISC] (PLOSS): Likewise.
	[__USE_MISC] (HUGE): Likewise.
	[__USE_XOPEN] (MAXFLOAT): Define even if [__USE_MISC].
	* math/math-svid-compat.h: New file.
	* conform/linknamespace.pl (@whitelist): Remove matherr, matherrf
	and matherrl.
	* include/math.h [!_ISOMAC] (__matherr): Remove.
	* manual/arith.texi (FP Exceptions): Do not document matherr.
	* math/Makefile (tests): Change test-matherr to test-matherr-3.
	(tests-internal): New variable.
	(install-lib): Do not add libieee.a.
	(non-lib.a): Likewise.
	(extra-objs): Do not add libieee.a and ieee-math.o.
	(CPPFLAGS-s_lib_version.c): Remove variable.
	($(objpfx)libieee.a): Remove rule.
	($(addprefix $(objpfx), $(tests-internal)): Depend on $(libm).
	* math/ieee-math.c: Remove.
	* math/libm-test-support.c (matherr): Remove.
	* math/test-matherr.c: Use <support/test-driver.c>.  Add copyright
	and license notices.  Include <math-svid-compat.h> and
	<shlib-compat.h>.
	(matherr): Undefine as macro.  Use compat_symbol_reference.
	(_LIB_VERSION): Likewise.
	* math/test-matherr-2.c: New file.
	* math/test-matherr-3.c: Likewise.
	* sysdeps/generic/math_private.h (__kernel_standard): Remove
	declaration.
	(__kernel_standard_f): Likewise.
	(__kernel_standard_l): Likewise.
	* sysdeps/ieee754/s_lib_version.c: Do not include <math.h> or
	<math_private.h>.  Include <math-svid-compat.h>.
	(_LIB_VERSION): Undefine as macro.
	(_LIB_VERSION_INTERNAL): Always initialize to _POSIX_.  Define
	only if [LIBM_SVID_COMPAT || !defined SHARED].  If
	[LIBM_SVID_COMPAT], use compat_symbol.
	* sysdeps/ieee754/s_matherr.c: Do not include <math.h> or
	<math_private.h>.  Include <math-svid-compat.h>.
	(matherr): Undefine as macro.
	(__matherr): Define only if [LIBM_SVID_COMPAT].  Use
	compat_symbol.
	* sysdeps/ia64/fpu/libm_error.c: Include <math-svid-compat.h>.
	[_LIBC && LIBM_SVID_COMPAT] (matherrf): Use
	compat_symbol_reference.
	[_LIBC && LIBM_SVID_COMPAT] (matherrl): Likewise.
	[_LIBC && !LIBM_SVID_COMPAT] (matherrf): Define as macro.
	[_LIBC && !LIBM_SVID_COMPAT] (matherrl): Likewise.
	* sysdeps/ia64/fpu/libm_support.h: Include <math-svid-compat.h>.
	(MATHERR_D): Remove declaration.
	[!_LIBC] (_LIB_VERSION_TYPE): Likewise
	[!LIBM_BUILD] (_LIB_VERSIONIMF): Likewise.
	[LIBM_BUILD] (pmatherrf): Likewise.
	[LIBM_BUILD] (pmatherr): Likewise.
	[LIBM_BUILD] (pmatherrl): Likewise.
	(DOMAIN): Likewise.
	(SING): Likewise.
	(OVERFLOW): Likewise.
	(UNDERFLOW): Likewise.
	(TLOSS): Likewise.
	(PLOSS): Likewise.
	* sysdeps/ia64/fpu/s_matherrf.c: Include <math-svid-compat.h>.
	(__matherrf): Define only if [LIBM_SVID_COMPAT].  Use
	compat_symbol.
	* sysdeps/ia64/fpu/s_matherrl.c: Include <math-svid-compat.h>.
	(__matherrl): Define only if [LIBM_SVID_COMPAT].  Use
	compat_symbol.
	* math/lgamma-compat.h: Include <math-svid-compat.h>.
	* math/w_acos_compat.c: Likewise.
	* math/w_acosf_compat.c: Likewise.
	* math/w_acosh_compat.c: Likewise.
	* math/w_acoshf_compat.c: Likewise.
	* math/w_acoshl_compat.c: Likewise.
	* math/w_acosl_compat.c: Likewise.
	* math/w_asin_compat.c: Likewise.
	* math/w_asinf_compat.c: Likewise.
	* math/w_asinl_compat.c: Likewise.
	* math/w_atan2_compat.c: Likewise.
	* math/w_atan2f_compat.c: Likewise.
	* math/w_atan2l_compat.c: Likewise.
	* math/w_atanh_compat.c: Likewise.
	* math/w_atanhf_compat.c: Likewise.
	* math/w_atanhl_compat.c: Likewise.
	* math/w_cosh_compat.c: Likewise.
	* math/w_coshf_compat.c: Likewise.
	* math/w_coshl_compat.c: Likewise.
	* math/w_exp10_compat.c: Likewise.
	* math/w_exp10f_compat.c: Likewise.
	* math/w_exp10l_compat.c: Likewise.
	* math/w_exp2_compat.c: Likewise.
	* math/w_exp2f_compat.c: Likewise.
	* math/w_exp2l_compat.c: Likewise.
	* math/w_fmod_compat.c: Likewise.
	* math/w_fmodf_compat.c: Likewise.
	* math/w_fmodl_compat.c: Likewise.
	* math/w_hypot_compat.c: Likewise.
	* math/w_hypotf_compat.c: Likewise.
	* math/w_hypotl_compat.c: Likewise.
	* math/w_j0_compat.c: Likewise.
	* math/w_j0f_compat.c: Likewise.
	* math/w_j0l_compat.c: Likewise.
	* math/w_j1_compat.c: Likewise.
	* math/w_j1f_compat.c: Likewise.
	* math/w_j1l_compat.c: Likewise.
	* math/w_jn_compat.c: Likewise.
	* math/w_jnf_compat.c: Likewise.
	* math/w_jnl_compat.c: Likewise.
	* math/w_lgamma_main.c: Likewise.
	* math/w_lgamma_r_compat.c: Likewise.
	* math/w_lgammaf_main.c: Likewise.
	* math/w_lgammaf_r_compat.c: Likewise.
	* math/w_lgammal_main.c: Likewise.
	* math/w_lgammal_r_compat.c: Likewise.
	* math/w_log10_compat.c: Likewise.
	* math/w_log10f_compat.c: Likewise.
	* math/w_log10l_compat.c: Likewise.
	* math/w_log2_compat.c: Likewise.
	* math/w_log2f_compat.c: Likewise.
	* math/w_log2l_compat.c: Likewise.
	* math/w_log_compat.c: Likewise.
	* math/w_logf_compat.c: Likewise.
	* math/w_logl_compat.c: Likewise.
	* math/w_pow_compat.c: Likewise.
	* math/w_powf_compat.c: Likewise.
	* math/w_powl_compat.c: Likewise.
	* math/w_remainder_compat.c: Likewise.
	* math/w_remainderf_compat.c: Likewise.
	* math/w_remainderl_compat.c: Likewise.
	* math/w_scalb_compat.c: Likewise.
	* math/w_scalbf_compat.c: Likewise.
	* math/w_scalbl_compat.c: Likewise.
	* math/w_sinh_compat.c: Likewise.
	* math/w_sinhf_compat.c: Likewise.
	* math/w_sinhl_compat.c: Likewise.
	* math/w_sqrt_compat.c: Likewise.
	* math/w_sqrtf_compat.c: Likewise.
	* math/w_sqrtl_compat.c: Likewise.
	* math/w_tgamma_compat.c: Likewise.
	* math/w_tgammaf_compat.c: Likewise.
	* math/w_tgammal_compat.c: Likewise.
	* sysdeps/ieee754/dbl-64/w_exp_compat.c: Likewise.
	* sysdeps/ieee754/flt-32/w_expf_compat.c: Likewise.
	* sysdeps/ieee754/k_standard.c: Likewise.
	* sysdeps/ieee754/k_standardf.c: Likewise.
	* sysdeps/ieee754/k_standardl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/w_expl_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/w_expl_compat.c: Likewise.
	* sysdeps/ieee754/ldbl-96/w_expl_compat.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/fpu/w_sqrt_compat.S: Likewise.
	* sysdeps/powerpc/powerpc32/power4/fpu/w_sqrtf_compat.S: Likewise.
	* sysdeps/powerpc/powerpc32/power5/fpu/w_sqrt_compat.S: Likewise.
	* sysdeps/powerpc/powerpc32/power5/fpu/w_sqrtf_compat.S: Likewise.
	* sysdeps/sparc/sparc32/fpu/w_sqrt_compat.S: Likewise.
	* sysdeps/sparc/sparc32/fpu/w_sqrtf_compat.S: Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrt_compat-vis3.S:
	Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrtf_compat-vis3.S:
	Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrt_compat.S: Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrtf_compat.S: Likewise.
	* sysdeps/sparc/sparc64/fpu/w_sqrt_compat.S: Likewise.
	* sysdeps/sparc/sparc64/fpu/w_sqrtf_compat.S: Likewise.
2017-08-21 17:45:10 +00:00
Gabriel F. T. Gomes f67d78192c Move wrappers to libm-compat-calls-auto
This commit moves one step towards the deprecation of wrappers that
use _LIB_VERSION / matherr / __kernel_standard functionality, by
adding the suffix '_compat' to their filenames and adjusting Makefiles
and #includes accordingly.

New template wrappers that do not use such functionality will be added
by future patches and will be first used by the float128 wrappers.
2017-01-04 16:25:04 -02:00
Renamed from math/w_j0f.c (Browse further)