从编译器的详细输出使用内联汇编程序什么时候? [英] Verbose output from compiler when using inline assembler?

查看:474
本文介绍了从编译器的详细输出使用内联汇编程序什么时候?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我赶上ARM下编译失败的一些内联汇编:

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'

虽然并不明显,code以上可窒息四种情况之一的旋转,这取决于CPU的功能,如拇指,如果在的效果。

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.

标准输入的是不是非常有帮助,我试图让GCC提供在源$ C ​​$ C违规行的更多信息。 - 详细这两个编译器驱动程序和汇编程序不会产生它:

"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'

我怎样才能得到GCC印刷更多的信息,如相关的行号?

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

先谢谢了。

推荐答案

使用为GNU的列表选项, -ahl 将产生高水平的源$ C的列表$ C与汇编混合。您将需要通过 -g 选项,GCC,所以你需要的选项 -Wa,-ahl -g

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.

这篇关于从编译器的详细输出使用内联汇编程序什么时候?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