Prevent replacing my code with library calls

Clang optimizes the code by replacing some parts with efficient library functions.

For example, the following code:

for (i=0;i<size;++i)
       dest[i]=src[i];

will be compiled (target = ARM assembly):

bl      __aeabi_memcpy(PLT)

I tried using -fno-builtin and -O0 without success.

Is there a flag or some other way to prevent the compiler from replacing code with library calls?

+4
source share
1 answer

This seems to be a syntax error in clang. You should use the optimization flag with the flag without inline code.

The following command builds with memcopy:

arm-linux-androideabi-clang -S myMemcpy.c -fno-builtin

memcopy:

arm-linux-androideabi-clang -S myMemcpy.c -fno-builtin -O1

.

0

All Articles