[PATCH] Don't use weak linkage for symbols in COMDAT groups

Daniel Jacobowitz drow@false.org
Sun Feb 27 21:48:00 GMT 2005


On Sat, Feb 26, 2005 at 11:22:49PM -0500, Andrew Pinski wrote:
> 
> On Feb 25, 2005, at 1:54 PM, Julian Brown wrote:
> 
> >Mark Mitchell wrote:
> >>Julian Brown wrote:
> >>>Hi,
> >>>
> >>>This patch stops entities with vague linkage from being declared as 
> >>>ELF weak symbols when HAVE_GAS_COMDAT_GROUP is true. This is mainly 
> >>>cosmetic, but could lead to subtle interoperability problems.
> >>>
> >>>Tested with cross to arm-none-eabi.
> >>>
> >>>OK to apply?
> >>Is there any reason not to do this in elf.h?  It doesn't seem 
> >>ARM-specific to me.  Would you try making that change, and testing on 
> >>IA32 GNU/Linux as well?  Does anyone see backwards compatibility 
> >>problems here?
> >
> >It doesn't lead to any new regressions on HEAD for i686-pc-linux-gnu 
> >with the alteration in config/elfos.h instead.
> >
> >So now I guess this could be applied to both HEAD & csl-arm-branch. OK?
> 
> This breaks building libjava on i686-pc-linux-gnu and other valid C++ 
> code.
> The following multiple file example shows the problem:
> file a:
> struct a
> {
>   virtual void g();
>   virtual void f(){}
> };
> int main() { a b; b.f(); b.g(); }
> 
> file b:
> struct a
> {
>   virtual void g();
>   virtual void f(){}
> };
> void a::g() {}
> 
> Before this change, a::f in the TU of file b and a were both marked as 
> weak so
> that they would not complain when you link the two files together.

Why isn't a::f in a COMDAT group, anyway?

-- 
Daniel Jacobowitz
CodeSourcery, LLC



More information about the Gcc-patches mailing list