Commit 40df759e authored by Michal Marek's avatar Michal Marek

kbuild: Fix build with binutils <= 2.19

The D option of ar is only available in newer versions.
Signed-off-by: default avatarMichal Marek <mmarek@suse.cz>
parent a8b8017c
...@@ -955,6 +955,11 @@ When kbuild executes, the following steps are followed (roughly): ...@@ -955,6 +955,11 @@ When kbuild executes, the following steps are followed (roughly):
used when linking modules. This is often a linker script. used when linking modules. This is often a linker script.
From commandline LDFLAGS_MODULE shall be used (see kbuild.txt). From commandline LDFLAGS_MODULE shall be used (see kbuild.txt).
KBUILD_ARFLAGS Options for $(AR) when creating archives
$(KBUILD_ARFLAGS) set by the top level Makefile to "D" (deterministic
mode) if this option is supported by $(AR).
--- 6.2 Add prerequisites to archprepare: --- 6.2 Add prerequisites to archprepare:
The archprepare: rule is used to list prerequisites that need to be The archprepare: rule is used to list prerequisites that need to be
......
...@@ -382,6 +382,7 @@ export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE CFLAGS_GCOV ...@@ -382,6 +382,7 @@ export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE CFLAGS_GCOV
export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_LDFLAGS_MODULE export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_LDFLAGS_MODULE
export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL
export KBUILD_ARFLAGS
# When compiling out-of-tree modules, put MODVERDIR in the module # When compiling out-of-tree modules, put MODVERDIR in the module
# tree rather than in the kernel tree. The kernel tree might # tree rather than in the kernel tree. The kernel tree might
...@@ -612,6 +613,9 @@ KBUILD_CFLAGS += $(call cc-option,-fno-strict-overflow) ...@@ -612,6 +613,9 @@ KBUILD_CFLAGS += $(call cc-option,-fno-strict-overflow)
# conserve stack if available # conserve stack if available
KBUILD_CFLAGS += $(call cc-option,-fconserve-stack) KBUILD_CFLAGS += $(call cc-option,-fconserve-stack)
# use the deterministic mode of AR if available
KBUILD_ARFLAGS := $(call ar-option,D)
# check for 'asm goto' # check for 'asm goto'
ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC)), y) ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC)), y)
KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO
......
...@@ -141,6 +141,11 @@ cc-ldoption = $(call try-run,\ ...@@ -141,6 +141,11 @@ cc-ldoption = $(call try-run,\
ld-option = $(call try-run,\ ld-option = $(call try-run,\
$(CC) /dev/null -c -o "$$TMPO" ; $(LD) $(1) "$$TMPO" -o "$$TMP",$(1),$(2)) $(CC) /dev/null -c -o "$$TMPO" ; $(LD) $(1) "$$TMPO" -o "$$TMP",$(1),$(2))
# ar-option
# Usage: KBUILD_ARFLAGS := $(call ar-option,D)
# Important: no spaces around options
ar-option = $(call try-run, $(AR) rc$(1) "$$TMP",$(1),$(2))
###### ######
### ###
......
...@@ -345,7 +345,7 @@ quiet_cmd_link_o_target = LD $@ ...@@ -345,7 +345,7 @@ quiet_cmd_link_o_target = LD $@
cmd_link_o_target = $(if $(strip $(obj-y)),\ cmd_link_o_target = $(if $(strip $(obj-y)),\
$(LD) $(ld_flags) -r -o $@ $(filter $(obj-y), $^) \ $(LD) $(ld_flags) -r -o $@ $(filter $(obj-y), $^) \
$(cmd_secanalysis),\ $(cmd_secanalysis),\
rm -f $@; $(AR) rcsD $@) rm -f $@; $(AR) rcs$(KBUILD_ARFLAGS) $@)
$(builtin-target): $(obj-y) FORCE $(builtin-target): $(obj-y) FORCE
$(call if_changed,link_o_target) $(call if_changed,link_o_target)
...@@ -371,7 +371,7 @@ $(modorder-target): $(subdir-ym) FORCE ...@@ -371,7 +371,7 @@ $(modorder-target): $(subdir-ym) FORCE
# #
ifdef lib-target ifdef lib-target
quiet_cmd_link_l_target = AR $@ quiet_cmd_link_l_target = AR $@
cmd_link_l_target = rm -f $@; $(AR) rcsD $@ $(lib-y) cmd_link_l_target = rm -f $@; $(AR) rcs$(KBUILD_ARFLAGS) $@ $(lib-y)
$(lib-target): $(lib-y) FORCE $(lib-target): $(lib-y) FORCE
$(call if_changed,link_l_target) $(call if_changed,link_l_target)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment