* speclib: Semi-revert to previous version but don't try to generate
well-formed import library. Instead, just extract appropriate symbols and let later libcygwin.a on link line fill in the rest of the import stuff. * gendef: Hopefully no-op modification to allow easier post-processing on symbol values.
This commit is contained in:
parent
0c4023011d
commit
59328e28c4
|
@ -1,3 +1,12 @@
|
||||||
|
2009-04-09 Christopher Faylor <me+cygwin@cgf.cx>
|
||||||
|
|
||||||
|
* speclib: Semi-revert to previous version but don't try to generate
|
||||||
|
well-formed import library. Instead, just extract appropriate symbols
|
||||||
|
and let later libcygwin.a on link line fill in the rest of the import
|
||||||
|
stuff.
|
||||||
|
* gendef: Hopefully no-op modification to allow easier post-processing
|
||||||
|
on symbol values.
|
||||||
|
|
||||||
2009-04-09 Corinna Vinschen <corinna@vinschen.de>
|
2009-04-09 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* syscalls.cc (try_to_bin): Use tmp_pathbuf buffer to allocate infobuf
|
* syscalls.cc (try_to_bin): Use tmp_pathbuf buffer to allocate infobuf
|
||||||
|
|
|
@ -105,7 +105,7 @@ LIBGMON_A:=libgmon.a
|
||||||
CYGWIN_START:=crt0.o
|
CYGWIN_START:=crt0.o
|
||||||
GMON_START:=gcrt0.o
|
GMON_START:=gcrt0.o
|
||||||
|
|
||||||
speclib=${word 1, $^} "${NM}" "$(DLLTOOL)" $(wordlist 2, $(words $^), $^)
|
speclib=${word 1, $^} "${NM}" "${AR}" $(wordlist 2, $(words $^), $^)
|
||||||
|
|
||||||
# Some things want these from libc, but they have their own static
|
# Some things want these from libc, but they have their own static
|
||||||
# data which apps can get to, which is a pain in the dll, so we
|
# data which apps can get to, which is a pain in the dll, so we
|
||||||
|
@ -442,22 +442,22 @@ shared.o: shared_info_magic.h
|
||||||
$(srcdir)/devices.cc: gendevices devices.in devices.h
|
$(srcdir)/devices.cc: gendevices devices.in devices.h
|
||||||
${wordlist 1,2,$^} $@
|
${wordlist 1,2,$^} $@
|
||||||
|
|
||||||
${CURDIR}/libc.a: speclib ${DEF_FILE} ./libm.a libpthread.a libutil.a
|
${CURDIR}/libc.a: speclib ${LIB_NAME} ./libm.a libpthread.a libutil.a
|
||||||
${speclib} -v ${@F}
|
${speclib} -v ${@F}
|
||||||
|
|
||||||
${CURDIR}/libm.a: speclib ${DEF_FILE} $(LIBM)
|
${CURDIR}/libm.a: speclib ${LIB_NAME} $(LIBM)
|
||||||
${speclib} ${@F}
|
${speclib} ${@F}
|
||||||
|
|
||||||
libpthread.a: speclib ${DEF_FILE} pthread.o thread.o
|
libpthread.a: speclib ${LIB_NAME} pthread.o thread.o
|
||||||
${speclib} ${@F}
|
${speclib} ${@F}
|
||||||
|
|
||||||
libutil.a: speclib ${DEF_FILE} bsdlib.o
|
libutil.a: speclib ${LIB_NAME} bsdlib.o
|
||||||
${speclib} ${@F}
|
${speclib} ${@F}
|
||||||
|
|
||||||
libdl.a: speclib ${DEF_FILE} dlfcn.o
|
libdl.a: speclib ${LIB_NAME} dlfcn.o
|
||||||
${speclib} ${@F}
|
${speclib} ${@F}
|
||||||
|
|
||||||
libresolv.a: speclib ${DEF_FILE} minires.o
|
libresolv.a: speclib ${LIB_NAME} minires.o
|
||||||
${speclib} ${@F}
|
${speclib} ${@F}
|
||||||
|
|
||||||
${EXTRALIBS}: lib%.a: %.o
|
${EXTRALIBS}: lib%.a: %.o
|
||||||
|
|
|
@ -34,13 +34,13 @@ close(IN);
|
||||||
my %sigfe = ();
|
my %sigfe = ();
|
||||||
my @data = ();
|
my @data = ();
|
||||||
my @nosigfuncs = ();
|
my @nosigfuncs = ();
|
||||||
my @out = ();
|
my @text = ();
|
||||||
for (@in) {
|
for (@in) {
|
||||||
/\sDATA$/o and do {
|
chomp;
|
||||||
push(@data, $_);
|
s/\sDATA$//o and do {
|
||||||
|
push @data, $_;
|
||||||
next;
|
next;
|
||||||
};
|
};
|
||||||
chomp;
|
|
||||||
if (/=/o) {
|
if (/=/o) {
|
||||||
if (s/\s+NOSIGFE\s*$//) {
|
if (s/\s+NOSIGFE\s*$//) {
|
||||||
# nothing
|
# nothing
|
||||||
|
@ -63,16 +63,18 @@ for (@in) {
|
||||||
s/(\S)\s+(\S)/$1 $2/go;
|
s/(\S)\s+(\S)/$1 $2/go;
|
||||||
s/(\S)\s+$/$1/o;
|
s/(\S)\s+$/$1/o;
|
||||||
s/^\s+(\S)/$1/o;
|
s/^\s+(\S)/$1/o;
|
||||||
push(@out, $_ . "\n");
|
push @text, $_;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (@out) {
|
for (@text) {
|
||||||
my ($alias, $func) = /^(\S+) = (\S+)\s*$/o;
|
my ($alias, $func) = /^(\S+) = (\S+)\s*$/o;
|
||||||
$_ = $alias . ' = ' . $sigfe{$func} . "\n"
|
$_ = $alias . ' = ' . $sigfe{$func}
|
||||||
if defined($func) && $sigfe{$func};
|
if defined($func) && $sigfe{$func};
|
||||||
}
|
}
|
||||||
|
|
||||||
open(OUT, '>', $out) or die "$0: couldn't open \"$out\" - $!\n";
|
open(OUT, '>', $out) or die "$0: couldn't open \"$out\" - $!\n";
|
||||||
print OUT @top, @data, @out;
|
push @top, (map {$_ . " DATA\n"} @data), (map {$_ . "\n"} @text);
|
||||||
|
print OUT @top;
|
||||||
close OUT;
|
close OUT;
|
||||||
|
|
||||||
open(SIGFE, '>', $sigfe) or die "$0: couldn't open sigfe file \"$sigfe\" - $!\n";
|
open(SIGFE, '>', $sigfe) or die "$0: couldn't open sigfe file \"$sigfe\" - $!\n";
|
||||||
|
|
|
@ -2,51 +2,52 @@
|
||||||
use Getopt::Long;
|
use Getopt::Long;
|
||||||
use File::Temp qw'tempdir';
|
use File::Temp qw'tempdir';
|
||||||
use File::Basename;
|
use File::Basename;
|
||||||
|
use Cwd;
|
||||||
use strict;
|
use strict;
|
||||||
|
|
||||||
|
sub dllname($;$);
|
||||||
|
|
||||||
|
my $static;
|
||||||
|
my $exclude;
|
||||||
|
|
||||||
|
GetOptions('static!'=>\$static, 'v|exclude!'=>\$exclude);
|
||||||
|
|
||||||
my $nm = shift;
|
my $nm = shift;
|
||||||
my $dlltool = shift;
|
my $ar = shift;
|
||||||
my $def = shift;
|
my $libdll = Cwd::abs_path(shift @ARGV);
|
||||||
my $lib = pop;
|
my $lib = Cwd::abs_path(pop @ARGV);
|
||||||
|
|
||||||
my $inverse;
|
open my $nm_fd, '-|', $nm, '-Ap', '--defined-only', @ARGV, $libdll or
|
||||||
if ($ARGV[$#ARGV] ne '-v') {
|
|
||||||
$inverse = 0;
|
|
||||||
} else {
|
|
||||||
$inverse = 1;
|
|
||||||
$#ARGV--;
|
|
||||||
}
|
|
||||||
|
|
||||||
open my $def_fd, '<', $def or die "$0: couldn't open \"$def\" - $!\n";
|
|
||||||
my %defsyms = ();
|
|
||||||
my $newdef = '';
|
|
||||||
while (<$def_fd>) {
|
|
||||||
if (/^\s*(?:EXPORTS\b|LIBRARY\b|\s*$)/o) {
|
|
||||||
$newdef .= $_;
|
|
||||||
} else {
|
|
||||||
my $sym = (split ' ')[0];
|
|
||||||
$defsyms{$sym} = $_;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
close $def_fd;
|
|
||||||
|
|
||||||
open my $nm_fd, '-|', $nm, '-pg', '--defined-only', @ARGV or
|
|
||||||
die "$0: execution of $nm for object files failed - $!\n";
|
die "$0: execution of $nm for object files failed - $!\n";
|
||||||
|
|
||||||
|
my %match_syms = ();
|
||||||
|
my $symfiles = ();
|
||||||
|
my $lastfn;
|
||||||
|
my %extract = ();
|
||||||
while (<$nm_fd>) {
|
while (<$nm_fd>) {
|
||||||
next unless /\S+\s+[A-Z]+\s+_(.*)$/o;
|
study;
|
||||||
if ($inverse) {
|
m%^\Q$libdll\E:([^:]*):\d+ i \.idata\$([56])% and do {
|
||||||
delete $defsyms{$1};
|
next;
|
||||||
} else {
|
};
|
||||||
$newdef .= $defsyms{$1} if exists $defsyms{$1};
|
m%^\Q$libdll\E:[^:]*:\d+ I (__head_.*)$% and do {
|
||||||
}
|
next;
|
||||||
|
};
|
||||||
|
next unless m%^([^:]*):([^:]*(?=:))?.* [DTI] (.*)%o;
|
||||||
|
if ($1 ne $libdll) {
|
||||||
|
$match_syms{$3} = 1;
|
||||||
|
} elsif ($match_syms{$3} ? !$exclude : $exclude) {
|
||||||
|
$extract{$2} = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
close $nm_fd;
|
close $nm_fd;
|
||||||
|
|
||||||
$newdef .= join '', sort values %defsyms if $inverse;
|
%extract or die "$0: couldn't find symbols for $lib\n";
|
||||||
|
|
||||||
open my $dlltool_fd, '|-', $dlltool, '-d', '/proc/self/fd/0', '-D', 'cygwin1.dll', '-l', $lib or
|
my $dir = tempdir(CLEANUP => 1);
|
||||||
die "$0: couldn't start dlltool - $dlltool - $!\n";
|
|
||||||
print $dlltool_fd $newdef;
|
chdir $dir;
|
||||||
close $dlltool_fd or exit 1;
|
# print join(' ', '+', $ar, 'x', sort keys %extract), "\n";
|
||||||
exit 0;
|
my $res = system $ar, 'x', $libdll, sort keys %extract;
|
||||||
|
die "$0: $ar extraction exited with non-zero status\n" if $res;
|
||||||
|
unlink $lib;
|
||||||
|
exec $ar, 'crus', $lib, sort keys %extract;
|
||||||
|
|
Loading…
Reference in New Issue