1 ########################################################################
3 # Copyright (c) 2010, Secure Endpoints Inc.
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions
10 # - Redistributions of source code must retain the above copyright
11 # notice, this list of conditions and the following disclaimer.
13 # - Redistributions in binary form must reproduce the above copyright
14 # notice, this list of conditions and the following disclaimer in
15 # the documentation and/or other materials provided with the
18 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21 # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22 # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24 # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28 # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 # POSSIBILITY OF SUCH DAMAGE.
45 GetOptions
("def=s" => \
$def_name,
47 "help|?" => \
$show_help) or pod2usage
( -exitval
=> 2,
49 pod2usage
( -exitval
=> 1,
50 -verbose
=> 3 ) if $show_help or !$def_name or !$vs_name;
52 open (my $def, '<', $def_name) or die $!;
53 open (my $vs, '<', $vs_name) or die $!;
55 # First go through the version-script
61 next unless m/^([^#]+)/;
63 @a = split(/\s+|(\{|})/,$1);
67 when (/global\:/) { $global = 1; }
68 when (/{|}|.*\:/) { $global = 0; }
69 when (/(.*)\;/ and $global == 1) {
79 next unless m/^;!([^;]+)/ or m/^([^;]+);?(!?)/;
81 @a = split(/\s+/, $1);
84 next if $f =~ /EXPORTS/ or $f =~ /DATA/ or not $f;
86 if (not exists $syms{$f} and not $2) {
87 print "$f: Only in DEF\n";
94 #while (($k,$v) = each %syms) {
95 for $k (sort keys %syms) {
96 print "$k: Only in VS\n";
103 if ($def_only or $vs_only) {
104 print "\nMismatches found.\n";
112 w32-sync-exported-symbols.pl - Synchronize Windows .def with version-script
116 w32-sync-exported-symbols.pl {options}
119 --def Name of .def file
120 --vs Name of version-script file
124 Verifies that all the symbols exported by the version-script is also
125 accounted for in the .def file. Also checks that no extra symbols are
126 exported by the .def file unless they are marked as safe.