4

I'm compiling DCP-O-Matic on a Raspberry Pi 2 and am getting the following warning:

/tmp/ccu6rDcg.s: Assembler messages:
/tmp/ccu6rDcg.s:4208: Warning: swp{b} use is deprecated for ARMv6 and ARMv7

I've passed "-mcpu=cortex-a8 -mfpu=neon" to the compiler, but I still get the warnings. I'm pretty sure there is something in the Linux kernel that makes this warning irrelevant, but I would really like to solve this.

This post has a lot of good information, but I can't seem to find the right switches to prevent the warnings. I've verified that there is no explicit assembler code using swp{b}.

Can anyone recommend the best way to clear these warnings? I really am kind of anal about compilation warnings. ;) I figure if there's a warning, there's a fix.

To clarify, I'm interested in how to get the gcc toolchain to emit the correct LDREX/STREX instructions, rather than swap{b}.

6
  • What I would do is to make build verbose. If it is make try V=1, and see full toolchain invocation for that particular line. High chance you'll see the culprit. In worst case there might be a inline assembly in your source files where swp was explicitly used.
    – auselen
    Feb 17, 2015 at 7:13
  • swp is explicitly used in ccu6rDcg.s at line 4208. David doesn't try to stop using swp, he tries to disable the warning message, which is relevant on cortex-A8 as it is an ARM v7a, excepted if this assembly code is run in a non preemptible context. Therefore, I would rather modify the code to use exclusive monitor than trying to disable the warning.
    – Jacen
    Feb 17, 2015 at 9:12
  • @Jacen ccu6rDcg.s is an artifact of compilation, that doesn't mean it is explicitly used in code base he is trying to compile. That swp could be produced due to a macro, intrinsic etc.
    – auselen
    Feb 17, 2015 at 9:29
  • 1
    I would imagine that this is due to some in-line assembler macro. The best way is to find what source is causing it and eliminate it. The assembler file will have 'line' and 'file' stuff in it. Save the temporary and look around/above line 4208. It should point you to a macro or source line. I've verified that there is no explicit assembler code using swp{b}. if this is true, then the compiler is buggy. An system header include may have a macro with inline assembler swp. Feb 17, 2015 at 20:10
  • What platform are you building on? Raspbian? Based on which Debian?
    – unixsmurf
    Feb 17, 2015 at 20:20

1 Answer 1

1

You can disable the warning with -mno-warn-deprecated. A quick grep of the source code doesn't seem to show a use of inline asm, so perhaps it is in a header file of some library.

Incidentally, the Raspberry Pi 2 uses a Cortex-A7 processor, and you should get better performance if you build with -mcpu=cortex-a7 instead of -mcpu=cortex-a8.

1
  • 1
    Thanks for the info. I had forgotten about the no-warn flag. However, I'm more interested in how to get gcc to emit the correct LDREX/STREX instructions, rather than swap{b}. Feb 17, 2015 at 20:55

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.