Fri, 09 Nov 2018 10:38:30 +0100
8210647: libsaproc is being compiled without optimization
Reviewed-by: erikj, jcbeyler
duke@435 | 1 | # |
dbuck@9322 | 2 | # Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. |
duke@435 | 3 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
duke@435 | 4 | # |
duke@435 | 5 | # This code is free software; you can redistribute it and/or modify it |
duke@435 | 6 | # under the terms of the GNU General Public License version 2 only, as |
duke@435 | 7 | # published by the Free Software Foundation. |
duke@435 | 8 | # |
duke@435 | 9 | # This code is distributed in the hope that it will be useful, but WITHOUT |
duke@435 | 10 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
duke@435 | 11 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
duke@435 | 12 | # version 2 for more details (a copy is included in the LICENSE file that |
duke@435 | 13 | # accompanied this code). |
duke@435 | 14 | # |
duke@435 | 15 | # You should have received a copy of the GNU General Public License version |
duke@435 | 16 | # 2 along with this work; if not, write to the Free Software Foundation, |
duke@435 | 17 | # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
duke@435 | 18 | # |
trims@1907 | 19 | # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
trims@1907 | 20 | # or visit www.oracle.com if you need additional information or have any |
trims@1907 | 21 | # questions. |
duke@435 | 22 | # |
duke@435 | 23 | # |
bpittore@4028 | 24 | include $(GAMMADIR)/make/defs.make |
bpittore@4028 | 25 | include $(GAMMADIR)/make/altsrc.make |
duke@435 | 26 | |
duke@435 | 27 | # Rules to build serviceability agent library, used by vm.make |
duke@435 | 28 | |
dcubed@4344 | 29 | # libsaproc.so: serviceability agent |
phh@1558 | 30 | |
phh@1558 | 31 | SAPROC = saproc |
duke@435 | 32 | LIBSAPROC = lib$(SAPROC).so |
duke@435 | 33 | |
dcubed@3150 | 34 | LIBSAPROC_DEBUGINFO = lib$(SAPROC).debuginfo |
dcubed@3724 | 35 | LIBSAPROC_DIZ = lib$(SAPROC).diz |
dcubed@3150 | 36 | |
duke@435 | 37 | AGENT_DIR = $(GAMMADIR)/agent |
duke@435 | 38 | |
duke@435 | 39 | SASRCDIR = $(AGENT_DIR)/src/os/$(Platform_os_family) |
duke@435 | 40 | |
duke@435 | 41 | SASRCFILES = $(SASRCDIR)/salibelf.c \ |
duke@435 | 42 | $(SASRCDIR)/symtab.c \ |
duke@435 | 43 | $(SASRCDIR)/libproc_impl.c \ |
duke@435 | 44 | $(SASRCDIR)/ps_proc.c \ |
duke@435 | 45 | $(SASRCDIR)/ps_core.c \ |
minqi@4093 | 46 | $(SASRCDIR)/LinuxDebuggerLocal.c \ |
minqi@4093 | 47 | $(AGENT_DIR)/src/share/native/sadis.c |
duke@435 | 48 | |
bpittore@4028 | 49 | -include $(HS_ALT_MAKE)/linux/makefiles/saproc.make |
bpittore@4028 | 50 | |
duke@435 | 51 | SAMAPFILE = $(SASRCDIR)/mapfile |
duke@435 | 52 | |
dcubed@3150 | 53 | DEST_SAPROC = $(JDK_LIBDIR)/$(LIBSAPROC) |
dcubed@3150 | 54 | DEST_SAPROC_DEBUGINFO = $(JDK_LIBDIR)/$(LIBSAPROC_DEBUGINFO) |
dcubed@3724 | 55 | DEST_SAPROC_DIZ = $(JDK_LIBDIR)/$(LIBSAPROC_DIZ) |
duke@435 | 56 | |
aph@1202 | 57 | # DEBUG_BINARIES overrides everything, use full -g debug information |
aph@1202 | 58 | ifeq ($(DEBUG_BINARIES), true) |
aph@1202 | 59 | SA_DEBUG_CFLAGS = -g |
aph@1202 | 60 | endif |
aph@1202 | 61 | |
sgehwolf@9601 | 62 | # Optimize saproc lib at level -O3 unless it's a slowdebug build |
sgehwolf@9601 | 63 | ifneq ($(BUILD_FLAVOR), debug) |
sgehwolf@9601 | 64 | SA_OPT_FLAGS = $(OPT_CFLAGS) |
sgehwolf@9601 | 65 | endif |
sgehwolf@9601 | 66 | |
duke@435 | 67 | # if $(AGENT_DIR) does not exist, we don't build SA |
bpittore@4028 | 68 | # also, we don't build SA on Itanium or zero. |
duke@435 | 69 | |
stefank@2314 | 70 | ifneq ($(wildcard $(AGENT_DIR)),) |
bpittore@4028 | 71 | ifneq ($(filter-out ia64 zero,$(SRCARCH)),) |
stefank@2314 | 72 | BUILDLIBSAPROC = $(LIBSAPROC) |
stefank@2314 | 73 | endif |
stefank@2314 | 74 | endif |
stefank@2314 | 75 | |
bpittore@4028 | 76 | ifneq ($(ALT_SASRCDIR),) |
dlong@7598 | 77 | ALT_SAINCDIR=-I$(ALT_SASRCDIR) -DALT_SASRCDIR |
bpittore@4028 | 78 | else |
bpittore@4028 | 79 | ALT_SAINCDIR= |
bpittore@4028 | 80 | endif |
dbuck@9322 | 81 | SA_LFLAGS = $(MAPFLAG:FILENAME=$(SAMAPFILE)) $(LDFLAGS_HASH_STYLE) \ |
sgehwolf@9330 | 82 | $(LDFLAGS_NO_EXEC_STACK) $(EXTRA_LDFLAGS) |
duke@435 | 83 | |
dlong@7598 | 84 | SAARCH ?= $(BUILDARCH) |
dlong@7598 | 85 | |
duke@435 | 86 | $(LIBSAPROC): $(SASRCFILES) $(SAMAPFILE) |
duke@435 | 87 | $(QUIETLY) if [ "$(BOOT_JAVA_HOME)" = "" ]; then \ |
duke@435 | 88 | echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \ |
duke@435 | 89 | exit 1; \ |
duke@435 | 90 | fi |
duke@435 | 91 | @echo Making SA debugger back-end... |
dlong@7598 | 92 | $(QUIETLY) $(CC) -D$(SAARCH) -D_GNU_SOURCE \ |
poonam@3546 | 93 | -D_FILE_OFFSET_BITS=64 \ |
duke@435 | 94 | $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \ |
duke@435 | 95 | -I$(SASRCDIR) \ |
duke@435 | 96 | -I$(GENERATED) \ |
duke@435 | 97 | -I$(BOOT_JAVA_HOME)/include \ |
duke@435 | 98 | -I$(BOOT_JAVA_HOME)/include/$(Platform_os_family) \ |
bpittore@4028 | 99 | $(ALT_SAINCDIR) \ |
duke@435 | 100 | $(SASRCFILES) \ |
duke@435 | 101 | $(SA_LFLAGS) \ |
aph@1202 | 102 | $(SA_DEBUG_CFLAGS) \ |
sgehwolf@9601 | 103 | $(SA_OPT_FLAGS) \ |
bpittore@5148 | 104 | $(EXTRA_CFLAGS) \ |
duke@435 | 105 | -o $@ \ |
sgehwolf@9486 | 106 | -lthread_db -ldl |
dcubed@3724 | 107 | ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) |
sgehwolf@9357 | 108 | ifneq ($(STRIP_POLICY),no_strip) |
dcubed@3150 | 109 | $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBSAPROC_DEBUGINFO) |
sgehwolf@9357 | 110 | $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBSAPROC_DEBUGINFO) $@ |
sgehwolf@9357 | 111 | endif |
sgehwolf@9346 | 112 | ifeq ($(STRIP_POLICY),all_strip) |
dcubed@3150 | 113 | $(QUIETLY) $(STRIP) $@ |
dcubed@3150 | 114 | else |
dcubed@3150 | 115 | ifeq ($(STRIP_POLICY),min_strip) |
dcubed@3150 | 116 | $(QUIETLY) $(STRIP) -g $@ |
sgehwolf@9346 | 117 | endif |
dcubed@3150 | 118 | # implied else here is no stripping at all |
dcubed@3150 | 119 | endif |
sgehwolf@9357 | 120 | ifneq ($(STRIP_POLICY),no_strip) |
sgehwolf@9357 | 121 | ifeq ($(ZIP_DEBUGINFO_FILES),1) |
dcubed@4344 | 122 | $(ZIPEXE) -q -y $(LIBSAPROC_DIZ) $(LIBSAPROC_DEBUGINFO) |
dcubed@4344 | 123 | $(RM) $(LIBSAPROC_DEBUGINFO) |
sgehwolf@9357 | 124 | endif |
dcubed@3724 | 125 | endif |
dcubed@3150 | 126 | endif |
duke@435 | 127 | |
stefank@2314 | 128 | install_saproc: $(BUILDLIBSAPROC) |
duke@435 | 129 | $(QUIETLY) if [ -e $(LIBSAPROC) ] ; then \ |
duke@435 | 130 | echo "Copying $(LIBSAPROC) to $(DEST_SAPROC)"; \ |
dcubed@3150 | 131 | test -f $(LIBSAPROC_DEBUGINFO) && \ |
dcubed@3150 | 132 | cp -f $(LIBSAPROC_DEBUGINFO) $(DEST_SAPROC_DEBUGINFO); \ |
dcubed@3724 | 133 | test -f $(LIBSAPROC_DIZ) && \ |
dcubed@3724 | 134 | cp -f $(LIBSAPROC_DIZ) $(DEST_SAPROC_DIZ); \ |
duke@435 | 135 | cp -f $(LIBSAPROC) $(DEST_SAPROC) && echo "Done"; \ |
duke@435 | 136 | fi |
duke@435 | 137 | |
stefank@2314 | 138 | .PHONY: install_saproc |