misunderstanding about shared libs.

Let’s consider a libmisc.so.1.0 usefull for lot of programs.

Now I want to add a general functionnality in libmisc.so.
So, I build a libmisc.so.1.1, which is EXACTLY libmisc.so.1.0 plus
something.

my_prog doesn’t take care of the new functionnality so, I don’t want to
rebuilt it.

I replace the old lib, and I link libmisc.so.1.0 on libmisc.so.1.1

Now I start my_prog and I get:
attempt to load libmisc.so.1.0
loaded lib at addr B8200000(text) B820AA50(data)

attempt to load libmisc.so.1.0
loaded lib at addr B8217000(text) B820AA50(data)
attempt to load libmisc.so.1.0
loaded lib at addr B8222000(text) B820AA50(data)
attempt to load libmisc.so.1.0
loaded lib at addr B8222d000(text) B820AA50(data)
segmentation violation (core dumped)

Why ?!?

Thanks,
Alain.

alain.bonnefoy@icbt.com sed in <3DD4C0CF.3080608@icbt.com>

Now I want to add a general functionnality in libmisc.so.
So, I build a libmisc.so.1.1, which is EXACTLY libmisc.so.1.0 plus
something.

I replace the old lib, and I link libmisc.so.1.0 on libmisc.so.1.1

Things like this usually involves setting SONAME in the *.so,
but SIGSEGV should be another cause.
Post exactly what you’re doing, including sample source if possible.

kabe

Found that sigsegv came from a static lib I put in a shared lib. I
didn’t take care of that first. I though to have the so version.
About multiple loading of the shared lib, it’s effectively caused by the
fact that I load a libmisc.so.1.1 , even though over shared libs that
my_prog loads are built for libmisc.so.1.0.

SO_NAME=libmisc.so.1.1

That way is commonly used in UNIX. Does it happen the same thing, or do
I have to set my SO_NAME differently?

Thanks,
Alain.

kabe@sra-tohoku.co.jp a écrit:

alain.bonnefoy@icbt.com > sed in <> 3DD4C0CF.3080608@icbt.com



Now I want to add a general functionnality in libmisc.so.
So, I build a libmisc.so.1.1, which is EXACTLY libmisc.so.1.0 plus
something.

I replace the old lib, and I link libmisc.so.1.0 on libmisc.so.1.1



Things like this usually involves setting SONAME in the *.so,
but SIGSEGV should be another cause.
Post exactly what you’re doing, including sample source if possible.

alain.bonnefoy@icbt.com sed in <3DD89380.7020404@icbt.com>

SO_NAME=libmisc.so.1.1
That way is commonly used in UNIX. Does it happen the same thing, or do
I have to set my SO_NAME differently?

I have to give a WILD guess that that SO_NAME is a Makefile macro,
which generally (generally) doesn’t do much.

I wuz talking about SONAME value in the ELF .dynamic section.

Althoug QNX 6.x uses GNU ld, lots of knowledge should be gained from
Solaris Documentation, e.g

Solaris 2.4 Software Developer AnswerBook/Linker and Libraries Guide
URL:http://docs.sun.com/db/doc/801-6737

which mostly applies to other ELF-based systems.
(Latest Solaris has lots of useful quirks which don’t apply to other OS;
for beginners, stick to older releases’ docs)

GNU ld’s native info file isn’t helpful for primer.

kabe