This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: New symbol binding to fix C++ ABI
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Ulrich Drepper <drepper at redhat dot com>
- Cc: Binutils <binutils at sourceware dot org>, Jason Merrill <jason at redhat dot com>
- Date: Mon, 1 Jun 2009 16:21:31 -0700
- Subject: Re: New symbol binding to fix C++ ABI
- References: <4A24405B.8030602@redhat.com>
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.