]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - scripts/versions.awk
Update miscellaneous files from upstream sources.
[thirdparty/glibc.git] / scripts / versions.awk
index e642b3d16ecc8500283ad8b42e956df560f6ae23..4fa3e9259a5e70831c090571c48083eb095aab5a 100644 (file)
@@ -1,5 +1,5 @@
 # Combine version map fragments into version scripts for our shared objects.
-# Copyright (C) 1998,99,2000,2002,2005 Free Software Foundation, Inc.
+# Copyright (C) 1998-2019 Free Software Foundation, Inc.
 # Written by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
 # This script expects the following variables to be defined:
@@ -28,10 +28,8 @@ BEGIN {
   close(defsfile);
 
   tmpfile = buildroot "Versions.tmp";
-  # Note this sorting presumes only single digits between dots for proper
-  # numeric ordering.  sort -n doesn't do quite the right thing either,
-  # and in some non-GNU sort implementations does not sort at all.
-  sort = "sort > " tmpfile;
+  # POSIX sort needed.
+  sort = "sort -t. -k 1,1 -k 2n,2n -k 3 > " tmpfile;
 }
 
 # Remove comment lines.
@@ -103,6 +101,17 @@ 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;
+  real_ldbl_compat_header = buildroot "ldbl-compat-choose.h"
+  ldbl_compat_header = real_ldbl_compat_header "T"
+  printf("#ifndef _LDBL_COMPAT_CHOOSE_H\n") > ldbl_compat_header;
+  printf("#define _LDBL_COMPAT_CHOOSE_H\n") > ldbl_compat_header;
+  printf("#ifndef LONG_DOUBLE_COMPAT\n") > ldbl_compat_header;
+  printf("# error LONG_DOUBLE_COMPAT not defined\n") > ldbl_compat_header;
+  printf("#endif\n") > ldbl_compat_header;
   printf("version-maps =");
   while (getline < tmpfile) {
     if ($1 != oldlib) {
@@ -129,11 +138,36 @@ 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;
+       if (oldlib == "libc" || oldlib == "libm") {
+         printf("#if LONG_DOUBLE_COMPAT (%s, %s)\n",
+                oldlib, ver_val) > ldbl_compat_header;
+         printf("# define LONG_DOUBLE_COMPAT_CHOOSE_%s_%s(a, b) a\n",
+                oldlib, sym) > ldbl_compat_header;
+         printf("#else\n") > ldbl_compat_header;
+         printf("# define LONG_DOUBLE_COMPAT_CHOOSE_%s_%s(a, b) b\n",
+                oldlib, sym) > ldbl_compat_header;
+         printf("#endif\n") > ldbl_compat_header;
+       }
+      }
     }
     printf("\n") > outfile;
   }
   printf("\n");
+  printf("#endif /* first-versions.h */\n") > first_ver_header;
+  printf("#endif /* ldbl-compat-choose.h */\n") > ldbl_compat_header;
   closeversion(oldver, veryoldver);
   close_and_move(outfile, real_outfile);
-  system("rm -f " tmpfile);
+  close_and_move(first_ver_header, real_first_ver_header);
+  close_and_move(ldbl_compat_header, real_ldbl_compat_header);
+  #system("rm -f " tmpfile);
 }