[PATCH] Don't use .gnu.linkonce with COMDAT
Mark Mitchell
mark@codesourcery.com
Fri May 6 18:03: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.
With those changes, I think the patch is OK. But, you'll need to be
alert; this stuff seems very fragile, and I don't know if there are
other things like the .rodata problem that will pop up.
--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
(916) 791-8304
More information about the Gcc-patches
mailing list