Package: libgc Severity: serious Tags: patch Justification: no longer builds from source
libgc 6.6 FTBFS on arm platforms using any current gcc/binutils combo, bailing out with an error of the following type: Error: Rn must not overlap other operands -- `swp r3,r5,[r3]' The ARM 'swp Rd, Rm, [Rn]' instruction performs a 32 bit load-and-store on the memory address pointed to by Rn -- the old value at [Rn] is stored in Rd, and Rm is then written to [Rn]. The ARM Architecture Reference Manual specifies that if Rd and Rn are the same register (or if Rm and Rn are the same register), the result of the SWP instruction is unpredictable. The assembler rightfully throws an error when this condition occurs, which is what's happening here. libgc implements GC_test_and_set using inline assembly, but doesn't specify the right constraint for 'oldval'. Changing the 'oldval' constraint from "=r" to "=&r" tells gcc not to use a register for oldval which might also be used as an input operand, and prevents this error from occuring. Fix provided by rmk. -- System Information: Debian Release: testing/unstable APT prefers stable APT policy: (500, 'stable') Architecture: armeb (armv5teb) Shell: /bin/sh linked to /bin/bash Kernel: Linux 2.6.15-rc1 Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
--- libgc-6.6/include/private/gc_locks.h.orig 2005-12-16 14:46:31.000000000 +0100 +++ libgc-6.6/include/private/gc_locks.h 2005-12-16 14:47:20.000000000 +0100 @@ -244,7 +244,7 @@ * this code will likely need to be updated. */ /* See linuxthreads/sysdeps/arm/pt-machine.h in glibc-2.1 */ __asm__ __volatile__("swp %0, %1, [%2]" - : "=r"(oldval) + : "=&r"(oldval) : "r"(1), "r"(addr) : "memory"); return oldval;