This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils 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: [PATCH 2/2] Add C++ iterators


Petr Machata <pmachata@redhat.com> writes:

>> I am happy we have an explicit ABI now. But I am somewhat concerned
>> about how libdw/libdwpp.map looks. Is this really the best we can do? It
>> feels somewhat unmaintainable if we have to hand edit this version
>> script. How did you generate this?
>
> Cut'n'paste from symbol tables.
>
> One alternative way would be to use version namespace instead.  Using
> version script may have been too much of cargo culting for C++
> interfaces.

The branch now holds the code that does symbol versioning by using
namespaces.  The basic organization is like this:

namespace elfutils {
  namespace v1 {
    class one_iterator;
    class another_iterator;
  }

  using namespace elfutils::v1;
}

The using directive brings the contents of the inner namespace to the
outer one, so that the symbols are accessible as elfutils::one_iterator
and elfutils::another_iterator.  But their full name and corresponding
mangling is elfutils::v1::one_iterator etc.

When ABI changes, we do this:

namespace elfutils {
  namespace v1 {
    class one_iterator;
    class another_iterator;
  }

  namespace v2 {
    class one_iterator; // New version.
    using namespace elfutils::v1; // Import the rest.
  }

  using namespace elfutils::v2;
}

Since the code in v1:: is still there, those symbols are still
generated, and old code can dynamically link to them.  There would
additionally be elfutils::v2::one_iterator with the new stuff.

Hiding individual symbols can still be done through GCC attributes, and
in fact that's now on the branch.  The private methods are not even
exported.

Thanks,
Petr

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