2000-03-20 19:33:28 +01:00
|
|
|
# Combine version map fragments into version scripts for our shared objects.
|
2005-03-23 00:52:59 +01:00
|
|
|
# Copyright (C) 1998,99,2000,2002,2005 Free Software Foundation, Inc.
|
1998-07-03 00:51:40 +02:00
|
|
|
# Written by Ulrich Drepper <drepper@cygnus.com>, 1998.
|
|
|
|
|
1998-07-09 00:53:56 +02:00
|
|
|
# This script expects the following variables to be defined:
|
|
|
|
# defsfile name of Versions.def file
|
|
|
|
# buildroot name of build directory with trailing slash
|
|
|
|
# move_if_change move-if-change command
|
|
|
|
|
1998-07-03 00:51:40 +02:00
|
|
|
# Read definitions for the versions.
|
|
|
|
BEGIN {
|
2005-03-23 00:52:59 +01:00
|
|
|
lossage = 0;
|
|
|
|
|
1998-07-03 00:51:40 +02:00
|
|
|
nlibs=0;
|
1998-07-06 19:09:00 +02:00
|
|
|
while (getline < defsfile) {
|
1999-02-07 01:06:12 +01:00
|
|
|
if (/^[a-zA-Z0-9_.]+ \{/) {
|
1998-07-03 00:51:40 +02:00
|
|
|
libs[$1] = 1;
|
|
|
|
curlib = $1;
|
1998-07-06 19:09:00 +02:00
|
|
|
while (getline < defsfile && ! /^}/) {
|
2005-03-23 00:52:59 +01:00
|
|
|
if ($2 == "=") {
|
2000-03-20 19:33:28 +01:00
|
|
|
renamed[curlib "::" $1] = $3;
|
2005-03-23 00:52:59 +01:00
|
|
|
}
|
2000-03-19 21:36:44 +01:00
|
|
|
else
|
2005-03-23 00:52:59 +01:00
|
|
|
versions[curlib "::" $1] = 1;
|
1998-07-03 00:51:40 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
1998-07-06 19:09:00 +02:00
|
|
|
close(defsfile);
|
1998-07-03 00:51:40 +02:00
|
|
|
|
1998-07-09 00:53:56 +02:00
|
|
|
tmpfile = buildroot "Versions.tmp";
|
2002-12-02 07:31:28 +01:00
|
|
|
# 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;
|
1998-07-03 00:51:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
# Remove comment lines.
|
|
|
|
/^ *#/ {
|
|
|
|
next;
|
|
|
|
}
|
|
|
|
|
|
|
|
# This matches the beginning of the version information for a new library.
|
1999-02-07 01:06:12 +01:00
|
|
|
/^[a-zA-Z0-9_.]+/ {
|
1998-07-03 00:51:40 +02:00
|
|
|
actlib = $1;
|
1998-07-06 19:09:00 +02:00
|
|
|
if (!libs[$1]) {
|
|
|
|
printf("no versions defined for %s\n", $1) > "/dev/stderr";
|
2005-03-23 00:52:59 +01:00
|
|
|
++lossage;
|
1998-07-03 00:51:40 +02:00
|
|
|
}
|
|
|
|
next;
|
|
|
|
}
|
|
|
|
|
|
|
|
# This matches the beginning of a new version for the current library.
|
|
|
|
/^ [A-Za-z_]/ {
|
2000-03-20 19:33:28 +01:00
|
|
|
if (renamed[actlib "::" $1])
|
|
|
|
actver = renamed[actlib "::" $1];
|
2005-03-23 02:46:42 +01:00
|
|
|
else if (!versions[actlib "::" $1] && $1 != "GLIBC_PRIVATE") {
|
2002-02-07 06:25:11 +01:00
|
|
|
printf("version %s not defined for %s\n", $1, actlib) > "/dev/stderr";
|
2005-03-23 00:52:59 +01:00
|
|
|
++lossage;
|
1998-07-03 00:51:40 +02:00
|
|
|
}
|
2000-03-19 21:36:44 +01:00
|
|
|
else
|
|
|
|
actver = $1;
|
1998-07-03 00:51:40 +02:00
|
|
|
next;
|
|
|
|
}
|
|
|
|
|
|
|
|
# This matches lines with names to be added to the current version in the
|
|
|
|
# current library. This is the only place where we print something to
|
|
|
|
# the intermediate file.
|
|
|
|
/^ / {
|
2001-12-06 08:59:42 +01:00
|
|
|
sortver=actver
|
|
|
|
# Ensure GLIBC_ versions come always first
|
|
|
|
sub(/^GLIBC_/," GLIBC_",sortver)
|
|
|
|
printf("%s %s %s\n", actlib, sortver, $0) | sort;
|
1998-07-03 00:51:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-11-15 08:01:16 +01:00
|
|
|
function closeversion(name, oldname) {
|
1998-07-03 00:51:40 +02:00
|
|
|
if (firstinfile) {
|
|
|
|
printf(" local:\n *;\n") > outfile;
|
|
|
|
firstinfile = 0;
|
|
|
|
}
|
2002-02-07 06:25:11 +01:00
|
|
|
# This version inherits from the last one only if they
|
|
|
|
# have the same nonnumeric prefix, i.e. GLIBC_x.y and GLIBC_x.z
|
|
|
|
# or FOO_x and FOO_y but not GLIBC_x and FOO_y.
|
|
|
|
pfx = oldname;
|
|
|
|
sub(/[0-9.]+/,".+",pfx);
|
|
|
|
if (oldname == "" || name !~ pfx) print "};" > outfile;
|
|
|
|
else printf("} %s;\n", oldname) > outfile;
|
1998-07-03 00:51:40 +02:00
|
|
|
}
|
|
|
|
|
1998-07-09 00:53:56 +02:00
|
|
|
function close_and_move(name, real_name) {
|
|
|
|
close(name);
|
|
|
|
system(move_if_change " " name " " real_name " >&2");
|
|
|
|
}
|
|
|
|
|
1998-07-03 00:51:40 +02:00
|
|
|
# Now print the accumulated information.
|
|
|
|
END {
|
|
|
|
close(sort);
|
2005-03-23 00:52:59 +01:00
|
|
|
|
|
|
|
if (lossage) {
|
|
|
|
system("rm -f " tmpfile);
|
|
|
|
exit 1;
|
|
|
|
}
|
|
|
|
|
1998-07-09 00:53:56 +02:00
|
|
|
oldlib = "";
|
|
|
|
oldver = "";
|
|
|
|
printf("version-maps =");
|
2002-02-07 06:25:11 +01:00
|
|
|
while (getline < tmpfile) {
|
1998-07-03 00:51:40 +02:00
|
|
|
if ($1 != oldlib) {
|
|
|
|
if (oldlib != "") {
|
1999-11-15 08:01:16 +01:00
|
|
|
closeversion(oldver, veryoldver);
|
1998-07-03 00:51:40 +02:00
|
|
|
oldver = "";
|
1998-07-09 00:53:56 +02:00
|
|
|
close_and_move(outfile, real_outfile);
|
1998-07-03 00:51:40 +02:00
|
|
|
}
|
|
|
|
oldlib = $1;
|
1998-07-09 00:53:56 +02:00
|
|
|
real_outfile = buildroot oldlib ".map";
|
|
|
|
outfile = real_outfile "T";
|
1998-07-03 00:51:40 +02:00
|
|
|
firstinfile = 1;
|
1999-11-15 08:01:16 +01:00
|
|
|
veryoldver = "";
|
1998-07-09 00:53:56 +02:00
|
|
|
printf(" %s.map", oldlib);
|
1998-07-03 00:51:40 +02:00
|
|
|
}
|
|
|
|
if ($2 != oldver) {
|
|
|
|
if (oldver != "") {
|
1999-11-15 08:01:16 +01:00
|
|
|
closeversion(oldver, veryoldver);
|
|
|
|
veryoldver = oldver;
|
1998-07-03 00:51:40 +02:00
|
|
|
}
|
|
|
|
printf("%s {\n global:\n", $2) > outfile;
|
|
|
|
oldver = $2;
|
|
|
|
}
|
|
|
|
printf(" ") > outfile;
|
|
|
|
for (n = 3; n <= NF; ++n) {
|
|
|
|
printf(" %s", $n) > outfile;
|
|
|
|
}
|
|
|
|
printf("\n") > outfile;
|
|
|
|
}
|
1998-07-06 19:09:00 +02:00
|
|
|
printf("\n");
|
1999-11-15 08:01:16 +01:00
|
|
|
closeversion(oldver, veryoldver);
|
1998-07-09 00:53:56 +02:00
|
|
|
close_and_move(outfile, real_outfile);
|
|
|
|
system("rm -f " tmpfile);
|
1998-07-03 00:51:40 +02:00
|
|
|
}
|