Skip to content

Commit

Permalink
kbuild: remove ar-option and KBUILD_ARFLAGS
Browse files Browse the repository at this point in the history
Commit 40df759 ("kbuild: Fix build with binutils <= 2.19")
introduced ar-option and KBUILD_ARFLAGS to deal with old binutils.

According to Documentation/process/changes.rst, the current minimal
supported version of binutils is 2.21 so you can assume the 'D' option
is always supported. Not only GNU ar but also llvm-ar supports it.

With the 'D' option hard-coded, there is no more user of ar-option
or KBUILD_ARFLAGS.

Signed-off-by: Masahiro Yamada <[email protected]>
Reviewed-by: Nick Desaulniers <[email protected]>
Tested-by: Nick Desaulniers <[email protected]>
  • Loading branch information
masahir0y committed Oct 1, 2019
1 parent 54ecb8f commit 13dc8c0
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 17 deletions.
5 changes: 0 additions & 5 deletions Documentation/kbuild/makefiles.rst
Original file line number Diff line number Diff line change
Expand Up @@ -954,11 +954,6 @@ When kbuild executes, the following steps are followed (roughly):

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).

KBUILD_LDS

The linker script with full path. Assigned by the top-level Makefile.
Expand Down
4 changes: 0 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,6 @@ export CFLAGS_KASAN CFLAGS_KASAN_NOSANITIZE CFLAGS_UBSAN
export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_LDFLAGS_MODULE
export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL
export KBUILD_ARFLAGS

# Files to ignore in find ... statements

Expand Down Expand Up @@ -914,9 +913,6 @@ ifdef CONFIG_RETPOLINE
KBUILD_CFLAGS += $(call cc-option,-fcf-protection=none)
endif

# use the deterministic mode of AR if available
KBUILD_ARFLAGS := $(call ar-option,D)

include scripts/Makefile.kasan
include scripts/Makefile.extrawarn
include scripts/Makefile.ubsan
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/boot/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ endif

BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -nostdinc

BOOTARFLAGS := -cr$(KBUILD_ARFLAGS)
BOOTARFLAGS := -crD

ifdef CONFIG_CC_IS_CLANG
BOOTCFLAGS += $(CLANG_FLAGS)
Expand Down
5 changes: 0 additions & 5 deletions scripts/Kbuild.include
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,6 @@ cc-ifversion = $(shell [ $(CONFIG_GCC_VERSION)0 $(1) $(2)000 ] && echo $(3) || e
# Usage: KBUILD_LDFLAGS += $(call ld-option, -X, -Y)
ld-option = $(call try-run, $(LD) $(KBUILD_LDFLAGS) $(1) -v,$(1),$(2),$(3))

# 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))

# ld-version
# Note this is mainly for HJ Lu's 3 number binutil versions
ld-version = $(shell $(LD) --version | $(srctree)/scripts/ld-version.sh)
Expand Down
2 changes: 1 addition & 1 deletion scripts/Makefile.build
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ $(sort $(subdir-obj-y)): $(subdir-ym) ;
ifdef builtin-target

quiet_cmd_ar_builtin = AR $@
cmd_ar_builtin = rm -f $@; $(AR) rcSTP$(KBUILD_ARFLAGS) $@ $(real-prereqs)
cmd_ar_builtin = rm -f $@; $(AR) cDPrST $@ $(real-prereqs)

$(builtin-target): $(real-obj-y) FORCE
$(call if_changed,ar_builtin)
Expand Down
2 changes: 1 addition & 1 deletion scripts/Makefile.lib
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ quiet_cmd_ld = LD $@
# ---------------------------------------------------------------------------

quiet_cmd_ar = AR $@
cmd_ar = rm -f $@; $(AR) rcsTP$(KBUILD_ARFLAGS) $@ $(real-prereqs)
cmd_ar = rm -f $@; $(AR) cDPrsT $@ $(real-prereqs)

# Objcopy
# ---------------------------------------------------------------------------
Expand Down

0 comments on commit 13dc8c0

Please sign in to comment.