about summary refs log tree commit diff
path: root/Makerules
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2017-05-19 11:26:00 +0000
committerJoseph Myers <joseph@codesourcery.com>2017-05-19 11:26:00 +0000
commit8f2e1830f298f45d34cfdb4cffc8ce3b940a3990 (patch)
tree2ef1718177270ba6b5d846641a49cbf79c0225c3 /Makerules
parent332e01c6276e05ece5953007c98aa84725c4fda4 (diff)
downloadglibc-8f2e1830f298f45d34cfdb4cffc8ce3b940a3990.tar.gz
glibc-8f2e1830f298f45d34cfdb4cffc8ce3b940a3990.tar.xz
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 'Makerules')
-rw-r--r--Makerules13
1 files changed, 10 insertions, 3 deletions
diff --git a/Makerules b/Makerules
index 2000e543a1..d19ebf292a 100644
--- a/Makerules
+++ b/Makerules
@@ -105,6 +105,11 @@ $(common-objpfx)%.latest: $(common-objpfx)abi-versions.h
 	sed -n '/ VERSION_$*_/{s/^.*_\([A-Z0-9_]*\).*$$/\1/;h;};$${g;p;}' \
 	    $(common-objpfx)abi-versions.h > $@T
 	mv -f $@T $@
+
+# first-versions.h provides macros used in various symbol versioning
+# macro calls.
+before-compile := $(common-objpfx)first-versions.h $(before-compile)
+$(common-objpfx)first-versions.h: $(common-objpfx)versions.stmp
 endif # avoid-generated
 endif # $(build-shared) = yes
 
@@ -458,7 +463,8 @@ $(common-objpfx)Versions.all: $(..)scripts/firstversions.awk \
 $(common-objpfx)Versions.v.i: $(wildcard $(subdirs:%=$(..)%/Versions)) \
 			      $(wildcard $(sysdirs:%=%/Versions)) \
 			      $(sysd-versions-force)
-$(common-objpfx)sysd-versions: $(common-objpfx)Versions.all \
+$(common-objpfx)sysd-versions: $(common-objpfx)versions.stmp
+$(common-objpfx)versions.stmp: $(common-objpfx)Versions.all \
 			       $(common-objpfx)Versions.v \
 			       $(..)scripts/versions.awk
 	( echo 'sysd-versions-subdirs = $(subdirs) $(config-sysdirs)' ; \
@@ -466,8 +472,9 @@ $(common-objpfx)sysd-versions: $(common-objpfx)Versions.all \
 	  | LC_ALL=C $(AWK) -v buildroot=$(common-objpfx) -v defsfile=$< \
 			    -v move_if_change='$(move-if-change)' \
 			    -f $(word 3,$^); \
-	) > $@T
-	mv -f $@T $@
+	) > $(common-objpfx)sysd-versionsT
+	mv -f $(common-objpfx)sysd-versionsT $(common-objpfx)sysd-versions
+	touch $@
 endif # avoid-generated
 endif # $(build-shared) = yes
 endif # sysd-sorted-done