This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH to memcpy visibility for middle-end/20297
On Wed, Mar 22, 2006 at 12:04:41AM -0500, Jason Merrill wrote:
> Andrew Pinski wrote:
> >
> >On Mar 21, 2006, at 11:18 PM, Jason Merrill wrote:
> >
> >>The problem here was that builtin FUNCTION_DECLs built lazily were
> >>getting whatever the current visibility was at the time, which is
> >>wrong; they should always have default visibility. The C++ front end
> >>already got this right (in build_library_fn_1), but some middle end
> >>code didn't yet.
> >>
> >>Tested x86_64-pc-linux-gnu; applied to trunk, 4.1 and 4.0.
> >
> >I don't see a patch attached :).
>
> Er, yes, it's a very subtle change...
>
> Here you go.
The testcase fails on x86_64, gcc insists on inlining the memcpy there.
But more importantly
#pragma GCC visibility push(hidden)
void *memcpy (void *, const void *, __SIZE_TYPE__);
#pragma GCC visibility pop
struct a { int a[10]; };
extern void *bar (struct a *, struct a *, int);
void *
foo (struct a *a, struct a *b, int c)
{
struct a cc = *b;
return bar (a, &cc, 4 * c);
}
should result in a hidden memcpy call (i.e. without @PLT).
So set_builtin_user_assembler_name should certainly copy over the user
selected visibility for the builtin in addition to asmspec used.
Jakub