Skip to content

Commit d503ac5

Browse files
committed
kbuild: rename LDFLAGS to KBUILD_LDFLAGS
Commit a0f97e0 ("kbuild: enable 'make CFLAGS=...' to add additional options to CC") renamed CFLAGS to KBUILD_CFLAGS. Commit 222d394 ("kbuild: enable 'make AFLAGS=...' to add additional options to AS") renamed AFLAGS to KBUILD_AFLAGS. Commit 06c5040 ("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 <yamada.masahiro@socionext.com> Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Reviewed-by: Palmer Dabbelt <palmer@sifive.com>
1 parent 87a32e6 commit d503ac5

File tree

29 files changed

+48
-51
lines changed

29 files changed

+48
-51
lines changed

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -440,15 +440,15 @@ KBUILD_CFLAGS_KERNEL :=
440440
KBUILD_AFLAGS_MODULE := -DMODULE
441441
KBUILD_CFLAGS_MODULE := -DMODULE
442442
KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds
443-
LDFLAGS :=
443+
KBUILD_LDFLAGS :=
444444
GCC_PLUGINS_CFLAGS :=
445445

446446
export ARCH SRCARCH CONFIG_SHELL HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE AS LD CC
447447
export CPP AR NM STRIP OBJCOPY OBJDUMP KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS
448448
export MAKE LEX YACC AWK GENKSYMS INSTALLKERNEL PERL PYTHON PYTHON2 PYTHON3 UTS_MACHINE
449449
export HOSTCXX KBUILD_HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS
450450

451-
export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS
451+
export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS KBUILD_LDFLAGS
452452
export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE
453453
export CFLAGS_KASAN CFLAGS_KASAN_NOSANITIZE CFLAGS_UBSAN
454454
export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
@@ -1020,7 +1020,7 @@ ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(SRCARCH)/Makefile.postlink)
10201020

10211021
# Final link of vmlinux with optional arch pass after final link
10221022
cmd_link-vmlinux = \
1023-
$(CONFIG_SHELL) $< $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) ; \
1023+
$(CONFIG_SHELL) $< $(LD) $(KBUILD_LDFLAGS) $(LDFLAGS_vmlinux) ; \
10241024
$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true)
10251025

10261026
vmlinux: scripts/link-vmlinux.sh autoksyms_recursive $(vmlinux-deps) FORCE

arch/arc/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ KBUILD_CFLAGS_MODULE += -mlong-calls -mno-millicode
9595
# Finally dump eveything into kernel build system
9696
KBUILD_CFLAGS += $(cflags-y)
9797
KBUILD_AFLAGS += $(KBUILD_CFLAGS)
98-
LDFLAGS += $(ldflags-y)
98+
KBUILD_LDFLAGS += $(ldflags-y)
9999

100100
head-y := arch/arc/kernel/head.o
101101

arch/arm/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ ifeq ($(CONFIG_CPU_BIG_ENDIAN),y)
4343
KBUILD_CPPFLAGS += -mbig-endian
4444
CHECKFLAGS += -D__ARMEB__
4545
AS += -EB
46-
LDFLAGS += -EB
46+
KBUILD_LDFLAGS += -EB
4747
else
4848
KBUILD_CPPFLAGS += -mlittle-endian
4949
CHECKFLAGS += -D__ARMEL__
5050
AS += -EL
51-
LDFLAGS += -EL
51+
KBUILD_LDFLAGS += -EL
5252
endif
5353

5454
#

arch/arm64/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,14 @@ CHECKFLAGS += -D__AARCH64EB__
6262
AS += -EB
6363
# Prefer the baremetal ELF build target, but not all toolchains include
6464
# it so fall back to the standard linux version if needed.
65-
LDFLAGS += -EB $(call ld-option, -maarch64elfb, -maarch64linuxb)
65+
KBUILD_LDFLAGS += -EB $(call ld-option, -maarch64elfb, -maarch64linuxb)
6666
UTS_MACHINE := aarch64_be
6767
else
6868
KBUILD_CPPFLAGS += -mlittle-endian
6969
CHECKFLAGS += -D__AARCH64EL__
7070
AS += -EL
7171
# Same as above, prefer ELF but fall back to linux target if needed.
72-
LDFLAGS += -EL $(call ld-option, -maarch64elf, -maarch64linux)
72+
KBUILD_LDFLAGS += -EL $(call ld-option, -maarch64elf, -maarch64linux)
7373
UTS_MACHINE := aarch64
7474
endif
7575

