When jlink --strip-debug (or --strip-native-debug-symbols 
exclude-debuginfo-files) is used to link from a runtime image, pre-existing 
native debug symbol sidecar files (.debuginfo, .diz) are incorrectly included 
in the output image. On a JDK built with external debug symbols, this results 
in large files such as lib/server/libjvm.debuginfo (often 1 GB) appearing in 
the linked image despite the explicit request to strip debug information.

StripNativeDebugSymbolsPlugin.transform() only processes entries whose path 
ends in .so (NATIVE_LIB) or whose type is NATIVE_CMD. Sidecar files have type 
NATIVE_LIB or NATIVE_CMD but paths ending in .debuginfo or .diz (compressed 
.debuginfo), so they fall through the filter unchanged.

---------
- [x] I confirm that I make this contribution in accordance with the [OpenJDK 
Interim AI Policy](https://openjdk.org/legal/ai).

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

Commit messages:
 - Better checks for .diz files in test.
 - 8375623: Filter .diz and .debuginfo files in StripNativeDebugSymbolsPlugin

Changes: https://git.openjdk.org/jdk/pull/31534/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=31534&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8375623
  Stats: 47 lines in 2 files changed: 42 ins; 0 del; 5 mod
  Patch: https://git.openjdk.org/jdk/pull/31534.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/31534/head:pull/31534

PR: https://git.openjdk.org/jdk/pull/31534

Reply via email to