6764892: VS2008 changes required to compile hotspot sources
authortbell
Tue, 11 Nov 2008 22:01:08 -0800
changeset 1546 a02228c60567
parent 1501 72de50c44b55
child 1548 bb30d685dce3
6764892: VS2008 changes required to compile hotspot sources Summary: Minor changes required to build using the Visual Studio 2008 compiler Reviewed-by: kvn, ohair
hotspot/make/windows/makefiles/adlc.make
hotspot/make/windows/makefiles/compile.make
hotspot/make/windows/makefiles/debug.make
hotspot/make/windows/makefiles/defs.make
hotspot/make/windows/makefiles/fastdebug.make
hotspot/make/windows/makefiles/product.make
hotspot/make/windows/makefiles/sa.make
hotspot/src/cpu/x86/vm/register_definitions_x86.cpp
--- a/hotspot/make/windows/makefiles/adlc.make	Fri Nov 07 13:55:14 2008 -0800
+++ b/hotspot/make/windows/makefiles/adlc.make	Tue Nov 11 22:01:08 2008 -0800
@@ -102,6 +102,12 @@
 adlc.exe: main.obj adlparse.obj archDesc.obj arena.obj dfa.obj dict2.obj filebuff.obj \
           forms.obj formsopt.obj formssel.obj opcodes.obj output_c.obj output_h.obj
 	$(LINK) $(LINK_FLAGS) /subsystem:console /out:$@ $**
+!if "$(MT)" != ""
+# The previous link command created a .manifest file that we want to
+# insert into the linked artifact so we do not need to track it
+# separately.  Use ";#2" for .dll and ";#1" for .exe:
+	$(MT) /manifest $@.manifest /outputresource:$@;#1
+!endif
 
 $(GENERATED_NAMES_IN_INCL): $(Platform_arch_model).ad adlc.exe includeDB.current 
 	rm -f $(GENERATED_NAMES)
--- a/hotspot/make/windows/makefiles/compile.make	Fri Nov 07 13:55:14 2008 -0800
+++ b/hotspot/make/windows/makefiles/compile.make	Tue Nov 11 22:01:08 2008 -0800
@@ -30,7 +30,7 @@
 #   /W3       Warning level 3
 #   /Zi       Include debugging information
 #   /WX       Treat any warning error as a fatal error
-#   /MD       Use dynamic multi-threaded runtime (msvcrt.dll or msvc*71.dll)
+#   /MD       Use dynamic multi-threaded runtime (msvcrt.dll or msvc*NN.dll)
 #   /MTd      Use static multi-threaded runtime debug versions
 #   /O1       Optimize for size (/Os), skips /Oi
 #   /O2       Optimize for speed (/Ot), adds /Oi to /O1
@@ -80,8 +80,10 @@
 CPP=ARCH_ERROR
 !endif
 
-# MSC_VER is a 4 digit number that tells us what compiler is being used, it is
-#    generated when the local.make file is created by the script gen_msc_ver.sh.
+# MSC_VER is a 4 digit number that tells us what compiler is being used
+#    and is generated when the local.make file is created by build.make
+#    via the script get_msc_ver.sh
+#
 #    If MSC_VER is set, it overrides the above default setting.
 #    But it should be set.
 #    Possible values:
@@ -89,13 +91,14 @@
 #      1300 and 1310 is VS2003 or VC7
 #      1399 is our fake number for the VS2005 compiler that really isn't 1400
 #      1400 is for VS2005
+#      1500 is for VS2008
 #    Do not confuse this MSC_VER with the predefined macro _MSC_VER that the
 #    compiler provides, when MSC_VER==1399, _MSC_VER will be 1400.
 #    Normally they are the same, but a pre-release of the VS2005 compilers
 #    in the Windows 64bit Platform SDK said it was 1400 when it was really
 #    closer to VS2003 in terms of option spellings, so we use 1399 for that
 #    1400 version that really isn't 1400.
-#    See the file gen_msc_ver.sh for more info.
+#    See the file get_msc_ver.sh for more info.
 !if "x$(MSC_VER)" == "x"
 COMPILER_NAME=$(DEFAULT_COMPILER_NAME)
 !else
@@ -115,6 +118,9 @@
 !if "$(MSC_VER)" == "1400"
 COMPILER_NAME=VS2005
 !endif
