constructors/destructors compiled twice

Daniel Lohmann daniel.lohmann@informatik.uni-erlangen.de
Fri Jun 22 10:35:00 GMT 2007


Brian Dessent wrote:
> Kövesdi György wrote:
> 
>> It is a very old bug, and seems to be suspended (however, has some activity).
>> Is there anybody working on it? Some patch is mentioned, but it seems to be
>> quite old.
> 
> Read the last comment in the PR again.  To fix this requires arranging
> to have the same function body with multiple names, and to do that in a
> way that ensures compatibility and correct behavior across toolchains,
> the ABI must be updated, or failing that, somebody has to invent an
> ad-hoc mangling scheme for a vendor extensions.  So it is a much wider
> scope change than just making the compiler do something differently, it
> involves forging new ABI ground and that always makes developers
> cringe.  The fact that the PR's been around for 6 years now pretty much
> shows the cost-benefit model that people apply to potentially breaking
> an already complex ABI for what amounts to a code size reduction but no
> wrong-code/wrong-behavior regression.
> 
> OTOH, if you don't care about ABI compatibility then you could probably
> use the proposed patch.

Hm... This brings a pragmatic alternative into my mind:

Instead of having multiple names for the same function body gcc could
still generate distinct functions at different adresses that just jmp to
the identical parts of the code.

This would solve 99% of the unnecessary code duplication without having
to change any ABI, binutil or documentation.

Or am I missing something?


Daniel



More information about the Gcc-help mailing list