about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog44
-rw-r--r--Makerules13
-rw-r--r--scripts/versions.awk17
-rw-r--r--sysdeps/ieee754/ldbl-opt/math-type-macros-double.h35
4 files changed, 74 insertions, 35 deletions
diff --git a/ChangeLog b/ChangeLog
index 527e4e4776..ed4db8cf19 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,47 @@
+2017-05-19  Joseph Myers  <joseph@codesourcery.com>
+
+	* 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.
+
 2017-05-18  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
 	* rt/Makefile (CFLAGS-mq_timedsend.c): New flag.
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
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);
 }
diff --git a/sysdeps/ieee754/ldbl-opt/math-type-macros-double.h b/sysdeps/ieee754/ldbl-opt/math-type-macros-double.h
index a83c2b37cc..67b5268dc4 100644
--- a/sysdeps/ieee754/ldbl-opt/math-type-macros-double.h
+++ b/sysdeps/ieee754/ldbl-opt/math-type-macros-double.h
@@ -19,48 +19,19 @@
 #ifndef _MATH_TYPE_MACROS_DOUBLE
 
 #include <math_ldbl_opt.h>
-
-#define LDOUBLE_cabsl_libm_version GLIBC_2_1
-#define LDOUBLE_cargl_libm_version GLIBC_2_1
-#define LDOUBLE_cimagl_libm_version GLIBC_2_1
-#define LDOUBLE_conjl_libm_version GLIBC_2_1
-#define LDOUBLE_creall_libm_version GLIBC_2_1
-#define LDOUBLE_cacosl_libm_version GLIBC_2_1
-#define LDOUBLE_cacoshl_libm_version GLIBC_2_1
-#define LDOUBLE_ccosl_libm_version GLIBC_2_1
-#define LDOUBLE_ccoshl_libm_version GLIBC_2_1
-#define LDOUBLE_casinl_libm_version GLIBC_2_1
-#define LDOUBLE_csinl_libm_version GLIBC_2_1
-#define LDOUBLE_casinhl_libm_version GLIBC_2_1
-#define LDOUBLE_csinhl_libm_version GLIBC_2_1
-#define LDOUBLE_catanl_libm_version GLIBC_2_1
-#define LDOUBLE_catanhl_libm_version GLIBC_2_1
-#define LDOUBLE_ctanl_libm_version GLIBC_2_1
-#define LDOUBLE_ctanhl_libm_version GLIBC_2_1
-#define LDOUBLE_cexpl_libm_version GLIBC_2_1
-#define LDOUBLE_clogl_libm_version GLIBC_2_1
-#define LDOUBLE_cprojl_libm_version GLIBC_2_1
-#define LDOUBLE_csqrtl_libm_version GLIBC_2_1
-#define LDOUBLE_cpowl_libm_version GLIBC_2_1
-#define LDOUBLE_clog10l_libm_version GLIBC_2_1
-#define LDOUBLE___clog10l_libm_version GLIBC_2_1
-#define LDOUBLE_fdiml_libm_version GLIBC_2_1
-#define LDOUBLE_fmaxl_libm_version GLIBC_2_1
-#define LDOUBLE_fminl_libm_version GLIBC_2_1
-#define LDOUBLE_ilogbl_libm_version GLIBC_2_0
-#define LDOUBLE_nanl_libm_version GLIBC_2_1
+#include <first-versions.h>
 
 /* Define compat symbols for long double on platforms
    where it was not always a distinct type.  */
 #if !defined M_LIBM_NEED_COMPAT
 # define M_LIBM_NEED_COMPAT(f) \
-  LONG_DOUBLE_COMPAT (libm, LDOUBLE_ ## f ## l_libm_version)
+  LONG_DOUBLE_COMPAT (libm, FIRST_VERSION_libm_ ## f ## l)
 #endif
 
 #if !defined declare_mgen_libm_compat
 # define declare_mgen_libm_compat(from, to)	      \
   compat_symbol (libm, from, to ## l,		      \
-		 LDOUBLE_ ## to ## l_libm_version);
+		 FIRST_VERSION_libm_ ## to ## l);
 #endif
 
 #include_next <math-type-macros-double.h>