On Mon, 22 Sep 2025 15:00:41 GMT, Jorn Vernee <[email protected]> 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.

@JornVernee Thanks! You confirmed basically what I suspected.

@MBaesken Can you revert your changes to `libsyslookup`, and add a comment 
summarizing Jorn's description above, that it is imperative that we keep 
linking with libdl even if it seems unused by the library.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/27358#discussion_r2370302658

Reply via email to