about summary refs log tree commit diff
path: root/scripts/abilist.awk
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-12-23 11:17:18 +0000
committerRoland McGrath <roland@gnu.org>2002-12-23 11:17:18 +0000
commitc823a4d21b76fbc6cf86503d23e3cd55384644ce (patch)
tree6a61fb4da98c47f12d37455776b30543b51d9a3e /scripts/abilist.awk
parentb27b002d5b85b8628f19f65886d25a342c6cbc18 (diff)
downloadglibc-c823a4d21b76fbc6cf86503d23e3cd55384644ce.tar.gz
glibc-c823a4d21b76fbc6cf86503d23e3cd55384644ce.tar.xz
glibc-c823a4d21b76fbc6cf86503d23e3cd55384644ce.zip
* scripts/abilist.awk: Produce a more compact format, divided into
	stanzas for each version set, the set name listed only once.
	* scripts/extract-abilist.awk: New file.
	* scripts/merge-abilist.awk: New file.
	* Makerules (check-abi-%, update-abi-%): New pattern rules.
	(update-abi, check-abi): New targets.
	* Makefile (+subdir_targets): Add subdir_{check,update}-abi.

	* Makerules (%.symlist): Use LC_ALL=C when running awk script.
Diffstat (limited to 'scripts/abilist.awk')
-rw-r--r--scripts/abilist.awk70
1 files changed, 60 insertions, 10 deletions
diff --git a/scripts/abilist.awk b/scripts/abilist.awk
index 97818344d4..346527ef0b 100644
--- a/scripts/abilist.awk
+++ b/scripts/abilist.awk
@@ -1,8 +1,6 @@
 # This awk script processes the output of objdump --dynamic-syms
 # into a simple format that should not change when the ABI is not changing.
 
-BEGIN { outpipe = "sort" }
-
 # Normalize columns.
 /^[0-9a-fA-F]+      / { sub(/      /, "  -   ") }
 
@@ -13,11 +11,11 @@ $4 == "*UND*" { next }
 $2 == "l" { next }
 
 $2 == "g" || $2 == "w" && NF == 7 {
-  weak = ($2 == "w") ? "weak" : "strong";
+  weak = $2;
   type = $3;
   size = $5;
   sub(/^0*/, "", size);
-  size = "0x" size;
+  size = " 0x" size;
   version = $6;
   symbol = $7;
   gsub(/[()]/, "", version);
@@ -25,24 +23,36 @@ $2 == "g" || $2 == "w" && NF == 7 {
   if (version == "GLIBC_PRIVATE") next;
 
   if (type == "D" && $4 == ".tbss") {
-    print symbol, version, weak, "TLS", size | outpipe;
+    type = "T";
   }
   else if (type == "D" && $4 == ".opd") {
-    print symbol, version, weak, "FDESC" | outpipe;
+    type = "O";
+    size = "";
   }
   else if (type == "DO" && $4 == "*ABS*") {
-    print symbol, version, weak, "ABS" | outpipe;
+    type = "A";
+    size = "";
   }
   else if (type == "DO") {
-    print symbol, version, weak, "DATA", size | outpipe;
+    type = "D";
   }
   else if (type == "DF") {
-    print symbol, version, weak, "FUNC" | outpipe;
+    type = "F";
+    size = "";
   }
   else {
-    print symbol, version, weak, "UNEXPECTED", type, $4, $5;
+    print symbol, version, weak, "?", type, $4, $5;
+    next;
   }
 
+  desc = " " symbol " " (weak == "w" ? tolower(type) : type) size;
+
+  if (version in versions) {
+    versions[version] = versions[version] "\n" desc;
+  }
+  else {
+    versions[version] = desc;
+  }
   next;
 }
 
@@ -52,3 +62,43 @@ NF == 0 || /DYNAMIC SYMBOL TABLE/ || /file format/ { next }
 {
   print "Don't grok this line:", $0
 }
+
+END {
+  nverlist = 0;
+  for (version in versions) {
+    if (nverslist == 0) {
+      verslist = version;
+      nverslist = 1;
+      continue;
+    }
+    split(verslist, s, "\n");
+    if (version < s[1]) {
+      verslist = version;
+      for (i = 1; i <= nverslist; ++i) {
+	verslist = verslist "\n" s[i];
+      }
+    }
+    else {
+      verslist = s[1];
+      for (i = 2; i <= nverslist; ++i) {
+	if (version < s[i]) break;
+	verslist = verslist "\n" s[i];
+      }
+      verslist = verslist "\n" version;
+      for (; i <= nverslist; ++i) {
+	verslist = verslist "\n" s[i];
+      }
+    }
+    ++nverslist;
+  }
+
+  split(verslist, order, "\n");
+  for (i = 1; i <= nverslist; ++i) {
+    version = order[i];
+
+    print version;
+    outpipe = "sort";
+    print versions[version] | outpipe;
+    close(outpipe);
+  }
+}