VirtualBox

source: vbox/trunk/tools/kBuildTools/VBoxXGccArm64Elf.kmk@ 105445

Last change on this file since 105445 was 100474, checked in by vboxsync, 17 months ago

tools: Add gcc cross compile toolchains for baremetal arm and arm64 in order to build UEFI images for arm on linux.amd64, bugref:10400 [scm fix]

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 17.5 KB
Line 
1# $Id: VBoxXGccArm64Elf.kmk 100474 2023-07-10 15:58:55Z vboxsync $
2## @file
3# kBuild Tool Config - GCC v13.1.x, targeting baremetal ARM64 (for the UEFI firmware).
4#
5
6#
7# Copyright (C) 2023 Oracle and/or its affiliates.
8#
9# This file is part of VirtualBox base platform packages, as
10# available from https://www.virtualbox.org.
11#
12# This program is free software; you can redistribute it and/or
13# modify it under the terms of the GNU General Public License
14# as published by the Free Software Foundation, in version 3 of the
15# License.
16#
17# This program is distributed in the hope that it will be useful, but
18# WITHOUT ANY WARRANTY; without even the implied warranty of
19# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20# General Public License for more details.
21#
22# You should have received a copy of the GNU General Public License
23# along with this program; if not, see <https://www.gnu.org/licenses>.
24#
25# SPDX-License-Identifier: GPL-3.0-only
26#
27
28TOOL_VBoxXGccArm64Elf := Generic GCC v13.1.x or later using the tools GCC and Binutils, targeting ARM64.
29
30
31#
32# Tool Specific Properties
33#
34ifndef PATH_TOOL_VBoxXGccArm64Elf
35 PATH_TOOL_VBoxXGccArm64Elf := $(firstfile $(rversortfiles $(qwildcard ,$(KBUILD_DEVTOOLS_HST)/gcc-aarch64/v13.1*/bin)))
36 ifeq ($(PATH_TOOL_VBoxXGccArm64Elf),)
37 PATH_TOOL_VBoxXGccArm64Elf := $(PATH_TOOL_VBoxXGccArm64Elf)
38 endif
39 ifeq ($(PATH_TOOL_VBoxXGccArm64Elf),)
40 $(error kBuild: PATH_TOOL_VBoxXGccArm64Elf cannot be determined!)
41 endif
42else
43 # Resolve any fancy stuff once and for all.
44 PATH_TOOL_VBoxXGccArm64Elf := $(PATH_TOOL_VBoxXGccArm64Elf)
45endif
46
47
48# Tool Specific Properties
49ifndef TOOL_VBoxXGccArm64Elf_PREFIX
50 TOOL_VBoxXGccArm64Elf_PREFIX := aarch64-elf-
51endif
52ifndef TOOL_VBoxXGccArm64Elf_SUFFIX
53 TOOL_VBoxXGccArm64Elf_SUFFIX := $(HOSTSUFF_EXE)
54endif
55
56TOOL_VBoxXGccArm64Elf_CC ?= $(PATH_TOOL_VBoxXGccArm64Elf)/$(TOOL_VBoxXGccArm64Elf_PREFIX)gcc$(TOOL_VBoxXGccArm64Elf_SUFFIX)
57TOOL_VBoxXGccArm64Elf_CXX ?= $(PATH_TOOL_VBoxXGccArm64Elf)/$(TOOL_VBoxXGccArm64Elf_PREFIX)g++$(TOOL_VBoxXGccArm64Elf_SUFFIX)
58TOOL_VBoxXGccArm64Elf_PCH ?= $(TOOL_VBoxXGccArm64Elf_CXX)
59TOOL_VBoxXGccArm64Elf_AS ?= $(PATH_TOOL_VBoxXGccArm64Elf)/$(TOOL_VBoxXGccArm64Elf_PREFIX)gcc$(TOOL_VBoxXGccArm64Elf_SUFFIX)
60TOOL_VBoxXGccArm64Elf_AR ?= $(PATH_TOOL_VBoxXGccArm64Elf)/$(TOOL_VBoxXGccArm64Elf_PREFIX)ar$(TOOL_VBoxXGccArm64Elf_SUFFIX)
61TOOL_VBoxXGccArm64Elf_AR_IMP ?= $(ECHO) not supported!
62TOOL_VBoxXGccArm64Elf_LD ?= $(PATH_TOOL_VBoxXGccArm64Elf)/$(TOOL_VBoxXGccArm64Elf_PREFIX)g++$(TOOL_VBoxXGccArm64Elf_SUFFIX)
63TOOL_VBoxXGccArm64Elf_LD_SYSMOD ?= $(PATH_TOOL_VBoxXGccArm64Elf)/$(TOOL_VBoxXGccArm64Elf_PREFIX)ld$(TOOL_VBoxXGccArm64Elf_SUFFIX)
64ifndef TOOL_VBoxXGccArm64Elf_LDFLAGS.$(KBUILD_TARGET)
65 TOOL_VBoxXGccArm64Elf_LDFLAGS.dll ?= -shared
66else
67 TOOL_VBoxXGccArm64Elf_LDFLAGS.dll ?= $(TOOL_VBoxXGccArm64Elf_LDFLAGS.$(KBUILD_TARGET))
68endif
69TOOL_VBoxXGccArm64Elf_LDFLAGS.sysmod ?= -r
70TOOL_VBoxXGccArm64Elf_LD_SONAME ?= -Wl,-soname=$(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
71ifeq ($(KBUILD_TARGET),os2)
72 TOOL_VBoxXGccArm64Elf_LD_MAP ?= -Zmap=$(1)
73 TOOL_VBoxXGccArm64Elf_LD_SYSMOD_MAP ?= -Zmap=$(1)
74else
75 TOOL_VBoxXGccArm64Elf_LD_MAP ?=
76 TOOL_VBoxXGccArm64Elf_LD_SYSMOD_MAP ?=
77endif
78TOOL_VBoxXGccArm64Elf_OBJCOPY ?= $(PATH_TOOL_VBoxXGccArm64Elf)/$(TOOL_VBoxXGccArm64Elf_PREFIX)objcopy$(TOOL_VBoxXGccArm64Elf_SUFFIX)
79
80# General Properties used by kBuild
81TOOL_VBoxXGccArm64Elf_COBJSUFF ?= .o
82TOOL_VBoxXGccArm64Elf_CFLAGS ?=
83TOOL_VBoxXGccArm64Elf_CFLAGS.debug ?= -g
84TOOL_VBoxXGccArm64Elf_CFLAGS.profile ?= -O2 #-g -pg
85TOOL_VBoxXGccArm64Elf_CFLAGS.release ?= -O2
86TOOL_VBoxXGccArm64Elf_CINCS ?=
87TOOL_VBoxXGccArm64Elf_CDEFS ?=
88
89TOOL_VBoxXGccArm64Elf_CXXOBJSUFF ?= .o
90TOOL_VBoxXGccArm64Elf_CXXFLAGS ?=
91TOOL_VBoxXGccArm64Elf_CXXFLAGS.debug ?= -g
92TOOL_VBoxXGccArm64Elf_CXXFLAGS.profile ?= -O2 #-g -pg
93TOOL_VBoxXGccArm64Elf_CXXFLAGS.release ?= -O2
94TOOL_VBoxXGccArm64Elf_CXXINCS ?=
95TOOL_VBoxXGccArm64Elf_CXXDEFS ?=
96
97TOOL_VBoxXGccArm64Elf_PCHOBJSUFF ?= .h.gch
98TOOL_VBoxXGccArm64Elf_PCHFLAGS ?= $(TOOL_VBoxXGccArm64Elf_CXXFLAGS)
99TOOL_VBoxXGccArm64Elf_PCHFLAGS.debug ?= $(TOOL_VBoxXGccArm64Elf_CXXFLAGS.debug)
100TOOL_VBoxXGccArm64Elf_PCHFLAGS.profile ?= $(TOOL_VBoxXGccArm64Elf_CXXFLAGS.profile)
101TOOL_VBoxXGccArm64Elf_PCHFLAGS.release ?= $(TOOL_VBoxXGccArm64Elf_CXXFLAGS.release)
102TOOL_VBoxXGccArm64Elf_PCHINCS ?= $(TOOL_VBoxXGccArm64Elf_CXXINCS)
103TOOL_VBoxXGccArm64Elf_PCHDEFS ?= $(TOOL_VBoxXGccArm64Elf_CXXDEFS)
104
105TOOL_VBoxXGccArm64Elf_ASFLAGS ?= -x assembler-with-cpp
106TOOL_VBoxXGccArm64Elf_ASFLAGS.debug ?= -g
107TOOL_VBoxXGccArm64Elf_ASFLAGS.profile ?= -g
108TOOL_VBoxXGccArm64Elf_ASOBJSUFF ?= .o
109
110TOOL_VBoxXGccArm64Elf_ARFLAGS ?= cr
111TOOL_VBoxXGccArm64Elf_ARLIBSUFF ?= .a
112
113TOOL_VBoxXGccArm64Elf_LDFLAGS ?=
114TOOL_VBoxXGccArm64Elf_LDFLAGS.debug ?= -g
115TOOL_VBoxXGccArm64Elf_LDFLAGS.profile ?= -g
116
117
118## Compile C source.
119# @param $(target) Normalized main target name.
120# @param $(source) Source filename (relative).
121# @param $(obj) Object file name. This shall be (re)created by the compilation.
122# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
123# @param $(flags) Flags.
124# @param $(defs) Definitions. No -D or something.
125# @param $(incs) Includes. No -I or something.
126# @param $(dirdep) Directory creation dependency.
127# @param $(deps) Other dependencies.
128#
129# @param $(outbase) Output basename (full). Use this for list files and such.
130# @param $(objsuff) Object suffix.
131TOOL_VBoxXGccArm64Elf_COMPILE_C_DEPEND =
132TOOL_VBoxXGccArm64Elf_COMPILE_C_DEPORD =
133TOOL_VBoxXGccArm64Elf_COMPILE_C_OUTPUT = $(if-expr "$(use_objcache)" != "",$(outbase).i,)
134TOOL_VBoxXGccArm64Elf_COMPILE_C_USES_KOBJCACHE = $(if-expr "$(use_objcache)" != "",1,)
135define TOOL_VBoxXGccArm64Elf_COMPILE_C_CMDS
136 if "$(use_objcache)" != ""
137 $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
138 --kObjCache-cpp $(outbase).i\
139 $(TOOL_VBoxXGccArm64Elf_CC) -E -o -\
140 $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
141 -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
142 $(abspath $(source))\
143 --kObjCache-cc $(obj)\
144 $(TOOL_VBoxXGccArm64Elf_CC) -c\
145 $(flags) -fpreprocessed -x c\
146 -o $(obj)\
147 -
148 else
149 $(QUIET)$(TOOL_VBoxXGccArm64Elf_CC) -c\
150 $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
151 -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
152 -o $(obj)\
153 $(abspath $(source))
154 endif
155 $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
156endef
157
158
159## Compile C++ source.
160# @param $(target) Normalized main target name.
161# @param $(source) Source filename (relative).
162# @param $(obj) Object file name. This shall be (re)created by the compilation.
163# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
164# @param $(flags) Flags.
165# @param $(defs) Definitions. No -D or something.
166# @param $(incs) Includes. No -I or something.
167# @param $(dirdep) Directory creation dependency.
168# @param $(deps) Other dependencies.
169# @param $(outbase) Output basename (full). Use this for list files and such.
170# @param $(objsuff) Object suffix.
171TOOL_VBoxXGccArm64Elf_COMPILE_CXX_OUTPUT = $(if-expr "$(use_objcache)" != "",$(outbase).ii,)
172TOOL_VBoxXGccArm64Elf_COMPILE_CXX_DEPEND = $($(target)_1_GCC_PCH_FILE)
173TOOL_VBoxXGccArm64Elf_COMPILE_CXX_DEPORD =
174TOOL_VBoxXGccArm64Elf_COMPILE_CXX_USES_KOBJCACHE = $(if-expr "$(use_objcache)" != "",1,)
175define TOOL_VBoxXGccArm64Elf_COMPILE_CXX_CMDS
176 if "$(use_objcache)" != ""
177 $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
178 --kObjCache-cpp $(outbase).ii\
179 $(TOOL_VBoxXGccArm64Elf_CXX) -E -o - $(if-expr defined($(target)_PCH_HDR)\
180 ,-fpch-preprocess -Winvalid-pch -I$($(target)_1_GCC_PCH_DIR) -include $(basename $($(target)_1_GCC_PCH_FILE)),)\
181 $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
182 -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
183 $(abspath $(source))\
184 --kObjCache-cc $(obj)\
185 $(TOOL_VBoxXGccArm64Elf_CXX) -c\
186 $(flags) -fpreprocessed $(if-expr defined($(target)_PCH_HDR),-fpch-preprocess,) -x c++\
187 -o $(obj)\
188 -
189 else
190 $(QUIET)$(TOOL_VBoxXGccArm64Elf_CXX) -c\
191 $(flags) $(qaddprefix sh,-I, $($(target)_1_GCC_PCH_DIR) $(incs)) $(qaddprefix sh,-D, $(defs))\
192 -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
193 -o $(obj) $(if-expr defined($(target)_PCH_HDR) \
194 ,-Winvalid-pch -include $(basename $($(target)_1_GCC_PCH_FILE)),) \
195 $(abspath $(source))
196 endif
197 $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
198endef
199
200
201## Precompile C++ header.
202# @param $(target) Normalized main target name.
203# @param $(source) Source filename (relative).
204# @param $(obj) Object file name. This shall be (re)created by the compilation.
205# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
206# @param $(flags) Flags.
207# @param $(defs) Definitions. No -D or something.
208# @param $(incs) Includes. No -I or something.
209# @param $(dirdep) Directory creation dependency.
210# @param $(deps) Other dependencies.
211# @param $(outbase) Output basename (full). Use this for list files and such.
212# @param $(objsuff) Object suffix.
213TOOL_VBoxXGccArm64Elf_COMPILE_PCH_OUTPUT = $($(target)_1_GCC_PCH_FILE)
214TOOL_VBoxXGccArm64Elf_COMPILE_PCH_DEPEND =
215TOOL_VBoxXGccArm64Elf_COMPILE_PCH_DEPORD = $($(target)_1_GCC_PCH_DIR)
216define TOOL_VBoxXGccArm64Elf_COMPILE_PCH_CMDS
217 $(QUIET)$(TOOL_VBoxXGccArm64Elf_PCH) -c\
218 $(flags) $(qaddprefix sh,-I, $($(target)_1_GCC_PCH_DIR) $(incs)) $(qaddprefix sh,-D, $(defs))\
219 -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
220 -o $(obj)\
221 $(abspath $(source))
222 $(INSTALL) --hard-link-files-when-possible -m 0644 -- "$(obj)" "$($(target)_1_GCC_PCH_FILE)"
223 $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
224endef
225
226
227## Compile Assembly source.
228# @param $(target) Normalized main target name.
229# @param $(source) Source filename (relative).
230# @param $(obj) Object file name. This shall be (re)created by the compilation.
231# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
232# @param $(flags) Flags.
233# @param $(defs) Definitions. No -D or something.
234# @param $(incs) Includes. No -I or something.
235# @param $(dirdep) Directory creation dependency.
236# @param $(deps) Other dependencies.
237# @param $(outbase) Output basename (full). Use this for list files and such.
238# @param $(objsuff) Object suffix.
239#
240TOOL_VBoxXGccArm64Elf_COMPILE_AS_OUTPUT =
241TOOL_VBoxXGccArm64Elf_COMPILE_AS_DEPEND =
242TOOL_VBoxXGccArm64Elf_COMPILE_AS_DEPORD =
243define TOOL_VBoxXGccArm64Elf_COMPILE_AS_CMDS
244 $(QUIET)$(TOOL_VBoxXGccArm64Elf_AS) -c\
245 $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
246 -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
247 -o $(obj)\
248 $(abspath $(source))
249 $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
250endef
251
252
253## Link library
254# @param $(target) Normalized main target name.
255# @param $(out) Library name.
256# @param $(objs) Object files to put in the library.
257# @param $(flags) Flags.
258# @param $(dirdep) Directory creation dependency.
259# @param $(deps) Other dependencies.
260# @param $(othersrc) Unhandled sources.
261# @param $(outbase) Output basename (full). Use this for list files and such.
262TOOL_VBoxXGccArm64Elf_LINK_LIBRARY_OUTPUT = $(out).ar-script
263TOOL_VBoxXGccArm64Elf_LINK_LIBRARY_OUTPUT_MAYBE = $(outbase).imp.a
264TOOL_VBoxXGccArm64Elf_LINK_LIBRARY_DEPEND = $(othersrc)
265TOOL_VBoxXGccArm64Elf_LINK_LIBRARY_DEPORD =
266define TOOL_VBoxXGccArm64Elf_LINK_LIBRARY_CMDS
267 $(QUIET)$(APPEND) $(out).ar-script 'CREATE $(out)'
268 $(QUIET)$(APPEND) -n $(out).ar-script \
269 $(foreach o,$(filter-out %.h.gch,$(objs)), 'ADDMOD $(o)') \
270 $(foreach o,$(filter-out %.def %.imp %.dll,$(othersrc)), 'ADDLIB $(o)')
271 $(if $(filter %.def %.imp %.dll,$(othersrc))\
272 ,$(TOOL_VBoxXGccArm64Elf_AR_IMP) -o $(outbase).imp.a $(filter %.def %.imp %.dll,$(othersrc))\
273 $(NL)$(TAB)$(QUIET)$(APPEND) $(out).ar-script 'ADDLIB $(outbase).imp.a')
274 $(QUIET)$(APPEND) $(out).ar-script 'SAVE'
275 $(QUIET)$(APPEND) $(out).ar-script 'END'
276 $(QUIET)$(REDIRECT) -rti $(out).ar-script -- $(TOOL_VBoxXGccArm64Elf_AR) -M
277endef
278
279
280## Link program
281# @param $(target) Normalized main target name.
282# @param $(out) Program name.
283# @param $(objs) Object files to link together.
284# @param $(libs) Libraries to search.
285# @param $(libpath) Library search paths.
286# @param $(flags) Flags.
287# @param $(dirdep) Directory creation dependency.
288# @param $(deps) Other dependencies.
289# @param $(othersrc) Unhandled sources.
290# @param $(custom_pre) Custom step invoked before linking.
291# @param $(custom_post) Custom step invoked after linking.
292# @param $(outbase) Output basename (full). Use this for list files and such.
293TOOL_VBoxXGccArm64Elf_LINK_PROGRAM_OUTPUT =
294TOOL_VBoxXGccArm64Elf_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).map
295TOOL_VBoxXGccArm64Elf_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).debug
296TOOL_VBoxXGccArm64Elf_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).debug=>$(basename $(3)).debug
297TOOL_VBoxXGccArm64Elf_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) \
298 $(filter %.def, $(othersrc))
299TOOL_VBoxXGccArm64Elf_LINK_PROGRAM_DEPORD =
300define TOOL_VBoxXGccArm64Elf_LINK_PROGRAM_CMDS
301 $(QUIET)$(TOOL_VBoxXGccArm64Elf_LD) $(flags) -o $(out) $(filter-out %.h.gch,$(objs))\
302 $(filter %.def, $(othersrc))\
303 $(foreach p,$(libpath), -L$(p))\
304 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib))) \
305 $(call TOOL_VBoxXGccArm64Elf_LD_MAP,$(outbase).map)
306 ifeq ($(ld_debug),split)
307 $(QUIET)$(TOOL_VBoxXGccArm64Elf_OBJCOPY) --only-keep-debug $(out) $(outbase).debug
308 $(QUIET)$(CHMOD) a-x $(outbase).debug
309 $(QUIET)$(TOOL_VBoxXGccArm64Elf_OBJCOPY) --strip-debug --strip-unneeded --add-gnu-debuglink=$(outbase).debug $(out)
310 endif
311endef
312
313
314## Link DLL
315# @param $(target) Normalized main target name.
316# @param $(out) Program name.
317# @param $(objs) Object files to link together.
318# @param $(libs) Libraries to search.
319# @param $(libpath) Library search paths.
320# @param $(flags) Flags.
321# @param $(dirdep) Directory creation dependency.
322# @param $(deps) Other dependencies.
323# @param $(othersrc) Unhandled sources.
324# @param $(custom_pre) Custom step invoked before linking.
325# @param $(custom_post) Custom step invoked after linking.
326# @param $(outbase) Output basename (full). Use this for list files and such.
327TOOL_VBoxXGccArm64Elf_LINK_DLL_OUTPUT =
328TOOL_VBoxXGccArm64Elf_LINK_DLL_OUTPUT_MAYBE = $(outbase).map
329TOOL_VBoxXGccArm64Elf_LINK_DLL_OUTPUT_DEBUG = $(outbase).debug
330TOOL_VBoxXGccArm64Elf_LINK_DLL_DEBUG_INSTALL_FN = $(2).debug=>$(basename $(3)).debug
331TOOL_VBoxXGccArm64Elf_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) \
332 $(filter %.def, $(othersrc))
333TOOL_VBoxXGccArm64Elf_LINK_DLL_DEPORD =
334define TOOL_VBoxXGccArm64Elf_LINK_DLL_CMDS
335 $(QUIET)$(TOOL_VBoxXGccArm64Elf_LD) $(TOOL_VBoxXGccArm64Elf_LDFLAGS.dll) $(flags) -o $(out)\
336 $(if $(filter-out win os2, $(KBUILD_TARGET)),$(call TOOL_VBoxXGccArm64Elf_LD_SONAME,$(target),$(out)))\
337 $(filter-out %.h.gch,$(objs))\
338 $(filter %.def, $(othersrc))\
339 $(foreach p,$(libpath), -L$(p))\
340 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib))) \
341 $(call TOOL_VBoxXGccArm64Elf_LD_MAP,$(outbase).map)
342 ifeq ($(ld_debug),split)
343 $(QUIET)$(TOOL_VBoxXGccArm64Elf_OBJCOPY) --only-keep-debug $(out) $(outbase).debug
344 $(QUIET)$(CHMOD) a-x $(outbase).debug
345 $(QUIET)$(TOOL_VBoxXGccArm64Elf_OBJCOPY) --strip-debug --strip-unneeded --add-gnu-debuglink=$(outbase).debug $(out)
346 endif
347endef
348
349
350## Link system module (windows aka driver, linux aka kernel module)
351# @param $(target) Normalized main target name.
352# @param $(out) System module name.
353# @param $(objs) Object files to link together.
354# @param $(libs) Libraries to search.
355# @param $(libpath) Library search paths.
356# @param $(flags) Flags.
357# @param $(dirdep) Directory creation dependency.
358# @param $(deps) Other dependencies.
359# @param $(othersrc) Unhandled sources.
360# @param $(custom_pre) Custom step invoked before linking.
361# @param $(custom_post) Custom step invoked after linking.
362# @param $(outbase) Output basename (full). Use this for list files and such.
363TOOL_VBoxXGccArm64Elf_LINK_SYSMOD_OUTPUT =
364TOOL_VBoxXGccArm64Elf_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).map
365TOOL_VBoxXGccArm64Elf_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).debug
366TOOL_VBoxXGccArm64Elf_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).debug=>$(basename $(3)).debug
367TOOL_VBoxXGccArm64Elf_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) \
368 $(filter %.def, $(othersrc))
369TOOL_VBoxXGccArm64Elf_LINK_SYSMOD_DEPORD =
370define TOOL_VBoxXGccArm64Elf_LINK_SYSMOD_CMDS
371 $(QUIET)$(TOOL_VBoxXGccArm64Elf_LD_SYSMOD) $(TOOL_VBoxXGccArm64Elf_LDFLAGS.sysmod) $(flags) -o $(out) $(filter-out %.h.gch,$(objs)) \
372 $(filter %.def, $(othersrc))\
373 $(foreach p,$(libpath), -L$(p))\
374 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\
375 $(call TOOL_VBoxXGccArm64Elf_LD_SYSMOD_MAP,$(outbase).map)
376 ifeq ($(ld_debug),split)
377 $(QUIET)$(TOOL_VBoxXGccArm64Elf_OBJCOPY) --only-keep-debug $(out) $(outbase).debug
378 $(QUIET)$(CHMOD) a-x $(outbase).debug
379 $(QUIET)$(TOOL_VBoxXGccArm64Elf_OBJCOPY) --strip-debug --strip-unneeded --add-gnu-debuglink=$(outbase).debug $(out)
380 endif
381endef
382
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