Skip to contentSkip to conversation

arm64/vdso: Remove --hash-style=sysv

PATCH Applied Fangrui Song 3 participants 5 messages Jul 18, 2024 – Aug 15, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64/vdso: Remove --hash-style=sysv

glibc added support for .gnu.hash in 2006 and .hash has been obsoleted for more than one decade in many Linux distributions. Using --hash-style=sysv might imply unaddressed issues and confuse readers.

Just drop the option and rely on the linker default, which is likely "both", or "gnu" when the distribution really wants to eliminate sysv hash overhead.

Similar to commit 6b7e26547fad ("x86/vdso: Emit a GNU hash").

---
 arch/arm64/kernel/vdso/Makefile   | 2 +-
 arch/arm64/kernel/vdso32/Makefile | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm64/kernel/vdso/Makefile +1 -1
index d63930c82839..d11da6461278 100644
@@ -21,7 +21,7 @@ btildflags-$(CONFIG_ARM64_BTI_KERNEL) += -z force-bti
 # potential future proofing if we end up with internal calls to the exported
 # routines, as x86 does (see 6f121e548f83 ("x86, vdso: Reimplement vdso.so
 # preparation in build-time C")).
-ldflags-y := -shared -soname=linux-vdso.so.1 --hash-style=sysv	\
+ldflags-y := -shared -soname=linux-vdso.so.1 \
 	     -Bsymbolic --build-id=sha1 -n $(btildflags-y)
 
 ifdef CONFIG_LD_ORPHAN_WARN
arch/arm64/kernel/vdso32/Makefile +1 -1
index cc4508c604b2..25a2cb6317f3 100644
@@ -98,7 +98,7 @@ VDSO_AFLAGS += -D__ASSEMBLY__
 # From arm vDSO Makefile
 VDSO_LDFLAGS += -Bsymbolic --no-undefined -soname=linux-vdso.so.1
 VDSO_LDFLAGS += -z max-page-size=4096 -z common-page-size=4096
-VDSO_LDFLAGS += -shared --hash-style=sysv --build-id=sha1
+VDSO_LDFLAGS += -shared --build-id=sha1
 VDSO_LDFLAGS += --orphan-handling=$(CONFIG_LD_ORPHAN_WARN_LEVEL)
 
 
Signature · 1 line
2.45.2.1089.g2a221341d9-goog
maintainer Applied
#1 lore raw
Quoted 9 lines · Fangrui Song

glibc added support for .gnu.hash in 2006 and .hash has been obsoleted for more than one decade in many Linux distributions. Using --hash-style=sysv might imply unaddressed issues and confuse readers.

Just drop the option and rely on the linker default, which is likely "both", or "gnu" when the distribution really wants to eliminate sysv hash overhead.

[...]

Applied to arm64 (for-next/core), thanks!

[1/1] arm64/vdso: Remove --hash-style=sysv

      https://git.kernel.org/arm64/c/48f6430505c0

Cheers,

Signature · 5 lines
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev
#2 lore raw
In reply to Fangrui Song
Quoted 11 lines · Fangrui Song

glibc added support for .gnu.hash in 2006 and .hash has been obsoleted for more than one decade in many Linux distributions.  Using --hash-style=sysv might imply unaddressed issues and confuse readers.

Just drop the option and rely on the linker default, which is likely "both", or "gnu" when the distribution really wants to eliminate sysv hash overhead.

Similar to commit 6b7e26547fad ("x86/vdso: Emit a GNU hash").

Hi Fangrui,

If I read tools/testing/selftests/vDSO/parse_vdso.c correctly, it does know DT_GNU_HASH as at now. Thus after this change the vDSO selftests are skipped with "Couldn't find __vdso_gettimeofday" etc if the distro enables --hash-style=gnu by default.

So it seems we need to add DT_GNU_HASH support for parse_vdso.c to keep test coverage.

Quoted 31 lines

---
 arch/arm64/kernel/vdso/Makefile   | 2 +-
 arch/arm64/kernel/vdso32/Makefile | 2 +-

 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm64/kernel/vdso/Makefile +1 -1
