[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: hppa ocaml build failure :(((



Hello,

> GAH!  Make that: ocaml was doing a 64-bit store (with fstd) to a 32-bit
> aligned address.  (Gotta remember to keep my architectures straight...)
> 
> Since malloc always returns a 64-bit aligned address, you have to work to
> be unaligned...

Right.  OCaml has its own garbage-collected memory management, and,
yes, it can access double floats at word-aligned addresses.

However, alignment constraints are detected during autoconfiguration,
and if doubles need alignment above 1 word, accesses to doubles go
through special re-aligning routines (functions Double_val and
Store_double_val in ocamlrun).

This is the theory.  The practice is that the autoconfiguration
procedure might have detected incorrectly the alignment constraints
(this happened to Sven Luther on the SPARC with a recent version of
gcc), or were fooled by a kernel that performs alignment fixups behind
the program's back.

One way to circumvent the problem is to add a special case to the
"configure" script, next to the SPARC special case:

file ocaml-3.07/configure, starting on line 401:

# Determine alignment constraints

case "$host" in
  sparc-*-*)
    # On Sparc V9 with certain versions of gcc, determination of double
    # alignment is not reliable (PR#1521), hence force it
    echo "Doubles must be doubleword-aligned."
    echo "#define ARCH_ALIGN_DOUBLE" >> m.h;;
  *)
    sh ./runtest dblalign.c
    case $? in
      0) echo "Doubles can be word-aligned."

Just replace sparc-*-* by sparc-*-*|hppa*-*-*  for instance.

Let me know if this fixes the problem, and I'll put it in the working
sources.

Best regards,

- Xavier Leroy



Reply to: