From 1116b75741a804852b723d421649706b5323bc7c Mon Sep 17 00:00:00 2001 From: Christoph Langer Date: Thu, 6 May 2021 20:28:38 +0000 Subject: [PATCH] 8265666: Enable AIX build platform to make external debug symbols Backport-of: 84b52db931943db5aa2df7edca7103776f2f2092 --- make/autoconf/jdk-options.m4 | 13 ++----------- make/common/NativeCompilation.gmk | 7 +++++++ 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/make/autoconf/jdk-options.m4 b/make/autoconf/jdk-options.m4 index c87522ffa2e..e828b1c944d 100644 --- a/make/autoconf/jdk-options.m4 +++ b/make/autoconf/jdk-options.m4 @@ -240,11 +240,7 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_DEBUG_SYMBOLS], [AS_HELP_STRING([--with-native-debug-symbols], [set the native debug symbol configuration (none, internal, external, zipped) @<:@varying@:>@])], [ - if test "x$OPENJDK_TARGET_OS" = xaix; then - if test "x$withval" = xexternal || test "x$withval" = xzipped; then - AC_MSG_ERROR([AIX only supports the parameters 'none' and 'internal' for --with-native-debug-symbols]) - fi - elif test "x$OPENJDK_TARGET_OS" = xwindows; then + if test "x$OPENJDK_TARGET_OS" = xwindows; then if test "x$withval" = xinternal; then AC_MSG_ERROR([Windows does not support the parameter 'internal' for --with-native-debug-symbols]) fi @@ -254,12 +250,7 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_DEBUG_SYMBOLS], if test "x$STATIC_BUILD" = xtrue; then with_native_debug_symbols="none" else - if test "x$OPENJDK_TARGET_OS" = xaix; then - # AIX doesn't support 'external' so use 'internal' as default - with_native_debug_symbols="internal" - else - with_native_debug_symbols="external" - fi + with_native_debug_symbols="external" fi ]) AC_MSG_RESULT([$with_native_debug_symbols]) diff --git a/make/common/NativeCompilation.gmk b/make/common/NativeCompilation.gmk index db2a0ba1156..4f74f88d51d 100644 --- a/make/common/NativeCompilation.gmk +++ b/make/common/NativeCompilation.gmk @@ -974,6 +974,13 @@ define SetupNativeCompilationBody $(CD) $$($1_SYMBOLS_DIR) && \ $$($1_OBJCOPY) --add-gnu-debuglink=$$($1_DEBUGINFO_FILES) $$($1_TARGET) + else ifeq ($(call isTargetOs, aix), true) + # AIX does not provide the equivalent of OBJCOPY to extract debug symbols, + # so we copy the compiled object with symbols to the .debuginfo file, which + # happens prior to the STRIP_CMD on the original target object file. + $1_DEBUGINFO_FILES := $$($1_SYMBOLS_DIR)/$$($1_NOSUFFIX).debuginfo + $1_CREATE_DEBUGINFO_CMDS := $(CP) $$($1_TARGET) $$($1_DEBUGINFO_FILES) + else ifeq ($(call isTargetOs, macosx), true) $1_DEBUGINFO_FILES := \ $$($1_SYMBOLS_DIR)/$$($1_BASENAME).dSYM/Contents/Info.plist \