Re: Multiple definition of static constexpr data member with C++11 and 17

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 16 Aug 2021 at 10:59, Florian Weimer wrote:
>
> * Jonathan Wakely via Gcc-help:
>
> > I'm not sure if GCC should change, or if the linker should be changed
> > to permit a single non-weak non-UNIQUE definition to be merged with
> > zero or more UNIQUE definitions. As a workaround you can compile the
> > C++17 code with -fno-gnu-unique so that GCC uses a weak symbol, but
> > that isn't a good solution in general (the unique binding exists for
> > good reasons).
>
> What are those reasons, exactly?

I think it was added to ensure uniqueness of static objects across
libraries opened with RTLD_LOCAL.

> I've been trying to find a rationale and specification of
> STB_GNU_UNIQUE, but have not been successful.
>
> The glibc implementation does not handle symbol versions, it ignores
> them.  It's not entirely clear to me if this is a bug.

Does anybody use it with more than one symbol version though?

Using symbol versioning on a STB_GNU_UNIQUE symbol would seem to
violate its uniqueness.

> Furthermore, I haven't seen a case yet which would require
> STB_GNU_UNIQUE and could not have been handled equally well via symbol
> interposition.

Does that work for RTLD_LOCAL though?



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux