On Wed, 29 Apr 2026 07:44:08 GMT, Matthias Baesken <[email protected]> wrote:
> Or add to the existing --with-native-debug-symbols=[none, internal, external,
> zipped] some more options
For example, check this diff with an additional option external_compressed
diff --git a/make/autoconf/jdk-options.m4 b/make/autoconf/jdk-options.m4
index 89fcbc88521..c843fe7374d 100644
--- a/make/autoconf/jdk-options.m4
+++ b/make/autoconf/jdk-options.m4
@@ -268,7 +268,7 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_DEBUG_SYMBOLS],
AC_MSG_CHECKING([what type of native debug symbols to use])
AC_ARG_WITH([native-debug-symbols],
[AS_HELP_STRING([--with-native-debug-symbols],
- [set the native debug symbol configuration (none, internal, external,
zipped) @<:@varying@:>@])],
+ [set the native debug symbol configuration (none, internal, external,
external_compressed, zipped) @<:@varying@:>@])],
[
if test "x$OPENJDK_TARGET_OS" = xwindows; then
if test "x$withval" = xinternal; then
@@ -281,6 +281,8 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_DEBUG_SYMBOLS],
])
AC_MSG_RESULT([$with_native_debug_symbols])
+ COMPRESS_EXTERNAL_DEBUG_SYMBOLS_IN_ARCHIVE=false
+
if test "x$with_native_debug_symbols" = xnone; then
COMPILE_WITH_DEBUG_SYMBOLS=false
COPY_DEBUG_SYMBOLS=false
@@ -302,6 +304,21 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_DEBUG_SYMBOLS],
COMPILE_WITH_DEBUG_SYMBOLS=true
COPY_DEBUG_SYMBOLS=true
ZIP_EXTERNAL_DEBUG_SYMBOLS=false
+ elif test "x$with_native_debug_symbols" = xexternal_compressed; then
+
+ if test "x$OPENJDK_TARGET_OS" = xlinux; then
+ if test "x$OBJCOPY" = x; then
+ # enabling of enable-debug-symbols and can't find objcopy
+ # this is an error
+ AC_MSG_ERROR([Unable to find objcopy, cannot enable native debug
symbols])
+ fi
+ fi
+
+ COMPILE_WITH_DEBUG_SYMBOLS=true
+ COPY_DEBUG_SYMBOLS=true
+ ZIP_EXTERNAL_DEBUG_SYMBOLS=false
+ COMPRESS_EXTERNAL_DEBUG_SYMBOLS_IN_ARCHIVE=true
+
elif test "x$with_native_debug_symbols" = xzipped; then
if test "x$OPENJDK_TARGET_OS" = xlinux; then
@@ -322,6 +339,7 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_DEBUG_SYMBOLS],
AC_SUBST(COMPILE_WITH_DEBUG_SYMBOLS)
AC_SUBST(COPY_DEBUG_SYMBOLS)
AC_SUBST(ZIP_EXTERNAL_DEBUG_SYMBOLS)
+ AC_SUBST(COMPRESS_EXTERNAL_DEBUG_SYMBOLS_IN_ARCHIVE)
# Should we add external native debug symbols to the shipped bundles?
AC_MSG_CHECKING([if we should add external native debug symbols to the
shipped bundles])
diff --git a/make/autoconf/spec.gmk.template b/make/autoconf/spec.gmk.template
index 2a3f2793a32..a48e4da4591 100644
--- a/make/autoconf/spec.gmk.template
+++ b/make/autoconf/spec.gmk.template
@@ -635,6 +635,7 @@ METALLIB := @METALLIB@
COMPILE_WITH_DEBUG_SYMBOLS := @COMPILE_WITH_DEBUG_SYMBOLS@
COPY_DEBUG_SYMBOLS := @COPY_DEBUG_SYMBOLS@
ZIP_EXTERNAL_DEBUG_SYMBOLS := @ZIP_EXTERNAL_DEBUG_SYMBOLS@
+COMPRESS_EXTERNAL_DEBUG_SYMBOLS_IN_ARCHIVE :=
@COMPRESS_EXTERNAL_DEBUG_SYMBOLS_IN_ARCHIVE@
CFLAGS_DEBUG_SYMBOLS := @CFLAGS_DEBUG_SYMBOLS@
ASFLAGS_DEBUG_SYMBOLS := @ASFLAGS_DEBUG_SYMBOLS@
diff --git a/make/common/native/Link.gmk b/make/common/native/Link.gmk
index 855e50bddfb..3bf3593f5d8 100644
--- a/make/common/native/Link.gmk
+++ b/make/common/native/Link.gmk
@@ -146,6 +146,11 @@ define CreateStaticLibrary
$$(ECHO) $$(strip $$($1_LIBS) $$($1_EXTRA_LIBS)) >
$$($1_TARGET).lib-flags.txt
endef
+# Compress DWARF debug sections using zlib
+ifeq ($(COMPRESS_EXTERNAL_DEBUG_SYMBOLS_IN_ARCHIVE), true)
+ OBJCOPY_COMPRESS_FLAG := --compress-debug-sections=zlib-gnu
+endif
+
################################################################################
define CreateDynamicLibraryOrExecutable
# A shared dynamic library or an executable binary has been specified
@@ -189,7 +194,7 @@ define CreateDynamicLibraryOrExecutable
# This cannot be run separately since it updates the original
target
# file.
$$(call ExecuteWithLog,
$$($1_OBJECT_DIR)/$$($1_SAFE_NAME)_create_debuginfo, \
- $$($1_OBJCOPY) --only-keep-debug $$($1_TARGET)
$$($1_DEBUGINFO_FILES))
+ $$($1_OBJCOPY) $(OBJCOPY_COMPRESS_FLAG) --only-keep-debug
$$($1_TARGET) $$($1_DEBUGINFO_FILES))
-------------
PR Comment: https://git.openjdk.org/jdk/pull/30971#issuecomment-4343735543