+!if "$(MSC_VER)" == "1500"
+COMPILER_NAME=VS2008
+!endif
 !endif
 
 # Add what version of the compiler we think this is to the compile line
@@ -160,7 +166,25 @@
 #    externals at link time. Even with /GS-, you need bufferoverflowU.lib.
 #    NOTE: Currently we decided to not use /GS-
 BUFFEROVERFLOWLIB = bufferoverflowU.lib
-LINK_FLAGS = $(LINK_FLAGS) $(BUFFEROVERFLOWLIB)
+LINK_FLAGS = /manifest $(LINK_FLAGS) $(BUFFEROVERFLOWLIB)
+# Manifest Tool - used in VS2005 and later to adjust manifests stored
+# as resources inside build artifacts.
+MT=mt.exe
+!if "$(BUILDARCH)" == "i486"
+# VS2005 on x86 restricts the use of certain libc functions without this
+CPP_FLAGS=$(CPP_FLAGS) /D _CRT_SECURE_NO_DEPRECATE
+!endif
+!endif
+
+!if "$(COMPILER_NAME)" == "VS2008"
+PRODUCT_OPT_OPTION   = /O2 /Oy-
+FASTDEBUG_OPT_OPTION = /O2 /Oy-
+DEBUG_OPT_OPTION     = /Od
+GX_OPTION = /EHsc
+LINK_FLAGS = /manifest $(LINK_FLAGS)
+# Manifest Tool - used in VS2005 and later to adjust manifests stored
+# as resources inside build artifacts.
+MT=mt.exe
 !if "$(BUILDARCH)" == "i486"
 # VS2005 on x86 restricts the use of certain libc functions without this
 CPP_FLAGS=$(CPP_FLAGS) /D _CRT_SECURE_NO_DEPRECATE
--- a/hotspot/make/windows/makefiles/debug.make	Fri Nov 07 13:55:14 2008 -0800
+++ b/hotspot/make/windows/makefiles/debug.make	Tue Nov 11 22:01:08 2008 -0800
@@ -50,6 +50,12 @@
 	$(LINK) @<<
   $(LINK_FLAGS) /out:$@ /implib:$*.lib /def:vm.def $(Obj_Files) $(Res_Files)
 <<
+!if "$(MT)" != ""
+# The previous link command created a .manifest file that we want to
+# insert into the linked artifact so we do not need to track it
+# separately.  Use ";#2" for .dll and ";#1" for .exe:
+	$(MT) /manifest $@.manifest /outputresource:$@;#2
+!endif
 
 !include $(WorkSpace)/make/windows/makefiles/shared.make
 !include $(WorkSpace)/make/windows/makefiles/sa.make
--- a/hotspot/make/windows/makefiles/defs.make	Fri Nov 07 13:55:14 2008 -0800
+++ b/hotspot/make/windows/makefiles/defs.make	Tue Nov 11 22:01:08 2008 -0800
@@ -25,7 +25,7 @@
 # The common definitions for hotspot windows builds.
 # Include the top level defs.make under make directory instead of this one.
 # This file is included into make/defs.make.
-# On windows it is only used to construct parameters for 
+# On windows it is only used to construct parameters for
 # make/windows/build.make when make/Makefile is used to build VM.
 
 SLASH_JAVA ?= J:
@@ -69,7 +69,7 @@
 
 JDK_INCLUDE_SUBDIR=win32
 
-# HOTSPOT_RELEASE_VERSION and HOTSPOT_BUILD_VERSION are defined 
+# HOTSPOT_RELEASE_VERSION and HOTSPOT_BUILD_VERSION are defined
 # and added to MAKE_ARGS list in $(GAMMADIR)/make/defs.make.
 
 # next parameters are defined in $(GAMMADIR)/make/defs.make.
@@ -125,7 +125,7 @@
 endif
 
 ifeq ($(BUILD_WIN_SA), 1)
-  ifeq ($(ARCH),ia64)   
+  ifeq ($(ARCH),ia64)
     BUILD_WIN_SA = 0
   endif
 endif
@@ -154,7 +154,7 @@
   EXPORT_LIST += $(EXPORT_JRE_BIN_DIR)/sawindbg.dll
   EXPORT_LIST += $(EXPORT_JRE_BIN_DIR)/sawindbg.pdb
   EXPORT_LIST += $(EXPORT_JRE_BIN_DIR)/sawindbg.map
