Added the ability to xfail based on llvmgcc version
[llvm-complete.git] / utils / findsym.pl
blob31dd8b2f1f91cf84d28499b118a0a2ea807b3d50
1 #!/usr/bin/perl -w
3 # Program: findsym.pl
5 # Synopsis: Generate a list of the libraries in which a symbol is defined or
6 # referenced.
8 # Syntax: GenLibDeps.pl <directory_with_libraries_in_it> <symbol>
11 # Give first option a name.
12 my $Directory = $ARGV[0];
13 my $Symbol = $ARGV[1];
16 # Open the directory and read its contents, sorting by name and differentiating
17 # by whether its a library (.a) or an object file (.o)
18 opendir DIR,$Directory;
19 my @files = readdir DIR;
20 closedir DIR;
21 @objects = grep(/l?i?b?LLVM.*\.[oa]$/,sort(@files));
23 # Gather definitions from the libraries
24 foreach $lib (@objects) {
25 my $head = 0;
26 open SYMS,
27 "nm $Directory/$lib | grep '$Symbol' | sort --key=3 | uniq |";
28 while (<SYMS>) {
29 if (!$head) { print "$lib:\n"; $head = 1; }
30 chomp($_);
31 print " $_\n";
33 close SYMS;