]>
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. | |
27676bd0 JB |
17 | </pre><pre> |
18 | --- ocaml-4.02.1.orig/byterun/caml/signals_machdep.h | |
19 | +++ ocaml-4.02.1/byterun/caml/signals_machdep.h | |
dc9de8a5 JR |
20 | @@ -25,10 +25,19 @@ |
21 | ||
22 | #elif defined(__GNUC__) && defined(__x86_64__) | |
23 | ||
24 | +#ifdef __ILP32__ | |
25 | +/* x32 */ | |
26 | +#define Read_and_clear(dst,src) \ | |
27 | + asm("xorl %0, %0; xchgl %0, %1" \ | |
28 | + : "=r" (dst), "=m" (src) \ | |
29 | + : "m" (src)) | |
30 | +#else | |
31 | +/* amd64 */ | |
32 | #define Read_and_clear(dst,src) \ | |
33 | asm("xorq %0, %0; xchgq %0, %1" \ | |
34 | : "=r" (dst), "=m" (src) \ | |
35 | : "m" (src)) | |
36 | +#endif | |
37 | ||
38 | #elif defined(__GNUC__) && defined(__ppc__) | |
39 | ||
40 | --- ocaml-4.02.1.orig/configure | |
41 | +++ ocaml-4.02.1/configure | |
42 | @@ -832,6 +832,7 @@ case "$target" in | |
43 | arm*-*-linux-gnueabi) arch=arm; system=linux_eabi;; | |
44 | arm*-*-openbsd*) arch=arm; system=bsd;; | |
45 | zaurus*-*-openbsd*) arch=arm; system=bsd;; | |
46 | + x86_64-*-linux-gnux32) arch=x32; system=linux;; | |
47 | x86_64-*-linux*) arch=amd64; system=linux;; | |
48 | x86_64-*-gnu*) arch=amd64; system=gnu;; | |
49 | x86_64-*-freebsd*) arch=amd64; system=freebsd;; | |
50 | --- ocaml-4.02.1.orig/otherlibs/num/bng.c | |
51 | +++ ocaml-4.02.1/otherlibs/num/bng.c | |
52 | @@ -17,7 +17,7 @@ | |
53 | #include "config.h" | |
54 | ||
55 | #if defined(__GNUC__) && BNG_ASM_LEVEL > 0 | |
56 | -#if defined(BNG_ARCH_ia32) | |
57 | +#if defined(BNG_ARCH_ia32) || defined(BNG_ARCH_x32) | |
58 | #include "bng_ia32.c" | |
59 | #elif defined(BNG_ARCH_amd64) | |
60 | #include "bng_amd64.c" | |
61 | --- ocaml-4.02.1.orig/otherlibs/num/bng_ia32.c | |
62 | +++ ocaml-4.02.1/otherlibs/num/bng_ia32.c | |
63 | @@ -187,7 +187,7 @@ static bngdigit bng_ia32_mult_sub_digit | |
64 | This is faster than the plain IA32 code above on the Pentium 4. | |
65 | (Arithmetic operations with carry are slow on the Pentium 4). */ | |
66 | ||
67 | -#if BNG_ASM_LEVEL >= 2 | |
68 | +#if BNG_ASM_LEVEL >= 2 || defined(__x86_64__) | |
69 | ||
70 | static bngcarry bng_ia32sse2_add | |
71 | (bng a/*[alen]*/, bngsize alen, | |
72 | @@ -393,6 +393,13 @@ static int bng_ia32_sse2_supported(void) | |
73 | ||
74 | static void bng_ia32_setup_ops(void) | |
75 | { | |
76 | +#ifdef __x86_64__ | |
77 | + /* x32 -- SSE2 always supported */ | |
78 | + bng_ops.add = bng_ia32sse2_add; | |
79 | + bng_ops.sub = bng_ia32sse2_sub; | |
80 | + bng_ops.mult_add_digit = bng_ia32sse2_mult_add_digit; | |
81 | + bng_ops.mult_sub_digit = bng_ia32sse2_mult_sub_digit; | |
82 | +#else | |
83 | #if BNG_ASM_LEVEL >= 2 | |
84 | if (bng_ia32_sse2_supported()) { | |
85 | bng_ops.add = bng_ia32sse2_add; | |
86 | @@ -406,6 +413,7 @@ static void bng_ia32_setup_ops(void) | |
87 | bng_ops.sub = bng_ia32_sub; | |
88 | bng_ops.mult_add_digit = bng_ia32_mult_add_digit; | |
89 | bng_ops.mult_sub_digit = bng_ia32_mult_sub_digit; | |
90 | +#endif | |
91 | } | |
92 | ||
93 | #define BNG_SETUP_OPS bng_ia32_setup_ops() |