[MLton] Question on Investigating Segfaults in Compiler

Brent Fulgham bfulg@pacbell.net
Thu, 8 Jul 2004 18:20:38 -0700 (PDT)


> 3. Run the regression tests with the cross-compiler.
>  To cross-compile
>    all the tests, do
> 
> 	bin/regression -cross i386-mingw
> 
>   This will create all the executables.  Then, copy
> bin/regression and
>   the regression directory to the target machine,
> and do
> 
> 	bin/regression -run-only
> 
>   This should run all the tests. 
> 

I'm running into trouble here already.  For some
reason, gcState is not being built into the runtime
properly (here I'm using gcc directly, rather than
running bin/regression because I was trying to
determine where I was having problems).

bfulgham@BFULGHAM ~/mlton/regression
$ gcc -o 1.exe 1.0.o 1.1.o -L. -lmlton -lgmp -lgdtoa
1.0.o(.text+0x2):1.0.S: undefined reference to
`gcState'
1.0.o(.text+0x11):1.0.S: undefined reference to
`globalWord32'
1.0.o(.text+0x1d):1.0.S: undefined reference to
`gcState'
1.0.o(.text+0x2d):1.0.S: undefined reference to
`globalWord32'
1.0.o(.text+0xaf):1.0.S: undefined reference to
`globalPointer'
1.0.o(.text+0xb5):1.0.S: undefined reference to
`gcState'

[ ... ]

The libmlton.a is the version built under Mingwin,
which was used to run "print-constants".  Obviously,
the Cygwin build does create a defined gcState entry,
but the Mingwin build does not:

bfulgham@bfulgham ~/mlton.cygwin/build/lib/Mingwin
$ nm libmlton.a  | grep gcState
         U _gcState
         U _gcState
         U _gcState
         U _gcState
         U _gcState
         U _gcState
         U _gcState
         U _gcState
         U _gcState
         U _gcState

bfulgham@bfulgham ~/mlton.cygwin/build/lib/Mingwin
$ nm ~/mlton.cygwin/build/lib/self/libmlton.a | grep
gcState
         U _gcState
         U _gcState
         U _gcState
         U _gcState
         U _gcState
         U _gcState
         U _gcState
         U _gcState
         U _gcState
         U _gcState
         U _gcState
         U _gcState
00000320 C _gcState

I've grepped around a bit, but don't see where gcState
(for example) is actually allocated.  If you can point
me in the right direction, I'll be able to figure out
what's not being built.

Thanks,

-Brent