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

Symbol-versioning a C++ library



Hi,

This is slightly off-topic, for which I apologise.  It's just that I
learned about symbol versioning during my NM process, and nobody outside
Debian seems to understand what it is. :-(

I have a library, which I want to package for Debian.  I felt it would
be a good idea to use symbol versioning, since most of my programs (and
in some cases other libraries) use it.  The library is written in C++,
which seems to be a slight problem.  AFAIU the linker should be able to
handle it, but I don't see how.  Let's start with the problem in more
detail:

I want a symbol-versioned library, where most symbols are of one
version, but some are of a different version.

I started small, and made a version script to give all symbols the same
version:

SHEVEK_1 {
	global:
		*;
};

This works fine.  When I use objdump -T library.so, I can see all my
symbols with version SHEVEK_1.

Then I tried to give the whole shevek::fd class a different version by
adding:

SHEVEK_2 {
	global:
		shevek::fd::*;
};

(and some variations.)  That didn't work at all: it defines the version:
00000000 g    DO *ABS*  00000000  SHEVEK_2    SHEVEK_2
But no symbol actually uses it.

Inserting the mangled name does work (if I do it before the SHEVEK_1
version, which makes sense).  However, I would like to use the symbols
from my code, and not the things gcc makes of them.  Especially because
I never know if gcc doesn't change the way it mangles in the future.

So the question is: is that possible, and if so, how?

Any other comments on this approach (or on anything else ;-) ) are also
welcome.

Thanks,
Bas

-- 
I encourage people to send encrypted e-mail (see http://www.gnupg.org).
If you have problems reading my e-mail, use a better reader.
Please send the central message of e-mails as plain text
   in the message body, not as HTML and definitely not as MS Word.
Please do not use the MS Word format for attachments either.
For more information, see http://pcbcn10.phys.rug.nl/e-mail.html

Attachment: signature.asc
Description: Digital signature


Reply to: