Fix FTBFS on m68k
authorStéphane Glondu <glondu@debian.org>
Thu, 20 Jun 2024 00:37:06 +0000 (02:37 +0200)
committerStéphane Glondu <glondu@debian.org>
Thu, 20 Jun 2024 02:25:27 +0000 (04:25 +0200)
debian/patches/0009-Remove-fixed-register-assignments-on-m68k.patch [new file with mode: 0644]
debian/patches/series

diff --git a/debian/patches/0009-Remove-fixed-register-assignments-on-m68k.patch b/debian/patches/0009-Remove-fixed-register-assignments-on-m68k.patch
new file mode 100644 (file)
index 0000000..26bc069
--- /dev/null
@@ -0,0 +1,37 @@
+From: Miod Vallat <miod@tarides.com>
+Date: Wed, 19 Jun 2024 13:13:03 +0000
+Subject: Remove fixed register assignments on m68k.
+
+The use of %a5 conflicts with its internal usage as a GOT base by Glibc, and
+given the scarce number of available registers on this platform, it is
+probably better to trust the compiler to perform register assignment here.
+
+Origin: https://github.com/ocaml/ocaml/pull/13252
+---
+ runtime/interp.c | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/runtime/interp.c b/runtime/interp.c
+index 66f0123..b688a6d 100644
+--- a/runtime/interp.c
++++ b/runtime/interp.c
+@@ -208,11 +208,18 @@ Caml_inline void check_trap_barrier_for_effect
+ #define SP_REG asm("%r17")
+ #define ACCU_REG asm("%r16")
+ #endif
+-#ifdef __mc68000__
++#ifdef __mc68000__ /* { */
++#ifdef __linux__
++/* glibc relies upon %a5 to always contain the base address of the GOT. */
++#define PC_REG asm("a3")
++#define SP_REG asm("a4")
++#define ACCU_REG asm("d7")
++#else
+ #define PC_REG asm("a5")
+ #define SP_REG asm("a4")
+ #define ACCU_REG asm("d7")
+ #endif
++#endif /* } __mc68000 */
+ /* PR#4953: these specific registers not available in Thumb mode */
+ #if defined (__arm__) && !defined(__thumb__)
+ #define PC_REG asm("r6")
index da8df5a18e1dc5cf1493cdeae06dbf5a87f949d6..65399d578f83bef64528bd55c5dd696a66fbc555 100644 (file)
@@ -6,3 +6,4 @@
 0007-Put-manpages-in-section-3o-instead-of-3.patch
 0008-Filter-out-f-debug-file-prefix-map-from-ocamlc_cflag.patch
 0008-Fix-call-to-test-in-configure.ac.patch
+0009-Remove-fixed-register-assignments-on-m68k.patch