diff options
author | Joseph Myers <joseph@codesourcery.com> | 2017-05-19 11:26:00 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2017-05-19 11:26:00 +0000 |
commit | 8f2e1830f298f45d34cfdb4cffc8ce3b940a3990 (patch) | |
tree | 2ef1718177270ba6b5d846641a49cbf79c0225c3 /scripts | |
parent | 332e01c6276e05ece5953007c98aa84725c4fda4 (diff) | |
download | glibc-8f2e1830f298f45d34cfdb4cffc8ce3b940a3990.tar glibc-8f2e1830f298f45d34cfdb4cffc8ce3b940a3990.tar.gz glibc-8f2e1830f298f45d34cfdb4cffc8ce3b940a3990.tar.bz2 glibc-8f2e1830f298f45d34cfdb4cffc8ce3b940a3990.zip |
Create and use first-versions.h with macros for function symbol versions.
This patch arranges for the glibc build to generate a header
first-versions.h that defines macros for the earliest symbol version
in which each public symbol (GLIBC_[0-9]* symbol version, name only
uses C identifier characters) is available.
This is used in sysdeps/ieee754/ldbl-opt/math-type-macros-double.h to
replace the manually defined LDOUBLE_*_libm_version macros for various
functions defined using type-generic templates, the purpose of which
is to use in LONG_DOUBLE_COMPAT tests "was this function originally
added before glibc supported long double != double on this platform?".
As discussed in
<https://sourceware.org/ml/libc-alpha/2016-12/msg00246.html>, I expect
this to be useful more generally in reducing the amount of
special-case code needed in ldbl-opt and ldbl-64-128.
Tested with build-many-glibcs.py that installed stripped shared
libraries are unchanged by this patch.
* scripts/versions.awk: Generate first-versions.h.
* sysdeps/ieee754/ldbl-opt/math-type-macros-double.h: Include
<first-versions.h>.
(LDOUBLE_cabsl_libm_version): Remove macro.
(LDOUBLE_cargl_libm_version): Likewise.
(LDOUBLE_cimagl_libm_version): Likewise.
(LDOUBLE_conjl_libm_version): Likewise.
(LDOUBLE_creall_libm_version): Likewise.
(LDOUBLE_cacosl_libm_version): Likewise.
(LDOUBLE_cacoshl_libm_version): Likewise.
(LDOUBLE_ccosl_libm_version): Likewise.
(LDOUBLE_ccoshl_libm_version): Likewise.
(LDOUBLE_casinl_libm_version): Likewise.
(LDOUBLE_csinl_libm_version): Likewise.
(LDOUBLE_casinhl_libm_version): Likewise.
(LDOUBLE_csinhl_libm_version): Likewise.
(LDOUBLE_catanl_libm_version): Likewise.
(LDOUBLE_catanhl_libm_version): Likewise.
(LDOUBLE_ctanl_libm_version): Likewise.
(LDOUBLE_ctanhl_libm_version): Likewise.
(LDOUBLE_cexpl_libm_version): Likewise.
(LDOUBLE_clogl_libm_version): Likewise.
(LDOUBLE_cprojl_libm_version): Likewise.
(LDOUBLE_csqrtl_libm_version): Likewise.
(LDOUBLE_cpowl_libm_version): Likewise.
(LDOUBLE_clog10l_libm_version): Likewise.
(LDOUBLE___clog10l_libm_version): Likewise.
(LDOUBLE_fdiml_libm_version): Likewise.
(LDOUBLE_fmaxl_libm_version): Likewise.
(LDOUBLE_fminl_libm_version): Likewise.
(LDOUBLE_ilogbl_libm_version): Likewise.
(LDOUBLE_nanl_libm_version): Likewise.
[!M_LIBM_NEED_COMPAT] (M_LIBM_NEED_COMPAT): Use
FIRST_VERSION_libm_* macros.
[!declare_mgen_libm_compat] (declare_mgen_libm_compat): Likewise.
* Makerules [$(build-shared) = yes && !avoid-generated]
(before-compile): Add $(common-objpfx)first-versions.h.
[$(build-shared) = yes && !avoid-generated]
($(common-objpfx)first-versions.h): New target.
($(common-objpfx)sysd-versions): Depend on and change to rule for
building $(common-objpfx)versions.stmp.
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/versions.awk | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/scripts/versions.awk b/scripts/versions.awk index df33529e59..df08d06816 100644 --- a/scripts/versions.awk +++ b/scripts/versions.awk @@ -101,6 +101,10 @@ END { oldlib = ""; oldver = ""; + real_first_ver_header = buildroot "first-versions.h" + first_ver_header = real_first_ver_header "T" + printf("#ifndef _FIRST_VERSIONS_H\n") > first_ver_header; + printf("#define _FIRST_VERSIONS_H\n") > first_ver_header; printf("version-maps ="); while (getline < tmpfile) { if ($1 != oldlib) { @@ -127,11 +131,24 @@ END { printf(" ") > outfile; for (n = 3; n <= NF; ++n) { printf(" %s", $n) > outfile; + sym = $n; + sub(";", "", sym); + first_ver_macro = "FIRST_VERSION_" oldlib "_" sym; + if (!(first_ver_macro in first_ver_seen) \ + && oldver ~ "^GLIBC_[0-9]" \ + && sym ~ "^[A-Za-z0-9_]*$") { + ver_val = oldver; + gsub("\\.", "_", ver_val); + printf("#define %s %s\n", first_ver_macro, ver_val) > first_ver_header; + first_ver_seen[first_ver_macro] = 1; + } } printf("\n") > outfile; } printf("\n"); + printf("#endif /* first-versions.h */\n") > first_ver_header; closeversion(oldver, veryoldver); close_and_move(outfile, real_outfile); + close_and_move(first_ver_header, real_first_ver_header); #system("rm -f " tmpfile); } |