Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Thu, 4 Jun 2020 15:48:49 -0400
From: Rich Felker <>
To: Alexander Scherbatiy <>
Cc:, Markus Wichmann <>
Subject: Re: Shared library loading

On Thu, Jun 04, 2020 at 10:37:40PM +0300, Alexander Scherbatiy wrote:
> On 25.05.2020 20:46, Rich Felker wrote:
> >On Mon, May 25, 2020 at 08:26:51PM +0300, Alexander Scherbatiy wrote:
> >>   What is the suggested way in musl to load $libdir/myapp/
> >>from a custom directory so can find it?
> >Probably putting the dir in your application's rpath (or in the rpath
> >of libbar). dlopen is not a tool for (effectively) adding additional
> >directories to the library search path.
> OpenJDK can have several jvm variants (like server, client, minimal).
> Each of variants contains its own version of lib.
>   jdk/bin/java
>   jdk/lib/server/
>   jdk/lib/client/
>   jdk/lib/minimal/
> When java is executed it first loads for the requested variant
> using dlopen() with RTLD_NOW | RTLD_GLOBAL flags [1] and then
> loads libraries from jdk/lib dir with dlopen() and RTLD_LAZY flag.
> To make it works with musl JDK implements workaround where
> it puts into LD_LIBRARY_PATH [2] and re-executes itself.
> Is there a better way to handle the case where an application
> with several lib variants can load common libraries
> without changing LD_LIBRARY_PATH?
> [1]
> [2]

One way to do it would be to make dummy libraries,, and that contain no code or data
but just a DT_NEEDED reference to and an appropriate
DT_RUNPATH to find it.


Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.