From d503ac531a5246e4d910f971b213807fea925956 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Fri, 24 Aug 2018 08:20:39 +0900 Subject: kbuild: rename LDFLAGS to KBUILD_LDFLAGS Commit a0f97e06a43c ("kbuild: enable 'make CFLAGS=...' to add additional options to CC") renamed CFLAGS to KBUILD_CFLAGS. Commit 222d394d30e7 ("kbuild: enable 'make AFLAGS=...' to add additional options to AS") renamed AFLAGS to KBUILD_AFLAGS. Commit 06c5040cdb13 ("kbuild: enable 'make CPPFLAGS=...' to add additional options to CPP") renamed CPPFLAGS to KBUILD_CPPFLAGS. For some reason, LDFLAGS was not renamed. Using a well-known variable like LDFLAGS may result in accidental override of the variable. Kbuild generally uses KBUILD_ prefixed variables for the internally appended options, so here is one more conversion to sanitize the naming convention. I did not touch Makefiles under tools/ since the tools build system is a different world. Signed-off-by: Masahiro Yamada Acked-by: Kirill A. Shutemov Reviewed-by: Palmer Dabbelt --- scripts/Kbuild.include | 4 ++-- scripts/Makefile.build | 6 +++--- scripts/Makefile.lib | 2 +- scripts/Makefile.modpost | 2 +- scripts/link-vmlinux.sh | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) (limited to 'scripts') diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 7c98f60e2266..c75413d05a63 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -163,8 +163,8 @@ cc-ldoption = $(call try-run,\ $(CC) $(1) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2)) # ld-option -# Usage: LDFLAGS += $(call ld-option, -X, -Y) -ld-option = $(call try-run, $(LD) $(LDFLAGS) $(1) -v,$(1),$(2),$(3)) +# 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) diff --git a/scripts/Makefile.build b/scripts/Makefile.build index f5d7612696d0..1c48572223d1 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -190,7 +190,7 @@ cmd_modversions_c = \ $(call cmd_gensymtypes_c,$(KBUILD_SYMTYPES),$(@:.o=.symtypes)) \ > $(@D)/.tmp_$(@F:.o=.ver); \ \ - $(LD) $(LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) \ + $(LD) $(KBUILD_LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) \ -T $(@D)/.tmp_$(@F:.o=.ver); \ rm -f $(@D)/.tmp_$(@F) $(@D)/.tmp_$(@F:.o=.ver); \ else \ @@ -220,7 +220,7 @@ sub_cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH "$(if $(CONFIG_CPU_BIG_ENDIAN),big,little)" \ "$(if $(CONFIG_64BIT),64,32)" \ "$(OBJDUMP)" "$(OBJCOPY)" "$(CC) $(KBUILD_CFLAGS)" \ - "$(LD) $(LDFLAGS)" "$(NM)" "$(RM)" "$(MV)" \ + "$(LD) $(KBUILD_LDFLAGS)" "$(NM)" "$(RM)" "$(MV)" \ "$(if $(part-of-module),1,0)" "$(@)"; recordmcount_source := $(srctree)/scripts/recordmcount.pl endif # BUILD_C_RECORDMCOUNT @@ -394,7 +394,7 @@ cmd_modversions_S = \ $(call cmd_gensymtypes_S,$(KBUILD_SYMTYPES),$(@:.o=.symtypes)) \ > $(@D)/.tmp_$(@F:.o=.ver); \ \ - $(LD) $(LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) \ + $(LD) $(KBUILD_LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) \ -T $(@D)/.tmp_$(@F:.o=.ver); \ rm -f $(@D)/.tmp_$(@F) $(@D)/.tmp_$(@F:.o=.ver); \ else \ diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index df0fff252619..61e596650ed3 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -162,7 +162,7 @@ a_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \ cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \ $(__cpp_flags) -ld_flags = $(LDFLAGS) $(ldflags-y) $(LDFLAGS_$(@F)) +ld_flags = $(KBUILD_LDFLAGS) $(ldflags-y) $(LDFLAGS_$(@F)) DTC_INCLUDE := $(srctree)/scripts/dtc/include-prefixes diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost index dd92dbbbaa68..7d4af0d0accb 100644 --- a/scripts/Makefile.modpost +++ b/scripts/Makefile.modpost @@ -120,7 +120,7 @@ ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(SRCARCH)/Makefile.postlink) # Step 6), final link of the modules with optional arch pass after final link quiet_cmd_ld_ko_o = LD [M] $@ cmd_ld_ko_o = \ - $(LD) -r $(LDFLAGS) \ + $(LD) -r $(KBUILD_LDFLAGS) \ $(KBUILD_LDFLAGS_MODULE) $(LDFLAGS_MODULE) \ -o $@ $(filter-out FORCE,$^) ; \ $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true) diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh index 4bf811c09f59..c8cf45362bd6 100755 --- a/scripts/link-vmlinux.sh +++ b/scripts/link-vmlinux.sh @@ -75,7 +75,7 @@ modpost_link() ${KBUILD_VMLINUX_LIBS} \ --end-group" - ${LD} ${LDFLAGS} -r -o ${1} ${objects} + ${LD} ${KBUILD_LDFLAGS} -r -o ${1} ${objects} } # Link of vmlinux @@ -95,7 +95,7 @@ vmlinux_link() --end-group \ ${1}" - ${LD} ${LDFLAGS} ${LDFLAGS_vmlinux} -o ${2} \ + ${LD} ${KBUILD_LDFLAGS} ${LDFLAGS_vmlinux} -o ${2} \ -T ${lds} ${objects} else objects="-Wl,--whole-archive \ -- cgit v1.2.3