[PATCH] Don't use .gnu.linkonce with COMDAT

Andrew Pinski pinskia@physics.uc.edu
Fri May 6 18:07:00 GMT 2005


> 
> 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




More information about the Gcc-patches mailing list