简体   繁体   English

如何使用NDK r8b将C或C ++源文件生成为临时程序集

[英]how to generated C or C++ source file into a temporary assembly with NDK r8b

my code has some problem in compiler's optim, i want to see the a temporary assembly code of my c++ files. 我的代码在编译器的一些的Optim问题,我想看看我的C ++文件的临时汇编代码。 how to config the android.mk file? 如何配置android.mk文件?

if i use 如果我用

LOCAL_CFLAGS := -S

the compiler error! 编译器错误! and output: 并输出:

f:/codes/eclipse/android-ndk-r8b/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/../lib/gcc/arm-linux-androideabi/4.6.x-google/../../../../arm-linux-androideabi/bin/ld.exe:./obj/local/armeabi-v7a/objs-debug/sunred/SunRedVersion.o: file format not recognized; treating as linker script
f:/codes/eclipse/android-ndk-r8b/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/../lib/gcc/arm-linux-androideabi/4.6.x-google/../../../../arm-linux-androideabi/bin/ld.exe:./obj/local/armeabi-v7a/objs-debug/sunred/SunRedVersion.o:1: syntax error
collect2: ld returned 1 exit status
make: *** [obj/local/armeabi-v7a/libsunred.so] Error 1

and no any assembly code generate. 并且没有任何汇编代码生成。

if i use 如果我用

myasmfilter :=  $OBJS_DIR/SunRedVersion.S.original $OBJS_DIR/SunRedVersion.S $OBJS_DIR/SunRedVersion.o

    LOCAL_FILTER_ASM := myasmfilter

it out put 它把

AsmFilter      : sunred <= SunRedVersion.s

myasmfilter ./obj/local/armeabi-v7a/objs-debug/sunred/SunRedVersion.s ./obj/local/armeabi-v7a/objs-debug/sunred/SunRedVersion.filtered.s
process_begin: CreateProcess(NULL, myasmfilter ./obj/local/armeabi-v7a/objs-debug/sunred/SunRedVersion.s ./obj/local/armeabi-v7a/objs-debug/sunred/SunRedVersion.filtered.s, ...) failed.
make (e=2): 系统找不到指定的文件。(system can't find the file)

make: *** [obj/local/armeabi-v7a/objs-debug/sunred/SunRedVersion.filtered.s] Error 2

it can find a assembly code ,no anyother files. 它可以找到一个汇编代码,没有其他文件。 if i change other cpp file,it still output the first make file's assembly code. 如果我更改其他cpp文件,它仍会输出第一个make文件的汇编代码。

somebody know how to write LOCAL_FILTER_ASM filter ? 有人知道如何编写LOCAL_FILTER_ASM过滤器吗? can give me a example? 能举个例子吗?

ndk-bulid transparently runs make with all its parameters. ndk-bulid使用其所有参数透明地运行make So, you can use it as follows: 因此,您可以按以下方式使用它:

ndk-build obj/local/armeabi-v7a/objs-debug/sunred/SunRedVersion.o LOCAL_CFLAGS=-S V=1

... for any C file you want to investigate. ...针对您要调查的任何C文件。 Or even specify multiple targets on the command line. 甚至在命令行上指定多个目标。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM