def METHOD_NAME(libs, libdirs):
    # XX write interface to objdump -t XX
    libnames = []
    for lib in libs:
        for ext in shared_ext,'.a':
            libname = 'lib'+lib+ext
            for libdir in libdirs:
                path = libdir+'/'+libname
                if file_exists(path):
                    libnames.append(path)
                    break
            #else:
                #print "cannot find %s lib as %s in %s" % ( lib, libname, libdir )
    print 'libnames:', libnames
    syms = {}
    accept = [ ' %s '%c for c in 'TVWBCDGRS' ]
    #f = open('syms.out','w')
    for libname in libnames:
        try:
            from subprocess import Popen, PIPE
            p = Popen(['nm', libname], bufsize=1, stdout=PIPE)
            fout = p.stdout
        except ImportError:
            fin, fout = os.popen2( 'nm %s' % libname )
        for line in fout.readlines():
            for acc in accept:
                if line.count(acc):
                    left, right = line.split(acc)
                    sym = right.strip()
                    if sys.platform.count('darwin'):
                        if sym[0] == '_':
                            sym = sym[1:] # remove underscore prefix
                        if sym.endswith('.eh'):
                            sym = sym[:-len('.eh')]
                    syms[sym] = None
                    #f.write( '%s: %s %s\n' % (sym,line[:-1],libname) )
                    break
    return syms