This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: New symbol binding to fix C++ ABI


On Mon, Jun 1, 2009 at 1:55 PM, Ulrich Drepper <drepper@redhat.com> wrote:
> The C++ ABI demands that certain data objects are unique in the entire
> process. ?This is the case static class members or static variables in
> inline functions. ?Jason can provide the necessary details, if needed.
>
> I attach a patch which implements a new symbol binding, STB_GNU_UNIQUE.
> ?The compile will use this binding, instead of defining the variable as
> a global variable. ?Jason already has a patch for gcc which is using the
> extension of the patch below.
>
> There is one detail of the patch which is non-obvious. ?The interface to
> get to such an object is not implemented by providing a pseudo-op
> similar to .global. ?Instead, I've defined a new symbol type, to be used
> with the .type pseudo-op. ?The reason for this is that it is wrong to
> apply the new symbol binding to anything but data object (no functions
> in particular). ?It makes no sense. ?So, instead of opening the door for
> misuse the compiler will emit
>
> ?.type name,%gnu_unique_object
> ?.global
>
> instead of
>
> ?.type name,%object
> ?.global
>
> At the assembler source level this isn't confusing at all. ?It's only
> the translation to what it means at the ELF level that might be a bit
> confusing. ?But not many people have to actually deal with this so I
> don't consider it a problem.
>

What should happen with ".set" on a symbol with STB_GNU_UNIQUE?

-- 
H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]