first of all, you should pull some libraries from android device.

list of it:

ld-android.so  libc.so  libdl.so  libdl_android.so  liblog.so  libm.so

 

after that you can compile your program with this command:

 

arm-none-linux-gnueabihf-gcc hello.c -fPIE -pie -o hello_android_gcc2 -Wall -Wl,--dynamic-linker=/system/bin/linker -nostdlib -nodefaultlibs -L. -I. ./ld-android.so ./libdl_android.so ./libc.so ./libm.so ./libdl.so  ./libdl.so

we use dynamic-linker flag to force ELF file to use /system/bin/linker as interpreter linker because in android device the ld-linux.so is not exist.

we use -nostdlib because as default of arm-none-linux-gnueabihf-gcc compiler it use libc.so.6 that is glibc standard library that not exist on android instead of that bionic is standard c library in /system/lib/libc.so

ادامه مطلب

Compile ELF for android with GCC for ARM compiler

android ,linker ,that ,libc ,libdl ,system ,linux gnueabihf ,none linux ,android device ,none linux gnueabihf
مشخصات
آخرین مطالب این وبلاگ