make/bsd/makefiles/launcher.make

Tue, 14 May 2013 09:41:12 -0700

author
minqi
date
Tue, 14 May 2013 09:41:12 -0700
changeset 5103
f9be75d21404
parent 4153
b9a9ed0f8eeb
permissions
-rw-r--r--

8012902: remove use of global operator new - take 2
Summary: The fix of 8010992, disable use of global operator new and new[] which caused failure on some tests. This takes two of the bugs also add ALLOW_OPERATOR_NEW_USAGE to prevent crash for third party code calling operator new of jvm on certain platforms.
Reviewed-by: coleenp, dholmes, zgu
Contributed-by: yumin.qi@oracle.com

never@3156 1 #
mikael@4153 2 # Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
never@3156 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
never@3156 4 #
never@3156 5 # This code is free software; you can redistribute it and/or modify it
never@3156 6 # under the terms of the GNU General Public License version 2 only, as
never@3156 7 # published by the Free Software Foundation.
never@3156 8 #
never@3156 9 # This code is distributed in the hope that it will be useful, but WITHOUT
never@3156 10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
never@3156 11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
never@3156 12 # version 2 for more details (a copy is included in the LICENSE file that
never@3156 13 # accompanied this code).
never@3156 14 #
never@3156 15 # You should have received a copy of the GNU General Public License version
never@3156 16 # 2 along with this work; if not, write to the Free Software Foundation,
never@3156 17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
never@3156 18 #
never@3156 19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
never@3156 20 # or visit www.oracle.com if you need additional information or have any
never@3156 21 # questions.
sla@4076 22 #
never@3156 23 #
never@3156 24
never@3156 25 # Rules to build gamma launcher, used by vm.make
never@3156 26
never@3156 27
never@3156 28 LAUNCHER_SCRIPT = hotspot
never@3156 29 LAUNCHER = gamma
never@3156 30
never@3156 31 LAUNCHERDIR := $(GAMMADIR)/src/os/posix/launcher
never@3156 32 LAUNCHERDIR_SHARE := $(GAMMADIR)/src/share/tools/launcher
never@3156 33 LAUNCHERFLAGS := $(ARCHFLAG) \
never@3156 34 -I$(LAUNCHERDIR) -I$(GAMMADIR)/src/share/vm/prims \
never@3156 35 -I$(LAUNCHERDIR_SHARE) \
never@3156 36 -DFULL_VERSION=\"$(HOTSPOT_RELEASE_VERSION)\" \
never@3156 37 -DJDK_MAJOR_VERSION=\"$(JDK_MAJOR_VERSION)\" \
never@3156 38 -DJDK_MINOR_VERSION=\"$(JDK_MINOR_VERSION)\" \
never@3156 39 -DARCH=\"$(LIBARCH)\" \
never@3156 40 -DGAMMA \
never@3156 41 -DLAUNCHER_TYPE=\"gamma\" \
never@3156 42 -DLINK_INTO_$(LINK_INTO) \
never@3156 43 $(TARGET_DEFINES)
sla@4076 44 # Give the launcher task_for_pid() privileges so that it can be used to run JStack, JInfo, et al.
sla@4076 45 LFLAGS_LAUNCHER += -sectcreate __TEXT __info_plist $(GAMMADIR)/src/os/bsd/launcher/Info-privileged.plist
never@3156 46
never@3156 47 ifeq ($(LINK_INTO),AOUT)
never@3156 48 LAUNCHER.o = launcher.o $(JVM_OBJ_FILES)
never@3156 49 LAUNCHER_MAPFILE = mapfile_reorder
never@3156 50 LFLAGS_LAUNCHER$(LDNOMAP) += $(MAPFLAG:FILENAME=$(LAUNCHER_MAPFILE))
never@3156 51 LFLAGS_LAUNCHER += $(SONAMEFLAG:SONAME=$(LIBJVM)) $(STATIC_LIBGCC)
never@3156 52 LIBS_LAUNCHER += $(STATIC_STDCXX) $(LIBS)
never@3156 53 else
never@3156 54 LAUNCHER.o = launcher.o
sla@4076 55 LFLAGS_LAUNCHER += -L`pwd`
phh@3473 56
phh@3473 57 # The gamma launcher runs the JDK from $JAVA_HOME, overriding the JVM with a
sla@4076 58 # freshly built JVM at ./libjvm.{so|dylib}. This is accomplished by setting
sla@4076 59 # the library searchpath using ({DY}LD_LIBRARY_PATH) to find the local JVM
phh@3473 60 # first. Gamma dlopen()s libjava from $JAVA_HOME/jre/lib{/$arch}, which is
phh@3473 61 # statically linked with CoreFoundation framework libs. Unfortunately, gamma's
sla@4076 62 # unique searchpath results in some unresolved symbols in the framework
phh@3473 63 # libraries, because JDK libraries are inadvertently discovered first on the
phh@3473 64 # searchpath, e.g. libjpeg. On Mac OS X, filenames are case *insensitive*.
phh@3473 65 # So, the actual filename collision is libjpeg.dylib and libJPEG.dylib.
sla@4076 66 # To resolve this, gamma needs to also statically link with the CoreFoundation
phh@3473 67 # framework libraries.
phh@3473 68
phh@3473 69 ifeq ($(OS_VENDOR),Darwin)
sla@4076 70 LFLAGS_LAUNCHER += -framework CoreFoundation
phh@3473 71 endif
phh@3473 72
never@3156 73 LIBS_LAUNCHER += -l$(JVM) $(LIBS)
never@3156 74 endif
never@3156 75
erikj@3518 76 LINK_LAUNCHER = $(LINK.CC)
never@3156 77
erikj@3518 78 LINK_LAUNCHER/PRE_HOOK = $(LINK_LIB.CXX/PRE_HOOK)
erikj@3518 79 LINK_LAUNCHER/POST_HOOK = $(LINK_LIB.CXX/POST_HOOK)
never@3156 80
never@3156 81 LAUNCHER_OUT = launcher
never@3156 82
never@3156 83 SUFFIXES += .d
never@3156 84
never@3156 85 SOURCES := $(shell find $(LAUNCHERDIR) -name "*.c")
never@3156 86 SOURCES_SHARE := $(shell find $(LAUNCHERDIR_SHARE) -name "*.c")
never@3156 87
never@3156 88 OBJS := $(patsubst $(LAUNCHERDIR)/%.c,$(LAUNCHER_OUT)/%.o,$(SOURCES)) $(patsubst $(LAUNCHERDIR_SHARE)/%.c,$(LAUNCHER_OUT)/%.o,$(SOURCES_SHARE))
never@3156 89
never@3156 90 DEPFILES := $(patsubst %.o,%.d,$(OBJS))
never@3156 91 -include $(DEPFILES)
never@3156 92
never@3156 93 $(LAUNCHER_OUT)/%.o: $(LAUNCHERDIR_SHARE)/%.c
never@3156 94 $(QUIETLY) [ -d $(LAUNCHER_OUT) ] || { mkdir -p $(LAUNCHER_OUT); }
erikj@3518 95 $(QUIETLY) $(CC) -g -o $@ -c $< -MMD $(LAUNCHERFLAGS) $(CXXFLAGS)
never@3156 96
never@3156 97 $(LAUNCHER_OUT)/%.o: $(LAUNCHERDIR)/%.c
never@3156 98 $(QUIETLY) [ -d $(LAUNCHER_OUT) ] || { mkdir -p $(LAUNCHER_OUT); }
erikj@3518 99 $(QUIETLY) $(CC) -g -o $@ -c $< -MMD $(LAUNCHERFLAGS) $(CXXFLAGS)
never@3156 100
never@3156 101 $(LAUNCHER): $(OBJS) $(LIBJVM) $(LAUNCHER_MAPFILE)
never@3156 102 $(QUIETLY) echo Linking launcher...
never@3156 103 $(QUIETLY) $(LINK_LAUNCHER/PRE_HOOK)
ohair@4087 104 $(QUIETLY) $(LINK_LAUNCHER) $(LFLAGS_LAUNCHER) -o $@ $(sort $(OBJS)) $(LIBS_LAUNCHER)
never@3156 105 $(QUIETLY) $(LINK_LAUNCHER/POST_HOOK)
sla@4076 106 # Sign the launcher with the development certificate (if present) so that it can be used
sla@4076 107 # to run JStack, JInfo, et al.
sla@4076 108 $(QUIETLY) -codesign -s openjdk_codesign $@
never@3156 109
never@3156 110 $(LAUNCHER): $(LAUNCHER_SCRIPT)
never@3156 111
never@3156 112 $(LAUNCHER_SCRIPT): $(LAUNCHERDIR)/launcher.script
never@3156 113 $(QUIETLY) sed -e 's/@@LIBARCH@@/$(LIBARCH)/g' $< > $@
never@3156 114 $(QUIETLY) chmod +x $@
never@3156 115

mercurial