Conflicting wchar_t attributes

Paul Brook paul@codesourcery.com
Wed Jun 27 13:08:00 GMT 2007


> My question is should merging on the sizes be allowed while linking ?
> As of now ld just rejects it.

The size of wchar_t is an ABI changing option, so IMHO it is reasonable to ld 
to refuse to link objects with conflicting options, in the same way that it 
refuses to link objects using hard and soft-float calling conventions.

The object attribute is actually a tristate option: 2-byte, 4byte, and "don't 
care". The linker will happily merge "don't care" with a specific size.

Ideally objects would only be marked with a specific wchar_t size if they 
actually use wchar_t in a public interface. gcc is not currently clever 
enough to do that though.

It may be reasonable to have a linker commandline option to ignore object 
attribute conflicts.

Paul



More information about the Binutils mailing list