This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Don't use .gnu.linkonce with COMDAT
- From: Andrew Pinski <pinskia at physics dot uc dot edu>
- To: mark at codesourcery dot com (Mark Mitchell)
- Cc: drow at false dot org (Daniel Jacobowitz), julian at codesourcery dot com (Julian Brown), hjl at lucon dot org (H. J. Lu), gcc-patches at gcc dot gnu dot org (GCC Patches), paul at codesourcery dot com (Paul Brook)
- Date: Fri, 6 May 2005 14:04:58 -0400 (EDT)
- Subject: Re: [PATCH] Don't use .gnu.linkonce with COMDAT
>
> Daniel Jacobowitz wrote:
>
> > How does this patch interact with non-GNU linkers? This is one of the
> > problems with version-number based checks...
>
> All the ld_vers* stuff is conditionalized on GNU ld, so I think this
> patch would disable COMDAT for non-GNU linkers. Julian, I suggest you
> change it so that if $ld_vers is empty, you just set HAVE_COMDAT_GROUP
> based on the the assembler, as is done at present. That's no more or
> less broken than the current state.
>
> This bit:
>
> + memcpy (rname, ".rodata", 7);
> + memcpy (rname + 7, name + 5, len - 5);
>
> We shouldn't right "7" and such here; use strlen (".rodata"), instead.
> GCC knows to collapse that at compile time. And, for that matter, just
> use strcpy; GCC knows to turn that into more efficient operations if the
> string is known.
Why not just use strcpy and strcat?
If GCC does not optimize the strcat into a memcpy, please file a bug.
-- Pinski