1834659 Members
2091 Online
110069 Solutions
New Discussion

shl_load problem

 
Dedieu
Occasional Advisor

shl_load problem

i have to build a dynamic library but when i start the main program i receive :

/usr/lib/dld.sl: Can't shl_load() a library containing Thread Local Storage: /usr/lib/libpthread.1
/usr/lib/dld.sl: Exec format error

I have no choice, my library must be shared, is there a solution ?

Thanx
3 REPLIES 3
Kiran N. Mehta
Advisor

Re: shl_load problem

I am afraid you have have hit the dynamic loader's limitation stated in man shl_load(3x): shl_load cannot load a shared-library (or any of its dependent libraries) if it uses thread local storage.

You will either have to arrange for the shared-library and its dependents to get loaded during program start-up (by linking them with the executable on the command-line) or you will have to change your library code to stop using TLS.

Re: shl_load problem



I know of two ways to solve this problem.

a) eliminate all libraries from the link list that use TLS. In our case, this was the pthread library that was linked to our lib but never used.

b) Install patch PHSS_24303 . It adds a LD_PRELOAD functionality to overcome this problem. Look into the description of this patch for more information. In general, I found this patch to be very recommendable.

Regards, M.S.
aaa_17
Advisor

Re: shl_load problem

Hi Martin Schneider

I also get the same symptom
/usr/lib/dld.sl: Can't shl_load() a library containing Thread Local Storage: /usr/lib/libpthread.1
/usr/lib/dld.sl: Exec format error

I follow your 2 suggestions but the problem does not solve. Can you give more detailed info for me to solve the problem? Any example?

Thanks.