[PATCH] LoongArch: vDSO: Remove --hash-style=sysv

Xi Ruoyao posted 1 patch 9 months, 4 weeks ago
arch/loongarch/vdso/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] LoongArch: vDSO: Remove --hash-style=sysv
Posted by Xi Ruoyao 9 months, 4 weeks ago
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.

In the past we really had an unaddressed issue: the vdso selftests did
not know how to process .gnu.hash.  But it has been addressed by commit
e0746bde6f82 ("selftests/vDSO: support DT_GNU_HASH") now.

Just drop the option and rely on the linker default, which is likely
"both" (AOSC) or "gnu" (Arch, Debian, Gentoo, LFS) on all LoongArch
distros.

Similar to commit 6b7e26547fad ("x86/vdso: Emit a GNU hash") and commit
48f6430505c0 ("arm64/vdso: Remove --hash-style=sysv").

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
Re: [PATCH] LoongArch: vDSO: Remove --hash-style=sysv
Posted by Huacai Chen 9 months, 4 weeks ago
Hi, Ruoyao,

On Fri, Feb 21, 2025 at 5:25 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.
>
> In the past we really had an unaddressed issue: the vdso selftests did
> not know how to process .gnu.hash.  But it has been addressed by commit
> e0746bde6f82 ("selftests/vDSO: support DT_GNU_HASH") now.
>
> Just drop the option and rely on the linker default, which is likely
> "both" (AOSC) or "gnu" (Arch, Debian, Gentoo, LFS) on all LoongArch
> distros.
What about changing to "--hash-style=both" as most architectures do?

Huacai

>
> Similar to commit 6b7e26547fad ("x86/vdso: Emit a GNU hash") and commit
> 48f6430505c0 ("arm64/vdso: Remove --hash-style=sysv").
>
> 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
>
Re: [PATCH] LoongArch: vDSO: Remove --hash-style=sysv
Posted by Xi Ruoyao 9 months, 4 weeks ago
On Fri, 2025-02-21 at 17:47 +0800, Huacai Chen wrote:
> Hi, Ruoyao,
> 
> On Fri, Feb 21, 2025 at 5:25 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.
> > 
> > In the past we really had an unaddressed issue: the vdso selftests did
> > not know how to process .gnu.hash.  But it has been addressed by commit
> > e0746bde6f82 ("selftests/vDSO: support DT_GNU_HASH") now.
> > 
> > Just drop the option and rely on the linker default, which is likely
> > "both" (AOSC) or "gnu" (Arch, Debian, Gentoo, LFS) on all LoongArch
> > distros.
> What about changing to "--hash-style=both" as most architectures do?

IMO we are more close to ARM64 for the aspect that there are no libc
(glibc or musl) releases lacking GNU hash support, so I prefer the ARM64
way.

Maybe this should be changed for some of other architectures (RISC-V and
C-SKY?) as well because I guess the only reason they used "both" was
"hey, without this the self tests don't work on Debian" but this is
resolved now.  Adding a few recipients and Cc for discussion.

-- 
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University
Re: [PATCH] LoongArch: vDSO: Remove --hash-style=sysv
Posted by Huacai Chen 9 months, 4 weeks ago
On Fri, Feb 21, 2025 at 6:23 PM Xi Ruoyao <xry111@xry111.site> wrote:
>
> On Fri, 2025-02-21 at 17:47 +0800, Huacai Chen wrote:
> > Hi, Ruoyao,
> >
> > On Fri, Feb 21, 2025 at 5:25 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.
> > >
> > > In the past we really had an unaddressed issue: the vdso selftests did
> > > not know how to process .gnu.hash.  But it has been addressed by commit
> > > e0746bde6f82 ("selftests/vDSO: support DT_GNU_HASH") now.
> > >
> > > Just drop the option and rely on the linker default, which is likely
> > > "both" (AOSC) or "gnu" (Arch, Debian, Gentoo, LFS) on all LoongArch
> > > distros.
> > What about changing to "--hash-style=both" as most architectures do?
>
> IMO we are more close to ARM64 for the aspect that there are no libc
> (glibc or musl) releases lacking GNU hash support, so I prefer the ARM64
> way.
>
> Maybe this should be changed for some of other architectures (RISC-V and
> C-SKY?) as well because I guess the only reason they used "both" was
> "hey, without this the self tests don't work on Debian" but this is
> resolved now.  Adding a few recipients and Cc for discussion.
OK, maybe we can change it for RISC-V/C-SKY and see what they will.

Huacai

>
> --
> Xi Ruoyao <xry111@xry111.site>
> School of Aerospace Science and Technology, Xidian University
Re: [PATCH] LoongArch: vDSO: Remove --hash-style=sysv
Posted by Fangrui Song 9 months, 3 weeks ago
On Fri, Feb 21, 2025 at 2:26 AM Huacai Chen <chenhuacai@kernel.org> wrote:
>
> On Fri, Feb 21, 2025 at 6:23 PM Xi Ruoyao <xry111@xry111.site> wrote:
> >
> > On Fri, 2025-02-21 at 17:47 +0800, Huacai Chen wrote:
> > > Hi, Ruoyao,
> > >
> > > On Fri, Feb 21, 2025 at 5:25 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.
> > > >
> > > > In the past we really had an unaddressed issue: the vdso selftests did
> > > > not know how to process .gnu.hash.  But it has been addressed by commit
> > > > e0746bde6f82 ("selftests/vDSO: support DT_GNU_HASH") now.
> > > >
> > > > Just drop the option and rely on the linker default, which is likely
> > > > "both" (AOSC) or "gnu" (Arch, Debian, Gentoo, LFS) on all LoongArch
> > > > distros.
> > > What about changing to "--hash-style=both" as most architectures do?
> >
> > IMO we are more close to ARM64 for the aspect that there are no libc
> > (glibc or musl) releases lacking GNU hash support, so I prefer the ARM64
> > way.
> >
> > Maybe this should be changed for some of other architectures (RISC-V and
> > C-SKY?) as well because I guess the only reason they used "both" was
> > "hey, without this the self tests don't work on Debian" but this is
> > resolved now.  Adding a few recipients and Cc for discussion.
> OK, maybe we can change it for RISC-V/C-SKY and see what they will.
>
> Huacai
>
> >
> > --
> > Xi Ruoyao <xry111@xry111.site>
> > School of Aerospace Science and Technology, Xidian University

Agreed that as selftests has been fixed, --hash-style=sysv can be
removed from more arches.
arch/arm64/kernel/vdso/Makefile has already removed the option.

(
I probably should add more information to
https://maskray.me/blog/2022-08-21-glibc-and-dt-gnu-hash :)
)