Skip to content

Commit

Permalink
SapMachine SAP#1823: Import async-profiler into the jdk and jre images
Browse files Browse the repository at this point in the history
  • Loading branch information
MBaesken authored and RealCLanger committed Sep 26, 2024
1 parent 67ace8c commit b1f7846
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 0 deletions.
35 changes: 35 additions & 0 deletions make/Images.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,41 @@ ifeq ($(GCOV_ENABLED), true)

endif

################################################################################
# SapMachine 2024-09-13: Async profiler import

ifeq ($(call isTargetOs, linux macosx)+$(ASYNC_PROFILER_IMPORT_ENABLED), true+true)

$(eval $(call SetupCopyFiles, COPY_ASYNC_PROFILER_BIN_TO_JDK, \
SRC := $(ASYNC_PROFILER_IMPORT_PATH), \
DEST := $(JDK_IMAGE_DIR), \
FILES := bin/asprof lib/libasyncProfiler$(SHARED_LIBRARY_SUFFIX), \
MACRO := install-file-and-sign, \
))

$(eval $(call SetupCopyFiles, COPY_ASYNC_PROFILER_BIN_TO_JRE, \
SRC := $(ASYNC_PROFILER_IMPORT_PATH), \
DEST := $(JRE_IMAGE_DIR), \
FILES := bin/asprof lib/libasyncProfiler$(SHARED_LIBRARY_SUFFIX), \
MACRO := install-file-and-sign, \
))

$(eval $(call SetupCopyFiles, COPY_ASYNC_PROFILER_TO_JDK, \
SRC := $(ASYNC_PROFILER_IMPORT_PATH), \
DEST := $(JDK_IMAGE_DIR), \
FILES := lib/async-profiler.jar lib/converter.jar legal/async/CHANGELOG.md legal/async/LICENSE legal/async/README.md, \
))

$(eval $(call SetupCopyFiles, COPY_ASYNC_PROFILER_TO_JRE, \
SRC := $(ASYNC_PROFILER_IMPORT_PATH), \
DEST := $(JRE_IMAGE_DIR), \
FILES := lib/async-profiler.jar lib/converter.jar legal/async/CHANGELOG.md legal/async/LICENSE legal/async/README.md, \
))

JDK_TARGETS += $(COPY_ASYNC_PROFILER_BIN_TO_JDK) $(COPY_ASYNC_PROFILER_TO_JDK)
JRE_TARGETS += $(COPY_ASYNC_PROFILER_BIN_TO_JRE) $(COPY_ASYNC_PROFILER_TO_JRE)
endif

################################################################################
# Debug symbols
# Since debug symbols are not included in the jmod files, they need to be copied
Expand Down
15 changes: 15 additions & 0 deletions make/autoconf/jdk-options.m4
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,21 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_JDK_OPTIONS],
fi
AC_SUBST(COPYRIGHT_YEAR)
# SapMachine 2024-09-13: import async profiler binaries
AC_ARG_WITH(async-profiler-import-path, [AS_HELP_STRING([--with-async-profiler-import-path],
[Set import path for downloaded async profiler binaries])])
if test "x$with_async_profiler_import_path" != x; then
ASYNC_PROFILER_IMPORT_PATH="$with_async_profiler_import_path"
if test -f "$ASYNC_PROFILER_IMPORT_PATH/bin/asprof"; then
ASYNC_PROFILER_IMPORT_ENABLED=true
AC_MSG_NOTICE([asprof exists, enabling async-profiler import])
else
AC_MSG_ERROR([async-profiler import path was set, but asprof was not found])
fi
fi
AC_SUBST(ASYNC_PROFILER_IMPORT_PATH)
AC_SUBST(ASYNC_PROFILER_IMPORT_ENABLED)
# Override default library path
AC_ARG_WITH([jni-libpath], [AS_HELP_STRING([--with-jni-libpath],
[override default JNI library search path])])
Expand Down
4 changes: 4 additions & 0 deletions make/autoconf/spec.gmk.template
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,10 @@ CACERTS_SRC := @CACERTS_SRC@
# Enable unlimited crypto policy
UNLIMITED_CRYPTO := @UNLIMITED_CRYPTO@

# SapMachine 2024-09-13: import async profiler binaries
ASYNC_PROFILER_IMPORT_PATH=@ASYNC_PROFILER_IMPORT_PATH@
ASYNC_PROFILER_IMPORT_ENABLED=@ASYNC_PROFILER_IMPORT_ENABLED@

GCOV_ENABLED := @GCOV_ENABLED@
JCOV_ENABLED := @JCOV_ENABLED@
JCOV_HOME := @JCOV_HOME@
Expand Down
24 changes: 24 additions & 0 deletions make/common/FileUtils.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,35 @@ ifeq ($(call isTargetOs, macosx), true)
$(XATTR) -cs '$(call DecodeSpace, $@)'; \
fi
endef

# SapMachine 2024-09-13: import async profiler binaries
ifeq ($(MACOSX_CODESIGN_MODE), disabled)
define install-file-and-sign
$(install-file)
$(ECHO) No Async profiler codesigning, codesign mode is $(MACOSX_CODESIGN_MODE)
endef
else
ifeq ($(MACOSX_CODESIGN_MODE), hardened)
CODESIGN_APOPTS="$(MACOSX_CODESIGN_IDENTITY)" --timestamp --options runtime
else ifeq ($(MACOSX_CODESIGN_MODE), debug)
CODESIGN_APOPTS=-
PLIST_APOPT=-debug
endif
define install-file-and-sign
$(install-file)
$(CODESIGN) --remove-signature '$(call DecodeSpace, $@)'
$(CODESIGN) -f -s $(CODESIGN_APOPTS) --entitlements $(TOPDIR)/make/data/macosxsigning/default$(PLIST_APOPT).plist '$(call DecodeSpace, $@)'
endef
endif
else
define install-file
$(call MakeTargetDir)
$(CP) -fP '$(call DecodeSpace, $<)' '$(call DecodeSpace, $@)'
endef
# SapMachine 2024-09-13: import async profiler binaries
define install-file-and-sign
$(install-file)
endef
endif

# Variant of install file that does not preserve symlinks
Expand Down

0 comments on commit b1f7846

Please sign in to comment.