This is the mail archive of the
cygwin-developers
mailing list for the Cygwin project.
Re: speclib vs. -lc trouble.
Dave Korn wrote:
>> I'll check something in shortly.
Howzat going? I see you've checked some stuff in but I'm still running on
yesterday's CVS.
> Here's a recipe to make a working libc.a from a broken (as currently
> generated on head) libc.a:
Here's a patch that I think should also do the job, against r1.18 of
speclib. Using the resulting libc.a resolves my ld-bootstrap testcase (also
my gcc bootstrap that was segfaulting in ld when libgcj gets linked with
"-ldl"), so now I'm going to install a full sysroot and try it out for a while.
winsup/cygwin/ChangeLog
* speclib: Forcibly add idata head, and rename symbols to
avoid collisions at link time.
cheers,
DaveK
Index: winsup/cygwin/speclib
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/speclib,v
retrieving revision 1.18
diff -p -u -r1.18 speclib
--- winsup/cygwin/speclib 10 Apr 2009 04:29:25 -0000 1.18
+++ winsup/cygwin/speclib 12 Apr 2009 17:24:30 -0000
@@ -43,6 +43,9 @@ close $nm_fd;
%extract or die "$0: couldn't find symbols for $lib\n";
+# Force the import lib head and tail in.
+$extract{"d000000.o"} = 1;
+
my $dir = tempdir(CLEANUP => 1);
chdir $dir;
@@ -50,4 +53,12 @@ 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;
-exec $ar, 'crus', $lib, sort keys %extract;
+system $ar, 'crus', $lib, sort keys %extract;
+
+# Post-munge it to rename import table head/name syms, making
+# it a completely separate import lib from the input source lib.
+my $prefix=$lib;
+$prefix =~ s/.*(lib.*)\.a/\1/ ;
+exec "objcopy", $lib, $lib,
+ "--redefine-sym", "__head_cygwin1_dll=__" . $prefix . "__head_cygwin1_dll",
+ "--redefine-sym", "_cygwin1_dll_iname=__" . $prefix . "_cygwin1_dll_iname";