Problems with double-word alignment on hppa and sparc - Debian

This is a discussion on Problems with double-word alignment on hppa and sparc - Debian ; Hi, I need some help with #444494 since I'm neither an ocaml nor a hppa, sparc specialist. The package orpie ships with its own gsl ocaml bindings and they cannot be compiled on hppa and sparc due to an alignment ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: Problems with double-word alignment on hppa and sparc

  1. Problems with double-word alignment on hppa and sparc

    Hi,

    I need some help with #444494 since I'm neither an ocaml nor a
    hppa, sparc specialist. The package orpie ships with its own
    gsl ocaml bindings and they cannot be compiled on hppa and sparc
    due to an alignment problem. I contacted upstream of orpie and
    got the following answer:


    I've looked into this a bit, and I'm not sure it can be fixed very
    easily. The OCaml bindings for libgsl avoid some expensive copy
    operations by making the assumption that the platform can accept double
    arrays aligned on word boundaries. Apparently hppa and sparc don't
    provide this capability.


    Well, is there really no hope for fixing this? This appears to
    be a more general problem and maybe somebody has solved it already.

    What puzzles me is the fact, that libocamlgsl-ocaml compiles without
    errors. The gsl bindings shipped with orpie are the same version as
    libocamlgsl-ocaml, though not all files are present.

    Uwe

    --
    MMK GmbH, Fleyer Str. 196, 58097 Hagen
    Uwe.Steinmann@mmk-hagen.de
    Tel: 02331 840446 Fax: 02331 843920

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.6 (GNU/Linux)

    iD8DBQFHS/+xih2Zvw18pwERAsmGAKCYZ3jcSLzycTdkT+OJV4QPOuOOdwCg l5tR
    cnyTYiM5l1eXYAWNAwBYHOQ=
    =//UR
    -----END PGP SIGNATURE-----


  2. Re: Problems with double-word alignment on hppa and sparc

    On Tue, Nov 27, 2007 at 12:29:53PM +0100, Uwe Steinmann wrote:
    >
    >I've looked into this a bit, and I'm not sure it can be fixed very
    >easily. The OCaml bindings for libgsl avoid some expensive copy
    >operations by making the assumption that the platform can accept double
    >arrays aligned on word boundaries. Apparently hppa and sparc don't
    >provide this capability.
    >


    sparc doesn't? I ran the attached test program on my Ultra 5 and it
    succesfully completed. If sparc didn't allow this, then the program
    would fail on the "ok" line with a SIGBUS. This might be different in
    64-bit mode, but since most Debian programs are compiled in 32-bit mode,
    this shouldn't matter.

    I cannot speak for hppa, since I don't own one.

    >Well, is there really no hope for fixing this? This appears to
    >be a more general problem and maybe somebody has solved it already.


    Remove the #error directive, and see if it works. Also, advise upstream
    that the C standard does not allow the assumption they made, and please
    chastise them. If it doesn't work, then you're out of luck; sparc does
    not provide in-kernel fixups of unaligned traps. (On Debian buildds,
    fixups of unaligned traps are disabled even on architectures that
    support them, due to the insane performance penalty they create.)

    >What puzzles me is the fact, that libocamlgsl-ocaml compiles without
    >errors. The gsl bindings shipped with orpie are the same version as
    >libocamlgsl-ocaml, though not all files are present.


    Unaligned access is not a compile-time problem, so you have to run the
    program to see if it fails. The way I would suggest handling this case
    is not to use #error directives, but instead to run a comprehensive
    testsuite and see if it fails; if not, you're probably free of any
    unaligned accesses. If the bindings really make the assumptions you say
    they do, then there is a 2**(-n) (n being the number of copies avoided)
    probability that you will pass a testsuite when there is an unaligned
    access.

    --
    brian m. carlson / brian with sandals: Houston, Texas, US
    +1 713 440 7475 | http://crustytoothpaste.ath.cx/~bmc | My opinion only
    a typesetting engine: http://crustytoothpaste.ath.cx/~bmc/code/thwack
    OpenPGP: RSA v4 4096b 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.6 (GNU/Linux)

    iQIVAwUBR0ySvr9TXYEfUvaLAQIliw//cyRMzdR6Gn52ZdDgw9FlqMqreXwzzLWT
    O8bhCKFCi0Uyv4q9sTfX1+0De8T8CSXBNSb1/Bw5oJ7AzzTOe7zLeTaBLVyGvMy3
    QOsTMltaLtV09KK93WRqCtAnYubi7OLWMmaq9WQAorMiA+lJAK m9SWAFnJpDMN5U
    4H3c3S9XVsTTXyvV71pAvAZrJZBurs4iv9aw7PVwln9qXK1H/SXd1XfYvLJVwWiH
    rydsrYQzsU3o2kTeyogo4EiXw2TjD3Jjh+i9SZfV93H1TsJ+GW ejuty+ChKzunTj
    9QS83KPcPQ04Xf1CDIknqi8a7bUxgwx8adKhzrAGDpIrvvLtX7 pmixC3hE05P1wE
    nr/6zBtqpvt5XEWK5GQNvDfho8KeGfWBFYLe0PdC7Iha9uFTTSY6K eZl2hrmP0Ji
    1GihiWKEzV8+In5syOdSsSmnxhSCUH1n6b0JQODYgw8N+QFCxB YkwcAtvNpimbyo
    IJczTKjy8WlfoOm9D7MeS2uvr8nm7OwqNtSqqQeKVTdxA99EwD VDJOw0gBTnYyKJ
    UV4n9EbJdoQRo053p+VkKR02nR4jvj8xWdK33YW7+paeeGsYzx jyvr0nMCIxL7iW
    z1om8OuNqeuI6ZznxROWJ8I6UFSHLzHOVEZHymfqIRwYQa4j/7FP0jUqFal0gP4u
    gsw8Vqz9evY=
    =ljFm
    -----END PGP SIGNATURE-----


  3. Re: Problems with double-word alignment on hppa and sparc

    On Tue, Nov 27, 2007 at 12:29:53PM +0100, Uwe Steinmann wrote:
    > Well, is there really no hope for fixing this? This appears to
    > be a more general problem and maybe somebody has solved it already.


    debian-hppa@l.d.o and debian-sparc@l.d.o might know.

    Gruesse,
    --
    Frank Lichtenheld
    www: http://www.djpig.de/


    --
    To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
    with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

  4. Re: Problems with double-word alignment on hppa and sparc

    * Uwe Steinmann [071127 14:02]:
    > I need some help with #444494 since I'm neither an ocaml nor a
    > hppa, sparc specialist. The package orpie ships with its own
    > gsl ocaml bindings and they cannot be compiled on hppa and sparc
    > due to an alignment problem. I contacted upstream of orpie and
    > got the following answer:
    >
    >
    > I've looked into this a bit, and I'm not sure it can be fixed very
    > easily. The OCaml bindings for libgsl avoid some expensive copy
    > operations by making the assumption that the platform can accept double
    > arrays aligned on word boundaries. Apparently hppa and sparc don't
    > provide this capability.
    >


    Uh, what are meant by word binaries? If word is 32bit, then this is
    false. If word means (not so absurd as it might sound as first, the
    8086 had that as word size, so it sticks in some people's mind) is
    16bit then this is indeed true. (And I am quite supprised that it only
    fails on hppa and sparc, I'd have guessed it to fail on almost anything
    but i386. (perhaps some other architectures only print warnings to
    syslog instead of punishing it directly with a sigbus)).

    What you can, even on sparc, is having 32 or even 64 bit quantities
    aligned to 16 bit in packed structs (and perhaps arrays). But you
    have to make sure you are not triggering undefined behaviour (which
    means sigbus here) by giving away pointer to unaligned data, nor forget
    that even an packages struct as a whole has an enforced alignment.
    (so having an struct with something on an +2 offset and and pointer
    to that struct which is not 0(mod 4) may mean the data is aliged but
    the compiler think it is misaligned and you get a buserror).

    Hochachtungsvoll,
    Bernhard R. Link


    --
    To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
    with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

+ Reply to Thread