Qt/KDE fails to build on ARM without implicit-it=thumb

Bug #673085 reported by Jonathan Riddell
50
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Linaro GCC
Won't Fix
Undecided
Unassigned
gcc-4.5 (Ubuntu)
Won't Fix
High
Unassigned
qt4-x11 (Ubuntu)
Fix Released
High
Unassigned

Bug Description

Qt, kde4libs and kdepimlibs fail to build on ARM. When we add CXXFLAGS += -Wa,-mimplicit-it=thumb this fixes the build

I'm told implicit-it=thumb was removed from the gcc defaults in natty because upstream rejected it

http://launchpadlibrarian.net/58101634/buildlog_ubuntu-natty-armel.qt4-x11_4:4.7.0-0ubuntu7_FAILEDTOBUILD.txt.gz
/tmp/ccwaVByM.s:479: Error: thumb conditional instruction should be in IT block -- `strexeq r2,r5,[r6]'
/tmp/ccwaVByM.s:480: Error: thumb conditional instruction should be in IT block -- `teqeq r2,#1'

http://launchpadlibrarian.net/58424482/buildlog_ubuntu-natty-armel.kde4libs_4:4.5.2a-0ubuntu2_FAILEDTOBUILD.txt.gz
/tmp/ccD0wzHK.s:918: Error: thumb conditional instruction should be in IT block -- `strexeq r7,r0,[r1]'
/tmp/ccD0wzHK.s:919: Error: thumb conditional instruction should be in IT block -- `teqeq r7,#1'
/tmp/ccD0wzHK.s:1473: Error: thumb conditional instruction should be in IT block -- `strexeq lr,r0,[r1]'
/tmp/ccD0wzHK.s:1474: Error: thumb conditional instruction should be in IT block -- `teqeq lr,#1'
/tmp/ccD0wzHK.s:2071: Error: thumb conditional instruction should be in IT block -- `strexeq r2,r0,[r3]'
/tmp/ccD0wzHK.s:2072: Error: thumb conditional instruction should be in IT block -- `teqeq r2,#1'

http://launchpadlibrarian.net/58639702/buildlog_ubuntu-natty-armel.kdepimlibs_4:4.5.3-0ubuntu1_FAILEDTOBUILD.txt.gz
/tmp/cciJeDbH.s:4990: Error: thumb conditional instruction should be in IT block -- `strexeq r0,r6,[r1]'
/tmp/cciJeDbH.s:4991: Error: thumb conditional instruction should be in IT block -- `teqeq r0,#1'
/tmp/cciJeDbH.s:5218: Error: thumb conditional instruction should be in IT block -- `strexeq r0,r7,[r1]'
/tmp/cciJeDbH.s:5219: Error: thumb conditional instruction should be in IT block -- `teqeq r0,#1'

Tags: patch
Revision history for this message
Matthias Klose (doko) wrote :

In gcc-4.4, -mimplicit-it=thumb was passed to the linker by default, not done anymore in 4.5, because the change was rejected by upstream. Dave (and Linaro), any suggestions?

Changed in gcc-4.5 (Ubuntu):
importance: Undecided → High
status: New → Confirmed
Revision history for this message
Michael Hope (michaelh1) wrote :

For reference, here's the original discussion between David and Richard:
 http://lists.linaro.org/pipermail/linaro-toolchain/2010-July/000030.html
 http://lists.linaro.org/pipermail/linaro-toolchain/2010-July/000035.html

My summary is:
 * IT instructions are ignored in ARM mode and hence add no overhead
 * gas has had IT support for 'around 5 years'

Revision history for this message
Michael Hope (michaelh1) wrote :

Ignoring the implicit-it question, this seems simple to fix upstream. The code is inline assembler in
 src/corelib/arch/qatomic_armv6.h

Revision history for this message
Jonathan Riddell (jr) wrote :

"simple to fix" for someone who knows ARM assember maybe, do we have any such people?

Revision history for this message
Michael Hope (michaelh1) wrote :

Something like the attached patch should do it. I'm still building to see if it works though.

There's a couple of bigger problems though if we want to do it right:
 * There's code in corelib/arch/armv6/qatomic*.c that may also being used
 * qatomic_armv6.h includes code for RVCT which should be fixed by someone
 * The code may not work on multi-processor systems like Panda due to the lack of DMB instructions

The better fix would be to replace everything with __sync_* primitives similar to qatomic_avr32.h and require GCC 4.4 or higher.

In progress...

Revision history for this message
Michael Hope (michaelh1) wrote :

(not tested)

Revision history for this message
Alexander Sack (asac) wrote :

thx michael. could someone verify michaels patch please so we can forward it upstream?

Revision history for this message
Matthias Klose (doko) wrote :

to forward it upstream, a configure check should be added to check for the primitives

Revision history for this message
Loïc Minier (lool) wrote :

I don't think Michael's patch uses the primitives; I understand it's just a stop gap to fix the current build by fixing the problematic Qt code to have IT blocks? IOW fix the code to build without -Wa,-mimplicit-it=thumb.

I understand we will need another patch to move to __sync primitives, but that's a larger work

Revision history for this message
Matthias Klose (doko) wrote :

whoever uploads the fix/workaround, please consider fixing bug #490371 too.

Revision history for this message
Thiago Macieira (thiago-kde) wrote :

Unless __sync now supports the four memory ordering semantics, the patch will not be accepted upstream.

tags: added: patch
Revision history for this message
Scott Kitterman (kitterman) wrote :

I have a test build of the proposed patch (adding IT instructions, not __sync) in progress. If it builds and I can build KDE packages that currently fail to build, I'll call that a test success and upload it. I should have something tomorrow.

Revision history for this message
Dave Martin (dave-martin-arm) wrote :

Note that Michael's patch isn't suitable for upstream as-is.

IT instructions are not accepted by the assembler when building for ARM, so the proposed change will provoke build failures for upstream.

(At least, they are only accepted in unified assembler syntax mode, which is not the default for ARM in GNU-land, and probably never will be)

The suggestion in the thread http://lists.linaro.org/pipermail/linaro-toolchain/2010-July/000035.html isn't ideal, but it's a bit more portable.

Revision history for this message
Scott Kitterman (kitterman) wrote : Re: [Bug 673085] Re: Qt/KDE fails to build on ARM without implicit-it=thumb

Once we've established that the core of the patch is working, I agree it should be wrapped up into something more portable.

Revision history for this message
Scott Kitterman (kitterman) wrote :

Fails to build pretty early on:

In file included from ../../include/QtCore/qatomic_armv6.h:1:0,
                 from ../../include/QtCore/../../src/corelib/arch/qatomic_arch.h:56,
                 from ../../include/QtCore/qatomic_arch.h:1,
                 from ../../include/QtCore/../../src/corelib/thread/qbasicatomic.h:227,
                 from ../../include/QtCore/qbasicatomic.h:1,
                 from ../../include/QtCore/../../src/corelib/thread/qatomic.h:46,
                 from ../../include/QtCore/qatomic.h:1,
                 from ../../include/QtCore/../../src/corelib/tools/qbytearray.h:45,
                 from ../../include/QtCore/qbytearray.h:1,
                 from ../../include/QtCore/../../src/corelib/tools/qstring.h:46,
                 from ../../include/QtCore/qstring.h:1,
                 from ../../include/QtCore/../../src/corelib/kernel/qobject.h:48,
                 from ../../include/QtCore/qobject.h:1,
                 from ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:45,
                 from ../../include/QtCore/qcoreapplication.h:1,
                 from global/qt_pch.h:58:
