dimanche 27 avril 2014

Thumb function pointers with position independent code?


Vote count:

0




I want function caller to take a thumb function pointer as an argument:



void fun(void) {}

void caller(void(*f)(void)) {
f();
}

void _start(void) {
caller(fun);
}


When I compile it with



arm-elf-gcc -mthumb -c -fpic test.c


and then link



arm-elf-ld test.o


, linker tries to wrap fun with interwork code and warns about interworking not enabled. But I don't want to enable interwork, because I want it to be thumb-only code. Without -fpic, code compiles and function pointer works correctly.


If want to ask why I have to pass thumb function pointers and provide PIC code, it's because the API which I can't change.



asked 50 secs ago






Aucun commentaire:

Enregistrer un commentaire