AnsweredAssumed Answered

"Text Relocation" issue when calling asm function from c code.

Question asked by Simmis Xu on Sep 9, 2014
Latest reply on Sep 10, 2014 by igorpadykov

Hi,

     I am now trying to write a assembly funciton which is called by c code. The platform is imx6 DL, and OS is based on android 4.4.2_r1 patch.

     The sample code is like this.

-------------------------------------

The asm code:

     .global asm_func

     .text

     .align

asm_func:

     ldr r1, =_VAR

     ldr r0, [r1]

 

     .data

_VAR: .word 10

-------------------------------------

The c code:

void main(void) {

     int ret;

     extern int asm_func();

     ret = asm_func();

     printf("Result of asm_func: %d.\n", ret);

     return.

}

--------------------------------------

     The program can be compiled and run. But when executing, there is warning msg "WARNING: linker: ./asm_test_imx has text relocations. This is wasting memory and is a security risk. Please fix."

     Do you know why the "text relocation" warning?

 

Thanks,

Simmis.

Outcomes