-  EXPORT_LIST += $(EXPORT_LIB_DIR)/sa-jdi.jar 
+  EXPORT_LIST += $(EXPORT_LIB_DIR)/sa-jdi.jar
   # Must pass this down to nmake.
   MAKE_ARGS += BUILD_WIN_SA=1
 endif
--- a/hotspot/make/windows/makefiles/fastdebug.make	Fri Nov 07 13:55:14 2008 -0800
+++ b/hotspot/make/windows/makefiles/fastdebug.make	Tue Nov 11 22:01:08 2008 -0800
@@ -50,6 +50,13 @@
 	$(LINK) @<<
   $(LINK_FLAGS) /out:$@ /implib:$*.lib /def:vm.def $(Obj_Files) $(Res_Files)
 <<
+!if "$(MT)" != ""
+# The previous link command created a .manifest file that we want to
+# insert into the linked artifact so we do not need to track it
+# separately.  Use ";#2" for .dll and ";#1" for .exe:
+	$(MT) /manifest $@.manifest /outputresource:$@;#2
+!endif
+
 
 !include $(WorkSpace)/make/windows/makefiles/shared.make
 !include $(WorkSpace)/make/windows/makefiles/sa.make
--- a/hotspot/make/windows/makefiles/product.make	Fri Nov 07 13:55:14 2008 -0800
+++ b/hotspot/make/windows/makefiles/product.make	Tue Nov 11 22:01:08 2008 -0800
@@ -61,6 +61,12 @@
   $(LINK_FLAGS) /out:$@ /implib:$*.lib /def:vm.def $(Obj_Files) $(Res_Files)
 <<
 !endif
+!if "$(MT)" != ""
+# The previous link command created a .manifest file that we want to
+# insert into the linked artifact so we do not need to track it
+# separately.  Use ";#2" for .dll and ";#1" for .exe:
+	$(MT) /manifest $@.manifest /outputresource:$@;#2
+!endif
 
 !include $(WorkSpace)/make/windows/makefiles/shared.make
 !include $(WorkSpace)/make/windows/makefiles/sa.make
--- a/hotspot/make/windows/makefiles/sa.make	Fri Nov 07 13:55:14 2008 -0800
+++ b/hotspot/make/windows/makefiles/sa.make	Tue Nov 11 22:01:08 2008 -0800
@@ -92,13 +92,18 @@
 !else
 SA_CFLAGS = /nologo $(MS_RUNTIME_OPTION) /W3 /Gm $(GX_OPTION) /ZI /Od /D "WIN32" /D "_WINDOWS" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
 !endif
-
+!if "$(MT)" != ""
+    SA_LINK_FLAGS = /manifest $(SA_LINK_FLAGS)
+!endif
 SASRCFILE = $(AGENT_DIR)/src/os/win32/windbg/sawindbg.cpp
 SA_LFLAGS = $(SA_LINK_FLAGS) /nologo /subsystem:console /map /debug /machine:$(MACHINE)
 
 # Note that we do not keep sawindbj.obj around as it would then
 # get included in the dumpbin command in build_vm_def.sh
 
+# In VS2005 or VS2008 the link command creates a .manifest file that we want
+# to insert into the linked artifact so we do not need to track it separately.
+# Use ";#2" for .dll and ";#1" for .exe in the MT command below:
 $(SAWINDBG): $(SASRCFILE)
 	set INCLUDE=$(SA_INCLUDE)$(INCLUDE)
 	$(CPP) @<<
@@ -109,6 +114,9 @@
 <<
 	set LIB=$(SA_LIB)$(LIB)
 	$(LINK) /out:$@ /DLL sawindbg.obj dbgeng.lib $(SA_LFLAGS)
+!if "$(MT)" != ""
+	$(MT) /manifest $(@F).manifest /outputresource:$(@F);#2
+!endif
 	-@rm -f sawindbg.obj
 
 cleanall :
--- a/hotspot/src/cpu/x86/vm/register_definitions_x86.cpp	Fri Nov 07 13:55:14 2008 -0800
+++ b/hotspot/src/cpu/x86/vm/register_definitions_x86.cpp	Tue Nov 11 22:01:08 2008 -0800
@@ -22,9 +22,6 @@
  *
  */
 
-// make sure the defines don't screw up the declarations later on in this file
-#define DONT_USE_REGISTER_DEFINES
-
 #include "incls/_precompiled.incl"
 #include "incls/_register_definitions_x86.cpp.incl"