linux-csky.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] Drop explicit --hash-style= setting for new
@ 2025-02-24 11:20 Xi Ruoyao
  2025-02-24 11:20 ` [PATCH 1/3] riscv: vDSO: Remove --hash-style=both Xi Ruoyao
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Xi Ruoyao @ 2025-02-24 11:20 UTC (permalink / raw)
  To: Guo Ren, Huacai Chen, WANG Xuerui, Palmer Dabbelt, Fangrui Song
  Cc: Tiezhu Yang, linux-csky, loongarch, linux-riscv, linux-arch,
	linux-kernel, Xi Ruoyao

For riscv, csky, and LoongArch, GNU hash had already become the de-facto
standard when they borned, so there's no Glibc/Musl releases for them
without GNU hash support, and the traditional SysV hash is just wasting
space for them.

Remove those settings and follow the distro toolchain default, which is
likely --hash-style=gnu.  In the past it could break vDSO self tests,
but now the issue has been addressed by commit
e0746bde6f82 ("selftests/vDSO: support DT_GNU_HASH").

Xi Ruoyao (3):
  riscv: vDSO: Remove --hash-style=both
  csky: vDSO: Remove --hash-style=both
  LoongArch: vDSO: Remove --hash-style=sysv

 arch/csky/kernel/vdso/Makefile  | 2 +-
 arch/loongarch/vdso/Makefile    | 2 +-
 arch/riscv/kernel/vdso/Makefile | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

-- 
2.48.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/3] riscv: vDSO: Remove --hash-style=both
  2025-02-24 11:20 [PATCH 0/3] Drop explicit --hash-style= setting for new Xi Ruoyao
@ 2025-02-24 11:20 ` Xi Ruoyao
  2025-02-24 11:20 ` [PATCH 2/3] csky: " Xi Ruoyao
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Xi Ruoyao @ 2025-02-24 11:20 UTC (permalink / raw)
  To: Guo Ren, Huacai Chen, WANG Xuerui, Palmer Dabbelt, Fangrui Song
  Cc: Tiezhu Yang, linux-csky, loongarch, linux-riscv, linux-arch,
	linux-kernel, Xi Ruoyao

When RISC-V borned, DT_GNU_HASH had already became the de-facto
standard so DT_HASH is just wasting storage space.  Remove the explicit
--hash-style=both setting and rely on the distro toolchain default,
which is most likely "gnu" (i.e. generating only DT_GNU_HASH, no
DT_HASH).

Following the logic of commit 48f6430505c0
("arm64/vdso: Remove --hash-style=sysv").

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
---
 arch/riscv/kernel/vdso/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/riscv/kernel/vdso/Makefile b/arch/riscv/kernel/vdso/Makefile
index 9a1b555e8733..ecee348af9ce 100644
--- a/arch/riscv/kernel/vdso/Makefile
+++ b/arch/riscv/kernel/vdso/Makefile
@@ -47,7 +47,7 @@ $(obj)/vdso.o: $(obj)/vdso.so
 $(obj)/vdso.so.dbg: $(obj)/vdso.lds $(obj-vdso) FORCE
 	$(call if_changed,vdsold_and_check)
 LDFLAGS_vdso.so.dbg = -shared -soname=linux-vdso.so.1 \
-	--build-id=sha1 --hash-style=both --eh-frame-hdr
+	--build-id=sha1 --eh-frame-hdr
 
 # strip rule for the .so file
 $(obj)/%.so: OBJCOPYFLAGS := -S
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/3] csky: vDSO: Remove --hash-style=both
  2025-02-24 11:20 [PATCH 0/3] Drop explicit --hash-style= setting for new Xi Ruoyao
  2025-02-24 11:20 ` [PATCH 1/3] riscv: vDSO: Remove --hash-style=both Xi Ruoyao
@ 2025-02-24 11:20 ` Xi Ruoyao
  2025-02-24 11:20 ` [PATCH 3/3] LoongArch: vDSO: Remove --hash-style=sysv Xi Ruoyao
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Xi Ruoyao @ 2025-02-24 11:20 UTC (permalink / raw)
  To: Guo Ren, Huacai Chen, WANG Xuerui, Palmer Dabbelt, Fangrui Song
  Cc: Tiezhu Yang, linux-csky, loongarch, linux-riscv, linux-arch,
	linux-kernel, Xi Ruoyao

When CSKY borned, DT_GNU_HASH had already became the de-facto
standard so DT_HASH is just wasting storage space.  Remove the explicit
--hash-style=both setting and rely on the distro toolchain default,
which is most likely "gnu" (i.e. generating only DT_GNU_HASH, no
DT_HASH).

