Linking object files created by different GCC compiler versions

Jonathan Wakely jwakely.gcc@gmail.com
Thu Apr 28 14:15:00 GMT 2011


On 28 April 2011 08:30, Cedric Roux wrote:
> On 04/28/2011 09:24 AM, Schmidt, Steffen wrote:
>>
>> Hello,
>>
>> I'm trying to link object files originally created by different GCC
>> versions together into one elf file.
>> Some object files were created by GCC 4.3.2, others by GCC 4.6.0.

That should work.

>> Unfortunately I get errors during final linking, having unresolved symbols.
>> This seems to be due to the fact, that the used compiler versions seem to
>> create different symbols for the same function/method.
>>
>> One example:
>> We implement the new operators by our own:
>> void * operator new(size_t size);
>> The symbol created by GCC 4.3.2 is _Znwm
>> The symbol created by GCC 4.6.0 is _Znwj
>
> /home/cro> c++filt _Znwm
> operator new(unsigned long)
> /home/cro> c++filt _Znwj
> operator new(unsigned int)
>
> might be helpful...
>

Yes, this means your objects were compiled with different definitions
of size_t, so you did not compile the same function in each case.
Where does your definition of size_t come from, stddef.h ?



More information about the Gcc-help mailing list