Search code examples
clinuxgccshared-librariesdlopen

Library with no TLS symbols gives error : dlopen: cannot load any more object with static TLS


The following call fails to dynamically load the library, complaining that it cannot load more objects with static TLS:

dlopen("libfoo.so",RTLD_LOCAL | RTLD_NOW);

However after I examine it:

readelf -a libfoo.so | grep TLS

There are no TLS symbols.

Any ideas why it would be failing to load?


Solution

  • Any ideas why it would be failing to load

    This library probably depends on some other library with a TLS segment.

    You can run ldd libfoo.so, and then readelf -l on each dependent library. One of them has to have a TLS segment, or you wouldn't be getting the error you are getting.