Following the logic of commit 48f6430505c0
("arm64/vdso: Remove --hash-style=sysv").

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
---
 arch/csky/kernel/vdso/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/csky/kernel/vdso/Makefile b/arch/csky/kernel/vdso/Makefile
index 069ef0b17fe5..3e100e6cf72f 100644
--- a/arch/csky/kernel/vdso/Makefile
+++ b/arch/csky/kernel/vdso/Makefile
@@ -29,7 +29,7 @@ SYSCFLAGS_vdso.so.dbg = $(c_flags)
 $(obj)/vdso.so.dbg: $(obj)/vdso.lds $(obj-vdso) FORCE
 	$(call if_changed,vdsold)
 SYSCFLAGS_vdso.so.dbg = -shared -s -Wl,-soname=linux-vdso.so.1 \
-	-Wl,--build-id=sha1 -Wl,--hash-style=both
+	-Wl,--build-id=sha1
 
 $(obj)/vdso-syms.S: $(obj)/vdso.so FORCE
 	$(call if_changed,so2s)
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/3] LoongArch: vDSO: Remove --hash-style=sysv
  2025-02-24 11:20 [PATCH 0/3] Drop explicit --hash-style= setting for new Xi Ruoyao
  2025-02-24 11:20 ` [PATCH 1/3] riscv: vDSO: Remove --hash-style=both Xi Ruoyao
  2025-02-24 11:20 ` [PATCH 2/3] csky: " Xi Ruoyao
@ 2025-02-24 11:20 ` Xi Ruoyao
  2025-03-30  9:55   ` Huacai Chen
  2025-03-05 13:27 ` Ping: [PATCH 0/3] Drop explicit --hash-style= setting for new Xi Ruoyao
  2025-05-09 17:30 ` patchwork-bot+linux-riscv
  4 siblings, 1 reply; 9+ messages in thread
From: Xi Ruoyao @ 2025-02-24 11:20 UTC (permalink / raw)
  To: Guo Ren, Huacai Chen, WANG Xuerui, Palmer Dabbelt, Fangrui Song
  Cc: Tiezhu Yang, linux-csky, loongarch, linux-riscv, linux-arch,
	linux-kernel, Xi Ruoyao

glibc added support for .gnu.hash in 2006 and .hash has been obsoleted
far before the first LoongArch CPU was taped.  Using
--hash-style=sysv might imply unaddressed issues and confuse readers.

Some architectures use an explicit --hash-style=both here, but
DT_GNU_HASH has already been supported by Glibc and Musl and become the
de-facto standard of the distros when the first LoongArch CPU was taped.
So DT_HASH seems just wasting storage space for LoongArch.

Just drop the option and rely on the linker default, which is likely
"gnu" (Arch, Debian, Gentoo, LFS) on all LoongArch distros (confirmed on
Arch, Debian, Gentoo, and LFS; AOSC now defaults to "both" but it seems
just an oversight).

Following the logic of commit 48f6430505c0
("arm64/vdso: Remove --hash-style=sysv").

Link: https://github.com/AOSC-Dev/aosc-os-abbs/pull/9796
Signed-off-by: Xi Ruoyao <xry111@xry111.site>
---
 arch/loongarch/vdso/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/loongarch/vdso/Makefile b/arch/loongarch/vdso/Makefile
index fdde1bcd4e26..abaf87c58f9d 100644
--- a/arch/loongarch/vdso/Makefile
+++ b/arch/loongarch/vdso/Makefile
@@ -37,7 +37,7 @@ endif
 # VDSO linker flags.
 ldflags-y := -Bsymbolic --no-undefined -soname=linux-vdso.so.1 \
 	$(filter -E%,$(KBUILD_CFLAGS)) -nostdlib -shared \
-	--hash-style=sysv --build-id -T
+	--build-id -T
 
 #
 # Shared build commands.
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Ping: [PATCH 0/3] Drop explicit --hash-style= setting for new
  2025-02-24 11:20 [PATCH 0/3] Drop explicit --hash-style= setting for new Xi Ruoyao
                   ` (2 preceding siblings ...)
  2025-02-24 11:20 ` [PATCH 3/3] LoongArch: vDSO: Remove --hash-style=sysv Xi Ruoyao
