]>
Commit | Line | Data |
---|---|---|
dc9de8a5 JR |
1 | Package: src:ocaml |
2 | Version: 4.02.1-2 | |
3 | Severity: wishlist | |
4 | Tags: patch | |
5 | User: debian-x32@lists.debian.org | |
6 | Usertags: port-x32 | |
7 | ||
8 | ||
9 | Please apply the attached patch, it adds support for x32 (as non-native). | |
10 | It's made against 4.02.1-2 (in experimental) as I guess you're not going | |
11 | to ever upload 4.01 again other than for eventual RC bug fixes. | |
12 | ||
13 | As you can see, the main problem is the current code confusing x32 for | |
14 | sometimes amd64 sometimes i386. I guess adding native optimized support | |
15 | wouldn't be hard (copying parts of i386 and parts of amd64...), but, not | |
16 | knowing anything about ocaml or the compiler, I preferred to keep it safe. | |
17 | </pre><pre>--- ocaml-4.02.1.orig/byterun/signals_machdep.h | |
18 | +++ ocaml-4.02.1/byterun/signals_machdep.h | |
19 | @@ -25,10 +25,19 @@ | |
20 | ||
21 | #elif defined(__GNUC__) && defined(__x86_64__) | |
22 | ||
23 | +#ifdef __ILP32__ | |
24 | +/* x32 */ | |
25 | +#define Read_and_clear(dst,src) \ | |
26 | + asm("xorl %0, %0; xchgl %0, %1" \ | |
27 | + : "=r" (dst), "=m" (src) \ | |
28 | + : "m" (src)) | |
29 | +#else | |
30 | +/* amd64 */ | |
31 | #define Read_and_clear(dst,src) \ | |
32 | asm("xorq %0, %0; xchgq %0, %1" \ | |
33 | : "=r" (dst), "=m" (src) \ | |
34 | : "m" (src)) | |
35 | +#endif | |
36 | ||
37 | #elif defined(__GNUC__) && defined(__ppc__) | |
38 | ||
39 | --- ocaml-4.02.1.orig/configure | |
40 | +++ ocaml-4.02.1/configure | |
41 | @@ -832,6 +832,7 @@ case "$target" in | |
42 | arm*-*-linux-gnueabi) arch=arm; system=linux_eabi;; | |
43 | arm*-*-openbsd*) arch=arm; system=bsd;; | |
44 | zaurus*-*-openbsd*) arch=arm; system=bsd;; | |
45 | + x86_64-*-linux-gnux32) arch=x32; system=linux;; | |
46 | x86_64-*-linux*) arch=amd64; system=linux;; | |
47 | x86_64-*-gnu*) arch=amd64; system=gnu;; | |
48 | x86_64-*-freebsd*) arch=amd64; system=freebsd;; | |
49 | --- ocaml-4.02.1.orig/otherlibs/num/bng.c | |
50 | +++ ocaml-4.02.1/otherlibs/num/bng.c | |
51 | @@ -17,7 +17,7 @@ | |
52 | #include "config.h" | |
53 | ||
54 | #if defined(__GNUC__) && BNG_ASM_LEVEL > 0 | |
55 | -#if defined(BNG_ARCH_ia32) | |
56 | +#if defined(BNG_ARCH_ia32) || defined(BNG_ARCH_x32) | |
57 | #include "bng_ia32.c" | |
58 | #elif defined(BNG_ARCH_amd64) | |
59 | #include "bng_amd64.c" | |
60 | --- ocaml-4.02.1.orig/otherlibs/num/bng_ia32.c | |
61 | +++ ocaml-4.02.1/otherlibs/num/bng_ia32.c | |
62 | @@ -187,7 +187,7 @@ static bngdigit bng_ia32_mult_sub_digit | |
63 | This is faster than the plain IA32 code above on the Pentium 4. | |
64 | (Arithmetic operations with carry are slow on the Pentium 4). */ | |
65 | ||
66 | -#if BNG_ASM_LEVEL >= 2 | |
67 | +#if BNG_ASM_LEVEL >= 2 || defined(__x86_64__) | |
68 | ||
69 | static bngcarry bng_ia32sse2_add | |
70 | (bng a/*[alen]*/, bngsize alen, | |
71 | @@ -393,6 +393,13 @@ static int bng_ia32_sse2_supported(void) | |
72 | ||
73 | static void bng_ia32_setup_ops(void) | |
74 | { | |
75 | +#ifdef __x86_64__ | |
76 | + /* x32 -- SSE2 always supported */ | |
77 | + bng_ops.add = bng_ia32sse2_add; | |
78 | + bng_ops.sub = bng_ia32sse2_sub; | |
79 | + bng_ops.mult_add_digit = bng_ia32sse2_mult_add_digit; | |
80 | + bng_ops.mult_sub_digit = bng_ia32sse2_mult_sub_digit; | |
81 | +#else | |
82 | #if BNG_ASM_LEVEL >= 2 | |
83 | if (bng_ia32_sse2_supported()) { | |
84 | bng_ops.add = bng_ia32sse2_add; | |
85 | @@ -406,6 +413,7 @@ static void bng_ia32_setup_ops(void) | |
86 | bng_ops.sub = bng_ia32_sub; | |
87 | bng_ops.mult_add_digit = bng_ia32_mult_add_digit; | |
88 | bng_ops.mult_sub_digit = bng_ia32_mult_sub_digit; | |
89 | +#endif | |
90 | } | |
91 | ||
92 | #define BNG_SETUP_OPS bng_ia32_setup_ops() | |
93 | --- ocaml-4.02.1.orig/testsuite/makefiles/Makefile.common | |
94 | +++ ocaml-4.02.1/testsuite/makefiles/Makefile.common | |
95 | @@ -68,7 +68,7 @@ OCAMLMKLIB=$(OCAMLRUN) $(OTOPDIR)/tools/ | |
96 | OCAMLYACC=$(TOPDIR)/yacc/ocamlyacc$(EXE) | |
97 | OCAMLBUILD=$(TOPDIR)/_build/ocamlbuild/ocamlbuild.native | |
98 | DUMPOBJ=$(OCAMLRUN) $(OTOPDIR)/tool/dumpobj | |
99 | -BYTECODE_ONLY=[ "$(ARCH)" = "none" -o "$(ASM)" = "none" ] | |
100 | +BYTECODE_ONLY=[ "$(ARCH)" = "none" -o "$(ARCH)" = "x32" -o "$(ASM)" = "none" ] | |
101 | ||
102 | #FORTRAN_COMPILER= | |
103 | #FORTRAN_LIBRARY= |