views:

142

answers:

2

Hi all,

I was wondering if someone could provide me with a bit of theory. I read that;

Page alignment causes changes in linking. Of very high impact on the success of compiling software for Android is the fact that Google forces compatible binaries to not be page aligned for the text and data section. This requires changes in the way of linking object files. For self-written software, one can take precautions and react on this fact with compiling all shared libraries accordingly. For already existing source code, changing the linker’s behavior can present a very tiring and, often, an even impossible task.

But personally know very little of page alignment, what does this actually mean? Is this the reason we must change the asx file when compiling native libraries for use on Android? Here's the context for that statement.

Apologies if you think I should just Google this, I did try but I'm just looking for a bit more of an explanation than there is at that link.

Kind regards,

Gavin

A: 

Hi Gavin,

using CodeSourcery and a linker script is not a valid way to create a native library on Android anymore. Take a look at the native library example at development/samples/PlatformLibrary/ to see how you should build a native library. For the start, you can modify the PlatformLibrary example to make your own library. Compiling the code should create the following files:

  • out/target/product/generic/system/app/PlatformLibraryClient.apk
  • out/target/product/generic/system/etc/permissions/com.example.android.platform_library.xml
  • out/target/product/generic/system/framework/com.example.android.platform_library.jar
  • out/target/product/generic/system/lib/libplatform_library_jni.so

You do not have to worry about those linker issues anymore.

Regards,

Manny

MannyNS
Hi Manny, thanks very much for the info. I actually use that method now but was just interested as to why the page alignment is an issue. I really appreciate you response though.Did google go it on purpose? Is it because of the Hardware?
gav
I do not why they did on purpose at the start, and I am not sure that page alignment change is still existent with 1.0 and later revisions.
MannyNS