RFR: 8305935: Resolve multiple definition of 'jmm_<interface|version>' when statically linking with JDK native libraries

David Holmes dholmes at openjdk.org
Thu Apr 13 23:10:32 UTC 2023


On Thu, 13 Apr 2023 23:05:02 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Forgot to mention that using 'static' effectively resolves the symbol issue when feasible, like the 'jvm' variable case. That doesn't work for the 'jmm_interface' and 'jmm_version' ...
>
> I'm not familiar with the details of symbol scoping and linkage with libraries, but I would have hoped there was a way to have symbols like this shareable throughout the code that comprises the library without exposing them to users of the library. It used to be IIRC only functions we listed in the mapfiles were exposed, and these days we use explicit attributes to export them. Is there not some equivalent thing for data?

> The direct renaming in this case seems to be more strait forward.

If we were to do this then we should have a naming convention of some kind e.g. `<lib-name>_<var-name>` but it strikes me as wrong as the code shouldn't need to know what library it is part of. In this case we do something as a simple point-fix, but to me it says there is a bigger problem.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13451#discussion_r1166111820


More information about the serviceability-dev mailing list