[英]how to generated C or C++ source file into a temporary assembly with NDK r8b
我的代碼在編譯器的一些的Optim問題,我想看看我的C ++文件的臨時匯編代碼。 如何配置android.mk文件?
如果我用
LOCAL_CFLAGS := -S
編譯器錯誤! 並輸出:
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
並且沒有任何匯編代碼生成。
如果我用
myasmfilter := $OBJS_DIR/SunRedVersion.S.original $OBJS_DIR/SunRedVersion.S $OBJS_DIR/SunRedVersion.o
LOCAL_FILTER_ASM := myasmfilter
它把
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
它可以找到一個匯編代碼,沒有其他文件。 如果我更改其他cpp文件,它仍會輸出第一個make文件的匯編代碼。
有人知道如何編寫LOCAL_FILTER_ASM過濾器嗎? 能舉個例子嗎?
ndk-bulid使用其所有參數透明地運行make 。 因此,您可以按以下方式使用它:
ndk-build obj/local/armeabi-v7a/objs-debug/sunred/SunRedVersion.o LOCAL_CFLAGS=-S V=1
...針對您要調查的任何C文件。 甚至在命令行上指定多個目標。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.