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.
Hi Simmis
seems this is well known error and well described on Android forums:
Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
No, Igor. I think your link is another Android issue.
In fact, in my sample code, if I remove the directive ".data", which means _VAR is in the same text section as asm_func. Then the warning disappears.
During my test, warning appears when asm lables are used like this:
_VAR: .word 10
_VAR1: word _VAR
No matter they are in seperate data section or in the same text section as asm_func.
Regards,
Simmis.
Hi Simmis
I do not think that Android has different errors,
output is the same, probably you can check this with Linux.
Best regards
igor