1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/make/windows/build_vm_def.sh Wed Apr 27 01:25:04 2016 +0800 1.3 @@ -0,0 +1,87 @@ 1.4 +# 1.5 +# Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. 1.6 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 +# 1.8 +# This code is free software; you can redistribute it and/or modify it 1.9 +# under the terms of the GNU General Public License version 2 only, as 1.10 +# published by the Free Software Foundation. 1.11 +# 1.12 +# This code is distributed in the hope that it will be useful, but WITHOUT 1.13 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.14 +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.15 +# version 2 for more details (a copy is included in the LICENSE file that 1.16 +# accompanied this code). 1.17 +# 1.18 +# You should have received a copy of the GNU General Public License version 1.19 +# 2 along with this work; if not, write to the Free Software Foundation, 1.20 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.21 +# 1.22 +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.23 +# or visit www.oracle.com if you need additional information or have any 1.24 +# questions. 1.25 +# 1.26 +# 1.27 + 1.28 +# This shell script builds a vm.def file for the current VM variant. 1.29 +# The .def file exports vtbl symbols which allow the Serviceability 1.30 +# Agent to run on Windows. See make/windows/projectfiles/*/vm.def 1.31 +# for more information. 1.32 +# 1.33 +# The script expects to be executed in the directory containing all of 1.34 +# the object files. 1.35 + 1.36 +# Note that we currently do not have a way to set HotSpotMksHome in 1.37 +# the batch build, but so far this has not seemed to be a problem. The 1.38 +# reason this environment variable is necessary is that it seems that 1.39 +# Windows truncates very long PATHs when executing shells like MKS's 1.40 +# sh, and it has been found that sometimes `which sh` fails. 1.41 +if [ "x$HOTSPOTMKSHOME" != "x" ]; then 1.42 + MKS_HOME="$HOTSPOTMKSHOME" 1.43 +else 1.44 + SH=`which sh` 1.45 + MKS_HOME=`dirname "$SH"` 1.46 +fi 1.47 + 1.48 +AWK="$MKS_HOME/awk.exe" 1.49 +if [ ! -e $AWK ]; then 1.50 + AWK="$MKS_HOME/gawk.exe" 1.51 +fi 1.52 +GREP="$MKS_HOME/grep.exe" 1.53 +SORT="$MKS_HOME/sort.exe" 1.54 +UNIQ="$MKS_HOME/uniq.exe" 1.55 +CAT="$MKS_HOME/cat.exe" 1.56 +RM="$MKS_HOME/rm.exe" 1.57 +DUMPBIN="link.exe /dump" 1.58 + 1.59 +if [ "$1" = "-nosa" ]; then 1.60 + echo EXPORTS > vm.def 1.61 + echo "" 1.62 + echo "***" 1.63 + echo "*** Not building SA: BUILD_WIN_SA != 1" 1.64 + echo "*** C++ Vtables NOT included in vm.def" 1.65 + echo "*** This jvm.dll will NOT work properly with SA." 1.66 + echo "***" 1.67 + echo "*** When in doubt, set BUILD_WIN_SA=1, clean and rebuild." 1.68 + echo "***" 1.69 + echo "" 1.70 + exit 1.71 +fi 1.72 + 1.73 +echo "EXPORTS" > vm1.def 1.74 + 1.75 +# When called from IDE the first param should contain the link version, otherwise may be nill 1.76 +if [ "x$1" != "x" ]; then 1.77 +LD_VER="$1" 1.78 +fi 1.79 + 1.80 +if [ "x$LD_VER" != "x800" -a "x$LD_VER" != "x900" -a "x$LD_VER" != "x1000" ]; then 1.81 +$DUMPBIN /symbols *.obj | "$GREP" "??_7.*@@6B@" | "$GREP" -v "type_info" | "$AWK" '{print $7}' | "$SORT" | "$UNIQ" > vm2.def 1.82 +else 1.83 +# Can't use pipes when calling cl.exe or link.exe from IDE. Using transit file vm3.def 1.84 +$DUMPBIN /OUT:vm3.def /symbols *.obj 1.85 +"$CAT" vm3.def | "$GREP" "??_7.*@@6B@" | "$GREP" -v "type_info" | "$AWK" '{print $7}' | "$SORT" | "$UNIQ" > vm2.def 1.86 +"$RM" -f vm3.def 1.87 +fi 1.88 + 1.89 +"$CAT" vm1.def vm2.def > vm.def 1.90 +"$RM" -f vm1.def vm2.def