This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: __builtin_* expansion to outcalls vs name space issues
> On Tue, 5 Feb 2013, Roland McGrath wrote:
>
> > What should be the expectation of responsibility here? On the one hand,
> > it seems vaguely reasonable that __builtin_foobar degenerates to calling
> > foobar.
>
> Yes, that's expected. (There is however a known GCC bug where calls may
> be generated to functions that aren't reserved and without a corresponding
> __builtin_* call: <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46926>.
> But it's always expected that not all __builtin_* calls are expanded
> inline.)
Certainly it's expected that not all __builtin_* calls are expanded to
instructions not involving a call. That's a separate issue from whether
any calls the compiler generates implicitly in any fashion ought to be
using symbols outside the most constrained name space.
If any call to __builtin_foobar can be expected sometimes to generate a
call to foobar, then what's the point of having the __builtin_foobar names
in the first place?
> > So, are we wrong for using __builtin_mempcpy in a place where a call to
> > mempcpy is not kosher?
>
> Yes. Declaring mempcpy with __asm__ ("__mempcpy") should cause
> __builtin_mempcpy to generate a call to __mempcpy.
I cannot figure out how to make that happen. Can you post a patch that
accomplishes this?
Thanks,
Roland