Commit nios2 port to master.
[platform/upstream/glibc.git] / scripts / abilist.awk
index 69da451..52b5b32 100644 (file)
@@ -9,19 +9,25 @@ BEGIN {
 }
 
 # Per-file header.
-/[^ :]+\.so\.[0-9]+:[  ]+.file format .*$/ {
-  if (parse_names && soname != "")
-    emit(1);
+/[^ :]+\.so\.[0-9.]+:[         ]+.file format .*$/ {
+  emit(0);
+
+  seen_opd = 0;
 
   sofullname = $1;
   sub(/:$/, "", sofullname);
   soname = sofullname;
   sub(/^.*\//, "", soname);
-  sub(/\.so\.[0-9]+$/, "", soname);
+  sub(/\.so\.[0-9.]+$/, "", soname);
+
+  suppress = ((filename_regexp != "" && sofullname !~ filename_regexp) \
+             || (libname_regexp != "" && soname !~ libname_regexp));
 
   next
 }
 
+suppress { next }
+
 # Normalize columns.
 /^[0-9a-fA-F]+      / { sub(/      /, "  -   ") }
 
@@ -31,16 +37,21 @@ $4 == "*UND*" { next }
 # Skip locals.
 $2 == "l" { next }
 
-$2 == "g" || $2 == "w" && NF == 7 {
+# If the target uses ST_OTHER, it will be output before the symbol name.
+$2 == "g" || $2 == "w" && (NF == 7 || NF == 8) {
   weak = $2;
   type = $3;
   size = $5;
   sub(/^0*/, "", size);
   size = " 0x" size;
   version = $6;
-  symbol = $7;
+  symbol = $NF;
   gsub(/[()]/, "", version);
 
+  # binutils versions up through at least 2.23 have some bugs that
+  # caused STV_HIDDEN symbols to appear in .dynsym, though that is useless.
+  if (NF > 7 && $7 == ".hidden") next;
+
   if (version == "GLIBC_PRIVATE") next;
 
   desc = "";
@@ -48,8 +59,17 @@ $2 == "g" || $2 == "w" && NF == 7 {
     type = "T";
   }
   else if (type == "D" && $4 == ".opd") {
-    type = "O";
+    type = "F";
     size = "";
+    if (seen_opd < 0)
+      type = "O";
+    seen_opd = 1;
+  }
+  else if (type == "D" && NF == 8 && $7 == "0x80") {
+    # Alpha functions avoiding plt entry in users
+    type = "F";
+    size = "";
+    seen_opd = -1;
   }
   else if ($4 == "*ABS*") {
     type = "A";
@@ -59,6 +79,14 @@ $2 == "g" || $2 == "w" && NF == 7 {
     type = "D";
   }
   else if (type == "DF") {
+    if (symbol ~ /^\./ && seen_opd >= 0)
+      next;
+    seen_opd = -1;
+    type = "F";
+    size = "";
+  }
+  else if (type == "iD" && ($4 == ".text" || $4 == ".opd")) {
+    # Indirect functions.
     type = "F";
     size = "";
   }
@@ -74,6 +102,9 @@ $2 == "g" || $2 == "w" && NF == 7 {
   if (desc == "")
     desc = " " symbol " " type size;
 
+  if (combine)
+    version = soname " " version (combine_fullname ? " " sofullname : "");
+
   if (version in versions) {
     versions[version] = versions[version] "\n" desc;
   }
@@ -90,7 +121,11 @@ NF == 0 || /DYNAMIC SYMBOL TABLE/ || /file format/ { next }
   print "Don't grok this line:", $0
 }
 
-function emit(tofile) {
+function emit(end) {
+  if (!end && (combine || ! parse_names || soname == ""))
+    return;
+  tofile = parse_names && !combine;
+
   nverslist = 0;
   for (version in versions) {
     if (nverslist == 0) {
@@ -119,9 +154,6 @@ function emit(tofile) {
     ++nverslist;
   }
 
-  if (combine)
-    tofile = 0;
-
   if (tofile) {
     out = prefix soname ".symlist";
     if (soname in outfiles)
@@ -141,12 +173,9 @@ function emit(tofile) {
       outpipe = "sort >> " out;
     }
     else {
-      if (combine_fullname)
-       print prefix soname, version, sofullname;
-      else if (combine)
-       print prefix soname, version;
-      else
-       print version;
+      if (combine)
+       print "";
+      print prefix version;
       outpipe = "sort";
     }
     print versions[version] | outpipe;
@@ -162,9 +191,5 @@ function emit(tofile) {
 }
 
 END {
-  if (! parse_names)
-    emit(0);
-  else if (soname != "") {
-    emit(1);
-  }
+  emit(1);
 }