make/linux/makefiles/saproc.make

Fri, 15 Jun 2018 14:30:02 +0200

author
sgehwolf
date
Fri, 15 Jun 2018 14:30:02 +0200
changeset 9330
f175513c2c3a
parent 9322
f2903632450a
child 9346
5ba59d58d976
permissions
-rw-r--r--

8205104: EXTRA_LDFLAGS not consistently being used
Summary: Add EXTRA_LDFLAGS to linker flags for relevant libraries.
Reviewed-by: ihse

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
duke@435 62 # if $(AGENT_DIR) does not exist, we don't build SA
bpittore@4028 63 # also, we don't build SA on Itanium or zero.
duke@435 64
stefank@2314 65 ifneq ($(wildcard $(AGENT_DIR)),)
bpittore@4028 66 ifneq ($(filter-out ia64 zero,$(SRCARCH)),)
stefank@2314 67 BUILDLIBSAPROC = $(LIBSAPROC)
stefank@2314 68 endif
stefank@2314 69 endif
stefank@2314 70
bpittore@4028 71 ifneq ($(ALT_SASRCDIR),)
dlong@7598 72 ALT_SAINCDIR=-I$(ALT_SASRCDIR) -DALT_SASRCDIR
bpittore@4028 73 else
bpittore@4028 74 ALT_SAINCDIR=
bpittore@4028 75 endif
dbuck@9322 76 SA_LFLAGS = $(MAPFLAG:FILENAME=$(SAMAPFILE)) $(LDFLAGS_HASH_STYLE) \
sgehwolf@9330 77 $(LDFLAGS_NO_EXEC_STACK) $(EXTRA_LDFLAGS)
duke@435 78
dlong@7598 79 SAARCH ?= $(BUILDARCH)
dlong@7598 80
duke@435 81 $(LIBSAPROC): $(SASRCFILES) $(SAMAPFILE)
duke@435 82 $(QUIETLY) if [ "$(BOOT_JAVA_HOME)" = "" ]; then \
duke@435 83 echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \
duke@435 84 exit 1; \
duke@435 85 fi
duke@435 86 @echo Making SA debugger back-end...
dlong@7598 87 $(QUIETLY) $(CC) -D$(SAARCH) -D_GNU_SOURCE \
poonam@3546 88 -D_FILE_OFFSET_BITS=64 \
duke@435 89 $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \
duke@435 90 -I$(SASRCDIR) \
duke@435 91 -I$(GENERATED) \
duke@435 92 -I$(BOOT_JAVA_HOME)/include \
duke@435 93 -I$(BOOT_JAVA_HOME)/include/$(Platform_os_family) \
bpittore@4028 94 $(ALT_SAINCDIR) \
duke@435 95 $(SASRCFILES) \
duke@435 96 $(SA_LFLAGS) \
aph@1202 97 $(SA_DEBUG_CFLAGS) \
bpittore@5148 98 $(EXTRA_CFLAGS) \
duke@435 99 -o $@ \
duke@435 100 -lthread_db
dcubed@3724 101 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
dcubed@3150 102 $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBSAPROC_DEBUGINFO)
dcubed@3150 103 $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBSAPROC_DEBUGINFO) $@
dcubed@3150 104 ifeq ($(STRIP_POLICY),all_strip)
dcubed@3150 105 $(QUIETLY) $(STRIP) $@
dcubed@3150 106 else
dcubed@3150 107 ifeq ($(STRIP_POLICY),min_strip)
dcubed@3150 108 $(QUIETLY) $(STRIP) -g $@
dcubed@3150 109 # implied else here is no stripping at all
dcubed@3150 110 endif
dcubed@3150 111 endif
dcubed@3724 112 ifeq ($(ZIP_DEBUGINFO_FILES),1)
dcubed@4344 113 $(ZIPEXE) -q -y $(LIBSAPROC_DIZ) $(LIBSAPROC_DEBUGINFO)
dcubed@4344 114 $(RM) $(LIBSAPROC_DEBUGINFO)
dcubed@3724 115 endif
dcubed@3150 116 endif
duke@435 117
stefank@2314 118 install_saproc: $(BUILDLIBSAPROC)
duke@435 119 $(QUIETLY) if [ -e $(LIBSAPROC) ] ; then \
duke@435 120 echo "Copying $(LIBSAPROC) to $(DEST_SAPROC)"; \
dcubed@3150 121 test -f $(LIBSAPROC_DEBUGINFO) && \
dcubed@3150 122 cp -f $(LIBSAPROC_DEBUGINFO) $(DEST_SAPROC_DEBUGINFO); \
dcubed@3724 123 test -f $(LIBSAPROC_DIZ) && \
dcubed@3724 124 cp -f $(LIBSAPROC_DIZ) $(DEST_SAPROC_DIZ); \
duke@435 125 cp -f $(LIBSAPROC) $(DEST_SAPROC) && echo "Done"; \
duke@435 126 fi
duke@435 127
stefank@2314 128 .PHONY: install_saproc

mercurial