------- Comment #31 from amylaar at gcc dot gnu dot org  2008-08-01 16:07 
-------
(In reply to comment #27)
> (In reply to comment #20)
> 
> Ian proposed handling the simple case in which the two constructors ("clones")
> are identical by emitting the code only once, but labelling it with the 
> symbols
> for both constructors.  This scheme fails in the case that the constructors
> must go in a comdat group. What do we name the group?  If we invent a new 
> name,
> this will have ABI impact, as other implementations must not step on it.  If 
> we
> use the name of one of the constructors, we may find that the section is
> discarded in favor of a like-named section produced by another compiler, but
> which need not define both symbols, resulting in link-incompatibility.

link-incompatibility is often of a lesser concern in the embedded world,
where some people are prepared to rebuild all their libraries if they can
save 20% code space this way.
Thus, having an option to use the scheme where the comdat section - if any -
is named after only one of the constructors / destructors would be helpful.
For situations where there are more concerns about link compatibility, I
suppose we could initiate a transitionary period where we put a weak
definition of the *1* con/destructor in the *2* section, and vice versa.
When a user is confident that all the libraries are built at least with this
transitionary scheme, they can turn on a switch to only emit the needed
sections, thus saving at least some space where not all the constructors /
destructors are coming from the libraries.
This transitionary period could be ended on a target-by-target basis when
the an ABI change is deemed safe, or extended indefinitely where it is
not considered safe.


-- 

amylaar at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |amylaar at gcc dot gnu dot
                   |                            |org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3187

Reply via email to