summaryrefslogtreecommitdiffstats
path: root/share/mk/version_gen.awk
diff options
context:
space:
mode:
authordeischen <deischen@FreeBSD.org>2007-04-23 03:24:33 +0000
committerdeischen <deischen@FreeBSD.org>2007-04-23 03:24:33 +0000
commit9172c87258d3b52611432fb3ac3537c198fbad53 (patch)
treecf0fe6a5dad7eec046fd8db8e95c68b212a94efa /share/mk/version_gen.awk
parent2063f013741d3fee2d48a255b6bbec6f1d15d003 (diff)
downloadFreeBSD-src-9172c87258d3b52611432fb3ac3537c198fbad53.zip
FreeBSD-src-9172c87258d3b52611432fb3ac3537c198fbad53.tar.gz
When generating the version map file, order versions oldest
first to make it easier for rtld to choose the oldest version of a symbol. Sumbitted by: kan
Diffstat (limited to 'share/mk/version_gen.awk')
-rw-r--r--share/mk/version_gen.awk55
1 files changed, 36 insertions, 19 deletions
diff --git a/share/mk/version_gen.awk b/share/mk/version_gen.awk
index 23c502c..916c084 100644
--- a/share/mk/version_gen.awk
+++ b/share/mk/version_gen.awk
@@ -53,6 +53,7 @@ BEGIN {
symver = $1;
versions[symver] = 1;
successors[symver] = "";
+ generated[symver] = 0;
version_count++;
}
else if (/^[ \t]*} *[a-zA-Z0-9._]+ *;/) {
@@ -141,26 +142,42 @@ BEGIN {
FILENAME, FNR, $0) > stderr;
}
+function print_version(v)
+{
+ # This function is recursive, so return if this version
+ # has already been printed. Otherwise, if there is an
+ # ancestral version, recursively print its symbols before
+ # printing the symbols for this version.
+ #
+ if (generated[v] == 1)
+ return;
+ if (successors[v] != "")
+ print_version(successors[v]);
+
+ printf("%s {\n", v);
+
+ # The version count is always one more that actual,
+ # so the loop ranges from 1 to n-1.
+ #
+ for (i = 1; i < versions[v]; i++) {
+ if (i == 1)
+ printf("global:\n");
+ printf("\t%s\n", symbols[v, i]);
+ }
+ if (successors[v] == "") {
+ # This version succeeds no other version.
+ printf("local:\n");
+ printf("\t*;\n");
+ printf("};\n");
+ }
+ else
+ printf("} %s;\n", successors[v]);
+ printf("\n");
+
+ generated[v] = 1;
+ }
END {
for (v in versions) {
- printf("\n");
- printf("%s {\n", v);
-
- # The version count is always one more that actual,
- # so the loop ranges from 1 to n-1.
- #
- for (i = 1; i < versions[v]; i++) {
- if (i == 1)
- printf("global:\n");
- printf("\t%s\n", symbols[v, i]);
- }
- if (successors[v] == "") {
- # This version succeeds no other version.
- printf("local:\n");
- printf("\t*;\n");
- printf("};\n");
- }
- else
- printf("} %s;\n", successors[v]);
+ print_version(v);
}
}
OpenPOWER on IntegriCloud