Thursday, February 21, 2008

Check on "Allow old ABI binaries ..." got Illegal instruction

With the google android kernel source, after "make goldfish_defconfig", check on "Kernel Features" -> "Allow old ABI binaries to run with this kernel", I got following simple native program failed with "Illegal instruction". The test native program source is in the following:
#include
#include
#include
#include
#include

void _sig_handler(int signo)
{
printf("Got it: %d, %x, \n", signo, &signo);
}

int
main(int argc, char * argv[])
{
struct sigaction sa;

memset(&sa, 0x0, sizeof(sa));
sa.sa_flags = SA_RESTART;
sa.sa_handler = _sig_handler;
if (sigaction(SIGALRM, &sa, NULL) < 0) {
perror("sigaction");
return -1;
}

alarm(1);
sleep(2);
printf("Sleep ... done\n");
return 0;
}
Follow the article Initialize libc for Android to create a dynamic linked android native program, and upload it to emulator. This native program will end with "Illegal instruction".

ABI is abbreviated of Application Binary Interface, but I dont know why it will have such problems when check on Old ABI binaries. So dont use it before you know you have to and how to.

Tips:
1. after create a new kernel file, e.g. zImage, use -kernel zImage to use it in android emulator.

1 comment:

sasha said...

Initially, the Apple Store had the largest number of apps, and iPhone users enjoyed a better selection than those that joined Team Android.

best android apps

best iphone apps