[cfe-dev] Implementing "external" built-in functions

Emmanuel Blot eblot.ml at gmail.com
Fri Jul 19 03:04:56 PDT 2013


Hi,

clang emits calls to external functions for built-in functions it
cannot implement, the way GCC does:

>From GCC doc about built-in functions for memory accesses:
"Not all operations are supported by all target processors. If a
particular operation cannot be implemented on the target processor, a
warning will be generated and a call an external function will be
generated. The external function will carry the same name as the
builtin, with an additional suffix `_n' where n is the size of the
data type."

Is is possible to implement those "external" built-in functions and
compile them with clang? The "problem" is that clang recognizes their
signature, and emit an error, such as:

error: definition of builtin function
   '__sync_fetch_and_and_4'

I'm unable to find a clang front-end option switch to disable this behavior.
What is the recommended way to compile such a built-in function?

I'm looking for a way to compile those functions in a dedicated
library, outside the clang build tree.

Thanks,
Emmanuel.



More information about the cfe-dev mailing list