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

[test] Fix jdk/tools/launcher/RunpathTest to handle both, RPATH and RUNPATH

XMLWordPrintable

    • b20

        The test jdk/tools/launcher/RunpathTest.java checks that the java launcher on Linux and Solaris has the correct RPATH path baked into the executable.

        Unfortunately, the situation with RPATH is a little weird:

          - in order to bake a runtime path into a dynamically linked library or executable one has to use the "-rpath <PATH>" linker option (from the C/C++ compiler this is usually available as "-Wl,-rpath,<path>").
          - depending on the dynamic linker version and Linux distribution, the "-rpath" linker option adds either a "RPATH" entry (Ubuntu 16.04, RHEL 7.4) or a "RUNPATH" entry (SLES 12.1, SLES 15) or both entries together (SLES 11.3) to the dynamic section of the shared library/executable.
          - the semantics of "RPATH" and "RUNPATH" are slightly different: "RPATH" is evaluated at runtime before LD_LIBRARY_PATH (if "RUNPATH" isn't present) while "RUNPATH" is evaluated after LD_LIBRARY_PATH (i.e. RUNPATH can be overridden at runtime by setting LD_LIBRARY_PATH).
          - "RPATH" is considered obsolete and should be replaced by "RUNPATH" according to the man-page of "ld.so (8)".
          - the linker option "--enable-new-dtags"/"--disable-new-dtags" (or the corresponding compiler flags "-Wl,--enable-new-dtags"/"-Wl,--disable-new-dtags") can be used to enforce the generation of "RUNPATH"/"RPATH" respectively (except for systems like SLES 11.3 where "--enable-new-dtags" generates both "RPATH" and "RUNPATH" while "--disable-new-dtags" only generates "RPATH").

        But this issue is not about fixing the build so to cut a long story short - the test RunpathTest.java should be able to handle both runtime path variants equally well. This can be easily achieved by extending the match pattern from ".*RPATH.*\\$ORIGIN/../lib.*" to ".*R(UN)?PATH.*\\$ORIGIN/../lib.*"

              simonis Volker Simonis
              simonis Volker Simonis
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: