Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8340475

Restoring mixed use of statically and dynamically linked JDK libraries

XMLWordPrintable

      JDK-8338768 replaced the use of `#ifdef STATIC_BUILD` with runtime checks. While this was intended as a code refactoring, it changed the behavior of libawt.so in an unexpected way.

      Before this change, the code that loaded the AWT library in awt_LoadLibrary.c was conditioned on whether libawt itself was statically linked. Now, it is conditioned on whether libjvm is statically linked, which is not the same. This effectively limits the dynamically linked libawt.so to work only with the dynamically linked libjvm.so, without good reason.

      Mixing statically and dynamically linked JDK libraries is important for GraalVM Native Image. Native binaries produced by native-image statically link core JDK libraries but rely on dynamically linked libraries for AWT support. However, the coupling introduced by the JVM_IsStaticallyLinked API between libawt and libjvm appears to overlook the mixed use of JDK libraries.

      On the other hand, the approach taken by this change for libjli, which involves a library-specific API, does not have this problem. Therefore, applying the same approach to libawt (and libjdwp) would eliminate the artificial coupling and restore the mixed use of JDK libraries to work as before.

            Unassigned Unassigned
            apejovic Aleksandar Pejovic
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated: