aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Marek <mmarek@suse.cz>2011-04-20 07:45:30 -0400
committerMichal Marek <mmarek@suse.cz>2011-04-20 09:39:22 -0400
commit40df759e2b9ec945f1a5ddc61b3fdfbb6583257e (patch)
tree1d727592c947dbfe33ddf89718201615488088e8
parenta8b8017c34fefcb763d8b06c294b58d1c480b2e4 (diff)
kbuild: Fix build with binutils <= 2.19
The D option of ar is only available in newer versions. Signed-off-by: Michal Marek <mmarek@suse.cz>
-rw-r--r--Documentation/kbuild/makefiles.txt5
-rw-r--r--Makefile4
-rw-r--r--scripts/Kbuild.include5
-rw-r--r--scripts/Makefile.build4
4 files changed, 16 insertions, 2 deletions
diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt
index 5d145bb443c0..40e082bb8c52 100644
--- a/Documentation/kbuild/makefiles.txt
+++ b/Documentation/kbuild/makefiles.txt
@@ -955,6 +955,11 @@ When kbuild executes, the following steps are followed (roughly):
955 used when linking modules. This is often a linker script. 955 used when linking modules. This is often a linker script.
956 From commandline LDFLAGS_MODULE shall be used (see kbuild.txt). 956 From commandline LDFLAGS_MODULE shall be used (see kbuild.txt).
957 957
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
958--- 6.2 Add prerequisites to archprepare: 963--- 6.2 Add prerequisites to archprepare:
959 964
960 The archprepare: rule is used to list prerequisites that need to be 965 The archprepare: rule is used to list prerequisites that need to be
diff --git a/Makefile b/Makefile
index c3bd316b16f4..d7c42319fe1e 100644
--- a/Makefile
+++ b/Makefile
@@ -382,6 +382,7 @@ export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE CFLAGS_GCOV
382export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE 382export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
383export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_LDFLAGS_MODULE 383export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_LDFLAGS_MODULE
384export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL 384export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL
385export KBUILD_ARFLAGS
385 386
386# When compiling out-of-tree modules, put MODVERDIR in the module 387# When compiling out-of-tree modules, put MODVERDIR in the module
387# tree rather than in the kernel tree. The kernel tree might 388# tree rather than in the kernel tree. The kernel tree might
@@ -612,6 +613,9 @@ KBUILD_CFLAGS += $(call cc-option,-fno-strict-overflow)
612# conserve stack if available 613# conserve stack if available
613KBUILD_CFLAGS += $(call cc-option,-fconserve-stack) 614KBUILD_CFLAGS += $(call cc-option,-fconserve-stack)
614 615
616# use the deterministic mode of AR if available
617KBUILD_ARFLAGS := $(call ar-option,D)
618
615# check for 'asm goto' 619# check for 'asm goto'
616ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC)), y) 620ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC)), y)
617 KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO 621 KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index ed2773edfe71..fae2d8d8cb09 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -141,6 +141,11 @@ cc-ldoption = $(call try-run,\
141ld-option = $(call try-run,\ 141ld-option = $(call try-run,\
142 $(CC) /dev/null -c -o "$$TMPO" ; $(LD) $(1) "$$TMPO" -o "$$TMP",$(1),$(2)) 142 $(CC) /dev/null -c -o "$$TMPO" ; $(LD) $(1) "$$TMPO" -o "$$TMP",$(1),$(2))
143 143
144# ar-option
145# Usage: KBUILD_ARFLAGS := $(call ar-option,D)
146# Important: no spaces around options
147ar-option = $(call try-run, $(AR) rc$(1) "$$TMP",$(1),$(2))
148
144###### 149######
145 150
146### 151###
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 5f87d3709f9f..e1244ef308ce 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -345,7 +345,7 @@ quiet_cmd_link_o_target = LD $@
345cmd_link_o_target = $(if $(strip $(obj-y)),\ 345cmd_link_o_target = $(if $(strip $(obj-y)),\
346 $(LD) $(ld_flags) -r -o $@ $(filter $(obj-y), $^) \ 346 $(LD) $(ld_flags) -r -o $@ $(filter $(obj-y), $^) \
347 $(cmd_secanalysis),\ 347 $(cmd_secanalysis),\
348 rm -f $@; $(AR) rcsD $@) 348 rm -f $@; $(AR) rcs$(KBUILD_ARFLAGS) $@)
349 349
350$(builtin-target): $(obj-y) FORCE 350$(builtin-target): $(obj-y) FORCE
351 $(call if_changed,link_o_target) 351 $(call if_changed,link_o_target)
@@ -371,7 +371,7 @@ $(modorder-target): $(subdir-ym) FORCE
371# 371#
372ifdef lib-target 372ifdef lib-target
373quiet_cmd_link_l_target = AR $@ 373quiet_cmd_link_l_target = AR $@
374cmd_link_l_target = rm -f $@; $(AR) rcsD $@ $(lib-y) 374cmd_link_l_target = rm -f $@; $(AR) rcs$(KBUILD_ARFLAGS) $@ $(lib-y)
375 375
376$(lib-target): $(lib-y) FORCE 376$(lib-target): $(lib-y) FORCE
377 $(call if_changed,link_l_target) 377 $(call if_changed,link_l_target)