On Tuesday, April 24, 2012 1:56:52 PM UTC-4, chinlin@tw-roc wrote:
if you are compiling your code in linux with standard ARM toolchains with compatible machine code (ex: ARMv5 or ARMv7(a)), then you can do so.
Yes, in theory, provided that your code has no dependencies which are not included. Note that it will be a little hard for such code to interact with the outside world, unless it was built against headers for an abi-compatible linux kernel, or unless you've take measured to be sure it will be compatible with the linkage of android's libraries.
At any rate, before you can execute even compatible code with satisfied dependencies, it will have to be turned into a shared library (.so) to be called by means of jni from an android app, or (currently workable but unsupported), a linux executable. A .o file is typically the output of a compiler - what you need is the output of the next step, the linker.
The most compatible way to generate this is to start the build process over from the beginning using the android ndk toolchain, ideally by grafting your code into the framework of an ndk library and using the ndk build system (see the ndk examples). Second preference to using the scripts which generate a stand alone toolchain for the build system of existing projects being ported, third to reverse engineering the flags used by the ndk build system and putting those in your existing project build system - and dead, dead last, to trying to persuade the output of a non-android gcc to work on the device.