5 # Synopsis: Generate a list of the libraries in which a symbol is defined or
8 # Syntax: findsym.pl <directory_with_libraries_in_it> <symbol>
13 # Give first option a name.
14 my $Directory = $ARGV[0];
15 my $Symbol = $ARGV[1];
17 # Open the directory and read its contents, sorting by name and differentiating
18 # by whether its a library (.a) or an object file (.o)
19 opendir DIR
,$Directory;
20 my @files = readdir DIR
;
22 @objects = grep(/l?i?b?LLVM.*\.[oa]$/,sort(@files));
24 # Gather definitions from the libraries
25 foreach $lib (@objects) {
28 "nm $Directory/$lib | grep '$Symbol' | sort --key=3 | uniq |";
30 if (!$head) { print "$lib:\n"; $head = 1; }