Build errors on TEGRA2(ubuntu), testandset()

Bug #670776 reported by hotdigi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
QEMU
Fix Released
Undecided
Unassigned

Bug Description

Build errors on TEGRA2(ubuntu)

/tmp/ccqt9Y5t.s: Assembler messages:
/tmp/ccqt9Y5t.s:1899: Error: selected processor does not support Thumb mode 'swp r4, r4, [r2]'
/tmp/ccqt9Y5t.s:1974: Error: selected processor does not support Thumb mode 'swp r5, r5, [ip]'
make[1]: *** [exec.o Error 1

qemu-lock.h

#elif defined(__arm__)
static inline int testandset (int *spinlock)
{
    register unsigned int ret;
    __asm__ __volatile__("swp %0, %1, [%2]"
                         : "=r"(ret)
                         : "0"(1), "r"(spinlock));
    return ret;
}

Revision history for this message
hotdigi (hotdigi) wrote :

Build errors on TEGRA2(ubuntu)

/tmp/ccqt9Y5t.s: Assembler messages:
/tmp/ccqt9Y5t.s:1899: Error: selected processor does not support Thumb mode 'swp r4, r4, [r2]'
/tmp/ccqt9Y5t.s:1974: Error: selected processor does not support Thumb mode 'swp r5, r5, [ip]'
make[1]: *** [exec.o Error 1

description: updated
summary: - testandset
+ Build errors on TEGRA2(ubuntu), testandset()
Revision history for this message
Peter Maydell (pmaydell) wrote :

The Ubuntu ARM gcc defaults to building in Thumb mode. The swp/swpb instructions only exist in ARM mode.

In any case, swp is deprecated for more recent ARM architectures (ARMv6 and above), and on ARMv7 MP it will UNDEF and have to be emulated in the kernel. So the testandset implementation should probably be replaced with something involving ldrex/strex for cores that support it, or by using the gcc sync primitives (needs a gcc 4.4.1 or better, I think).

This Ubuntu bug: https://bugs.launchpad.net/ubuntu/+source/qemu-kvm/+bug/514252 has a patch which checks for the gcc primitives in configure and uses them if they exist -- you might like to try that.

Or if we believe the comment at the top of qemu-lock.h that "most of this code should be redundant" we could do the cleanup to get rid of it completely :-)

Revision history for this message
Peter Maydell (pmaydell) wrote :

This patch which I proposed would fix this bug:
http://patchwork.ozlabs.org/patch/81205/

Revision history for this message
Peter Maydell (pmaydell) wrote :
Changed in qemu:
status: New → Fix Committed
Revision history for this message
Peter Maydell (pmaydell) wrote :

QEMU 0.15.0 has been released with a fix for this bug.

Changed in qemu:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.