Windows: Check for DATA symbols when scanning .obj files
authorAsanka Herath <asanka@secure-endpoints.com>
Tue, 24 Aug 2010 08:24:53 +0000 (04:24 -0400)
committerAsanka C. Herath <asanka@secure-endpoints.com>
Tue, 14 Sep 2010 12:03:34 +0000 (08:03 -0400)
The export symbol list for ASN.1 on Windows is generated by scanning
all the .obj files and extracting the symbols defined in them.  The
generated list did not specify which were functions and which were
data symbols.  This distinction is necessary for generating correct
import library stubs.

cf/w32-list-externs-from-objs.pl

index ebc7767449424f89692955153605f96fd6070416..882801a229048172a51637efebe9cb5d87443230 100644 (file)
@@ -17,8 +17,8 @@ sub dump_symbols_for_file($)
     while (<SP>) {
        # 008 00000000 SECT3  notype ()    External     | _encode_AccessDescription
 
-       /^[[:xdigit:]]{3,}\s[[:xdigit:]]{8,}\s(\w+)\s+\w*\s+(?:\(\)|  )\s+(\w+)\s+\|\s+(\w+)$/ && do {
-           my ($section, $visibility, $symbol) = ($1, $2, $3);
+       /^[[:xdigit:]]{3,}\s[[:xdigit:]]{8,}\s(\w+)\s+\w*\s+(\(\)|  )\s+(\w+)\s+\|\s+([0-9a-zA-Z\@\_]+)$/ && do {
+           my ($section, $type, $visibility, $symbol) = ($1, $2, $3, $4);
 
            if ($section ne "UNDEF" && $visibility eq "External") {
                print $fn if $show_module_name;
@@ -27,7 +27,13 @@ sub dump_symbols_for_file($)
                if ($strip_leading_underscore && $symbol =~ /_(.*)/) {
                    $symbol = $1;
                }
+               if ($strip_leading_underscore && $symbol =~ /(.*)\@.*$/) {
+                   $symbol = $1;
+               }
                print $symbol;
+                if ($type ne "()") {
+                    print "\tDATA";
+                }
                print "\n";
            }
        };