VirtualBox

source: vbox/trunk/tools/kBuildTools/VBoxXGccArmNoneEabi.kmk

Last change on this file was 100474, checked in by vboxsync, 11 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: 18.0 KB
Line 
1# $Id: VBoxXGccArmNoneEabi.kmk 100474 2023-07-10 15:58:55Z vboxsync $
2## @file
3# kBuild Tool Config - GCC v13.1.x, targeting baremetal ARM (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_VBoxXGccArmNoneEabi := Generic GCC v13.1.x or later using the tools GCC and Binutils, targeting ARM.
29
30
31#
32# Tool Specific Properties
33#
34ifndef PATH_TOOL_VBoxXGccArmNoneEabi
35 PATH_TOOL_VBoxXGccArmNoneEabi := $(firstfile $(rversortfiles $(qwildcard ,$(KBUILD_DEVTOOLS_HST)/gcc-arm-none-eabi/v13.1*/bin)))
36 ifeq ($(PATH_TOOL_VBoxXGccArmNoneEabi),)
37 PATH_TOOL_VBoxXGccArmNoneEabi := $(PATH_TOOL_VBoxXGccArmNoneEabi)
38 endif
39 ifeq ($(PATH_TOOL_VBoxXGccArmNoneEabi),)
40 $(error kBuild: PATH_TOOL_VBoxXGccArmNoneEabi cannot be determined!)
41 endif
42else
43 # Resolve any fancy stuff once and for all.
44 PATH_TOOL_VBoxXGccArmNoneEabi := $(PATH_TOOL_VBoxXGccArmNoneEabi)
45endif
46
47
48# Tool Specific Properties
49ifndef TOOL_VBoxXGccArmNoneEabi_PREFIX
50 TOOL_VBoxXGccArmNoneEabi_PREFIX := arm-none-eabi-
51endif
52ifndef TOOL_VBoxXGccArmNoneEabi_SUFFIX
53 TOOL_VBoxXGccArmNoneEabi_SUFFIX := $(HOSTSUFF_EXE)
54endif
55
56TOOL_VBoxXGccArmNoneEabi_CC ?= $(PATH_TOOL_VBoxXGccArmNoneEabi)/$(TOOL_VBoxXGccArmNoneEabi_PREFIX)gcc$(TOOL_VBoxXGccArmNoneEabi_SUFFIX)
57TOOL_VBoxXGccArmNoneEabi_CXX ?= $(PATH_TOOL_VBoxXGccArmNoneEabi)/$(TOOL_VBoxXGccArmNoneEabi_PREFIX)g++$(TOOL_VBoxXGccArmNoneEabi_SUFFIX)
58TOOL_VBoxXGccArmNoneEabi_PCH ?= $(TOOL_VBoxXGccArmNoneEabi_CXX)
59TOOL_VBoxXGccArmNoneEabi_AS ?= $(PATH_TOOL_VBoxXGccArmNoneEabi)/$(TOOL_VBoxXGccArmNoneEabi_PREFIX)gcc$(TOOL_VBoxXGccArmNoneEabi_SUFFIX)
60TOOL_VBoxXGccArmNoneEabi_AR ?= $(PATH_TOOL_VBoxXGccArmNoneEabi)/$(TOOL_VBoxXGccArmNoneEabi_PREFIX)ar$(TOOL_VBoxXGccArmNoneEabi_SUFFIX)
61TOOL_VBoxXGccArmNoneEabi_AR_IMP ?= $(ECHO) not supported!
62TOOL_VBoxXGccArmNoneEabi_LD ?= $(PATH_TOOL_VBoxXGccArmNoneEabi)/$(TOOL_VBoxXGccArmNoneEabi_PREFIX)g++$(TOOL_VBoxXGccArmNoneEabi_SUFFIX)
63TOOL_VBoxXGccArmNoneEabi_LD_SYSMOD ?= $(PATH_TOOL_VBoxXGccArmNoneEabi)/$(TOOL_VBoxXGccArmNoneEabi_PREFIX)ld$(TOOL_VBoxXGccArmNoneEabi_SUFFIX)
64ifndef TOOL_VBoxXGccArmNoneEabi_LDFLAGS.$(KBUILD_TARGET)
65 TOOL_VBoxXGccArmNoneEabi_LDFLAGS.dll ?= -shared
66else
67 TOOL_VBoxXGccArmNoneEabi_LDFLAGS.dll ?= $(TOOL_VBoxXGccArmNoneEabi_LDFLAGS.$(KBUILD_TARGET))
68endif
69TOOL_VBoxXGccArmNoneEabi_LDFLAGS.sysmod ?= -r
70TOOL_VBoxXGccArmNoneEabi_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_VBoxXGccArmNoneEabi_LD_MAP ?= -Zmap=$(1)
73 TOOL_VBoxXGccArmNoneEabi_LD_SYSMOD_MAP ?= -Zmap=$(1)
74else
75 TOOL_VBoxXGccArmNoneEabi_LD_MAP ?=
76 TOOL_VBoxXGccArmNoneEabi_LD_SYSMOD_MAP ?=
77endif
78TOOL_VBoxXGccArmNoneEabi_OBJCOPY ?= $(PATH_TOOL_VBoxXGccArmNoneEabi)/$(TOOL_VBoxXGccArmNoneEabi_PREFIX)objcopy$(TOOL_VBoxXGccArmNoneEabi_SUFFIX)
79
80# General Properties used by kBuild
81TOOL_VBoxXGccArmNoneEabi_COBJSUFF ?= .o
82TOOL_VBoxXGccArmNoneEabi_CFLAGS ?=
83TOOL_VBoxXGccArmNoneEabi_CFLAGS.debug ?= -g
84TOOL_VBoxXGccArmNoneEabi_CFLAGS.profile ?= -O2 #-g -pg
85TOOL_VBoxXGccArmNoneEabi_CFLAGS.release ?= -O2
86TOOL_VBoxXGccArmNoneEabi_CINCS ?=
87TOOL_VBoxXGccArmNoneEabi_CDEFS ?=
88
89TOOL_VBoxXGccArmNoneEabi_CXXOBJSUFF ?= .o
90TOOL_VBoxXGccArmNoneEabi_CXXFLAGS ?=
91TOOL_VBoxXGccArmNoneEabi_CXXFLAGS.debug ?= -g
92TOOL_VBoxXGccArmNoneEabi_CXXFLAGS.profile ?= -O2 #-g -pg
93TOOL_VBoxXGccArmNoneEabi_CXXFLAGS.release ?= -O2
94TOOL_VBoxXGccArmNoneEabi_CXXINCS ?=
95TOOL_VBoxXGccArmNoneEabi_CXXDEFS ?=
96
97TOOL_VBoxXGccArmNoneEabi_PCHOBJSUFF ?= .h.gch
98TOOL_VBoxXGccArmNoneEabi_PCHFLAGS ?= $(TOOL_VBoxXGccArmNoneEabi_CXXFLAGS)
99TOOL_VBoxXGccArmNoneEabi_PCHFLAGS.debug ?= $(TOOL_VBoxXGccArmNoneEabi_CXXFLAGS.debug)
100TOOL_VBoxXGccArmNoneEabi_PCHFLAGS.profile ?= $(TOOL_VBoxXGccArmNoneEabi_CXXFLAGS.profile)
101TOOL_VBoxXGccArmNoneEabi_PCHFLAGS.release ?= $(TOOL_VBoxXGccArmNoneEabi_CXXFLAGS.release)
102TOOL_VBoxXGccArmNoneEabi_PCHINCS ?= $(TOOL_VBoxXGccArmNoneEabi_CXXINCS)
103TOOL_VBoxXGccArmNoneEabi_PCHDEFS ?= $(TOOL_VBoxXGccArmNoneEabi_CXXDEFS)
104
105TOOL_VBoxXGccArmNoneEabi_ASFLAGS ?= -x assembler-with-cpp
106TOOL_VBoxXGccArmNoneEabi_ASFLAGS.debug ?= -g
107TOOL_VBoxXGccArmNoneEabi_ASFLAGS.profile ?= -g
108TOOL_VBoxXGccArmNoneEabi_ASOBJSUFF ?= .o
109
110TOOL_VBoxXGccArmNoneEabi_ARFLAGS ?= cr
111TOOL_VBoxXGccArmNoneEabi_ARLIBSUFF ?= .a
112
113TOOL_VBoxXGccArmNoneEabi_LDFLAGS ?=
114TOOL_VBoxXGccArmNoneEabi_LDFLAGS.debug ?= -g
115TOOL_VBoxXGccArmNoneEabi_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_VBoxXGccArmNoneEabi_COMPILE_C_DEPEND =
132TOOL_VBoxXGccArmNoneEabi_COMPILE_C_DEPORD =
133TOOL_VBoxXGccArmNoneEabi_COMPILE_C_OUTPUT = $(if-expr "$(use_objcache)" != "",$(outbase).i,)
134TOOL_VBoxXGccArmNoneEabi_COMPILE_C_USES_KOBJCACHE = $(if-expr "$(use_objcache)" != "",1,)
135define TOOL_VBoxXGccArmNoneEabi_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_VBoxXGccArmNoneEabi_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_VBoxXGccArmNoneEabi_CC) -c\
145 $(flags) -fpreprocessed -x c\
146 -o $(obj)\
147 -
148 else
149 $(QUIET)$(TOOL_VBoxXGccArmNoneEabi_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_VBoxXGccArmNoneEabi_COMPILE_CXX_OUTPUT = $(if-expr "$(use_objcache)" != "",$(outbase).ii,)
172TOOL_VBoxXGccArmNoneEabi_COMPILE_CXX_DEPEND = $($(target)_1_GCC_PCH_FILE)
173TOOL_VBoxXGccArmNoneEabi_COMPILE_CXX_DEPORD =
174TOOL_VBoxXGccArmNoneEabi_COMPILE_CXX_USES_KOBJCACHE = $(if-expr "$(use_objcache)" != "",1,)
175define TOOL_VBoxXGccArmNoneEabi_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_VBoxXGccArmNoneEabi_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_VBoxXGccArmNoneEabi_CXX) -c\
186 $(flags) -fpreprocessed $(if-expr defined($(target)_PCH_HDR),-fpch-preprocess,) -x c++\
187 -o $(obj)\
188 -
189 else
190 $(QUIET)$(TOOL_VBoxXGccArmNoneEabi_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_VBoxXGccArmNoneEabi_COMPILE_PCH_OUTPUT = $($(target)_1_GCC_PCH_FILE)
214TOOL_VBoxXGccArmNoneEabi_COMPILE_PCH_DEPEND =
215TOOL_VBoxXGccArmNoneEabi_COMPILE_PCH_DEPORD = $($(target)_1_GCC_PCH_DIR)
216define TOOL_VBoxXGccArmNoneEabi_COMPILE_PCH_CMDS
217 $(QUIET)$(TOOL_VBoxXGccArmNoneEabi_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_VBoxXGccArmNoneEabi_COMPILE_AS_OUTPUT =
241TOOL_VBoxXGccArmNoneEabi_COMPILE_AS_DEPEND =
242TOOL_VBoxXGccArmNoneEabi_COMPILE_AS_DEPORD =
243define TOOL_VBoxXGccArmNoneEabi_COMPILE_AS_CMDS
244 $(QUIET)$(TOOL_VBoxXGccArmNoneEabi_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_VBoxXGccArmNoneEabi_LINK_LIBRARY_OUTPUT = $(out).ar-script
263TOOL_VBoxXGccArmNoneEabi_LINK_LIBRARY_OUTPUT_MAYBE = $(outbase).imp.a
264TOOL_VBoxXGccArmNoneEabi_LINK_LIBRARY_DEPEND = $(othersrc)
265TOOL_VBoxXGccArmNoneEabi_LINK_LIBRARY_DEPORD =
266define TOOL_VBoxXGccArmNoneEabi_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_VBoxXGccArmNoneEabi_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_VBoxXGccArmNoneEabi_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_VBoxXGccArmNoneEabi_LINK_PROGRAM_OUTPUT =
294TOOL_VBoxXGccArmNoneEabi_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).map
295TOOL_VBoxXGccArmNoneEabi_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).debug
296TOOL_VBoxXGccArmNoneEabi_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).debug=>$(basename $(3)).debug
297TOOL_VBoxXGccArmNoneEabi_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) \
298 $(filter %.def, $(othersrc))
299TOOL_VBoxXGccArmNoneEabi_LINK_PROGRAM_DEPORD =
300define TOOL_VBoxXGccArmNoneEabi_LINK_PROGRAM_CMDS
301 $(QUIET)$(TOOL_VBoxXGccArmNoneEabi_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_VBoxXGccArmNoneEabi_LD_MAP,$(outbase).map)
306 ifeq ($(ld_debug),split)
307 $(QUIET)$(TOOL_VBoxXGccArmNoneEabi_OBJCOPY) --only-keep-debug $(out) $(outbase).debug
308 $(QUIET)$(CHMOD) a-x $(outbase).debug
309 $(QUIET)$(TOOL_VBoxXGccArmNoneEabi_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_VBoxXGccArmNoneEabi_LINK_DLL_OUTPUT =
328TOOL_VBoxXGccArmNoneEabi_LINK_DLL_OUTPUT_MAYBE = $(outbase).map
329TOOL_VBoxXGccArmNoneEabi_LINK_DLL_OUTPUT_DEBUG = $(outbase).debug
330TOOL_VBoxXGccArmNoneEabi_LINK_DLL_DEBUG_INSTALL_FN = $(2).debug=>$(basename $(3)).debug
331TOOL_VBoxXGccArmNoneEabi_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) \
332 $(filter %.def, $(othersrc))
333TOOL_VBoxXGccArmNoneEabi_LINK_DLL_DEPORD =
334define TOOL_VBoxXGccArmNoneEabi_LINK_DLL_CMDS
335 $(QUIET)$(TOOL_VBoxXGccArmNoneEabi_LD) $(TOOL_VBoxXGccArmNoneEabi_LDFLAGS.dll) $(flags) -o $(out)\
336 $(if $(filter-out win os2, $(KBUILD_TARGET)),$(call TOOL_VBoxXGccArmNoneEabi_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_VBoxXGccArmNoneEabi_LD_MAP,$(outbase).map)
342 ifeq ($(ld_debug),split)
343 $(QUIET)$(TOOL_VBoxXGccArmNoneEabi_OBJCOPY) --only-keep-debug $(out) $(outbase).debug
344 $(QUIET)$(CHMOD) a-x $(outbase).debug
345 $(QUIET)$(TOOL_VBoxXGccArmNoneEabi_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_VBoxXGccArmNoneEabi_LINK_SYSMOD_OUTPUT =
364TOOL_VBoxXGccArmNoneEabi_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).map
365TOOL_VBoxXGccArmNoneEabi_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).debug
366TOOL_VBoxXGccArmNoneEabi_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).debug=>$(basename $(3)).debug
367TOOL_VBoxXGccArmNoneEabi_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) \
368 $(filter %.def, $(othersrc))
369TOOL_VBoxXGccArmNoneEabi_LINK_SYSMOD_DEPORD =
370define TOOL_VBoxXGccArmNoneEabi_LINK_SYSMOD_CMDS
371 $(QUIET)$(TOOL_VBoxXGccArmNoneEabi_LD_SYSMOD) $(TOOL_VBoxXGccArmNoneEabi_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_VBoxXGccArmNoneEabi_LD_SYSMOD_MAP,$(outbase).map)
376 ifeq ($(ld_debug),split)
377 $(QUIET)$(TOOL_VBoxXGccArmNoneEabi_OBJCOPY) --only-keep-debug $(out) $(outbase).debug
378 $(QUIET)$(CHMOD) a-x $(outbase).debug
379 $(QUIET)$(TOOL_VBoxXGccArmNoneEabi_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.

© 2023 Oracle
ContactPrivacy policyTerms of Use