bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/17931] --gc-sections doesn't work on section in a group


From: rafael.espindola at gmail dot com
Subject: [Bug ld/17931] --gc-sections doesn't work on section in a group
Date: Fri, 06 Feb 2015 13:09:13 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=17931



Rafael Ávila de Espíndola <rafael.espindola at gmail dot com> cha
nged:



           What    |Removed                     |Added

----------------------------------------------------------------------------

                 CC|                            |ccoutant at google dot com,

                   |                            |rafael.espindola at gmail 
dot com



--- Comment #2 from Rafael Ávila de Espíndola <rafael.espindola a
t gmail dot com> ---

(In reply to Alan Modra from comment #1)

> No, it should not be removed.  See the gABI.  "Therefore, such groups must

> be included or omitted from the linked object as a unit."



I believe there is a misunderstanding here.



Semantically, during the "regular" part of the link, the linker includes or

discards groups as a unit.



During the --gc-sections part, individual sections are considered.



Even without groups, --gc-sections would be "invalid" according to the spec,

since it drop sections that should be copied to the output. The point is th
at

--gc-sections is effectively an extension.



This does show up in the real world since the deleting destructor is

unfortunately part of D5:



struct foo {

  virtual ~foo(){};

};

foo x;



produces with gcc 4.9:



 .section        .text._ZN3fooD2Ev,"axG",@progbits,_ZN3fooD5Ev,comdat

...

_ZN3fooD2Ev:

        ret

....

.set    _ZN3fooD1Ev,_ZN3fooD2Ev

....



      .section        .text._ZN3fooD0Ev,"axG",@progbits,_ZN3fooD5Ev,comdat

....

_ZN3fooD0Ev:

        jmp     _ZdlPv





Note that D0 is never equal to D1 or D2 since it has to call delete. If it 
is

not used in a DSO, we bloat the binary.



-- 

You are receiving this mail because:

You are on the CC list for the bug.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]