--- Begin Message ---
- To: Debian Bug Tracking System <submit@bugs.debian.org>
- Subject: src:ocaml: Please add support for the x32 architecture
- From: Adam Borowski <kilobyte@angband.pl>
- Date: Thu, 18 Dec 2014 05:47:12 +0100
- Message-id: <20141218044709.2954.19989.reportbug@umbar.angband.pl>
Package: src:ocaml
Version: 4.02.1-2
Severity: wishlist
Tags: patch
User: debian-x32@lists.debian.org
Usertags: port-x32
Please apply the attached patch, it adds support for x32 (as non-native).
It's made against 4.02.1-2 (in experimental) as I guess you're not going
to ever upload 4.01 again other than for eventual RC bug fixes.
As you can see, the main problem is the current code confusing x32 for
sometimes amd64 sometimes i386. I guess adding native optimized support
wouldn't be hard (copying parts of i386 and parts of amd64...), but, not
knowing anything about ocaml or the compiler, I preferred to keep it safe.
--- ocaml-4.02.1.orig/byterun/signals_machdep.h
+++ ocaml-4.02.1/byterun/signals_machdep.h
@@ -25,10 +25,19 @@
#elif defined(__GNUC__) && defined(__x86_64__)
+#ifdef __ILP32__
+/* x32 */
+#define Read_and_clear(dst,src) \
+ asm("xorl %0, %0; xchgl %0, %1" \
+ : "=r" (dst), "=m" (src) \
+ : "m" (src))
+#else
+/* amd64 */
#define Read_and_clear(dst,src) \
asm("xorq %0, %0; xchgq %0, %1" \
: "=r" (dst), "=m" (src) \
: "m" (src))
+#endif
#elif defined(__GNUC__) && defined(__ppc__)
--- ocaml-4.02.1.orig/configure
+++ ocaml-4.02.1/configure
@@ -832,6 +832,7 @@ case "$target" in
arm*-*-linux-gnueabi) arch=arm; system=linux_eabi;;
arm*-*-openbsd*) arch=arm; system=bsd;;
zaurus*-*-openbsd*) arch=arm; system=bsd;;
+ x86_64-*-linux-gnux32) arch=x32; system=linux;;
x86_64-*-linux*) arch=amd64; system=linux;;
x86_64-*-gnu*) arch=amd64; system=gnu;;
x86_64-*-freebsd*) arch=amd64; system=freebsd;;
--- ocaml-4.02.1.orig/otherlibs/num/bng.c
+++ ocaml-4.02.1/otherlibs/num/bng.c
@@ -17,7 +17,7 @@
#include "config.h"
#if defined(__GNUC__) && BNG_ASM_LEVEL > 0
-#if defined(BNG_ARCH_ia32)
+#if defined(BNG_ARCH_ia32) || defined(BNG_ARCH_x32)
#include "bng_ia32.c"
#elif defined(BNG_ARCH_amd64)
#include "bng_amd64.c"
--- ocaml-4.02.1.orig/otherlibs/num/bng_ia32.c
+++ ocaml-4.02.1/otherlibs/num/bng_ia32.c
@@ -187,7 +187,7 @@ static bngdigit bng_ia32_mult_sub_digit
This is faster than the plain IA32 code above on the Pentium 4.
(Arithmetic operations with carry are slow on the Pentium 4). */
-#if BNG_ASM_LEVEL >= 2
+#if BNG_ASM_LEVEL >= 2 || defined(__x86_64__)
static bngcarry bng_ia32sse2_add
(bng a/*[alen]*/, bngsize alen,
@@ -393,6 +393,13 @@ static int bng_ia32_sse2_supported(void)
static void bng_ia32_setup_ops(void)
{
+#ifdef __x86_64__
+ /* x32 -- SSE2 always supported */
+ bng_ops.add = bng_ia32sse2_add;
+ bng_ops.sub = bng_ia32sse2_sub;
+ bng_ops.mult_add_digit = bng_ia32sse2_mult_add_digit;
+ bng_ops.mult_sub_digit = bng_ia32sse2_mult_sub_digit;
+#else
#if BNG_ASM_LEVEL >= 2
if (bng_ia32_sse2_supported()) {
bng_ops.add = bng_ia32sse2_add;
@@ -406,6 +413,7 @@ static void bng_ia32_setup_ops(void)
bng_ops.sub = bng_ia32_sub;
bng_ops.mult_add_digit = bng_ia32_mult_add_digit;
bng_ops.mult_sub_digit = bng_ia32_mult_sub_digit;
+#endif
}
#define BNG_SETUP_OPS bng_ia32_setup_ops()
--- ocaml-4.02.1.orig/testsuite/makefiles/Makefile.common
+++ ocaml-4.02.1/testsuite/makefiles/Makefile.common
@@ -68,7 +68,7 @@ OCAMLMKLIB=$(OCAMLRUN) $(OTOPDIR)/tools/
OCAMLYACC=$(TOPDIR)/yacc/ocamlyacc$(EXE)
OCAMLBUILD=$(TOPDIR)/_build/ocamlbuild/ocamlbuild.native
DUMPOBJ=$(OCAMLRUN) $(OTOPDIR)/tool/dumpobj
-BYTECODE_ONLY=[ "$(ARCH)" = "none" -o "$(ASM)" = "none" ]
+BYTECODE_ONLY=[ "$(ARCH)" = "none" -o "$(ARCH)" = "x32" -o "$(ASM)" = "none" ]
#FORTRAN_COMPILER=
#FORTRAN_LIBRARY=
--- End Message ---
--- Begin Message ---
Source: ocaml
Source-Version: 4.02.3-6
We believe that the bug you reported is fixed in the latest version of
ocaml, which is due to be installed in the Debian FTP archive.
A summary of the changes between this version and the previous one is
attached.
Thank you for reporting the bug, which will now be closed. If you
have further comments please address them to 773409@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.
Debian distribution maintenance software
pp.
Stéphane Glondu <glondu@debian.org> (supplier of updated ocaml package)
(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
Format: 1.8
Date: Tue, 16 Feb 2016 11:34:16 +0100
Source: ocaml
Binary: ocaml-nox ocaml ocaml-base-nox ocaml-base ocaml-native-compilers ocaml-source ocaml-interp ocaml-compiler-libs ocaml-mode
Architecture: source amd64 all
Version: 4.02.3-6
Distribution: unstable
Urgency: medium
Maintainer: Debian OCaml Maintainers <debian-ocaml-maint@lists.debian.org>
Changed-By: Stéphane Glondu <glondu@debian.org>
Description:
ocaml - ML language implementation with a class-based object system
ocaml-base - Runtime system for OCaml bytecode executables
ocaml-base-nox - Runtime system for OCaml bytecode executables (no X)
ocaml-compiler-libs - OCaml interpreter and standard libraries
ocaml-interp - OCaml interactive interpreter and standard libraries
ocaml-mode - major mode for editing Objective Caml in Emacs
ocaml-native-compilers - Native code compilers of the OCaml suite (the .opt ones)
ocaml-nox - ML implementation with a class-based object system (no X)
ocaml-source - Sources for Objective Caml
Closes: 773409
Changes:
ocaml (4.02.3-6) unstable; urgency=medium
.
* Add x32 support (Closes: #773409)
Checksums-Sha1:
29f3906db93d1762398e772a56438db3fa6bd892 2686 ocaml_4.02.3-6.dsc
0acb2ffc34b22844980311280053dec0793e39ee 45780 ocaml_4.02.3-6.debian.tar.xz
3f10d603739990b1f5b38c6f2d5c15453d4430b1 8044 ocaml-base-dbgsym_4.02.3-6_amd64.deb
8437ef824e8f20eb92fcf0bed4d07e2f61c5b99d 54382 ocaml-base-nox-dbgsym_4.02.3-6_amd64.deb
145c63476fabcc8721178b469f04c8e877075908 538590 ocaml-base-nox_4.02.3-6_amd64.deb
656f3d7ba9a25ceec6a23602d630cf78e108f9c0 132784 ocaml-base_4.02.3-6_amd64.deb
842f806ffe554886a5058fe28a6ea3021d0017dd 9609306 ocaml-compiler-libs_4.02.3-6_amd64.deb
41f568af705ae5a18df91d69e307b1360e980053 360370 ocaml-interp_4.02.3-6_amd64.deb
8059dfe6e7dbcadcb19ed9aeb0b86b117f19afb4 136548 ocaml-mode_4.02.3-6_all.deb
33691b07774a7cbd3e26e382c9acef6dd58e10fa 762166 ocaml-native-compilers-dbgsym_4.02.3-6_amd64.deb
21230c108274d3fef4e4f32556d4357f41c30968 2548164 ocaml-native-compilers_4.02.3-6_amd64.deb
3b84bf92d43f1310f62feab235cc5b878597e7f8 1791762 ocaml-nox-dbgsym_4.02.3-6_amd64.deb
59a536a2d08097e506c3234da294eb1e369abe19 6706182 ocaml-nox_4.02.3-6_amd64.deb
2f512c24689921600047d436eb168411a2935711 2160690 ocaml-source_4.02.3-6_all.deb
70e0c7881aeb7d2a74509f8632dc23cdefc9c0a2 120548 ocaml_4.02.3-6_amd64.deb
Checksums-Sha256:
0b109335efe36d9574c52c71517bd2d32b0ef540678b5303560023dd8f877b16 2686 ocaml_4.02.3-6.dsc
b775ece2796460b06b3105bd825d32185042725d86009d79c1e8b2b2b7705ef4 45780 ocaml_4.02.3-6.debian.tar.xz
a425963ffb8ca080439c22dd655995df91388bb19a0dc8776f135784040f503a 8044 ocaml-base-dbgsym_4.02.3-6_amd64.deb
528faf7816ddc94abb8e89d844385032ecbbc6dec7300cb277cf089844c0dd1b 54382 ocaml-base-nox-dbgsym_4.02.3-6_amd64.deb
dd03bbbbea8be0ab99167321f88f1ba2e68d4c7c1846c205613245f5a8ee0192 538590 ocaml-base-nox_4.02.3-6_amd64.deb
25a5da63274f66b997fa9013abb6cde913ae025114e192ad8029c2cde7689546 132784 ocaml-base_4.02.3-6_amd64.deb
9f8a04b7387db9203fe93a1598706eb7061489ec29cc3280f13f843741d08bfd 9609306 ocaml-compiler-libs_4.02.3-6_amd64.deb
08fa50423255f0813a1678ab4a570f59f6444a5d1101815c30a5c3bb748bf31f 360370 ocaml-interp_4.02.3-6_amd64.deb
bf83e999960521be75d220c604709ada350c63242057756dd7c79ee05b05fcc8 136548 ocaml-mode_4.02.3-6_all.deb
13bfa2f148931a636ce04bfe6d380409c9762106e787dfe1e81d5583d70b0d22 762166 ocaml-native-compilers-dbgsym_4.02.3-6_amd64.deb
8a49640453f2d834a9e7be403e12d6955163873267362de1786be192a11e2890 2548164 ocaml-native-compilers_4.02.3-6_amd64.deb
683b38ced9fd076e901a12994a576392cd841a5b3cd1677b019e28260493ea8a 1791762 ocaml-nox-dbgsym_4.02.3-6_amd64.deb
1cef9abbc6dc9f3168805c8e8e4d3fad3ddd7b5c468f7989a060230041ad7aa9 6706182 ocaml-nox_4.02.3-6_amd64.deb
3842230954ee888935953bb02cab1a07fe3dad3e777a96311cecf10baeee28a5 2160690 ocaml-source_4.02.3-6_all.deb
9ef243ff33a10cf9722350910f85f425145a7939fdf60f73146fac517c14de6d 120548 ocaml_4.02.3-6_amd64.deb
Files:
dad4a030fd0412edd71de4ebeb70fd09 2686 ocaml optional ocaml_4.02.3-6.dsc
b7ad65c0bb338a129e79962a5f3a3718 45780 ocaml optional ocaml_4.02.3-6.debian.tar.xz
12d5ee9167a83d1f952984da02351065 8044 debug extra ocaml-base-dbgsym_4.02.3-6_amd64.deb
ab9d8dd816ca764767d23c7f3b33fa94 54382 debug extra ocaml-base-nox-dbgsym_4.02.3-6_amd64.deb
0075d8dfd966dce58c86308a2d48b710 538590 ocaml optional ocaml-base-nox_4.02.3-6_amd64.deb
8a496529e747a1b73f05001d998f445b 132784 ocaml optional ocaml-base_4.02.3-6_amd64.deb
11100a9201ee827560a48beda746127a 9609306 ocaml optional ocaml-compiler-libs_4.02.3-6_amd64.deb
57102460c37afb1b8726e0ae279ce1ab 360370 ocaml optional ocaml-interp_4.02.3-6_amd64.deb
56a9aaf693ddb9130f1b54d190d86907 136548 ocaml optional ocaml-mode_4.02.3-6_all.deb
43b186b40fcff380b0c9c01a9360402e 762166 debug extra ocaml-native-compilers-dbgsym_4.02.3-6_amd64.deb
1ffd2d2bb66a04868b2eab7cdb31997e 2548164 ocaml optional ocaml-native-compilers_4.02.3-6_amd64.deb
8cc347095c86903756536265f510fa31 1791762 debug extra ocaml-nox-dbgsym_4.02.3-6_amd64.deb
d4020180fdbcbd94cf741bb695ca961c 6706182 ocaml optional ocaml-nox_4.02.3-6_amd64.deb
461ea3b5159dd29eee7142ecee208913 2160690 ocaml optional ocaml-source_4.02.3-6_all.deb
d3835aebdff65e51ef6a915524af2d01 120548 ocaml optional ocaml_4.02.3-6_amd64.deb
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQIcBAEBCgAGBQJWwwEKAAoJEHhT2k1JiBrTzrEP/2RJl1R6tc0NLvJPRDrTEGQv
9FhmyFBUqOopVRnAn3P7lMhcKChzK/BvpRijfMH+pvSqpF86wtrFyfvwdfzdFPuk
aCKLfevICiu5gxDeF7gxB3KCrKO27kv2RlauDxQTXgykuNUQCr/wVcLZO6RogFyG
Bj2MyQpFVRnCdirJ9fujXaO46EhNmLO3/JjkStmiufzJ1Aa0WfUXigAIZanol21o
bO99Srs6J2D7L6ot7u4q7RSy9ikTQ3z7y4T3rbA0audS9YCGM4EH5yELrM4HaL92
+/Mlnt3vW8IhHGCRNgD87gdADhNWn+fPmNzbnkA6We8V1XZcQAL5js63TnLGhfHi
IWPJu2/5Iz+RaNUEZ/vDBnae26DmUMqMZOZUXAwnQFxgOwwXE3Ev3F/gDJMc+qqT
sauHiqlg43fpBJ7IVFz9RjVcrf5omMnsDwF/fZt2gOPI2fqFHjXTO9ins9r5AL1P
0kFUTJOHCyJupaEGTiKdpsoEP8pBXGZEWwHO/0BZhC2NZWro2D+OVivww0w/EngV
wO4BnDgZRUV6a8FfhNnsoT285UYd0nlpo3O+IVTe+KYnHbUTeDrpEL8DLMmZnjN7
cTguxl+7ldxl6BYPuDwF5G0XE+MEYIj7LZLiDkRhFFi5Za3dUz4sMnS8ZcR4mlyE
6IeqbqEsK3tZyiy08lM/
=0mEI
-----END PGP SIGNATURE-----
--- End Message ---