* [PATCH v2] sh: Do not use hyphen in exported variable name
@ 2025-07-17 14:47 Ben Hutchings
2025-07-26 15:12 ` John Paul Adrian Glaubitz
0 siblings, 1 reply; 2+ messages in thread
From: Ben Hutchings @ 2025-07-17 14:47 UTC (permalink / raw)
To: John Paul Adrian Glaubitz; +Cc: linux-sh
[-- Attachment #1: Type: text/plain, Size: 3862 bytes --]
arch/sh/Makefile defines and exports ld-bfd to be used by
arch/sh/boot/compressed/Makefile and arch/sh/boot/romimage/Makefile.
However some shells, including dash, will not pass through environment
variables whose name includes a hyphen. Usually GNU make does not use
a shell to recurse, but if e.g. $(srctree) contains '~' it will use a
shell here.
Other instances of this problem were previously fixed by commits
2bfbe7881ee0 "kbuild: Do not use hyphen in exported variable name"
and 82977af93a0d "sh: rename suffix-y to suffix_y".
Rename the variable to ld_bfd.
References: https://buildd.debian.org/status/fetch.php?pkg=linux&arch=sh4&ver=4.13%7Erc5-1%7Eexp1&stamp=1502943967&raw=0
Fixes: 7b022d07a0fd ("sh: Tidy up the ldscript output format specifier.")
Signed-off-by: Ben Hutchings <benh@debian.org>
---
v2: Updated after the use of suffix-y was fixed separately.
v1 is archived at
https://lore.kernel.org/linux-sh/20170819213109.GJ18698@decadent.org.uk/
arch/sh/Makefile | 10 +++++-----
arch/sh/boot/compressed/Makefile | 4 ++--
arch/sh/boot/romimage/Makefile | 4 ++--
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/arch/sh/Makefile b/arch/sh/Makefile
index cab2f9c011a8..7b420424b6d7 100644
--- a/arch/sh/Makefile
+++ b/arch/sh/Makefile
@@ -103,16 +103,16 @@ UTS_MACHINE := sh
LDFLAGS_vmlinux += -e _stext
ifdef CONFIG_CPU_LITTLE_ENDIAN
-ld-bfd := elf32-sh-linux
-LDFLAGS_vmlinux += --defsym jiffies=jiffies_64 --oformat $(ld-bfd)
+ld_bfd := elf32-sh-linux
+LDFLAGS_vmlinux += --defsym jiffies=jiffies_64 --oformat $(ld_bfd)
KBUILD_LDFLAGS += -EL
else
-ld-bfd := elf32-shbig-linux
-LDFLAGS_vmlinux += --defsym jiffies=jiffies_64+4 --oformat $(ld-bfd)
+ld_bfd := elf32-shbig-linux
+LDFLAGS_vmlinux += --defsym jiffies=jiffies_64+4 --oformat $(ld_bfd)
KBUILD_LDFLAGS += -EB
endif
-export ld-bfd
+export ld_bfd
# Mach groups
machdir-$(CONFIG_SOLUTION_ENGINE) += mach-se
diff --git a/arch/sh/boot/compressed/Makefile b/arch/sh/boot/compressed/Makefile
index 8bc319ff54bf..58df491778b2 100644
--- a/arch/sh/boot/compressed/Makefile
+++ b/arch/sh/boot/compressed/Makefile
@@ -27,7 +27,7 @@ endif
ccflags-remove-$(CONFIG_MCOUNT) += -pg
-LDFLAGS_vmlinux := --oformat $(ld-bfd) -Ttext $(IMAGE_OFFSET) -e startup \
+LDFLAGS_vmlinux := --oformat $(ld_bfd) -Ttext $(IMAGE_OFFSET) -e startup \
-T $(obj)/../../kernel/vmlinux.lds
KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
@@ -51,7 +51,7 @@ $(obj)/vmlinux.bin.lzo: $(obj)/vmlinux.bin FORCE
OBJCOPYFLAGS += -R .empty_zero_page
-LDFLAGS_piggy.o := -r --format binary --oformat $(ld-bfd) -T
+LDFLAGS_piggy.o := -r --format binary --oformat $(ld_bfd) -T
$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.$(suffix_y) FORCE
$(call if_changed,ld)
diff --git a/arch/sh/boot/romimage/Makefile b/arch/sh/boot/romimage/Makefile
index c7c8be58400c..17b03df0a8de 100644
--- a/arch/sh/boot/romimage/Makefile
+++ b/arch/sh/boot/romimage/Makefile
@@ -13,7 +13,7 @@ mmcif-obj-$(CONFIG_CPU_SUBTYPE_SH7724) := $(obj)/mmcif-sh7724.o
load-$(CONFIG_ROMIMAGE_MMCIF) := $(mmcif-load-y)
obj-$(CONFIG_ROMIMAGE_MMCIF) := $(mmcif-obj-y)
-LDFLAGS_vmlinux := --oformat $(ld-bfd) -Ttext $(load-y) -e romstart \
+LDFLAGS_vmlinux := --oformat $(ld_bfd) -Ttext $(load-y) -e romstart \
-T $(obj)/../../kernel/vmlinux.lds
$(obj)/vmlinux: $(obj)/head.o $(obj-y) $(obj)/piggy.o FORCE
@@ -24,7 +24,7 @@ OBJCOPYFLAGS += -j .empty_zero_page
$(obj)/zeropage.bin: vmlinux FORCE
$(call if_changed,objcopy)
-LDFLAGS_piggy.o := -r --format binary --oformat $(ld-bfd) -T
+LDFLAGS_piggy.o := -r --format binary --oformat $(ld_bfd) -T
$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/zeropage.bin arch/sh/boot/zImage FORCE
$(call if_changed,ld)
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] sh: Do not use hyphen in exported variable name
2025-07-17 14:47 [PATCH v2] sh: Do not use hyphen in exported variable name Ben Hutchings
@ 2025-07-26 15:12 ` John Paul Adrian Glaubitz
0 siblings, 0 replies; 2+ messages in thread
From: John Paul Adrian Glaubitz @ 2025-07-26 15:12 UTC (permalink / raw)
To: Ben Hutchings; +Cc: linux-sh
Hi Ben,
On Thu, 2025-07-17 at 16:47 +0200, Ben Hutchings wrote:
> arch/sh/Makefile defines and exports ld-bfd to be used by
> arch/sh/boot/compressed/Makefile and arch/sh/boot/romimage/Makefile.
> However some shells, including dash, will not pass through environment
> variables whose name includes a hyphen. Usually GNU make does not use
> a shell to recurse, but if e.g. $(srctree) contains '~' it will use a
> shell here.
>
> Other instances of this problem were previously fixed by commits
> 2bfbe7881ee0 "kbuild: Do not use hyphen in exported variable name"
> and 82977af93a0d "sh: rename suffix-y to suffix_y".
>
> Rename the variable to ld_bfd.
>
> References: https://buildd.debian.org/status/fetch.php?pkg=linux&arch=sh4&ver=4.13%7Erc5-1%7Eexp1&stamp=1502943967&raw=0
> Fixes: 7b022d07a0fd ("sh: Tidy up the ldscript output format specifier.")
> Signed-off-by: Ben Hutchings <benh@debian.org>
> ---
> v2: Updated after the use of suffix-y was fixed separately.
>
> v1 is archived at
> https://lore.kernel.org/linux-sh/20170819213109.GJ18698@decadent.org.uk/
>
> arch/sh/Makefile | 10 +++++-----
> arch/sh/boot/compressed/Makefile | 4 ++--
> arch/sh/boot/romimage/Makefile | 4 ++--
> 3 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/arch/sh/Makefile b/arch/sh/Makefile
> index cab2f9c011a8..7b420424b6d7 100644
> --- a/arch/sh/Makefile
> +++ b/arch/sh/Makefile
> @@ -103,16 +103,16 @@ UTS_MACHINE := sh
> LDFLAGS_vmlinux += -e _stext
>
> ifdef CONFIG_CPU_LITTLE_ENDIAN
> -ld-bfd := elf32-sh-linux
> -LDFLAGS_vmlinux += --defsym jiffies=jiffies_64 --oformat $(ld-bfd)
> +ld_bfd := elf32-sh-linux
> +LDFLAGS_vmlinux += --defsym jiffies=jiffies_64 --oformat $(ld_bfd)
> KBUILD_LDFLAGS += -EL
> else
> -ld-bfd := elf32-shbig-linux
> -LDFLAGS_vmlinux += --defsym jiffies=jiffies_64+4 --oformat $(ld-bfd)
> +ld_bfd := elf32-shbig-linux
> +LDFLAGS_vmlinux += --defsym jiffies=jiffies_64+4 --oformat $(ld_bfd)
> KBUILD_LDFLAGS += -EB
> endif
>
> -export ld-bfd
> +export ld_bfd
>
> # Mach groups
> machdir-$(CONFIG_SOLUTION_ENGINE) += mach-se
> diff --git a/arch/sh/boot/compressed/Makefile b/arch/sh/boot/compressed/Makefile
> index 8bc319ff54bf..58df491778b2 100644
> --- a/arch/sh/boot/compressed/Makefile
> +++ b/arch/sh/boot/compressed/Makefile
> @@ -27,7 +27,7 @@ endif
>
> ccflags-remove-$(CONFIG_MCOUNT) += -pg
>
> -LDFLAGS_vmlinux := --oformat $(ld-bfd) -Ttext $(IMAGE_OFFSET) -e startup \
> +LDFLAGS_vmlinux := --oformat $(ld_bfd) -Ttext $(IMAGE_OFFSET) -e startup \
> -T $(obj)/../../kernel/vmlinux.lds
>
> KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
> @@ -51,7 +51,7 @@ $(obj)/vmlinux.bin.lzo: $(obj)/vmlinux.bin FORCE
>
> OBJCOPYFLAGS += -R .empty_zero_page
>
> -LDFLAGS_piggy.o := -r --format binary --oformat $(ld-bfd) -T
> +LDFLAGS_piggy.o := -r --format binary --oformat $(ld_bfd) -T
>
> $(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.$(suffix_y) FORCE
> $(call if_changed,ld)
> diff --git a/arch/sh/boot/romimage/Makefile b/arch/sh/boot/romimage/Makefile
> index c7c8be58400c..17b03df0a8de 100644
> --- a/arch/sh/boot/romimage/Makefile
> +++ b/arch/sh/boot/romimage/Makefile
> @@ -13,7 +13,7 @@ mmcif-obj-$(CONFIG_CPU_SUBTYPE_SH7724) := $(obj)/mmcif-sh7724.o
> load-$(CONFIG_ROMIMAGE_MMCIF) := $(mmcif-load-y)
> obj-$(CONFIG_ROMIMAGE_MMCIF) := $(mmcif-obj-y)
>
> -LDFLAGS_vmlinux := --oformat $(ld-bfd) -Ttext $(load-y) -e romstart \
> +LDFLAGS_vmlinux := --oformat $(ld_bfd) -Ttext $(load-y) -e romstart \
> -T $(obj)/../../kernel/vmlinux.lds
>
> $(obj)/vmlinux: $(obj)/head.o $(obj-y) $(obj)/piggy.o FORCE
> @@ -24,7 +24,7 @@ OBJCOPYFLAGS += -j .empty_zero_page
> $(obj)/zeropage.bin: vmlinux FORCE
> $(call if_changed,objcopy)
>
> -LDFLAGS_piggy.o := -r --format binary --oformat $(ld-bfd) -T
> +LDFLAGS_piggy.o := -r --format binary --oformat $(ld_bfd) -T
>
> $(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/zeropage.bin arch/sh/boot/zImage FORCE
> $(call if_changed,ld)
Thanks for fixing this! Looks good to me. I will pick this up for v6.17.
Reviewed-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Adrian
--
.''`. John Paul Adrian Glaubitz
: :' : Debian Developer
`. `' Physicist
`- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-07-26 15:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-17 14:47 [PATCH v2] sh: Do not use hyphen in exported variable name Ben Hutchings
2025-07-26 15:12 ` John Paul Adrian Glaubitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).