Cannot use GCC's builtin functions on Cortex-A9

166 views Asked by At

For an embedded project (bare-metal) I need to use memc** functions.Though I haven't disable the builtin functions I always get a linker error; e.g:

undefined reference to `memcmp'

no matter if I use: memcmp or __builtin_memcmp!

Is there anything I missed to enable the builtins?

My compile options are: -g -Wall -mcpu=cortex-a9

1

There are 1 answers

0
Variable Length Coder On BEST ANSWER

__builtin is a bit of a lie. It will optionally use a built-in implementation, if it exists. Otherwise it will call the library functions. You will need to provide implementations of these functions, either in your own code or in a C library. Note that "a C library" doesn't mean a full OS libc, there are plenty of bare metal C libraries that don't include OS-dependent functions.