@ 2025-03-05 13:27 ` Xi Ruoyao
  2025-03-10  2:13   ` Guo Ren
  2025-05-09 17:30 ` patchwork-bot+linux-riscv
  4 siblings, 1 reply; 9+ messages in thread
From: Xi Ruoyao @ 2025-03-05 13:27 UTC (permalink / raw)
  To: Guo Ren, Huacai Chen, WANG Xuerui, Palmer Dabbelt, Fangrui Song
  Cc: Tiezhu Yang, linux-csky, loongarch, linux-riscv, linux-arch,
	linux-kernel

Ping.

On Mon, 2025-02-24 at 19:20 +0800, Xi Ruoyao wrote:
> For riscv, csky, and LoongArch, GNU hash had already become the de-
> facto
> standard when they borned, so there's no Glibc/Musl releases for them
> without GNU hash support, and the traditional SysV hash is just
> wasting
> space for them.
> 
> Remove those settings and follow the distro toolchain default, which
> is
> likely --hash-style=gnu.  In the past it could break vDSO self tests,
> but now the issue has been addressed by commit
> e0746bde6f82 ("selftests/vDSO: support DT_GNU_HASH").
> 
> Xi Ruoyao (3):
>   riscv: vDSO: Remove --hash-style=both
>   csky: vDSO: Remove --hash-style=both
>   LoongArch: vDSO: Remove --hash-style=sysv
> 
>  arch/csky/kernel/vdso/Makefile  | 2 +-
>  arch/loongarch/vdso/Makefile    | 2 +-
>  arch/riscv/kernel/vdso/Makefile | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 

-- 
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Ping: [PATCH 0/3] Drop explicit --hash-style= setting for new
  2025-03-05 13:27 ` Ping: [PATCH 0/3] Drop explicit --hash-style= setting for new Xi Ruoyao
@ 2025-03-10  2:13   ` Guo Ren
  2025-03-30 12:18     ` Xi Ruoyao
  0 siblings, 1 reply; 9+ messages in thread
From: Guo Ren @ 2025-03-10  2:13 UTC (permalink / raw)
  To: Xi Ruoyao
  Cc: Huacai Chen, WANG Xuerui, Palmer Dabbelt, Fangrui Song,
	Tiezhu Yang, linux-csky, loongarch, linux-riscv, linux-arch,
	linux-kernel

On Wed, Mar 5, 2025 at 9:27 PM Xi Ruoyao <xry111@xry111.site> wrote:
>
> Ping.
>
> On Mon, 2025-02-24 at 19:20 +0800, Xi Ruoyao wrote:
> > For riscv, csky, and LoongArch, GNU hash had already become the de-
> > facto
> > standard when they borned, so there's no Glibc/Musl releases for them
> > without GNU hash support, and the traditional SysV hash is just
> > wasting
> > space for them.
> >
> > Remove those settings and follow the distro toolchain default, which
> > is
> > likely --hash-style=gnu.  In the past it could break vDSO self tests,
> > but now the issue has been addressed by commit
> > e0746bde6f82 ("selftests/vDSO: support DT_GNU_HASH").
> >
> > Xi Ruoyao (3):
> >   riscv: vDSO: Remove --hash-style=both
The patch's comment is incorrect; when I removed --hash-style=both,
the output still contained the HASH, and no space was saved.

--hash-style=both and after the patch are the same:
Section Headers:
  [Nr] Name              Type             Address           Offset
       Size              EntSize          Flags  Link  Info  Align
  [ 0]                   NULL             0000000000000000  00000000
       0000000000000000  0000000000000000           0     0     0
  [ 1] .hash             HASH             0000000000000120  00000120
       000000000000003c  0000000000000004   A       3     0     8
  [ 2] .gnu.hash         GNU_HASH         0000000000000160  00000160
       0000000000000044  0000000000000000   A       3     0     8

But, --hash-style=gnu could save space:
Section Headers:
  [Nr] Name              Type             Address           Offset
       Size              EntSize          Flags  Link  Info  Align
  [ 0]                   NULL             0000000000000000  00000000
       0000000000000000  0000000000000000           0     0     0
  [ 1] .gnu.hash         GNU_HASH         0000000000000120  00000120
       0000000000000044  0000000000000000   A       2     0     8