arch/c6x/Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ ifdef CONFIG_CPU_BIG_ENDIAN
2323
KBUILD_CFLAGS += -mbig-endian
2424
KBUILD_AFLAGS += -mbig-endian
2525
LINKFLAGS += -mbig-endian
26-
KBUILD_LDFLAGS += -mbig-endian
27-
LDFLAGS += -EB
26+
KBUILD_LDFLAGS += -mbig-endian -EB
2827
CHECKFLAGS += -D_BIG_ENDIAN
2928
endif
3029

arch/h8300/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ KBUILD_CFLAGS += -mint32 -fno-builtin
2020
KBUILD_CFLAGS += -D__linux__
2121
KBUILD_CFLAGS += -DUTS_SYSNAME=\"uClinux\"
2222
KBUILD_AFLAGS += $(aflags-y)
23-
LDFLAGS += $(ldflags-y)
23+
KBUILD_LDFLAGS += $(ldflags-y)
2424

2525
ifeq ($(CROSS_COMPILE),)
2626
CROSS_COMPILE := h8300-unknown-linux-

arch/hexagon/Makefile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ ldflags-y += $(call cc-option,-mv${CONFIG_HEXAGON_ARCH_VERSION})
2222

2323
KBUILD_CFLAGS += $(cflags-y)
2424
KBUILD_AFLAGS += $(aflags-y)
25-
26-
# no KBUILD_LDFLAGS?
27-
LDFLAGS += $(ldflags-y)
25+
KBUILD_LDFLAGS += $(ldflags-y)
2826

2927
# Thread-info register will be r19. This value is not configureable;
3028
# it is hard-coded in several files.

arch/m68k/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ KBUILD_CFLAGS += -D__uClinux__
6969
KBUILD_AFLAGS += -D__uClinux__
7070
endif
7171

72-
LDFLAGS := -m m68kelf
72+
KBUILD_LDFLAGS := -m m68kelf
7373
KBUILD_LDFLAGS_MODULE += -T $(srctree)/arch/m68k/kernel/module.lds
7474

7575
ifdef CONFIG_SUN3

arch/microblaze/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_PCMP_INSTR) += -mxl-pattern-compare
4040
ifdef CONFIG_CPU_BIG_ENDIAN
4141
KBUILD_CFLAGS += -mbig-endian
4242
KBUILD_AFLAGS += -mbig-endian
43-
LDFLAGS += -EB
43+
KBUILD_LDFLAGS += -EB
4444
else
4545
KBUILD_CFLAGS += -mlittle-endian
4646
KBUILD_AFLAGS += -mlittle-endian
47-
LDFLAGS += -EL
47+
KBUILD_LDFLAGS += -EL
4848
endif
4949

5050
CPUFLAGS-1 += $(call cc-option,-mcpu=v$(CPU_VER))

arch/mips/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ endif
309309
# instead of .eh_frame so we don't discard them.
310310
KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
311311

312-
LDFLAGS += -m $(ld-emul)
312+
KBUILD_LDFLAGS += -m $(ld-emul)
313313

