]> sourceware.org Git - newlib-cygwin.git/commitdiff
* mkimport: Specify .text for stub explicitly.
authorChristopher Faylor <me@cgf.cx>
Sat, 18 Apr 2009 17:23:45 +0000 (17:23 +0000)
committerChristopher Faylor <me@cgf.cx>
Sat, 18 Apr 2009 17:23:45 +0000 (17:23 +0000)
* speclib: Add a dummy '.idata$7' section referring to the dll associated with
the real import library.

winsup/cygwin/ChangeLog
winsup/cygwin/mkimport
winsup/cygwin/speclib

index 3c5d3e537768f98a8fe2f11744988631d7976abd..59ac132f7bd80c3a5ce1fde37c4e5046546453d4 100644 (file)
@@ -1,3 +1,9 @@
+2009-04-18  Christopher Faylor  <me+cygwin@cgf.cx>
+
+       * mkimport: Specify .text for stub explicitly.
+       * speclib: Add a dummy '.idata$7' section referring to the dll
+       associated with the real import library.
+
 2009-04-18  Corinna Vinschen  <corinna@vinschen.de>
 
        * dcrt0.cc (globify): Only call mbtowc for non-ascii chars.
index 99d8ef0493cc83bdc5af4da03488b2eb20286aa1..abca7296445538d9f2473dd31948fc44eebae283 100755 (executable)
@@ -54,6 +54,7 @@ for my $f (keys %text) {
        $text{$f} = 1;
        open my $as_fd, '|-', $as, '-o', "$dir/t-$f", "-";
        print $as_fd <<EOF;
+       .text
        .extern $imp_sym
        .global $glob_sym
 $glob_sym:
index 9a0b678f3f76e83a683aefb94c19bd306c7dfe82..10218d876c86afa3aff32a79b10b25e0c81819a6 100755 (executable)
@@ -19,6 +19,8 @@ $_ = File::Spec->rel2abs($_) for @ARGV;
 
 my $libdll = shift;
 my $lib =  pop;
+(my $iname = basename $lib) =~ s/\.a$//o;
+$iname = '_' . $iname . '_dll_iname';
 
 open my $nm_fd, '-|', $nm, '-Apg', '--defined-only', @ARGV, $libdll or
   die "$0: execution of $nm for object files failed - $!\n";
@@ -29,17 +31,23 @@ my $lastfn;
 my %extract = ();
 my $exclude_regex = @exclude ? join('|', @exclude) : '\\UnLiKeLy//';
 $exclude_regex = qr/$exclude_regex/;
+my $dllname;
 while (<$nm_fd>) {
     study;
-    my ($file, $member, $symbol) = m%^([^:]*):([^:]*(?=:))?.* T (.*)%o;
-    next if !defined($symbol) || $symbol =~ $exclude_regex;
-    if ($file ne $libdll) {
-        $match_syms{$symbol} = 1;
-     } elsif ($match_syms{$symbol} ? !$inverse : $inverse) {
-        $extract{$member} = 1;
-     }
+    if (/ I _(.*)_dll_iname/o) {
+       $dllname ||= $1;
+    } else {
+       my ($file, $member, $symbol) = m%^([^:]*):([^:]*(?=:))?.* T (.*)%o;
+       next if !defined($symbol) || $symbol =~ $exclude_regex;
+       if ($file ne $libdll) {
+            $match_syms{$symbol} = 1;
+        } elsif ($match_syms{$symbol} ? !$inverse : $inverse) {
+            $extract{$member} = 1;
+        }
+    }
 }
 close $nm_fd;
+   
 
 %extract or die "$0: couldn't find symbols for $lib\n";
 
@@ -50,6 +58,20 @@ chdir $dir;
 my $res = system $ar, 'x', $libdll, sort keys %extract;
 die "$0: $ar extraction exited with non-zero status\n" if $res;
 unlink $lib;
+
+# Add a dummy .idata object for libtool so that it will think
+# this library is an import library.
+my $iname_o = 'd000000.o';
+$extract{$iname_o} = 1;
+open my $as_fd, '|-', $as, '-R', '-o', $iname_o, "-";
+print $as_fd <<EOF;
+       .section .idata\$7
+.global $iname
+$iname: .asciz "$dllname.dll"
+EOF
+close $as_fd or exit 1;
+system $objcopy, '-j', '.idata$7', $iname_o;
+
 $res = system $ar, 'crus', $lib, sort keys %extract;
 unlink keys %extract;
 die "$0: ar creation of $lib exited with non-zero status\n" if $res;
This page took 0.03812 seconds and 5 git commands to generate.