Comment 0 for bug 27203

Revision history for this message
In , Lennert Buytenhek (buytenh+debian) wrote :

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)