Issue with vtable duplication when compiling c++
nick at sqrt.co.uk
Mon Aug 16 06:50:52 PDT 2004
Peter Naulls wrote:
> In message <411C9854.8000503 at sqrt.co.uk>
> Nick Burrett <nick at sqrt.co.uk> wrote:
>>John-Mark Bell wrote:
>>The problem here is to do with linker sections. x86 g++ 3.3 does
>>duplicate the vtable block in both object files, however it uses a
>>gnu_linkonce attribute and section names to ensure that the linker
>>doesn't give multiple definitions.
I've just committed two bug fixes to drlink and a fix to 'as' to fix
handling of COMDEF areas. It turns out that these linkonce sections are
mostly similar to that of COMDEF.
The problem with COMDEF is that two AREAs of the same name must have an
exact data match. This does not allow for the case where one object
file is compiled with different optimisation characteristics to another
The only solution I can see is to pinch an AREA attribute and implement
a LINKONCE AREA option. I'll have a patch committed with this change to
GCC, AS and DRLINK later this afternoon.
More information about the gcc