.note.ABI-tag extension for Android

Thiago Jung Bauermann bauerman@br.ibm.com
Fri Apr 20 23:36:00 GMT 2012


I'm discussing with Google engineers about adding a .note.ABI-tag to
Android binaries, and extending the note format to allow identifying an
Android application.

I'd like to ask for comments about my proposed extension before
implementing and deploying it. I'm not sure which forum would be the
right one for this topic, but the binutils mailing list seems
appropriate. And it's subscribers probably overlap a lot with what would
be the correct group anyway. :-)

My goal is to allow distinguishing between an ELF file containing a
regular GNU/Linux program and an Android program.

This is so that GDB can know when it's debugging an Android application.
A few details which are not defined by the ABI differ between the two,
like the longjump buffer format and the signal handler trampoline.

The format of the ELF note is as follows:

name size: 4
desc size: 24
type: 1
name: "GNU"
desc: as as defined by the LSB standard:

"The first 32-bit word of the desc field shall be 0 (this signifies a
Linux executable). The second, third, and fourth 32-bit words of the
desc field contain the earliest compatible kernel version. For example,
if the 3 words are 2, 2, and 5, this signifies a 2.2.5 kernel."

And extended to contain the following two words right after the kernel

os_variant: 1
android_api: 15

I arbitrarily chose os_variant = 1 to mean Android.

So the idea is that if desc size is >= 20, then the fifth 32-bit word
will be examined. If it is 1, then this is an Android ELF file. The
sixth word will then tell you the API level the application expects.

What do you think?

Thiago Jung Bauermann
Linaro Toolchain Working Group

More information about the Binutils mailing list