History

kbuild: Fix build with binutils <= 2.19

The D option of ar is only available in newer versions.

Michal Marek committed 15 years ago

Commit 40df7591 parent a8b80174 files · +16 −2Browse files

Unified · Split

4 files
  1. Documentation/kbuild/makefiles.txt +5 −0
  2. Makefile +4 −0
  3. scripts/Kbuild.include +5 −0
  4. scripts/Makefile.build +2 −2
Documentation/kbuild/makefiles.txt+5−0
@@ -955,6 +955,11 @@ When kbuild executes, the following steps are followed (roughly): · 954 unmodified lines
955955 used when linking modules. This is often a linker script.
956956 From commandline LDFLAGS_MODULE shall be used (see kbuild.txt).
957957
958+ KBUILD_ARFLAGS Options for $(AR) when creating archives
959+
960+ $(KBUILD_ARFLAGS) set by the top level Makefile to "D" (deterministic
961+ mode) if this option is supported by $(AR).
962+
958963 --- 6.2 Add prerequisites to archprepare:
959964
960965 The archprepare: rule is used to list prerequisites that need to be
Makefile+4−0
@@ -382,6 +382,7 @@ export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE CFLAGS_GCOV · 381 unmodified lines
382382 export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
383383 export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_LDFLAGS_MODULE
384384 export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL
385+export KBUILD_ARFLAGS
385386
386387 # When compiling out-of-tree modules, put MODVERDIR in the module
387388 # tree rather than in the kernel tree. The kernel tree might
@@ -612,6 +613,9 @@ KBUILD_CFLAGS += $(call cc-option,-fno-strict-overflow) · 224 unmodified lines
612613 # conserve stack if available
613614 KBUILD_CFLAGS += $(call cc-option,-fconserve-stack)
614615
616+# use the deterministic mode of AR if available
617+KBUILD_ARFLAGS := $(call ar-option,D)
618+
615619 # check for 'asm goto'
616620 ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC)), y)
617621 KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO
scripts/Kbuild.include+5−0
@@ -141,6 +141,11 @@ cc-ldoption = $(call try-run,\ · 140 unmodified lines
141141 ld-option = $(call try-run,\
142142 $(CC) /dev/null -c -o "$$TMPO" ; $(LD) $(1) "$$TMPO" -o "$$TMP",$(1),$(2))
143143
144+# ar-option
145+# Usage: KBUILD_ARFLAGS := $(call ar-option,D)
146+# Important: no spaces around options
147+ar-option = $(call try-run, $(AR) rc$(1) "$$TMP",$(1),$(2))
148+
144149 ######
145150
146151 ###
scripts/Makefile.build+2−2
@@ -345,7 +345,7 @@ quiet_cmd_link_o_target = LD $@ · 344 unmodified lines
345345 cmd_link_o_target = $(if $(strip $(obj-y)),\
346346 $(LD) $(ld_flags) -r -o $@ $(filter $(obj-y), $^) \
347347 $(cmd_secanalysis),\
348− rm -f $@; $(AR) rcsD $@)
348+ rm -f $@; $(AR) rcs$(KBUILD_ARFLAGS) $@)
349349
350350 $(builtin-target): $(obj-y) FORCE
351351 $(call if_changed,link_o_target)
@@ -371,7 +371,7 @@ $(modorder-target): $(subdir-ym) FORCE · 19 unmodified lines
371371 #
372372 ifdef lib-target
373373 quiet_cmd_link_l_target = AR $@
374−cmd_link_l_target = rm -f $@; $(AR) rcsD $@ $(lib-y)
374+cmd_link_l_target = rm -f $@; $(AR) rcs$(KBUILD_ARFLAGS) $@ $(lib-y)
375375
376376 $(lib-target): $(lib-y) FORCE
377377 $(call if_changed,link_l_target)