314314
ifdef CONFIG_MIPS
315315
CHECKFLAGS += $(shell $(CC) $(KBUILD_CFLAGS) -dM -E -x c /dev/null | \

arch/mips/boot/compressed/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ UIMAGE_LOADADDR = $(VMLINUZ_LOAD_ADDRESS)
9292
vmlinuzobjs-y += $(obj)/piggy.o
9393

9494
quiet_cmd_zld = LD $@
95-
cmd_zld = $(LD) $(LDFLAGS) -Ttext $(VMLINUZ_LOAD_ADDRESS) -T $< $(vmlinuzobjs-y) -o $@
95+
cmd_zld = $(LD) $(KBUILD_LDFLAGS) -Ttext $(VMLINUZ_LOAD_ADDRESS) -T $< $(vmlinuzobjs-y) -o $@
9696
quiet_cmd_strip = STRIP $@
9797
cmd_strip = $(STRIP) -s $@
9898
vmlinuz: $(src)/ld.script $(vmlinuzobjs-y) $(obj)/calc_vmlinuz_load_addr

arch/mips/lasat/image/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ $(obj)/rom.bin: $(obj)/rom
3838

3939
# Rule to make the bootloader
4040
$(obj)/rom: $(addprefix $(obj)/,$(OBJECTS))
41-
$(LD) $(LDFLAGS) $(LDSCRIPT) -o $@ $^
41+
$(LD) $(KBUILD_LDFLAGS) $(LDSCRIPT) -o $@ $^
4242

4343
$(obj)/%.o: $(obj)/%.gz
4444
$(LD) -r -o $@ -b binary $<

arch/nds32/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ endif
3333
ifdef CONFIG_CPU_LITTLE_ENDIAN
3434
KBUILD_CFLAGS += $(call cc-option, -EL)
3535
KBUILD_AFLAGS += $(call cc-option, -EL)
36-
LDFLAGS += $(call cc-option, -EL)
36+
KBUILD_LDFLAGS += $(call cc-option, -EL)
3737
CHECKFLAGS += -D__NDS32_EL__
3838
else
3939
KBUILD_CFLAGS += $(call cc-option, -EB)
4040
KBUILD_AFLAGS += $(call cc-option, -EB)
41-
LDFLAGS += $(call cc-option, -EB)
41+
KBUILD_LDFLAGS += $(call cc-option, -EB)
4242
CHECKFLAGS += -D__NDS32_EB__
4343
endif
4444

arch/powerpc/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,14 @@ endif
7676

7777
ifdef CONFIG_CPU_LITTLE_ENDIAN
7878
KBUILD_CFLAGS += -mlittle-endian
79-
LDFLAGS += -EL
79+
KBUILD_LDFLAGS += -EL
8080
LDEMULATION := lppc
8181
GNUTARGET := powerpcle
8282
MULTIPLEWORD := -mno-multiple
8383
KBUILD_CFLAGS_MODULE += $(call cc-option,-mno-save-toc-indirect)
8484
else
8585
KBUILD_CFLAGS += $(call cc-option,-mbig-endian)
86-
LDFLAGS += -EB
86+
KBUILD_LDFLAGS += -EB
8787
LDEMULATION := ppc
8888
GNUTARGET := powerpc
8989
MULTIPLEWORD := -mmultiple
@@ -108,7 +108,7 @@ aflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mlittle-endian
108108
ifeq ($(HAS_BIARCH),y)
109109
KBUILD_CFLAGS += -m$(BITS)
110110
KBUILD_AFLAGS += -m$(BITS) -Wl,-a$(BITS)
111-
LDFLAGS += -m elf$(BITS)$(LDEMULATION)
111+
KBUILD_LDFLAGS += -m elf$(BITS)$(LDEMULATION)
112112
KBUILD_ARFLAGS += --target=elf$(BITS)-$(GNUTARGET)
113113
endif
114114

arch/riscv/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ ifeq ($(CONFIG_ARCH_RV64I),y)
2929
KBUILD_CFLAGS += $(call cc-ifversion, -ge, 0500, -DCONFIG_ARCH_SUPPORTS_INT128)
3030

3131
KBUILD_MARCH = rv64im
32-
LDFLAGS += -melf64lriscv
32+
KBUILD_LDFLAGS += -melf64lriscv
3333
else
3434
BITS := 32
3535
UTS_MACHINE := riscv32
3636

3737
KBUILD_CFLAGS += -mabi=ilp32
3838
KBUILD_AFLAGS += -mabi=ilp32
3939
KBUILD_MARCH = rv32im
40-
LDFLAGS += -melf32lriscv
40+
KBUILD_LDFLAGS += -melf32lriscv
4141
endif
4242

4343
KBUILD_CFLAGS += -Wall

arch/s390/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#
1212

1313
LD_BFD := elf64-s390
14-
LDFLAGS := -m elf64_s390
14+
KBUILD_LDFLAGS := -m elf64_s390
1515
KBUILD_AFLAGS_MODULE += -fPIC
1616
KBUILD_CFLAGS_MODULE += -fPIC
1717
KBUILD_AFLAGS += -m64

arch/sh/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,11 @@ endif
122122
ifdef CONFIG_CPU_LITTLE_ENDIAN
123123
ld-bfd := elf32-$(UTS_MACHINE)-linux
124124
LDFLAGS_vmlinux += --defsym jiffies=jiffies_64 --oformat $(ld-bfd)
125-
LDFLAGS += -EL
125+
KBUILD_LDFLAGS += -EL
126126
else
127127
ld-bfd := elf32-$(UTS_MACHINE)big-linux
128128
LDFLAGS_vmlinux += --defsym jiffies=jiffies_64+4 --oformat $(ld-bfd)
129-
LDFLAGS += -EB
129+
KBUILD_LDFLAGS += -EB
130130
endif
131131

132132
export ld-bfd BITS

arch/sparc/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ ifeq ($(CONFIG_SPARC32),y)
2121
#
2222

2323
CHECKFLAGS += -D__sparc__
24-
LDFLAGS := -m elf32_sparc
24+
KBUILD_LDFLAGS := -m elf32_sparc
2525
export BITS := 32
2626
UTS_MACHINE := sparc
2727

@@ -40,7 +40,7 @@ else
4040
#
4141

4242
CHECKFLAGS += -D__sparc__ -D__sparc_v9__ -D__arch64__
43-
LDFLAGS := -m elf64_sparc
43+
KBUILD_LDFLAGS := -m elf64_sparc
4444
export BITS := 64
4545
UTS_MACHINE := sparc64
4646

arch/um/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ export LDS_ELF_FORMAT := $(ELF_FORMAT)
133133
# The wrappers will select whether using "malloc" or the kernel allocator.
134134
LINK_WRAPS = -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc
135135

136-
LD_FLAGS_CMDLINE = $(foreach opt,$(LDFLAGS),-Wl,$(opt))
136+
LD_FLAGS_CMDLINE = $(foreach opt,$(KBUILD_LDFLAGS),-Wl,$(opt))
137137

138138
# Used by link-vmlinux.sh which has special support for um link
139139
export CFLAGS_vmlinux := $(LINK-y) $(LINK_WRAPS) $(LD_FLAGS_CMDLINE)

arch/x86/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,15 +219,15 @@ sha256_ni_instr :=$(call as-instr,sha256msg1 %xmm0$(comma)%xmm1,-DCONFIG_AS_SHA2
219219
KBUILD_AFLAGS += $(cfi) $(cfi-sigframe) $(cfi-sections) $(asinstr) $(avx_instr) $(avx2_instr) $(avx512_instr) $(sha1_ni_instr) $(sha256_ni_instr)
220220
KBUILD_CFLAGS += $(cfi) $(cfi-sigframe) $(cfi-sections) $(asinstr) $(avx_instr) $(avx2_instr) $(avx512_instr) $(sha1_ni_instr) $(sha256_ni_instr)
221221

222-
LDFLAGS := -m elf_$(UTS_MACHINE)
222+
KBUILD_LDFLAGS := -m elf_$(UTS_MACHINE)
223223

224224
#
225225
# The 64-bit kernel must be aligned to 2MB. Pass -z max-page-size=0x200000 to
226226
# the linker to force 2MB page size regardless of the default page size used
227227
# by the linker.
228228
#
229229
ifdef CONFIG_X86_64
230-
LDFLAGS += $(call ld-option, -z max-page-size=0x200000)
230+
KBUILD_LDFLAGS += $(call ld-option, -z max-page-size=0x200000)
231231
endif
232232

233233
# Speed up the build

arch/x86/Makefile.um

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ core-y += arch/x86/crypto/
44
ifeq ($(CONFIG_X86_32),y)
55
START := 0x8048000
66

7-
LDFLAGS += -m elf_i386
7+
KBUILD_LDFLAGS += -m elf_i386
88
ELF_ARCH := i386
99
ELF_FORMAT := elf32-i386
1010
CHECKFLAGS += -D__i386__
@@ -43,7 +43,7 @@ KBUILD_CFLAGS += -fno-builtin -m64
4343

4444
CHECKFLAGS += -m64 -D__x86_64__
4545
KBUILD_AFLAGS += -m64
46-
LDFLAGS += -m elf_x86_64
46+
KBUILD_LDFLAGS += -m elf_x86_64
4747
KBUILD_CPPFLAGS += -m64
4848

4949
ELF_ARCH := i386:x86-64

arch/x86/boot/compressed/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,16 @@ KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__
4242
GCOV_PROFILE := n
4343
UBSAN_SANITIZE :=n
4444

45-
LDFLAGS := -m elf_$(UTS_MACHINE)
45+
KBUILD_LDFLAGS := -m elf_$(UTS_MACHINE)
4646
# Compressed kernel should be built as PIE since it may be loaded at any
4747
# address by the bootloader.
4848
ifeq ($(CONFIG_X86_32),y)
49-
LDFLAGS += $(call ld-option, -pie) $(call ld-option, --no-dynamic-linker)
49+
KBUILD_LDFLAGS += $(call ld-option, -pie) $(call ld-option, --no-dynamic-linker)
5050
else
5151
# To build 64-bit compressed kernel as PIE, we disable relocation
5252
# overflow check to avoid relocation overflow error with a new linker
5353
# command-line option, -z noreloc-overflow.
54-
LDFLAGS += $(shell $(LD) --help 2>&1 | grep -q "\-z noreloc-overflow" \
54+
KBUILD_LDFLAGS += $(shell $(LD) --help 2>&1 | grep -q "\-z noreloc-overflow" \
5555
&& echo "-z noreloc-overflow -pie --no-dynamic-linker")
5656
endif
5757
LDFLAGS_vmlinux := -T

arch/xtensa/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ KBUILD_CFLAGS += $(call cc-option,-mno-serialize-volatile,)
4949
KBUILD_AFLAGS += -mlongcalls -mtext-section-literals
5050

5151
ifneq ($(CONFIG_LD_NO_RELAX),)
52-
LDFLAGS := --no-relax
52+
KBUILD_LDFLAGS := --no-relax
5353
endif
5454

5555
ifeq ($(shell echo __XTENSA_EB__ | $(CC) -E - | grep -v "\#"),1)

arch/xtensa/boot/boot-elf/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ $(obj)/Image.o: vmlinux.bin $(OBJS)
2525
$(OBJS) $@
2626

2727
$(obj)/../Image.elf: $(obj)/Image.o $(obj)/boot.lds
28-
$(Q)$(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) \
28+
$(Q)$(LD) $(KBUILD_LDFLAGS) $(LDFLAGS_vmlinux) \
2929
-T $(obj)/boot.lds \
3030
--build-id=none \
3131
-o $@ $(obj)/Image.o

scripts/Kbuild.include

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ cc-ldoption = $(call try-run,\
163163
$(CC) $(1) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2))
164164

165165
# ld-option
166-
# Usage: LDFLAGS += $(call ld-option, -X, -Y)
167-
ld-option = $(call try-run, $(LD) $(LDFLAGS) $(1) -v,$(1),$(2),$(3))
166+
# Usage: KBUILD_LDFLAGS += $(call ld-option, -X, -Y)
167+
ld-option = $(call try-run, $(LD) $(KBUILD_LDFLAGS) $(1) -v,$(1),$(2),$(3))
168168

169169
# ar-option
170170
# Usage: KBUILD_ARFLAGS := $(call ar-option,D)

scripts/Makefile.build

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ cmd_modversions_c = \
190190
$(call cmd_gensymtypes_c,$(KBUILD_SYMTYPES),$(@:.o=.symtypes)) \
191191
> $(@D)/.tmp_$(@F:.o=.ver); \
192192
\
193-
$(LD) $(LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) \
193+
$(LD) $(KBUILD_LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) \
194194
-T $(@D)/.tmp_$(@F:.o=.ver); \
195195
rm -f $(@D)/.tmp_$(@F) $(@D)/.tmp_$(@F:.o=.ver); \
196196
else \
@@ -220,7 +220,7 @@ sub_cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH
220220
"$(if $(CONFIG_CPU_BIG_ENDIAN),big,little)" \
221221
"$(if $(CONFIG_64BIT),64,32)" \
222222
"$(OBJDUMP)" "$(OBJCOPY)" "$(CC) $(KBUILD_CFLAGS)" \
223-
"$(LD) $(LDFLAGS)" "$(NM)" "$(RM)" "$(MV)" \
223+
"$(LD) $(KBUILD_LDFLAGS)" "$(NM)" "$(RM)" "$(MV)" \
224224
"$(if $(part-of-module),1,0)" "$(@)";
225225
recordmcount_source := $(srctree)/scripts/recordmcount.pl
226226
endif # BUILD_C_RECORDMCOUNT
@@ -394,7 +394,7 @@ cmd_modversions_S = \
394394
$(call cmd_gensymtypes_S,$(KBUILD_SYMTYPES),$(@:.o=.symtypes)) \
395395
> $(@D)/.tmp_$(@F:.o=.ver); \
396396
\
397-
$(LD) $(LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) \
397+
$(LD) $(KBUILD_LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) \
398398
-T $(@D)/.tmp_$(@F:.o=.ver); \
399399
rm -f $(@D)/.tmp_$(@F) $(@D)/.tmp_$(@F:.o=.ver); \
400400
else \

scripts/Makefile.lib

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ a_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \
162162
cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \
163163
$(__cpp_flags)
164164

165-
ld_flags = $(LDFLAGS) $(ldflags-y) $(LDFLAGS_$(@F))
165+
ld_flags = $(KBUILD_LDFLAGS) $(ldflags-y) $(LDFLAGS_$(@F))
166166

167167
DTC_INCLUDE := $(srctree)/scripts/dtc/include-prefixes
168168

scripts/Makefile.modpost

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(SRCARCH)/Makefile.postlink)
120120
# Step 6), final link of the modules with optional arch pass after final link
121121
quiet_cmd_ld_ko_o = LD [M] $@
122122
cmd_ld_ko_o = \
123-
$(LD) -r $(LDFLAGS) \
123+
$(LD) -r $(KBUILD_LDFLAGS) \
124124
$(KBUILD_LDFLAGS_MODULE) $(LDFLAGS_MODULE) \
125125
-o $@ $(filter-out FORCE,$^) ; \
126126
$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true)

0 commit comments

Comments
 (0)