]> rtime.felk.cvut.cz Git - omk.git/blob - snippets/nuttx-compile.omk
NuttX: update rules for 12.0.0 release yet attempt to support old versions.
[omk.git] / snippets / nuttx-compile.omk
1
2 # Rules for NuttX binaries compilation of C, C++ and assembler
3 # sources using GNU toolchain.
4
5 # Interface to other rules:
6 # kernel_HEADERS   .. list of the kernel-space public header files
7 # kernel_MODULES   .. list of the kernel side modules/applications
8
9 # Input variables:
10 # NUTTX_EXPORT - export directory of NuttX build
11 #                it should contain subdirectories:
12 #                arch  build  include  libs  registry  startup)
13 # LIB_DIR - directory where compiled libraries are stored
14 # OBJS_DIR - directory where intermediate files (.o, .map, ...) are stored
15 # INCLUDE_DIR - where includes can be found
16 # from config.omk or Makefile.omk
17 # CROSS_COMPILE - target architecture tools prefix
18 # TARGET_ARCH, DEBUG, OPTIMIZE, DEFS - forms CFLAGS
19 # from base: SOURCES_DIR
20 # from Makefile.omk: lib_LOADLIBES
21 # xxx_PROGBUILTIN - list of builtin programs linked into final system image
22 #                   when "all" is used then all programs provided by build are linked
23 # xxx_PROGBUILTIN_EXCLUDE - list of builtin user or NuttX provided programs which are excluded
24 # xxx_KMODBUILTIN - list of builtin programs linked into final system image
25
26 # Output variables:
27 # SOURCES - all the source files that needs to be compiled (except for shared library sources)
28 # SOLIB_SOURCES - all the source files that needs to be compiled for a shared library
29 # OBJ_EXT - extension of object files
30 # LIB_EXT - extension of library files
31 # LIB_PREF - prefix for library files
32 # ASM_EXT - extension of assembler sources
33
34 # Templates:
35 # COMPILER_DEFS_template - definitions that should be defined before
36 # the following templates can be used. The input variables needs to be
37 # defined before evaluating this template
38
39 # COMPILE_c_o_template, COMPILE_cc_o_template, COMPILE_S_o_template -
40 # templates that create rules for compilation of sources
41
42 # PROGRAM_template, LIBRARY_template, SOLIB_template - templates that
43 # create rules for compilation of a program, library and shared
44 # library. The rules can use rules produced by COMPILE_xxx_template.
45
46 EMPTY :=
47 LD_OPTION_SEP = $(EMPTY) $(EMPTY)
48
49 define COMPILER_DEFS_template
50 OBJ_EXT ?= $$(OBJEXT)
51 ifeq ($$(OBJ_EXT),)
52 OBJ_EXT = .o
53 endif
54 LIB_EXT ?= $$(LIBEXT)
55 ifeq ($$(LIB_EXT),)
56 LIB_EXT = .a
57 endif
58
59 LIB_PREF = lib
60 ASM_EXT = .S
61
62 CC ?= $$(CROSS_COMPILE)gcc
63 CXX ?= $$(CROSS_COMPILE)g++
64 LD ?= $$(CROSS_COMPILE)ld
65 ifneq ($$(filter -Wl%, $$(NXFLATLDFLAGS1)$$(NXFLATLDFLAGS2)$$(LDFLAGS)),)
66 CC_LD_OPTION = -Wl,
67 LD_OPTION_SEP := ,
68 LD_BY_CC := 1
69 LD_RAW ?= $$(CROSS_COMPILE)ld
70 endif
71 LD_RAW ?= $$(LD)
72 AR ?= $$(CROSS_COMPILE)ar
73 OBJCOPY ?= $$(CROSS_COMPILE)objcopy
74 NM ?= $$(CROSS_COMPILE)nm
75
76 ifeq ($$(LDSTARTGROUP),)
77 LDSTARTGROUP = $$(CC_LD_OPTION)--start-group
78 LDENDGROUP = $$(CC_LD_OPTION)--end-group
79 endif
80
81 NUTTXLIBES += $$(LDSTARTGROUP) $$(LDLIBS) $$(EXTRA_LIBS) $$(LDENDGROUP)
82 NUTTXREGISTRY += $$(NUTTX_EXPORT)/registry
83
84 TARGET_ARCH += $$(ARCHCFLAGS) $$(ARCHCPUFLAGS)
85
86 OPTIMIZE ?= $$(ARCHOPTIMIZATION)
87
88 CFLAGS += $$(ARCHWARNINGS)
89 CXXFLAGS += $$(ARCHCXXFLAGS)
90 CXXFLAGS += $$(ARCHWARNINGSXX)
91 DEFAULT_INCLUDES = -isystem $$(NUTTX_EXPORT)/include
92 INCLUDES +=
93
94 CFLAGS += $$(TARGET_ARCH) $$(DEBUG) $$(OPTIMIZE)
95 CFLAGS  += -Wall
96 CFLAGS += -I$$(SOURCES_DIR)
97 CFLAGS += -I$$(INCLUDE_DIR)
98
99 LDFLAGS := $$(filter-out -Map=%, $$(LDFLAGS))
100 LDFLAGS  += -L"$(NUTTX_EXPORT)/libs"
101
102 ifeq ($(word 2,$(AR)),)
103 ARFLAGS = rcs
104 else
105 ARFLAGS =
106 endif
107
108 ifeq ($$(LDNAME),)
109 LDNAME := $$(LDSCRIPT)
110 endif
111
112 LD_SCRIPT ?= $$(NUTTX_EXPORT)/scripts/$$(LDNAME)
113
114 ifneq ($$(filter-out clean distclean, $$(MAKECMDGOALS)),)
115 ifeq ($(LDNAME),)
116 $$(error no LDNAME or LDSCRIPT is defined)
117 endif
118
119 ifeq ($$(wildcard $$(LD_SCRIPT)),)
120 $$(error LD_SCRIPT='$$(LD_SCRIPT)' does not exists, correct config.target)
121 endif
122 endif
123
124 LD_SCRIPT = $$(NUTTX_EXPORT)/scripts/$$(LDNAME)
125
126 ELF_FILE_LDSCRIPT?=$$(wildcard $$(NUTTX_EXPORT)/scripts/gnu-elf.ld)
127
128 LOADLIBES += -L$$(LIB_DIR)
129 LOADLIBES += $$(lib_LOADLIBES:%=-l%)
130
131 -include $$(OBJS_DIR)/*.d
132
133 SOURCES2OBJS = $$(OBJ_EXT)/.c $$(OBJ_EXT)/.cc $$(OBJ_EXT)/.cxx $$(OBJ_EXT)/.S $$(OBJ_EXT)/.s $$(OBJ_EXT)/$$(OBJ_EXT)
134
135 SOURCES2OBJSLO = .lo/.c .lo/.cc .lo/.cxx .lo/.S .lo/.s .lo/.lo
136
137 #%.lo: %.c
138 #       $(CC) -o $@ $(LCFLAGS) -c $<
139
140 c_o_COMPILE = $$(CC) $$(DEFS) $$(DEFAULT_INCLUDES) $$(INCLUDES) $$(OMK_CPPFLAGS) \
141         $$(CPPFLAGS) $$(OMK_CFLAGS) $$(CFLAGS)
142
143 cc_o_COMPILE = $$(CXX) $$(DEFS) $$(DEFAULT_INCLUDES) $$(INCLUDES) $$(OMK_CPPFLAGS) \
144         $$(CPPFLAGS) $$(CXXFLAGS) $$(OMK_CFLAGS) $$(CFLAGS)
145
146 S_o_COMPILE = $$(CC) $(DEFS) $(DEFAULT_INCLUDES) $$(INCLUDES) \
147         $$(CPPFLAGS) $$(OMK_CFLAGS) $$(CFLAGS) $$(ASFLAGS)
148
149
150 # Check GCC version for user build
151 ifndef CC_MAJOR_VERSION
152 CC_MAJOR_VERSION = $$(shell $$(CC) -dumpversion | $(SED4OMK) -e 's/\([^.]\)\..*/\1/')
153 endif
154 # Prepare suitable define for dependency building
155 ifeq ($$(CC_MAJOR_VERSION),2)
156 CC_DEPFLAGS = -Wp,-MD,"$$@.d.tmp"
157 else
158 CC_DEPFLAGS = -MT $$@ -MD -MP -MF "$$@.d.tmp"
159 endif
160
161 endef # COMPILER_DEFS_template
162
163
164 # Syntax: $(call COMPILE_c_o_template,<source>,<target>,<additional c-flags>)
165 define COMPILE_c_o_template
166 $(2): $(1) $$(GEN_HEADERS)
167         @$(QUIET_CMD_ECHO) "  CC      $$@"
168         $(Q) if $$(c_o_COMPILE) $$(CC_DEPFLAGS) $(3) -o $$@ -c $$< ; \
169         then mv -f "$$@.d.tmp" "$$@.d" ; \
170         else rm -f "$$@.d.tmp" ; exit 1; \
171         fi
172 endef
173
174
175 # Syntax: $(call COMPILE_cc_o_template,<source>,<target>,<additional c-flags>)
176 define COMPILE_cc_o_template
177 $(2): $(1) $$(GEN_HEADERS)
178         @$(QUIET_CMD_ECHO) "  CXX     $$@"
179         $(Q) if $$(cc_o_COMPILE) $$(CC_DEPFLAGS) $(3) -o $$@ -c $$< ; \
180         then mv -f "$$@.d.tmp" "$$@.d" ; \
181         else rm -f "$$@.d.tmp" ; exit 1; \
182         fi
183 endef
184
185 # Syntax: $(call COMPILE_S_o_template,<source>,<target>,<additional c-flags>)
186 define COMPILE_S_o_template
187 $(2): $(1) $$(GEN_HEADERS)
188         @$(QUIET_CMD_ECHO) "  AS      $$@"
189         $(Q) if $$(S_o_COMPILE) -D__ASSEMBLY__ $$(CC_DEPFLAGS) $(3) -o $$@ -c $$< ; \
190         then if [ -e "$$@.d.tmp" ] ; then mv -f "$$@.d.tmp" "$$@.d" ; fi ; \
191         else rm -f "$$@.d.tmp" ; exit 1; \
192         fi
193 endef
194
195 # Syntax: $(call PROGRAM_template,<executable-name>,<dir>,<link-variant>)
196 define PROGRAM_template
197
198 GEN_SOURCES += $$($(1)_GEN_SOURCES)
199
200 $(foreach x, $(SOURCES2OBJS),
201 $(1)_OBJS += $$(patsubst %$(notdir $(x)),%$(dir $(x)),$$(filter %$(notdir $(x)),\
202                 $$($(1)_SOURCES) $$($(1)_GEN_SOURCES)))
203 )
204 $(1)_OBJS += $$($(1)_EMBEDROMFS:%=%_img$$(OBJ_EXT))
205 $(1)_OBJS := $$(sort $$($(1)_OBJS:%/=%))
206
207 SOURCES += $$($(1)_SOURCES)
208 EMBEDROMFS += $$($(1)_EMBEDROMFS)
209
210 ifneq ($$($(1)_PROGBUILTIN),)
211 ifneq ($$($(1)_PROGBUILTIN),all)
212 $(1)_PROGBUILTIN_TMP = $$($(1)_PROGBUILTIN)
213 else
214 $(1)_PROGBUILTIN_TMP1 = $$(wildcard $$(USER_REGISTRY_DIR)/*.pbi)
215 $(1)_PROGBUILTIN_TMP = $$($(1)_PROGBUILTIN_TMP1:$$(USER_REGISTRY_DIR)/%.pbi=%)
216 endif
217 $(1)_PROGBUILTIN_LIST = $$(filter-out $$($(1)_PROGBUILTIN_EXCLUDE),$$($(1)_PROGBUILTIN_TMP))
218
219 $(1)_PROGBUILTIN_OTHER=$$(filter-out $(1),$$($(1)_PROGBUILTIN_LIST))
220 $(1)_PROGBUILTIN_PBI=$$($(1)_PROGBUILTIN_OTHER:%=$$(USER_REGISTRY_DIR)/%.pbi)
221 $(1)_PROGBUILTIN_LDAT=$$($(1)_PROGBUILTIN_LIST:%=$$(USER_REGISTRY_DIR)/%.ldat)
222 $(1)_PROGBUILTIN_PDAT=$$($(1)_PROGBUILTIN_LIST:%=$$(USER_REGISTRY_DIR)/%.pdat) \
223         $$(filter-out $$($(1)_PROGBUILTIN_EXCLUDE:%=$(NUTTXREGISTRY)/%.pdat),\
224         $$(wildcard $(NUTTXREGISTRY)/*.pdat))
225 $(1)_PROGBUILTIN_BDAT=$$($(1)_PROGBUILTIN_LIST:%=$$(USER_REGISTRY_DIR)/%.bdat) \
226         $$(filter-out $$($(1)_PROGBUILTIN_EXCLUDE:%=$(NUTTXREGISTRY)/%.bdat),\
227         $$(wildcard $(NUTTXREGISTRY)/*.bdat))
228
229 ifneq ($$($(1)_KMODBUILTIN),all)
230 $(1)_KMODBUILTIN_LIBS = $$($(1)_KMODBUILTIN:%=$$(KERN_MODULES_DIR)/lib%.ka)
231 else
232 $(1)_KMODBUILTIN_LIBS = $$(wildcard $$(KERN_MODULES_DIR)/lib*.ka)
233 endif
234
235
236 ifneq ($$($(1)_PROGBUILTIN_PDAT),)
237 $(1)_BUILTINTABLE = $(OBJS_DIR)/$(1)-builtintab.c
238
239 $$($(1)_BUILTINTABLE): $$($(1)_PROGBUILTIN_PDAT) $$($(1)_PROGBUILTIN_BDAT)
240         $(Q) cat $$($(1)_PROGBUILTIN_PDAT) >$$@
241         $(Q) echo "#include <nuttx/config.h>" >>$$@
242         $(Q) echo "#include <nuttx/lib/builtin.h>" >>$$@
243         $(Q) echo "const struct builtin_s g_builtins[] = {" >>$$@
244         $(Q) cat $$($(1)_PROGBUILTIN_BDAT) >>$$@
245         $(Q) echo "{ NULL, 0, 0, 0 }};" >>$$@
246         $(Q) echo "const int g_builtin_count = sizeof(g_builtins) / sizeof(g_builtins[0]);" >>$$@
247
248 GEN_SOURCES += $$($(1)_BUILTINTABLE)
249
250 $(1)_BUILTINWRAPMAIN = $(OBJS_DIR)/$(1)-builtinwrapmain.c
251
252 $$($(1)_BUILTINWRAPMAIN):
253         $(Q) echo "#include <nuttx/config.h>" >$$@
254         $(Q) echo "#include <nuttx/compiler.h>" >>$$@
255         $(Q) echo "int main(int argc, FAR char *argv[]);" >>$$@
256         $(Q) echo "int weak_function $(1)_main(int argc, FAR char *argv[]) {return main(argc, argv);}" >>$$@
257
258 GEN_SOURCES += $$($(1)_BUILTINWRAPMAIN)
259
260 endif
261 endif
262
263 ifneq ($$(LD_SCRIPT$(3:%=-%)),)
264 $(1)$(3:%=-%)_LD_SCRIPT_FN = $$(LD_SCRIPT$(3:%=-%))
265 else
266 $(1)$(3:%=-%)_LD_SCRIPT_FN = $$(LD_SCRIPT)
267 endif
268
269 ifeq ($$(dir $$($(1)$(3:%=-%)_LD_SCRIPT_FN)),)
270 $(1)$(3:%=-%)_LD_SCRIPT = $$(LIB_DIR)/$$($(1)$(3:%=-%)_LD_SCRIPT_FN)
271 else
272 $(1)$(3:%=-%)_LD_SCRIPT = $$($(1)$(3:%=-%)_LD_SCRIPT_FN)
273 endif
274
275 $(1)$(3:%=-%)_LDFLAGS = $$(CC_LD_OPTION)-T$$(LD_OPTION_SEP)$$($(1)$(3:%=-%)_LD_SCRIPT)
276
277 $(2)/$(1)$(3:%=-%): $$($(1)_OBJS) $$($(1)_BUILTINTABLE:%.c=%$$(OBJ_EXT)) $$($(1)_BUILTINWRAPMAIN:%.c=%$$(OBJ_EXT)) $$($(1)_PROGBUILTIN_LDAT) $$($(1)$(3:%=-%)_LD_SCRIPT) $$($(1)_KMODBUILTIN_LIBS)
278         @$(QUIET_CMD_ECHO) "  LINK    $$@"
279         $(Q) $$(if $$(LD_BY_CC) , $$(if $$(filter %.cc,$$($(1)_SOURCES)) , \
280             $$(CXX) $$(CPPFLAGS) $$(OMK_CPPFLAGS) $$(OMK_CXXFLAGS) $$(CXXFLAGS) , \
281             $$(CC)  $$(CPPFLAGS) $$(OMK_CPPFLAGS) $$(OMK_CFLAGS)   $$(CFLAGS) ) , \
282             $$(LD) \
283           ) \
284           $$(OMK_LDFLAGS) $$(LDFLAGS) $$($(1)$(3:%=-%)_LDFLAGS) $$(CC_LD_OPTION)-Map$$(LD_OPTION_SEP)$(1)$(3:%=-%).map \
285           $$($(1)_OBJS) $$($(1)_MOREOBJS) $$($(1)_BUILTINTABLE:%.c=%$$(OBJ_EXT)) $$($(1)_BUILTINWRAPMAIN:%.c=%$$(OBJ_EXT)) \
286           $$($(1)_PROGBUILTIN_PBI) $$(LOADLIBES) $$($(1)_LIBS:%=-l%) $$($(1)_KMODBUILTIN_LIBS) \
287           $$(shell for i in $$($(1)_PROGBUILTIN_LDAT); do cat $$$$i ; done) $$(NUTTXLIBES) \
288           -o $$@
289         @echo "$(2)/$(1)$(3:%=-%): \\" >$(OBJS_DIR)/$(1)$(3:%=-%).exe.d
290         @$(SED4OMK) -n -e 's|^LOAD \(.*\)$$$$|  \1  \&|p' $(OBJS_DIR)/$(1)$(3:%=-%).map|tr '&' '\134'  >>$(OBJS_DIR)/$(1)$(3:%=-%).exe.d
291         @echo >>$(OBJS_DIR)/$(1).exe.d
292 endef
293
294 # Syntax: $(call ELF_template,<executable-name>,<dir>)
295 define ELF_template
296
297 $(2)/$(1).elf: $$($(1)_OBJS)
298         @$(QUIET_CMD_ECHO) "  ELF     $$@"
299         $(Q) $(LD_RAW) \
300           -r -e main -T $(ELF_FILE_LDSCRIPT) \
301           -Map $(1).elf.map \
302           $$($(1)_OBJS) $$($(1)_MOREOBJS) $$(LOADLIBES) $$($(1)_LIBS:%=-l%) \
303           -o $$@
304         @echo "$(2)/$(1).elf: \\" >$(OBJS_DIR)/$(1).elf.d
305         @echo "  $(ELF_FILE_LDSCRIPT) \\" >>$(OBJS_DIR)/$(1).elf.d
306         @$(SED4OMK) -n -e 's|^LOAD \(.*\)$$$$|  \1  \&|p' $(OBJS_DIR)/$(1).elf.map|tr '&' '\134'  >>$(OBJS_DIR)/$(1).elf.d
307         @echo >>$(OBJS_DIR)/$(1).elf.d
308 endef
309
310 # Syntax: $(call PROGBUILTIN_template,<executable-name>,<dir>,<registry-dir>)
311 define PROGBUILTIN_template
312
313 $(1)_PRIORITY ?= SCHED_PRIORITY_DEFAULT
314 $(1)_STACKSIZE ?= 2048
315
316 $(2)/$(1).pbi: $$($(1)_OBJS)
317         @$(QUIET_CMD_ECHO) "  PROGMOD $$@"
318         $(Q) $(LD_RAW) \
319           -r -x --defsym=$(1)_main=main \
320           -Map $(1).pbi.map \
321           $$($(1)_OBJS) $$($(1)_MOREOBJS) \
322           -o $(OBJS_DIR)/$(1).pbo
323         $(Q) $(OBJCOPY) --keep-global-symbol=$(1)_main $(OBJS_DIR)/$(1).pbo $$@
324         @echo "$(2)/$(1).pbi: \\" >$(OBJS_DIR)/$(1).pbi.d
325         @$(SED4OMK) -n -e 's|^LOAD \(.*\)$$$$|  \1  \&|p' $(OBJS_DIR)/$(1).pbi.map|tr '&' '\134'  >>$(OBJS_DIR)/$(1).pbi.d
326         @echo >>$(OBJS_DIR)/$(1).pbi.d
327         @echo "{ \"$1\", $$($(1)_PRIORITY), $$($(1)_STACKSIZE), $(1)_main }," >$(3)/$(1).bdat
328         @echo "int $(1)_main(int argc, char *argv[]);" >$(3)/$(1).pdat
329         @echo "$$(LOADLIBES) $$($(1)_LIBS:%=-l%)" >$(3)/$(1).ldat
330 endef
331
332
333 # Rules for other output formats (can be specified by OUTPUT_FORMATS)
334 %.bin: %
335         @$(QUIET_CMD_ECHO) "  OBJCOPY $@"
336         $(Q) $(OBJCOPY)  --output-target=binary -S $< $@
337
338 %.hex: %
339         @$(QUIET_CMD_ECHO) "  OBJCOPY $@"
340         $(Q) $(OBJCOPY)  --output-target=ihex -S $< $@
341
342 %.srec: %
343         @$(QUIET_CMD_ECHO) "  OBJCOPY $@"
344         $(Q) $(OBJCOPY)  --output-target=srec -S $< $@
345
346 # Syntax: $(call LIBRARY_template,<library-name>)
347 define LIBRARY_template
348
349 GEN_SOURCES += $$($(1)_GEN_SOURCES)
350
351 $(foreach x, $(SOURCES2OBJS),
352 $(1)_OBJS += $$(patsubst %$(notdir $(x)),%$(dir $(x)),$$(filter %$(notdir $(x)),\
353                 $$($(1)_SOURCES) $$($(1)_GEN_SOURCES)))
354 )
355 $(1)_OBJS += $$($(1)_EMBEDROMFS:%=%_img$$(OBJ_EXT))
356 $(1)_OBJS := $$(sort $$($(1)_OBJS:%/=%))
357
358 SOURCES += $$($(1)_SOURCES)
359 EMBEDROMFS += $$($(1)_EMBEDROMFS)
360
361 $(LIB_DIR)/lib$(1)$$(LIB_EXT): $$($(1)_OBJS)
362         @$(QUIET_CMD_ECHO) "  AR      $$@"
363         $(Q) $(AR) $(ARFLAGS) $$@ $$^
364 endef
365
366
367 # Syntax: $(call SOLIB_template,<library-name>)
368 define SOLIB_template
369
370 SOLIB_GEN_SOURCES += $$($(1)_GEN_SOURCES)
371
372 $(foreach x, $(SOURCES2OBJSLO),
373 $(1)_OBJSLO += $$(patsubst %$(notdir $(x)),%$(dir $(x)),$$(filter %$(notdir $(x)),\
374                 $$($(1)_SOURCES) $$($(1)_GEN_SOURCES)))
375 )
376 $(1)_OBJSLO := $$(sort $$($(1)_OBJSLO:%/=%))
377
378 SOLIB_OBJS  += $$($(1)_OBJSLO)
379 SOLIB_SOURCES += $$($(1)_SOURCES)
380
381 $(LIB_DIR)/lib$(1).so: $$($(1)_OBJSLO)
382         @$(QUIET_CMD_ECHO) "  LINK    $$@"
383         $(Q) $(LD) --shared --soname=lib$(1).so -o $$@ $$^
384 endef
385
386 ifneq ($(bin_PROGRAMS),)
387 library-pass_HOOKS += force_builtin_library_hook
388
389 .PHONY: force_builtin_library_hook
390 force_builtin_library_hook:
391
392 endif
393
394 # Syntax: $(call ROMFS_template,<filename>,<filename2>,<directory>) FIXME: Is this correct?
395 define ROMFS_template
396
397 .PHONY: $(2)
398
399 $(2):
400         $(Q) genromfs -f $(2).tmp -V $(1) -d $(3)
401         $(Q) if ( [ ! -e $(2) ] || ! cmp -s $(2).tmp $(2) ) ; then cp $(2).tmp $(2) ; fi
402
403 $(2)$$(OBJ_EXT): $(2)
404         @$(QUIET_CMD_ECHO) "  ROMFS   $$@"
405         $(Q) $(LD) -r --accept-unknown-input-arch -b binary \
406                 --defsym=$(2)_size=_binary_$(2)_size \
407                 --defsym=$(2)_start=_binary_$(2)_start \
408                 --defsym=$(2)_end=_binary_$(2)_end \
409                 -o $$@.tmp $$^
410         $(Q) $(OBJCOPY) --rename-section .data=.rodata,alloc,load,readonly,data,contents \
411                 $$@.tmp $$@
412
413 endef