[LLVMdev] Prevent clang from replacing code with library calls

Jim Grosbach
Thu, 07 Aug 2014 21:49:42 -0000

> On Aug 7, 2014, at 4:12 AM, Anton Korobeynikov <anton at
korobeynikov.info> wrote:
>
>> I downloaded the latest NDK (r10) and compiled with the following cmd:
>> arm-linux-androideabi-clang myMemcpy.c -S -fno-builtin -o0
>> It still produces assembly with a call to "memcpy". Maybe the
-fno-builtin
>> is broken also in the latest release.
> It's not broken. Even freestanding implementation is supposed to
> provide mem* functions.
>

It’s also supposed to be possible to write a memcpy() implementation in C
without the compiler’s idiom recognizer just transforming it into a call to the
system memcpy(). -fno-builtin is supposed to be how to do that, right?

-jim