mesa: add EXT_dsa glMultiTexCoordPointerEXT function
[mesa.git] / bin / symbols-check.py
index 001a727a03efde5feeaa3721e70979b789a43dbb..329ca5f46a06f55c9d6717dbb4245595a1504101 100644 (file)
@@ -1,8 +1,9 @@
 #!/usr/bin/env python
 
 import argparse
-import subprocess
 import os
+import platform
+import subprocess
 
 # This list contains symbols that _might_ be exported for some platforms
 PLATFORM_SYMBOLS = [
@@ -23,11 +24,22 @@ def get_symbols(nm, lib):
     List all the (non platform-specific) symbols exported by the library
     '''
     symbols = []
-    output = subprocess.check_output([nm, '--format=bsd', '-D', '--defined-only', lib],
+    platform_name = platform.system()
+    output = subprocess.check_output([nm, '-gP', lib],
                                      stderr=open(os.devnull, 'w')).decode("ascii")
     for line in output.splitlines():
-        (_, _, symbol_name) = line.split()
+        fields = line.split()
+        if len(fields) == 2 or fields[1] == 'U':
+            continue
+        symbol_name = fields[0]
+        if platform_name == 'Linux':
+            if symbol_name in PLATFORM_SYMBOLS:
+                continue
+        elif platform_name == 'Darwin':
+            assert symbol_name[0] == '_'
+            symbol_name = symbol_name[1:]
         symbols.append(symbol_name)
+
     return symbols
 
 
@@ -47,7 +59,12 @@ def main():
                         help='path to binary (or name in $PATH)')
     args = parser.parse_args()
 
-    lib_symbols = get_symbols(args.nm, args.lib)
+    try:
+        lib_symbols = get_symbols(args.nm, args.lib)
+    except:
+        # We can't run this test, but we haven't technically failed it either
+        # Return the GNU "skip" error code
+        exit(77)
     mandatory_symbols = []
     optional_symbols = []
     with open(args.symbols_file) as symbols_file:
@@ -92,8 +109,6 @@ def main():
             continue
         if symbol in optional_symbols:
             continue
-        if symbol in PLATFORM_SYMBOLS:
-            continue
         unknown_symbols.append(symbol)
 
     missing_symbols = [