Fri, 15 Apr 2011 09:34:43 -0400
7016797: Hotspot: securely/restrictive load dlls and new API for loading system dlls
Summary: Created Windows Dll wrapped to handle jdk6 and jdk7 platform requirements, also provided more restictive Dll search orders for Windows system Dlls.
Reviewed-by: acorn, dcubed, ohair, alanb
1 #
2 # Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 #
5 # This code is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License version 2 only, as
7 # published by the Free Software Foundation.
8 #
9 # This code is distributed in the hope that it will be useful, but WITHOUT
10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 # version 2 for more details (a copy is included in the LICENSE file that
13 # accompanied this code).
14 #
15 # You should have received a copy of the GNU General Public License version
16 # 2 along with this work; if not, write to the Free Software Foundation,
17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 #
19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 # or visit www.oracle.com if you need additional information or have any
21 # questions.
22 #
23 #
25 # Resource file containing VERSIONINFO
26 Res_Files=.\version.res
28 !include ..\generated\objfiles.make
30 COMMONSRC=$(WorkSpace)\src
31 ALTSRC=$(WorkSpace)\src\closed
33 !ifdef RELEASE
34 !ifdef DEVELOP
35 CPP_FLAGS=$(CPP_FLAGS) /D "DEBUG"
36 !else
37 CPP_FLAGS=$(CPP_FLAGS) /D "PRODUCT"
38 !endif
39 !else
40 CPP_FLAGS=$(CPP_FLAGS) /D "ASSERT"
41 !endif
43 !if "$(Variant)" == "core"
44 # No need to define anything, CORE is defined as !COMPILER1 && !COMPILER2
45 !endif
47 !if "$(Variant)" == "kernel"
48 CPP_FLAGS=$(CPP_FLAGS) /D "KERNEL"
49 !endif
51 !if "$(Variant)" == "compiler1"
52 CPP_FLAGS=$(CPP_FLAGS) /D "COMPILER1"
53 !endif
55 !if "$(Variant)" == "compiler2"
56 CPP_FLAGS=$(CPP_FLAGS) /D "COMPILER2"
57 !endif
59 !if "$(Variant)" == "tiered"
60 CPP_FLAGS=$(CPP_FLAGS) /D "COMPILER1" /D "COMPILER2"
61 !endif
63 !if "$(BUILDARCH)" == "i486"
64 HOTSPOT_LIB_ARCH=i386
65 !else
66 HOTSPOT_LIB_ARCH=$(BUILDARCH)
67 !endif
69 # The following variables are defined in the generated local.make file.
70 CPP_FLAGS=$(CPP_FLAGS) /D "HOTSPOT_RELEASE_VERSION=\"$(HS_BUILD_VER)\""
71 CPP_FLAGS=$(CPP_FLAGS) /D "JRE_RELEASE_VERSION=\"$(JRE_RELEASE_VER)\""
72 CPP_FLAGS=$(CPP_FLAGS) /D "HOTSPOT_LIB_ARCH=\"$(HOTSPOT_LIB_ARCH)\""
73 CPP_FLAGS=$(CPP_FLAGS) /D "HOTSPOT_BUILD_TARGET=\"$(BUILD_FLAVOR)\""
74 CPP_FLAGS=$(CPP_FLAGS) /D "HOTSPOT_BUILD_USER=\"$(BuildUser)\""
75 CPP_FLAGS=$(CPP_FLAGS) /D "HOTSPOT_VM_DISTRO=\"$(HOTSPOT_VM_DISTRO)\""
77 CPP_FLAGS=$(CPP_FLAGS) $(CPP_INCLUDE_DIRS)
79 # Define that so jni.h is on correct side
80 CPP_FLAGS=$(CPP_FLAGS) /D "_JNI_IMPLEMENTATION_"
82 !if "$(BUILDARCH)" == "ia64"
83 STACK_SIZE="/STACK:1048576,262144"
84 !else
85 STACK_SIZE=
86 !endif
88 !if "$(BUILDARCH)" == "ia64"
89 # AsyncGetCallTrace is not supported on IA64 yet
90 AGCT_EXPORT=
91 !else
92 !if "$(Variant)" == "kernel"
93 AGCT_EXPORT=
94 !else
95 AGCT_EXPORT=/export:AsyncGetCallTrace
96 !endif
97 !endif
99 # If you modify exports below please do the corresponding changes in
100 # src/share/tools/ProjectCreator/WinGammaPlatformVC7.java
101 LINK_FLAGS=$(LINK_FLAGS) $(STACK_SIZE) /subsystem:windows /dll /base:0x8000000 \
102 /export:JNI_GetDefaultJavaVMInitArgs \
103 /export:JNI_CreateJavaVM \
104 /export:JVM_FindClassFromBootLoader \
105 /export:JNI_GetCreatedJavaVMs \
106 /export:jio_snprintf \
107 /export:jio_printf \
108 /export:jio_fprintf \
109 /export:jio_vfprintf \
110 /export:jio_vsnprintf \
111 $(AGCT_EXPORT) \
112 /export:JVM_GetVersionInfo \
113 /export:JVM_GetThreadStateNames \
114 /export:JVM_GetThreadStateValues \
115 /export:JVM_InitAgentProperties
117 CPP_INCLUDE_DIRS=/I "..\generated"
119 !if exists($(ALTSRC)\share\vm)
120 CPP_INCLUDE_DIRS=$(CPP_INCLUDE_DIRS) /I "$(ALTSRC)\share\vm"
121 !endif
123 !if exists($(ALTSRC)\os\windows\vm)
124 CPP_INCLUDE_DIRS=$(CPP_INCLUDE_DIRS) /I "$(ALTSRC)\os\windows\vm"
125 !endif
127 !if exists($(ALTSRC)\os_cpu\windows_$(Platform_arch)\vm)
128 CPP_INCLUDE_DIRS=$(CPP_INCLUDE_DIRS) /I "$(ALTSRC)\os_cpu\windows_$(Platform_arch)\vm"
129 !endif
131 !if exists($(ALTSRC)\cpu\$(Platform_arch)\vm)
132 CPP_INCLUDE_DIRS=$(CPP_INCLUDE_DIRS) /I "$(ALTSRC)\cpu\$(Platform_arch)\vm"
133 !endif
135 CPP_INCLUDE_DIRS=$(CPP_INCLUDE_DIRS) \
136 /I "$(COMMONSRC)\share\vm" \
137 /I "$(COMMONSRC)\share\vm\prims" \
138 /I "$(COMMONSRC)\os\windows\vm" \
139 /I "$(COMMONSRC)\os_cpu\windows_$(Platform_arch)\vm" \
140 /I "$(COMMONSRC)\cpu\$(Platform_arch)\vm"
142 CPP_DONT_USE_PCH=/D DONT_USE_PRECOMPILED_HEADER
144 !if "$(USE_PRECOMPILED_HEADER)" != "0"
145 CPP_USE_PCH=/Fp"vm.pch" /Yu"precompiled.hpp"
146 !else
147 CPP_USE_PCH=$(CPP_DONT_USE_PCH)
148 !endif
150 # Where to find the source code for the virtual machine (is this used?)
151 VM_PATH=../generated
152 VM_PATH=$(VM_PATH);../generated/adfiles
153 VM_PATH=$(VM_PATH);../generated/jvmtifiles
154 VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/c1
155 VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/compiler
156 VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/code
157 VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/interpreter
158 VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/ci
159 VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/classfile
160 VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/gc_implementation/parallelScavenge
161 VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/gc_implementation/shared
162 VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/gc_implementation/parNew
163 VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/gc_implementation/concurrentMarkSweep
164 VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/gc_implementation/g1
165 VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/gc_interface
166 VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/asm
167 VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/memory
168 VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/oops
169 VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/prims
170 VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/runtime
171 VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/services
172 VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/utilities
173 VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/libadt
174 VM_PATH=$(VM_PATH);$(WorkSpace)/src/os/windows/vm
175 VM_PATH=$(VM_PATH);$(WorkSpace)/src/os_cpu/windows_$(Platform_arch)/vm
176 VM_PATH=$(VM_PATH);$(WorkSpace)/src/cpu/$(Platform_arch)/vm
177 VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/opto
179 VM_PATH={$(VM_PATH)}
181 # Special case files not using precompiled header files.
183 c1_RInfo_$(Platform_arch).obj: $(WorkSpace)\src\cpu\$(Platform_arch)\vm\c1_RInfo_$(Platform_arch).cpp
184 $(CPP) $(CPP_FLAGS) $(CPP_DONT_USE_PCH) /c $(WorkSpace)\src\cpu\$(Platform_arch)\vm\c1_RInfo_$(Platform_arch).cpp
186 os_windows.obj: $(WorkSpace)\src\os\windows\vm\os_windows.cpp
187 $(CPP) $(CPP_FLAGS) $(CPP_DONT_USE_PCH) /c $(WorkSpace)\src\os\windows\vm\os_windows.cpp
189 os_windows_$(Platform_arch).obj: $(WorkSpace)\src\os_cpu\windows_$(Platform_arch)\vm\os_windows_$(Platform_arch).cpp
190 $(CPP) $(CPP_FLAGS) $(CPP_DONT_USE_PCH) /c $(WorkSpace)\src\os_cpu\windows_$(Platform_arch)\vm\os_windows_$(Platform_arch).cpp
192 osThread_windows.obj: $(WorkSpace)\src\os\windows\vm\osThread_windows.cpp
193 $(CPP) $(CPP_FLAGS) $(CPP_DONT_USE_PCH) /c $(WorkSpace)\src\os\windows\vm\osThread_windows.cpp
195 conditionVar_windows.obj: $(WorkSpace)\src\os\windows\vm\conditionVar_windows.cpp
196 $(CPP) $(CPP_FLAGS) $(CPP_DONT_USE_PCH) /c $(WorkSpace)\src\os\windows\vm\conditionVar_windows.cpp
198 getThread_windows_$(Platform_arch).obj: $(WorkSpace)\src\os_cpu\windows_$(Platform_arch)\vm\getThread_windows_$(Platform_arch).cpp
199 $(CPP) $(CPP_FLAGS) $(CPP_DONT_USE_PCH) /c $(WorkSpace)\src\os_cpu\windows_$(Platform_arch)\vm\getThread_windows_$(Platform_arch).cpp
201 opcodes.obj: $(WorkSpace)\src\share\vm\opto\opcodes.cpp
202 $(CPP) $(CPP_FLAGS) $(CPP_DONT_USE_PCH) /c $(WorkSpace)\src\share\vm\opto\opcodes.cpp
204 bytecodeInterpreter.obj: $(WorkSpace)\src\share\vm\interpreter\bytecodeInterpreter.cpp
205 $(CPP) $(CPP_FLAGS) $(CPP_DONT_USE_PCH) /c $(WorkSpace)\src\share\vm\interpreter\bytecodeInterpreter.cpp
207 bytecodeInterpreterWithChecks.obj: ..\generated\jvmtifiles\bytecodeInterpreterWithChecks.cpp
208 $(CPP) $(CPP_FLAGS) $(CPP_DONT_USE_PCH) /c ..\generated\jvmtifiles\bytecodeInterpreterWithChecks.cpp
210 # Default rules for the Virtual Machine
211 {$(COMMONSRC)\share\vm\c1}.cpp.obj::
212 $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
214 {$(COMMONSRC)\share\vm\compiler}.cpp.obj::
215 $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
217 {$(COMMONSRC)\share\vm\code}.cpp.obj::
218 $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
220 {$(COMMONSRC)\share\vm\interpreter}.cpp.obj::
221 $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
223 {$(COMMONSRC)\share\vm\ci}.cpp.obj::
224 $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
226 {$(COMMONSRC)\share\vm\classfile}.cpp.obj::
227 $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
229 {$(COMMONSRC)\share\vm\gc_implementation\parallelScavenge}.cpp.obj::
230 $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
232 {$(COMMONSRC)\share\vm\gc_implementation\shared}.cpp.obj::
233 $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
235 {$(COMMONSRC)\share\vm\gc_implementation\parNew}.cpp.obj::
236 $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
238 {$(COMMONSRC)\share\vm\gc_implementation\concurrentMarkSweep}.cpp.obj::
239 $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
241 {$(COMMONSRC)\share\vm\gc_implementation\g1}.cpp.obj::
242 $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
244 {$(COMMONSRC)\share\vm\gc_interface}.cpp.obj::
245 $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
247 {$(COMMONSRC)\share\vm\asm}.cpp.obj::
248 $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
250 {$(COMMONSRC)\share\vm\memory}.cpp.obj::
251 $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
253 {$(COMMONSRC)\share\vm\oops}.cpp.obj::
254 $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
256 {$(COMMONSRC)\share\vm\prims}.cpp.obj::
257 $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
259 {$(COMMONSRC)\share\vm\runtime}.cpp.obj::
260 $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
262 {$(COMMONSRC)\share\vm\services}.cpp.obj::
263 $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
265 {$(COMMONSRC)\share\vm\utilities}.cpp.obj::
266 $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
268 {$(COMMONSRC)\share\vm\libadt}.cpp.obj::
269 $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
271 {$(COMMONSRC)\share\vm\opto}.cpp.obj::
272 $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
274 {$(COMMONSRC)\os\windows\vm}.cpp.obj::
275 $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
277 # This guy should remain a single colon rule because
278 # otherwise we can't specify the output filename.
279 {$(COMMONSRC)\os\windows\vm}.rc.res:
280 @$(RC) $(RC_FLAGS) /fo"$@" $<
282 {$(COMMONSRC)\cpu\$(Platform_arch)\vm}.cpp.obj::
283 $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
285 {$(COMMONSRC)\os_cpu\windows_$(Platform_arch)\vm}.cpp.obj::
286 $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
288 {$(ALTSRC)\share\vm\c1}.cpp.obj::
289 $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
291 {$(ALTSRC)\share\vm\compiler}.cpp.obj::
292 $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
294 {$(ALTSRC)\share\vm\code}.cpp.obj::
295 $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
297 {$(ALTSRC)\share\vm\interpreter}.cpp.obj::
298 $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
300 {$(ALTSRC)\share\vm\ci}.cpp.obj::
301 $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
303 {$(ALTSRC)\share\vm\classfile}.cpp.obj::
304 $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
306 {$(ALTSRC)\share\vm\gc_implementation\parallelScavenge}.cpp.obj::
307 $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
309 {$(ALTSRC)\share\vm\gc_implementation\shared}.cpp.obj::
310 $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
312 {$(ALTSRC)\share\vm\gc_implementation\parNew}.cpp.obj::
313 $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
315 {$(ALTSRC)\share\vm\gc_implementation\concurrentMarkSweep}.cpp.obj::
316 $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
318 {$(ALTSRC)\share\vm\gc_implementation\g1}.cpp.obj::
319 $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
321 {$(ALTSRC)\share\vm\gc_interface}.cpp.obj::
322 $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
324 {$(ALTSRC)\share\vm\asm}.cpp.obj::
325 $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
327 {$(ALTSRC)\share\vm\memory}.cpp.obj::
328 $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
330 {$(ALTSRC)\share\vm\oops}.cpp.obj::
331 $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
333 {$(ALTSRC)\share\vm\prims}.cpp.obj::
334 $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
336 {$(ALTSRC)\share\vm\runtime}.cpp.obj::
337 $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
339 {$(ALTSRC)\share\vm\services}.cpp.obj::
340 $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
342 {$(ALTSRC)\share\vm\utilities}.cpp.obj::
343 $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
345 {$(ALTSRC)\share\vm\libadt}.cpp.obj::
346 $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
348 {$(ALTSRC)\share\vm\opto}.cpp.obj::
349 $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
351 {$(ALTSRC)\os\windows\vm}.cpp.obj::
352 $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
354 # otherwise we can't specify the output filename.
355 {$(ALTSRC)\os\windows\vm}.rc.res:
356 @$(RC) $(RC_FLAGS) /fo"$@" $<
358 {$(ALTSRC)\cpu\$(Platform_arch)\vm}.cpp.obj::
359 $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
361 {$(ALTSRC)\os_cpu\windows_$(Platform_arch)\vm}.cpp.obj::
362 $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
364 {..\generated\incls}.cpp.obj::
365 $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
367 {..\generated\adfiles}.cpp.obj::
368 $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
370 {..\generated\jvmtifiles}.cpp.obj::
371 $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
373 default::
375 _build_pch_file.obj:
376 @echo #include "precompiled.hpp" > ../generated/_build_pch_file.cpp
377 $(CPP) $(CPP_FLAGS) /Fp"vm.pch" /Yc"precompiled.hpp" /c ../generated/_build_pch_file.cpp