VirtualBox

source: vbox/trunk/src/recompiler/Makefile.kmk@ 80268

Last change on this file since 80268 was 80024, checked in by vboxsync, 5 years ago

VMM: Kicking out raw-mode (work in progress) - em config. bugref:9517

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 11.8 KB
Line 
1# $Id: Makefile.kmk 80024 2019-07-28 13:30:53Z vboxsync $
2## @file
3# The Recompiler Sub-Makefile.
4#
5
6#
7# Copyright (C) 2006-2019 Oracle Corporation
8#
9# This file is part of VirtualBox Open Source Edition (OSE), as
10# available from http://www.virtualbox.org. This file is free software;
11# you can redistribute it and/or modify it under the terms of the GNU
12# General Public License (GPL) as published by the Free Software
13# Foundation, in version 2 as it comes in the "COPYING" file of the
14# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16#
17
18
19SUB_DEPTH = ../..
20include $(KBUILD_PATH)/subheader.kmk
21
22#
23# Globals
24#
25VBOX_PATH_RECOMPILER_SRC := $(PATH_SUB_CURRENT)
26# Workaround for darwin hell.
27ifeq ($(KBUILD_TARGET),darwin)
28 VBOX_WITHOUT_REM_LDR_CYCLE := 1
29endif
30ifeq ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH),win.amd64)
31 VBOX_USE_MINGWW64 = 1
32endif
33
34
35#
36# The primary REM module definition.
37#
38# This is extended by one of the VBoxREM* modules below. Currently, this
39# isn't done by inheritance because of some obscure bug wrt inheriting from
40# unused targets that I'm not going to fix now.
41#
42ifneq ($(KBUILD_TARGET),win)
43 VBoxRemPrimary_TEMPLATE = VBOXR3NP
44 # workaround the regparm bug in gcc <= 3.3
45 VBoxRemPrimary_DEFS = $(if $(VBOX_GCC_BUGGY_REGPARM),GCC_WITH_BUGGY_REGPARM,)
46else
47 VBoxRemPrimary_TEMPLATE = DUMMY
48 VBoxRemPrimary_TOOL.win.x86 = MINGW32
49 ifdef VBOX_USE_MINGWW64
50 VBoxRemPrimary_TOOL.win.amd64 = MINGWW64
51 else
52 VBoxRemPrimary_TOOL.win.amd64 = XGCCAMD64LINUX
53 endif
54 VBoxRemPrimary_SDKS.win.x86 = W32API
55 VBoxRemPrimary_ASFLAGS = -x assembler-with-cpp
56 VBoxRemPrimary_CFLAGS = -Wall -g -fno-omit-frame-pointer -fno-strict-aliasing -Wno-shadow
57 VBoxRemPrimary_CFLAGS.debug = -O0
58 VBoxRemPrimary_CFLAGS.release += -fno-gcse -O2
59 VBoxRemPrimary_CFLAGS.profile = $(VBoxRemPrimary_CFLAGS.release)
60 VBoxRemPrimary_DEFS += IN_RING3 $(ARCH_BITS_DEFS)
61 # Workaround the regparm bug in gcc <= 3.3.
62 VBoxRemPrimary_DEFS.win.x86 += GCC_WITH_BUGGY_REGPARM
63 # Missing fpclassify. Is there a better define or flag for this?
64 VBoxRemPrimary_DEFS.solaris += __C99FEATURES__
65endif # win
66VBoxRemPrimary_DEFS += IN_REM_R3 REM_INCLUDE_CPU_H NEED_CPU_H
67#VBoxRemPrimary_DEFS += REM_PHYS_ADDR_IN_TLB
68#VBoxRemPrimary_DEFS += DEBUG_ALL_LOGGING DEBUG_DISAS DEBUG_PCALL CONFIG_DEBUG_EXEC DEBUG_FLUSH DEBUG_IOPORT DEBUG_SIGNAL DEBUG_TLB_CHECK DEBUG_TB_INVALIDATE DEBUG_TLB # Enables huge amounts of debug logging.
69#VBoxRemPrimary_DEFS += DEBUG_DISAS DEBUG_PCALL CONFIG_DEBUG_EXEC DEBUG_FLUSH DEBUG_IOPORT DEBUG_SIGNAL DEBUG_TLB_CHECK DEBUG_TB_INVALIDATE DEBUG_TLB # Enables huge amounts of debug logging.
70ifdef VBOX_WITH_RAW_MODE
71 VBoxRemPrimary_DEFS += VBOX_WITH_RAW_MODE
72endif
73VBoxRemPrimary_DEFS.linux = _GNU_SOURCE
74ifdef VBOX_SOLARIS_10
75 VBoxRemPrimary_DEFS.solaris = CONFIG_SOLARIS_VERSION=10
76else
77 VBoxRemPrimary_DEFS.solaris = CONFIG_SOLARIS_VERSION=11
78endif
79VBoxRemPrimary_DEFS.freebsd += _BSD
80VBoxRemPrimary_DEFS.amd64 += __x86_64__
81VBoxRemPrimary_DEFS.x86 += __i386__
82
83VBoxRemPrimary_INCS = \
84 Sun \
85 target-i386 \
86 tcg \
87 fpu \
88 $(VBoxRemPrimary_0_OUTDIR) \
89 $(PATH_ROOT)/src/VBox/VMM/include \
90 tcg/i386 \
91 .
92ifn1of ($(VBoxRemPrimary_DEFS),DEBUG_TMP_LOGGING)
93 VBoxRemPrimary_DEFS += LOG_USE_C99
94 VBoxRemPrimary_INCS <= \
95 Sun/crt
96endif
97
98VBoxRemPrimary_SOURCES = \
99 VBoxRecompiler.c \
100 cpu-exec.c \
101 exec.c \
102 translate-all.c \
103 host-utils.c \
104 cutils.c \
105 tcg-runtime.c \
106 tcg/tcg.c \
107 tcg/tcg-dyngen.c \
108 fpu/softfloat-native.c \
109 target-i386/op_helper.c \
110 target-i386/helper.c \
111 target-i386/translate.c
112VBoxRemPrimary_SOURCES.debug += \
113 Sun/testmath.c
114VBoxRemPrimary_SOURCES.win = $(VBoxREMImp_0_OUTDIR)/VBoxREMRes.o
115VBoxRemPrimary_SOURCES.win.x86 = $(VBoxREMImp_0_OUTDIR)/VBoxREMWin.def
116ifdef VBOX_USE_MINGWW64
117 if 0 # exporting all helps when windbg pops up on crashes
118 VBoxRemPrimary_SOURCES.win.amd64 = $(VBoxREMImp_0_OUTDIR)/VBoxREMWin.def
119 else
120 VBoxRemPrimary_LDFLAGS.win.amd64 = --export-all
121 endif
122endif
123
124ifndef VBOX_USE_MINGWW64
125VBoxRemPrimary_LIBS = \
126 $(LIB_VMM) \
127 $(LIB_RUNTIME)
128else
129VBoxRemPrimary_LIBS = \
130 $(VBoxRemPrimary_0_OUTDIR)/VBoxVMMImp.a \
131 $(VBoxRemPrimary_0_OUTDIR)/VBoxRTImp.a
132VBoxRemPrimary_CLEAN = \
133 $(VBoxRemPrimary_0_OUTDIR)/VBoxVMMImp.a \
134 $(VBoxRemPrimary_0_OUTDIR)/VBoxVMMImp.def \
135 $(VBoxRemPrimary_0_OUTDIR)/VBoxRTImp.a \
136 $(VBoxRemPrimary_0_OUTDIR)/VBoxRTImp.def
137endif
138
139VBoxRemPrimary_LDFLAGS.solaris = -mimpure-text
140if defined(VBOX_WITH_HARDENING) && "$(KBUILD_TARGET)" == "win"
141 VBoxRemPrimary_POST_CMDS = \
142 $(VBOX_VCC_EDITBIN) /LargeAddressAware /DynamicBase /NxCompat /Release /IntegrityCheck \
143 /Version:$(VBOX_VERSION_MAJOR)0$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) "$(out)" \
144 $$(NLTAB)$(VBOX_SIGN_IMAGE_CMDS)
145else
146 VBoxRemPrimary_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
147endif
148
149
150if "$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)" == "win.amd64" && !defined(VBOX_USE_MINGWW64)
151 #
152 # VBoxREM2/VBoxRemPrimary - Currently only used by 64-bit Windows.
153 # (e_powl-xxx.S doesn't fit in IPRT because it requires GAS and is LGPL.)
154 #
155 SYSMODS += VBoxRemPrimary
156 VBoxRemPrimary_TEMPLATE = VBOXNOCRTGAS
157 VBoxRemPrimary_NAME = VBoxREM2
158 VBoxRemPrimary_DEFS += LOG_USE_C99 $(ARCH_BITS_DEFS)
159 VBoxRemPrimary_SOURCES += \
160 Sun/e_powl-$(KBUILD_TARGET_ARCH).S
161 VBoxRemPrimary_INCS += \
162 Sun/crt
163 VBoxRemPrimary_SYSSUFF = .rel
164 VBoxRemPrimary_LIBS = \
165 $(PATH_STAGE_LIB)/RuntimeR3NoCRTGCC$(VBOX_SUFF_LIB)
166 VBoxRemPrimary_POST_CMDS = $(NO_SUCH_VARIABLE)
167 VBOX_REM_WRAPPER = 2
168
169else if "$(KBUILD_TARGET_ARCH)" == "x86" && defined(VBOX_WITH_64_BITS_GUESTS)
170 #
171 # For 32-bit targets when enabled 64-bit guests we build 2 REM DLLs:
172 # with 64-bit support (slow and buggy at the moment) VBOXREM64
173 # only 32-bit support (faster, stable, but not suitable for 64-bit guests) VBOXREM32
174 # During the runtime, we load appropriate library from VBOXREM, depending on guest settings.
175 # 64-bit targets have 64-bit enabled REM by default, so is not part of this mess
176 #
177
178 #
179 # VBoxREM32/VBoxRemPrimary
180 #
181 DLLS += VBoxRemPrimary
182 VBoxRemPrimary_NAME = VBoxREM32
183 VBoxRemPrimary_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxREM32.dylib
184 VBOX_REM_WRAPPER = 32
185
186 #
187 # VBoxREM64
188 #
189 DLLS += VBoxREM64
190 VBoxREM64_EXTENDS = VBoxRemPrimary
191 VBoxREM64_EXTENDS_BY = appending
192 VBoxREM64_NAME = VBoxREM64
193 VBoxREM64_DEFS = VBOX_ENABLE_VBOXREM64
194 VBoxREM64_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxREM64.dylib
195
196else
197 #
198 # VBoxREM/VBoxRemPrimary - Normal.
199 #
200 DLLS += VBoxRemPrimary
201 VBoxRemPrimary_NAME = VBoxREM
202 VBoxRemPrimary_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxREM3.dylib
203
204 ifdef VBOX_USE_MINGWW64
205 # GNU ld (rubenvb-4.5.4) 2.22.52.20120716 doesn't fix up rip relative
206 # addressing in the import libraries generated by microsoft link.exe. So, we
207 # have to regenerate these.
208 # Note! The chdir to the output directory is because dlltool writes temporary files to the current directory.
209 $$(VBoxRemPrimary_0_OUTDIR)/VBoxVMMImp.a \
210 $$(VBoxRemPrimary_0_OUTDIR)/VBoxRTImp.a : $$(VBoxRemPrimary_0_OUTDIR)/$$(notdir $$(basename $$@)).def
211 $(REDIRECT) -C "$(dir $@)" -- $(TOOL_MINGWW64_DLLTOOL) \
212 --output-lib "$@" \
213 --input-def "$<" \
214 --dllname "$(patsubst %Imp.a,%.dll,$(notdir $@))"
215
216 $$(VBoxRemPrimary_0_OUTDIR)/VBoxVMMImp.def \
217 $$(VBoxRemPrimary_0_OUTDIR)/VBoxRTImp.def : \
218 $(PATH_STAGE_BIN)/$$(patsubst %Imp.def,%.dll,$$(notdir $$@)) \
219 | $$(dir $$@)
220 $(APPEND) -nt $@ "LIBRARY $(notdir $<)" "EXPORTS"
221 $(TOOL_$(VBOX_VCC_TOOL)_DUMPBIN) /EXPORTS "$<" \
222 | $(SED) -e '/ = /!d' \
223 -e 's/^.* \([^ ][^ ]*\) = .*$(DOLLAR)/ \"\1\"/' \
224 --append $@
225 endif # VBOX_USE_MINGWW64
226
227endif
228
229
230ifdef VBOX_REM_WRAPPER
231 #
232 # VBoxREM - Wrapper for loading VBoxREM2, VBoxREM32 or VBoxREM64.
233 #
234 DLLS += VBoxREMWrapper
235 VBoxREMWrapper_TEMPLATE = VBoxR3DllWarnNoPic
236 VBoxREMWrapper_NAME = VBoxREM
237 VBoxREMWrapper_DEFS = IN_REM_R3
238 if "$(KBUILD_TARGET_ARCH)" == "x86" && defined(VBOX_WITH_64_BITS_GUESTS)
239 VBoxREMWrapper_DEFS += VBOX_USE_BITNESS_SELECTOR
240 endif
241 ifdef VBOX_WITHOUT_REM_LDR_CYCLE
242 VBoxREMWrapper_DEFS += VBOX_WITHOUT_REM_LDR_CYCLE
243 endif
244 VBoxREMWrapper_SOURCES = \
245 VBoxREMWrapper.cpp
246 VBoxREMWrapper_SOURCES.win = VBoxREM.rc
247 if "$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)" == "win.amd64" && !defined(VBOX_USE_MINGWW64)
248 VBoxREMWrapper_SOURCES += \
249 VBoxREMWrapperA.asm
250 endif
251 VBoxREMWrapper_LIBS = \
252 $(LIB_RUNTIME)
253 ifndef VBOX_WITHOUT_REM_LDR_CYCLE
254 VBoxREMWrapper_LIBS += \
255 $(LIB_VMM)
256 VBoxREMWrapper_LIBS.darwin += \
257 $(TARGET_VBoxREMImp)
258 endif
259 VBoxREMWrapper_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxREM.dylib
260endif
261
262
263#
264# The VBoxREM import library.
265#
266# This is a HACK to get around (a) the cyclic dependency between VBoxVMM and
267# VBoxREM during linking and (b) the recursive build ordering which means VBoxREM
268# won't be built until after all the other DLLs.
269#
270IMPORT_LIBS += VBoxREMImp
271VBoxREMImp_TEMPLATE = VBoxR3Dll
272 ifn1of ($(KBUILD_TARGET), os2 win)
273VBoxREMImp_NAME = VBoxREM
274 endif
275VBoxREMImp_INST = $(INST_LIB)
276VBoxREMImp_SOURCES.win = $(VBoxREMImp_0_OUTDIR)/VBoxREMWin.def
277VBoxREMImp_CLEAN.win = $(VBoxREMImp_0_OUTDIR)/VBoxREMWin.def
278VBoxREMImp_SOURCES.os2 = $(VBoxREMImp_0_OUTDIR)/VBoxREMOS2.def
279VBoxREMImp_CLEAN.os2 = $(VBoxREMImp_0_OUTDIR)/VBoxREMOS2.def
280 ifn1of ($(KBUILD_TARGET), os2 win)
281VBoxREMImp_SOURCES = $(VBoxREMImp_0_OUTDIR)/VBoxREMImp.c
282VBoxREMImp_CLEAN = $(VBoxREMImp_0_OUTDIR)/VBoxREMImp.c
283 endif
284 ifn1of ($(KBUILD_TARGET), darwin os2 win)
285VBoxREMImp_SONAME = VBoxREM$(SUFF_DLL)
286 endif
287ifdef VBOX_WITHOUT_REM_LDR_CYCLE
288 VBoxREMImp_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxREM.dylib
289else
290 VBoxREMImp_LDFLAGS.darwin = -install_name $(subst @rpath,@executable_path,$(VBOX_DYLD_EXECUTABLE_PATH))/VBoxREM.dylib
291endif
292VBoxREMImp_LDFLAGS.l4 = -T$(L4_LIBDIR)/../main_rel.ld -nostdlib
293
294$$(VBoxREMImp_0_OUTDIR)/VBoxREMImp.c: $(VBOX_PATH_RECOMPILER_SRC)/VBoxREM.def $(VBOX_PATH_RECOMPILER_SRC)/Sun/deftoimp.sed $(MAKEFILE_CURRENT) | $$(dir $$@)
295 $(call MSG_GENERATE,,$@)
296 $(QUIET)$(APPEND) -t $@ '#ifdef VBOX_HAVE_VISIBILITY_HIDDEN'
297 $(QUIET)$(APPEND) $@ '# define EXPORT __attribute__((visibility("default")))'
298 $(QUIET)$(APPEND) $@ '#else'
299 $(QUIET)$(APPEND) $@ '# define EXPORT'
300 $(QUIET)$(APPEND) $@ '#endif'
301 $(QUIET)$(APPEND) $@ ''
302 $(QUIET)$(SED) -f $(VBOX_PATH_RECOMPILER_SRC)/Sun/deftoimp.sed --append $@ $<
303
304$$(VBoxREMImp_0_OUTDIR)/VBoxREMOS2.def: $(VBOX_PATH_RECOMPILER_SRC)/VBoxREM.def $(MAKEFILE_CURRENT) | $$(dir $$@)
305 $(SED) \
306 -e 's/^[ \t][ \t]*REMR3/ _REMR3/' \
307 -e 's/\.[Dd][Ll][Ll]//' \
308 -e 's/^LIBRARY .*/LIBRARY VBoxREM INITINSTANCE TERMINSTANCE\nDATA MULTIPLE\n/' \
309 --output $@ \
310 $<
311
312$$(VBoxREMImp_0_OUTDIR)/VBoxREMWin.def: $(VBOX_PATH_RECOMPILER_SRC)/VBoxREM.def $(MAKEFILE_CURRENT) | $$(dir $$@)
313 $(CP) -f $< $@
314
315$$(VBoxREMImp_0_OUTDIR)/VBoxREMRes.o: $(VBOX_PATH_RECOMPILER_SRC)/VBoxREM.rc $(MAKEFILE_CURRENT) $(VBOX_VERSION_MK) | $$(dir $$@)
316 $(call MSG_GENERATE,,$@)
317 $(QUIET)$(REDIRECT) -E 'COMSPEC=$(VBOX_GOOD_COMSPEC_BS)' \
318 -- $(TOOL_$(VBoxRemPrimary_TOOL.win.$(KBUILD_TARGET_ARCH))_PREFIX)windres \
319 $(addprefix -I,$(INCS) $(PATH_SDK_$(VBOX_WINPSDK)_INC) $(PATH_TOOL_$(VBOX_VCC_TOOL)_INC)) \
320 -DVBOX_SVN_REV=$(VBOX_SVN_REV) \
321 -DVBOX_SVN_REV_MOD_5K=$(expr $(VBOX_SVN_REV) % 50000) \
322 $< $@
323
324#
325# The math testcase as a standalone program for testing and debugging purposes.
326#
327## @todo This is a bit messy because of MINGW32.
328testmath_ASFLAGS.amd64 = -m amd64
329testmath_CFLAGS = -Wall -g
330testmath_CFLAGS.release = -O3
331testmath_LDFLAGS = -g
332testmath_DEFS = MATHTEST_STANDALONE
333testmath_SOURCES = Sun/testmath.c
334
335
336include $(FILE_KBUILD_SUB_FOOTER)
337
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette