RFR: 8367913: LIBDL dependency seems to be not needed for some jdk libs [v2]
Erik Joelsson
erikj at openjdk.org
Mon Sep 22 16:36:57 UTC 2025
On Mon, 22 Sep 2025 15:00:41 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:
>> @mcimadamore Can you help us here? libsyslookup has a dependency to libdl, but it is not used. Can we remove that from the linker command line, or would it somehow break libsyslookup? (I have just a very fuzzy idea of the point of this library.) If we try to remove it, what tests do we need to run to make sure we do not break anything?
>
>> but it is not used
>
> It is not used by the library itself, but we do dynamic `dlsym` calls on this library when a user tries to look up a symbol through `Linker.nativeLinker().defaultLookup().find(...)`. This is supposed to be able to find symbols from 'the standard library' which is an unspecified platform specific set of symbols. We link against `libdl` so that we can find symbols in that library as well (since `dlsym` recurses into a library's dependencies when looking up a symbol). We don't have a comprehensive test which tests that a certain set of symbols is available. Trying to look up a symbol from `libdl` might give a false positive if the symbol happens to be pulled in by another library that `libsyslookup` depends on, so testing this is unreliable.
>
> Either way, I think we want to keep linking against `libdl` so that it keeps being a dependency of the `libsyslookup` library, to guarantee that `libdl` symbols will be findable.
These sounds convoluted enough to warrant a comment explaining this in the makefile to avoid accidents in the future.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27358#discussion_r2369325183
More information about the serviceability-dev
mailing list