3 # Update CrossReport database.
4 # Copyright (C) 2009 Red Hat Inc.
5 # Written by Richard W.M. Jones <rjones@redhat.com>,
6 # http://fedoraproject.org/wiki/MinGW
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or (at
11 # your option) any later version.
13 # This program is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 # Map of symbol name -> RPM owner.
29 tie %symbols, "GDBM_File", "crossreport.db", &GDBM_NEWDB, 0666;
31 $symbols{__crossreport_time} = time ();
38 if (exists $symbols{$symbol} &&
39 $symbols{$symbol} ne $rpm_name) {
40 # Suppress this warning - it is quite common and probably
42 #warn "duplicate symbol: $symbol: $rpm_name and $symbols{$symbol}\n"
45 $symbols{$symbol} = $rpm_name;
50 Just a note: You should have ALL mingw32-* libraries installed
51 when you run this, otherwise you will get an incomplete database.
52 I do not have a way to test this, so I print this note.
56 my @implibs = </usr/i686-pc-mingw32/sys-root/mingw/lib/*.dll.a>;
58 print "Analyzing ", 0+@implibs, " libraries ...\n";
60 foreach my $implib (@implibs) {
61 # What MinGW library provides this file?
62 my $cmd = "rpm -qf $implib";
63 open CMD, "$cmd |" or die "$cmd: $!";
67 if ($r =~ /^(mingw32-[-+\w]+)-\d/) {
70 die "$implib: Cannot find RPM owning this file.\n"
73 $cmd = "i686-pc-mingw32-nm $implib | grep ' [A-HJ-TV-Z] ' | i686-pc-mingw32-c++filt -_";
74 open CMD, "$cmd |" or die "$cmd: $!";
77 if (m/^[[:xdigit:]]+ T _(\w+)(@\d+)?$/) {
78 add_symbol ($1, $rpm_name);
79 } elsif (m/^[[:xdigit:]]+ T (.*)(@\d+)?$/) {
80 add_symbol ($1, $rpm_name);
87 print "Found ", 0+(keys %symbols), " symbols.\n";