0

I'm catching a compile failure under ARM with some inline assembler:

g++ -DNDEBUG -g2 -O2 -pipe -c sha.cpp
{standard input}: Assembler messages:
{standard input}:779: Error: ARM register expected -- `ror [sp,#20],#31'
{standard input}:799: Error: ARM register expected -- `ror [sp],#31'
{standard input}:848: Error: ARM register expected -- `ror [sp,#4],#31'

While not obvious, the code above can be choking on one of four rotates, depending on the CPU features, like if thumb is in effect.

"standard input" is not very helpful, and I'm trying to get GCC to provide more information on the offending lines in the source code. --verbose to both the compiler driver and assembler does not produce it:

g++ --verbose -Wa,--verbose -DNDEBUG -g2 -O2 -pipe -c sha.cpp
Using built-in specs.
COLLECT_GCC=/usr/bin/g++
Target: arm-linux-gnueabi
...
COLLECT_GCC_OPTIONS='-v' '-D' 'NDEBUG' '-g2' '-O2' '-pipe' '-c' '-shared-libgcc'
  '-march=armv4t' '-mfloat-abi=soft' '-mtls-dialect=gnu'
/usr/lib/gcc/arm-linux-gnueabi/5/cc1plus -quiet -v -imultilib . -imultiarch arm-linux-gnueabi
  -D_GNU_SOURCE -D NDEBUG sha.cpp -quiet -dumpbase sha.cpp -march=armv4t -mfloat-abi=soft
  -mtls-dialect=gnu -auxbase sha -g2 -O2 -version -o - |
as -v -march=armv4t -mfloat-abi=soft -meabi=5 --verbose -o sha.o
GNU assembler version 2.25.1 (arm-linux-gnueabi) using BFD version (GNU Binutils for Debian)
...
ignoring duplicate directory "/usr/include/arm-linux-gnueabi/c++/5"
ignoring nonexistent directory "/usr/local/include/arm-linux-gnueabi"
...
Compiler executable checksum: e1a12b8fe77987e69c757712d6e0213e
{standard input}: Assembler messages:
{standard input}:779: Error: ARM register expected -- `ror [sp,#20],#31'
{standard input}:799: Error: ARM register expected -- `ror [sp],#31'
{standard input}:848: Error: ARM register expected -- `ror [sp,#4],#31'

How can I get GCC to print more information, like relevant line numbers?

Thanks in advance.

1
  • 1
    What happens when you don't use -pipe? I would also try -s to generate assembly file instead of binary. Commented Sep 13, 2015 at 9:20

1 Answer 1

1

Use the listing option for GNU as, -ahl will produce a listing with high level source code mixed with assembler. You will need to pass the -g option to gcc, so you need the options -Wa,-ahl -g.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.