[MLton-devel] gcc/ld bug

Stephen Weeks MLton@mlton.org
Sat, 13 Apr 2002 13:40:35 -0700


> I would try gcc 2.96 next, but it could just be that the
> cross-compiling aspect is the problem.

I built a gcc 2.95.3 cross-compiler, and it segfaulted in exactly the
same way.  

> One thing you might try to work around it, although this might not
> work in cross-compiling, is to use the -r flag, which lets you link
> a bunch of .r's together into a larger .o, and then link subsets of
> the program together.

I tried this, but I obviously don't understand how to use -r.

% gcc -b i386-pc-cygwin -r -o z.o mlton.*.o
% gcc -b i386-pc-cygwin -r mlton.o z.o
z.o: file not recognized: File truncated
collect2: ld returned 1 exit status
% file z.o
z.o: 80386 COFF executable not stripped - version 30821
% file mlton.o
mlton.o: 80386 COFF executable not stripped - version 30821

> Alternatively, you could make all the .o's except for the one with
> main in it into a .a (using ar) and then link against that.  The
> notion is that there is some table overflow going on because of all
> the things being linked together.

I tried this, but it fails in the same way.
	
% i386-pc-cygwin-ar rc foo.a mlton.*.o
% gcc -v -b i386-pc-cygwin mlton.o foo.a -L/tmp/cross/build/bin/../lib/i386-pc-cygwin -lmlton -lm -lgmp
Reading specs from /usr/lib/gcc-lib/i386-pc-cygwin/2.95.3/specs
gcc version 2.95.3 20010315 (release)
 /usr/lib/gcc-lib/i386-pc-cygwin/2.95.3/collect2 /usr/i386-pc-cygwin/lib/crt0.o -L/tmp/cross/build/bin/../lib/i386-pc-cygwin -L/usr/lib/gcc-lib/i386-pc-cygwin/2.95.3 -L/usr/i386-pc-cygwin/lib mlton.o foo.a -lmlton -lm -lgmp -lgcc -lcygwin -luser32 -lkernel32 -ladvapi32 -lshell32 -lgcc
collect2: ld terminated with signal 11 [Segmentation fault]

_______________________________________________
MLton-devel mailing list
MLton-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlton-devel