index d63930c82839..d11da6461278 100644
@@ -21,7 +21,7 @@ btildflags-$(CONFIG_ARM64_BTI_KERNEL) += -z force-bti
  # potential future proofing if we end up with internal calls to the exported
  # routines, as x86 does (see 6f121e548f83 ("x86, vdso: Reimplement vdso.so
  # preparation in build-time C")).
-ldflags-y := -shared -soname=linux-vdso.so.1 --hash-style=sysv	\
+ldflags-y := -shared -soname=linux-vdso.so.1 \
  	     -Bsymbolic --build-id=sha1 -n $(btildflags-y)


 ifdef CONFIG_LD_ORPHAN_WARN

arch/arm64/kernel/vdso32/Makefile +0 -0
index cc4508c604b2..25a2cb6317f3 100644
@@ -98,7 +98,7 @@ VDSO_AFLAGS += -D__ASSEMBLY__
  # From arm vDSO Makefile

 VDSO_LDFLAGS += -Bsymbolic --no-undefined -soname=linux-vdso.so.1 VDSO_LDFLAGS += -z max-page-size=4096 -z common-page-size=4096

arch/arm64/kernel/vdso32/Makefile +1 -1
-VDSO_LDFLAGS += -shared --hash-style=sysv --build-id=sha1
+VDSO_LDFLAGS += -shared --build-id=sha1

 VDSO_LDFLAGS += --orphan-handling=$(CONFIG_LD_ORPHAN_WARN_LEVEL)

Signature · 2 lines
Xi Ruoyao <[email protected]>
School of Aerospace Science and Technology, Xidian University
#3 lore raw
Quoted 16 lines · Xi Ruoyao
Quoted 11 lines · Fangrui Song

glibc added support for .gnu.hash in 2006 and .hash has been obsoleted for more than one decade in many Linux distributions. Using --hash-style=sysv might imply unaddressed issues and confuse readers.

Just drop the option and rely on the linker default, which is likely "both", or "gnu" when the distribution really wants to eliminate sysv hash overhead.

Similar to commit 6b7e26547fad ("x86/vdso: Emit a GNU hash").

Hi Fangrui,

Quoted 7 lines

If I read tools/testing/selftests/vDSO/parse_vdso.c correctly, it does know DT_GNU_HASH as at now. Thus after this change the vDSO selftests are skipped with "Couldn't find __vdso_gettimeofday" etc if the distro enables --hash-style=gnu by default.

So it seems we need to add DT_GNU_HASH support for parse_vdso.c to keep test coverage.

Hi Xi,

Perhaps the selftests file needs DT_GNU_HASH support like
https://github.com/abseil/abseil-cpp/commit/1278ee9bd9bd4916181521fac96d6fa1100e38e6

Quoted 35 lines
Quoted 23 lines
---
 arch/arm64/kernel/vdso/Makefile   | 2 +-
 arch/arm64/kernel/vdso32/Makefile | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm64/kernel/vdso/Makefile +1 -1
index d63930c82839..d11da6461278 100644
@@ -21,7 +21,7 @@ btildflags-$(CONFIG_ARM64_BTI_KERNEL) += -z force-bti
 # potential future proofing if we end up with internal calls to the exported
 # routines, as x86 does (see 6f121e548f83 ("x86, vdso: Reimplement vdso.so
 # preparation in build-time C")).
-ldflags-y := -shared -soname=linux-vdso.so.1 --hash-style=sysv       \
+ldflags-y := -shared -soname=linux-vdso.so.1 \
           -Bsymbolic --build-id=sha1 -n $(btildflags-y)
 
 ifdef CONFIG_LD_ORPHAN_WARN
arch/arm64/kernel/vdso32/Makefile +0 -0
index cc4508c604b2..25a2cb6317f3 100644

arch/arm64/kernel/vdso32/Makefile VDSO_AFLAGS += -D__ASSEMBLY__ · line 104