Here is my GCC VERSION:
Using built-in specs.
COLLECT_GCC=/rvhome/ren.guo/source/toolchain/rv64lp64/bin/riscv64-unknown-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/rvhome/ren.guo/source/toolchain/rv64lp64/bin/../libexec/gcc/riscv64-unknown-linux-gnu/13.2.0/lto-wrapper
Target: riscv64-unknown-linux-gnu
Configured with:
/home/runner/work/riscv-gnu-toolchain/riscv-gnu-toolchain/gcc/configure
--target=riscv64-unknown-linux-gnu --prefix=/opt/riscv
--with-sysroot=/opt/riscv/sysroot --with-pkgversion=
--with-system-zlib --enable-shared --enable-tls
--enable-languages=c,c++,fortran --disable-libmudflap --disable-libssp
--disable-libquadmath --disable-libsanitizer --disable-nls
--disable-bootstrap --src=.././gcc --disable-default-pie
--disable-multilib --with-abi=lp64d --with-arch=rv64gc
--with-tune=rocket --with-isa-spec=20191213 'CFLAGS_FOR_TARGET=-O2
-mcmodel=medlow' 'CXXFLAGS_FOR_TARGET=-O2    -mcmodel=medlow'
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 13.2.0 ()

So, do you mean "--hash-style=gnu"?

> >   csky: vDSO: Remove --hash-style=both
> >   LoongArch: vDSO: Remove --hash-style=sysv
> >
> >  arch/csky/kernel/vdso/Makefile  | 2 +-
> >  arch/loongarch/vdso/Makefile    | 2 +-
> >  arch/riscv/kernel/vdso/Makefile | 2 +-
> >  3 files changed, 3 insertions(+), 3 deletions(-)
> >
>
> --
> Xi Ruoyao <xry111@xry111.site>
> School of Aerospace Science and Technology, Xidian University



-- 
Best Regards
 Guo Ren

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/3] LoongArch: vDSO: Remove --hash-style=sysv
  2025-02-24 11:20 ` [PATCH 3/3] LoongArch: vDSO: Remove --hash-style=sysv Xi Ruoyao
@ 2025-03-30  9:55   ` Huacai Chen
  0 siblings, 0 replies; 9+ messages in thread
From: Huacai Chen @ 2025-03-30  9:55 UTC (permalink / raw)
  To: Xi Ruoyao
  Cc: Guo Ren, WANG Xuerui, Palmer Dabbelt, Fangrui Song, Tiezhu Yang,
	linux-csky, loongarch, linux-riscv, linux-arch, linux-kernel

Applied, thanks.

Huacai

On Mon, Feb 24, 2025 at 7:21 PM Xi Ruoyao <xry111@xry111.site> wrote:
>
> glibc added support for .gnu.hash in 2006 and .hash has been obsoleted
> far before the first LoongArch CPU was taped.  Using
> --hash-style=sysv might imply unaddressed issues and confuse readers.
>
> Some architectures use an explicit --hash-style=both here, but
> DT_GNU_HASH has already been supported by Glibc and Musl and become the
> de-facto standard of the distros when the first LoongArch CPU was taped.
> So DT_HASH seems just wasting storage space for LoongArch.
>
> Just drop the option and rely on the linker default, which is likely
> "gnu" (Arch, Debian, Gentoo, LFS) on all LoongArch distros (confirmed on
> Arch, Debian, Gentoo, and LFS; AOSC now defaults to "both" but it seems
> just an oversight).
>
> Following the logic of commit 48f6430505c0
> ("arm64/vdso: Remove --hash-style=sysv").
>
> Link: https://github.com/AOSC-Dev/aosc-os-abbs/pull/9796
> Signed-off-by: Xi Ruoyao <xry111@xry111.site>
> ---
>  arch/loongarch/vdso/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/loongarch/vdso/Makefile b/arch/loongarch/vdso/Makefile
> index fdde1bcd4e26..abaf87c58f9d 100644
> --- a/arch/loongarch/vdso/Makefile
> +++ b/arch/loongarch/vdso/Makefile
> @@ -37,7 +37,7 @@ endif
>  # VDSO linker flags.
>  ldflags-y := -Bsymbolic --no-undefined -soname=linux-vdso.so.1 \
>         $(filter -E%,$(KBUILD_CFLAGS)) -nostdlib -shared \
> -       --hash-style=sysv --build-id -T
> +       --build-id -T
>
>  #
>  # Shared build commands.
> --
> 2.48.1
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Ping: [PATCH 0/3] Drop explicit --hash-style= setting for new
  2025-03-10  2:13   ` Guo Ren
@ 2025-03-30 12:18     ` Xi Ruoyao
  0 siblings, 0 replies; 9+ messages in thread
From: Xi Ruoyao @ 2025-03-30 12:18 UTC (permalink / raw)
  To: Guo Ren
  Cc: Huacai Chen, WANG Xuerui, Palmer Dabbelt, Fangrui Song,
	Tiezhu Yang, linux-csky, loongarch, linux-riscv, linux-arch,
	linux-kernel

