简体   繁体   中英

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. how to config the android.mk file?

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.

somebody know how to write LOCAL_FILTER_ASM filter ? can give me a example?

ndk-bulid transparently runs make with all its parameters. 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. Or even specify multiple targets on the command line.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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