../../include/QtCore/../../src/corelib/arch/qatomic_armv6.h: In constructor 'QParallelAnimationGroup::QParallelAnimationGroup(QObject*)':
../../include/QtCore/../../src/corelib/arch/qatomic_armv6.h:119:35: error: output number 2 not directly addressable
../../include/QtCore/../../src/corelib/arch/qatomic_armv6.h:119:35: warning: use of memory input without lvalue in asm operand 4 is deprecated
../../include/QtCore/../../src/corelib/arch/qatomic_armv6.h:119:35: error: output number 2 not directly addressable
../../include/QtCore/../../src/corelib/arch/qatomic_armv6.h:119:35: warning: use of memory input without lvalue in asm operand 4 is deprecated
../../include/QtCore/../../src/corelib/arch/qatomic_armv6.h: In destructor 'QList<T>::~QList() [with T = QAbstractAnimation*]':
../../include/QtCore/../../src/corelib/arch/qatomic_armv6.h:137:35: error: output number 2 not directly addressable
../../include/QtCore/../../src/corelib/arch/qatomic_armv6.h:137:35: warning: use of memory input without lvalue in asm operand 4 is deprecated
../../include/QtCore/../../src/corelib/arch/qatomic_armv6.h: In destructor 'QHash<Key, T>::~QHash() [with Key = QAbstractAnimation*, T = int]':
../../include/QtCore/../../src/corelib/arch/qatomic_armv6.h:137:35: error: output number 2 not directly addressable
../../include/QtCore/../../src/corelib/arch/qatomic_armv6.h:137:35: warning: use of memory input without lvalue in asm operand 4 is deprecated
../../include/QtCore/../../src/corelib/arch/qatomic_armv6.h: In member function 'void QHash<Key, T>::detach_helper() [with Key = QAbstractAnimation*, T = int]':
../../include/QtCore/../../src/corelib/arch/qatomic_armv6.h:137:35: error: output number 2 not directly addressable
../../include/QtCore/../../src/corelib/arch/qatomic_armv6.h:137:35: warning: use of memory input without lvalue in asm operand 4 is deprecated

Revision history for this message
Michael Hope (michaelh1) wrote : Re: [Bug 673085] Re: Qt/KDE fails to build on ARM without implicit-it=thumb

Yip, this is a separate bug tracked in LP: #675347.

Revision history for this message
Michael Hope (michaelh1) wrote :

My own test build of qt4-x11_4.7.0-0ubuntu4 with gcc-linaro 2010.10-0 (the one before LP: #675347) completed OK.

Revision history for this message
Scott Kitterman (kitterman) wrote :

I addition to my test build of qt4-x11, I also successfully rebuilt qmf using the products of the test build, so i think I'm comfortable that this works. We'll include this patch (thanks) when we upload qt4-x11 4.7.1 to Natty, but it still needs to go upstream.

Is there someone who can look at producing a portable version of the change?

Changed in qt4-x11 (Ubuntu):
status: New → In Progress
importance: Undecided → High
milestone: none → natty-alpha-1
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package qt4-x11 - 4:4.7.1-0ubuntu1

---------------
qt4-x11 (4:4.7.1-0ubuntu1) natty; urgency=low

  * New upstream release
  * Remove kubuntu_21_fix_phantom_cursor.diff applied upstream
  * Refresh 10_config_tests_fixes.diff
  * Refresh 01_debian_append_qt4_suffix.diff
  * Add kubuntu_22_thumb2_support.diff LP: #673085, remove implict thumb
    flag from debian/rules
 -- Jonathan Riddell <email address hidden> Mon, 15 Nov 2010 17:20:18 +0000

Changed in qt4-x11 (Ubuntu):
status: In Progress → Fix Released
Revision history for this message
Scott Kitterman (kitterman) wrote :

Marking the Ubuntu gcc task as wontfix since it's fixed in qt4-x11.

Changed in gcc-4.5 (Ubuntu):
status: Confirmed → Won't Fix
Revision history for this message
Michael Hope (michaelh1) wrote :

Could I close this from a Linaro GCC point of view? I'll open/reopen another ticket to track the -mimplicit-it support question.

Revision history for this message
Scott Kitterman (kitterman) wrote :

I think it's fine.

Michael Hope (michaelh1)
Changed in gcc-linaro:
status: New → Won't Fix
Revision history for this message
Michael Hope (michaelh1) wrote :

See also the discussion in LP: #675347 which includes an improvement in the Qt code that also works around the problem.

Waiting for GCC upstream approval before including the compiler fix.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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