[PATCH] Allow builtin definition with -fno-builtin

Francois Pichet pichet2000 at gmail.com
Sun Jul 7 03:33:51 PDT 2013


I think so but currently we disable only builtins marked with 'f'

//  f -> this is a libc/libm function without the '__builtin_' prefix. It
can
//       be followed by ':headername:' to state which header this function
//       comes from.

-ffreestanding will also disable builtins but many test using
-ffreestanding are using target specific intrinsics builtins. Not sure how
to handle this.



On Tue, Jun 18, 2013 at 8:10 PM, John McCall <rjmccall at apple.com> wrote:

> On Jun 9, 2013, at 5:15 PM, Francois Pichet <pichet2000 at gmail.com> wrote:
>
> Hi, I would like to propose this patch to makes it possible to compile any
> builtin if -fno-builtin is passed.
>
> Here is the problem I am trying to get around.
>
> I am working on a out-of-tree target where atomic operations are expanded
> to function calls.
> for example:
>   setOperationAction(ISD::ATOMIC_SWAP,  MVT::i32, Expand);
>
>
> The backend will replace some atomic operations when compiling libc++ with
> function calls. Now if I try to actually compile the function calls with
> clang I'll get errors like:
>        definition of builtin function '__sync_lock_test_and_set_4'
>
> Just as if I was trying to compile a file similar to
> http://www.opensource.apple.com/source/Libc/Libc-583/arm/sys/gcc_atomic.c with
> clang.
>
> Any objection? Or any possible workaround?
>
>
> Should we even be recognizing this as a builtin under -fno-builtin?
>
> John.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130707/0b55b946/attachment.html>


More information about the cfe-commits mailing list