Quoted 8 lines
arch/arm64/kernel/vdso32/Makefile +1 -1
@@ -98,7 +98,7 @@ VDSO_AFLAGS += -D__ASSEMBLY__
 # From arm vDSO Makefile
 VDSO_LDFLAGS += -Bsymbolic --no-undefined -soname=linux-vdso.so.1
 VDSO_LDFLAGS += -z max-page-size=4096 -z common-page-size=4096
-VDSO_LDFLAGS += -shared --hash-style=sysv --build-id=sha1
+VDSO_LDFLAGS += -shared --build-id=sha1
 VDSO_LDFLAGS += --orphan-handling=$(CONFIG_LD_ORPHAN_WARN_LEVEL)
 
 

--
Xi Ruoyao <[email protected]>
School of Aerospace Science and Technology, Xidian University

Signature · 1 line
宋方睿
#4 lore raw
Quoted 23 lines · Fangrui Song
Quoted 21 lines · Xi Ruoyao
Quoted 11 lines · Fangrui Song

glibc added support for .gnu.hash in 2006 and .hash has been obsoleted for more than one decade in many Linux distributions. Using --hash-style=sysv might imply unaddressed issues and confuse readers.

Just drop the option and rely on the linker default, which is likely "both", or "gnu" when the distribution really wants to eliminate sysv hash overhead.

Similar to commit 6b7e26547fad ("x86/vdso: Emit a GNU hash").

Hi Fangrui,

If I read tools/testing/selftests/vDSO/parse_vdso.c correctly, it does know DT_GNU_HASH as at now. Thus after this change the vDSO selftests are skipped with "Couldn't find __vdso_gettimeofday" etc if the distro enables --hash-style=gnu by default.

Quoted 7 lines
Quoted 2 lines

So it seems we need to add DT_GNU_HASH support for parse_vdso.c to keep test coverage.

Hi Xi,

Perhaps the selftests file needs DT_GNU_HASH support like
https://github.com/abseil/abseil-cpp/commit/1278ee9bd9bd4916181521fac96d6fa1100e38e6

Created https://lore.kernel.org/linux-kselftest/[email protected]/T/#u
([PATCH] selftests/vDSO: support DT_GNU_HASH)

Quoted 41 lines
Quoted 28 lines
Quoted 28 lines
---
 arch/arm64/kernel/vdso/Makefile   | 2 +-
 arch/arm64/kernel/vdso32/Makefile | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm64/kernel/vdso/Makefile +1 -1
index d63930c82839..d11da6461278 100644
@@ -21,7 +21,7 @@ btildflags-$(CONFIG_ARM64_BTI_KERNEL) += -z force-bti
 # potential future proofing if we end up with internal calls to the exported
 # routines, as x86 does (see 6f121e548f83 ("x86, vdso: Reimplement vdso.so
 # preparation in build-time C")).
-ldflags-y := -shared -soname=linux-vdso.so.1 --hash-style=sysv       \
+ldflags-y := -shared -soname=linux-vdso.so.1 \
           -Bsymbolic --build-id=sha1 -n $(btildflags-y)
 
 ifdef CONFIG_LD_ORPHAN_WARN
arch/arm64/kernel/vdso32/Makefile +0 -1
index cc4508c604b2..25a2cb6317f3 100644
@@ -98,7 +98,7 @@ VDSO_AFLAGS += -D__ASSEMBLY__
 # From arm vDSO Makefile
 VDSO_LDFLAGS += -Bsymbolic --no-undefined -soname=linux-vdso.so.1
 VDSO_LDFLAGS += -z max-page-size=4096 -z common-page-size=4096
-VDSO_LDFLAGS += -shared --hash-style=sysv --build-id=sha1
Quoted 8 lines

arch/arm64/kernel/vdso32/Makefile VDSO_AFLAGS += -D__ASSEMBLY__ · line 104

Quoted 4 lines
arch/arm64/kernel/vdso32/Makefile +1 -0
+VDSO_LDFLAGS += -shared --build-id=sha1
 VDSO_LDFLAGS += --orphan-handling=$(CONFIG_LD_ORPHAN_WARN_LEVEL)
 
 

--
Xi Ruoyao <[email protected]>
School of Aerospace Science and Technology, Xidian University

--
宋方睿

Signature · 1 line
宋方睿