On Mon, 2025-03-10 at 10:13 +0800, Guo Ren wrote:
> On Wed, Mar 5, 2025 at 9:27 PM Xi Ruoyao <xry111@xry111.site> wrote:
> > 
> > Ping.
> > 
> > On Mon, 2025-02-24 at 19:20 +0800, Xi Ruoyao wrote:
> > > For riscv, csky, and LoongArch, GNU hash had already become the de-
> > > facto
> > > standard when they borned, so there's no Glibc/Musl releases for them
> > > without GNU hash support, and the traditional SysV hash is just
> > > wasting
> > > space for them.
> > > 
> > > Remove those settings and follow the distro toolchain default, which
> > > is
> > > likely --hash-style=gnu.  In the past it could break vDSO self tests,
> > > but now the issue has been addressed by commit
> > > e0746bde6f82 ("selftests/vDSO: support DT_GNU_HASH").
> > > 
> > > Xi Ruoyao (3):
> > >   riscv: vDSO: Remove --hash-style=both
> The patch's comment is incorrect; when I removed --hash-style=both,
> the output still contained the HASH, and no space was saved.

The idea is following the distro toolchain default (which can be
configured building binutils).

If the distro toolchain default is gnu, we'll use gnu.

If the distro toolchain default is both, the distro is already wasting
space everywhere for (a) some bizarre applications depending on DT_HASH
for some bizzare reason; or (b) an oversight.

In the case of (a) the bizarre application may needs DT_HASH in vDSO as
well, and in the case of (b) it should be fixed for the entire distro,
not only vDSO, for example what we are doing for AOSC:
https://github.com/AOSC-Dev/aosc-os-abbs/pull/9531

-- 
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/3] Drop explicit --hash-style= setting for new
  2025-02-24 11:20 [PATCH 0/3] Drop explicit --hash-style= setting for new Xi Ruoyao
                   ` (3 preceding siblings ...)
  2025-03-05 13:27 ` Ping: [PATCH 0/3] Drop explicit --hash-style= setting for new Xi Ruoyao
@ 2025-05-09 17:30 ` patchwork-bot+linux-riscv
  4 siblings, 0 replies; 9+ messages in thread
From: patchwork-bot+linux-riscv @ 2025-05-09 17:30 UTC (permalink / raw)
  To: Xi Ruoyao
  Cc: linux-riscv, guoren, chenhuacai, kernel, palmer, i, yangtiezhu,
	linux-csky, loongarch, linux-arch, linux-kernel

Hello:

This series was applied to riscv/linux.git (for-next)
by Palmer Dabbelt <palmer@rivosinc.com>:

On Mon, 24 Feb 2025 19:20:39 +0800 you wrote:
> For riscv, csky, and LoongArch, GNU hash had already become the de-facto
> standard when they borned, so there's no Glibc/Musl releases for them
> without GNU hash support, and the traditional SysV hash is just wasting
> space for them.
> 
> Remove those settings and follow the distro toolchain default, which is
> likely --hash-style=gnu.  In the past it could break vDSO self tests,
> but now the issue has been addressed by commit
> e0746bde6f82 ("selftests/vDSO: support DT_GNU_HASH").
> 
> [...]

Here is the summary with links:
  - [1/3] riscv: vDSO: Remove --hash-style=both
    https://git.kernel.org/riscv/c/2940954c1ac5
  - [2/3] csky: vDSO: Remove --hash-style=both
    (no matching commit)
  - [3/3] LoongArch: vDSO: Remove --hash-style=sysv
    (no matching commit)

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-05-09 17:29 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-24 11:20 [PATCH 0/3] Drop explicit --hash-style= setting for new Xi Ruoyao
2025-02-24 11:20 ` [PATCH 1/3] riscv: vDSO: Remove --hash-style=both Xi Ruoyao
2025-02-24 11:20 ` [PATCH 2/3] csky: " Xi Ruoyao
2025-02-24 11:20 ` [PATCH 3/3] LoongArch: vDSO: Remove --hash-style=sysv Xi Ruoyao
2025-03-30  9:55   ` Huacai Chen
2025-03-05 13:27 ` Ping: [PATCH 0/3] Drop explicit --hash-style= setting for new Xi Ruoyao
2025-03-10  2:13   ` Guo Ren
2025-03-30 12:18     ` Xi Ruoyao
2025-05-09 17:30 ` patchwork-bot+linux-riscv

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