4

When compiling certain cpp files for my project I'm getting warnings like this

Compile++ arm    : MYAPP <= myfile.cpp
/tmp/cc53K5MQ.s: Assembler messages:
/tmp/cc53K5MQ.s:887: Warning: swp{b} use is deprecated for this architecture

However, there's no any line number given in this warning so I don't know where to look at.

Do you have any idea why I'm getting this warning?

4
  • @zapi But that's line seems to be from a generated *.s assembler file not from my cpp file, I don't have a line 887
    – Alexander
    Commented Nov 27, 2012 at 12:21
  • Ah sry, a generated file. github.com/Neverlord/libcppa/issues/13 could be the same reason.
    – zapl
    Commented Nov 27, 2012 at 12:26
  • @zapl Thanks, yes looks like it's the same reason because I'm using std::atomic too.
    – Alexander
    Commented Nov 27, 2012 at 12:34
  • gcc myfile.cpp -S -c should produce myfile.s which contains the assembly.
    – auselen
    Commented Nov 27, 2012 at 13:52

2 Answers 2

6

The swp{b} instruction is deprecated in ARMv6 and above. Worse, it isn't supported at all in ARMv7 and is fixed up in the illegal instruction trap in the Linux kernel - at some runtime cost. Your compiler should absolutely not be generating it.

I've seen this problem too with the CodeSourcery compiler. The code generator phase emits swp{b} instructions, yet the assembler knows full well that they aren't supported for your target architecture. This rather implies you have the correct target architecture specified on the command-line.

I fixed the problem by upgrading to a newer version of GCC.

1
  • Thanks, I got this warning using distcc cross compile. The remote compiler was picking the wrong arch, so I fixed it by explicitly specifying the arch I wanted. Commented Mar 15, 2013 at 14:25
1

Use --save-temps to have GCC not delete the generated files.

1
  • 1
    Note that this won't fix the original problem, it will just make the .s file available so you can look at the assembly it's complaining about. Commented Dec 15, 2014 at 15:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.