mailing list of musl libc
 help / color / mirror / code / Atom feed
* [PATCH] x86/vdso: Emit a GNU hash
@ 2015-08-06 21:45 Andy Lutomirski
  2015-08-06 22:52 ` Andy Lutomirski
  2015-08-09 10:25 ` [tip:x86/asm] " tip-bot for Andy Lutomirski
  0 siblings, 2 replies; 7+ messages in thread
From: Andy Lutomirski @ 2015-08-06 21:45 UTC (permalink / raw)
  To: x86, linux-kernel
  Cc: Nathan Lynch, Isaac Dunham, Rich Felker, musl, Andy Lutomirski

From: Andy Lutomirski <luto@amacapital.net>

Some dynamic loaders may be slightly faster if a GNU hash is
available.  Strangely, this seems to have no effect at all on the
vdso size.

This is unlikely to have any measurable effect on the time it takes
to resolve vdso symbols (since there are so few of them).  In some
contexts, it can be a win for a different reason: if every DSO has a
GNU hash section, then libc can avoid calculating SysV hashes at
all.  Both musl and glibc appear to have this optimization.

It's plausible that this breaks some ancient glibc version.  If so,
then, depending on what glibc versions break, we could either
require COMPAT_VDSO for them or consider reverting.

Signed-off-by: Andy Lutomirski <luto@amacapital.net>
---

For review.  I'll add it to my (currently empty) 4.3 pull request if
people like it, unless Ingo feels like adding it to -tip directly.

 arch/x86/entry/vdso/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/entry/vdso/Makefile b/arch/x86/entry/vdso/Makefile
index e97032069f88..20f3ac53148d 100644
--- a/arch/x86/entry/vdso/Makefile
+++ b/arch/x86/entry/vdso/Makefile
@@ -175,7 +175,7 @@ quiet_cmd_vdso = VDSO    $@
 		       -Wl,-T,$(filter %.lds,$^) $(filter %.o,$^) && \
 		 sh $(srctree)/$(src)/checkundef.sh '$(NM)' '$@'
 
-VDSO_LDFLAGS = -fPIC -shared $(call cc-ldoption, -Wl$(comma)--hash-style=sysv) \
+VDSO_LDFLAGS = -fPIC -shared $(call cc-ldoption, -Wl$(comma)--hash-style=both) \
 	$(call cc-ldoption, -Wl$(comma)--build-id) -Wl,-Bsymbolic $(LTO_CFLAGS)
 GCOV_PROFILE := n
 
-- 
2.4.3


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

* Re: [PATCH] x86/vdso: Emit a GNU hash
  2015-08-06 21:45 [PATCH] x86/vdso: Emit a GNU hash Andy Lutomirski
@ 2015-08-06 22:52 ` Andy Lutomirski
  2015-08-07  0:48   ` [PATCH] tile/vdso: emit a GNU hash as well Chris Metcalf
                     ` (2 more replies)
  2015-08-09 10:25 ` [tip:x86/asm] " tip-bot for Andy Lutomirski
  1 sibling, 3 replies; 7+ messages in thread
From: Andy Lutomirski @ 2015-08-06 22:52 UTC (permalink / raw)
  To: Andy Lutomirski, Anton Blanchard, Martin Schwidefsky,
	Chris Metcalf, Richard Kuo
  Cc: X86 ML, linux-kernel, Nathan Lynch, Isaac Dunham, Rich Felker, musl

[adding lots of cc's]

On Thu, Aug 6, 2015 at 2:45 PM, Andy Lutomirski <luto@kernel.org> wrote:
> From: Andy Lutomirski <luto@amacapital.net>
>
> Some dynamic loaders may be slightly faster if a GNU hash is
> available.  Strangely, this seems to have no effect at all on the
> vdso size.
>
> This is unlikely to have any measurable effect on the time it takes
> to resolve vdso symbols (since there are so few of them).  In some
> contexts, it can be a win for a different reason: if every DSO has a
> GNU hash section, then libc can avoid calculating SysV hashes at
> all.  Both musl and glibc appear to have this optimization.
>
> It's plausible that this breaks some ancient glibc version.  If so,
> then, depending on what glibc versions break, we could either
> require COMPAT_VDSO for them or consider reverting.
>

Adding lots of arch vdso people.

I think this would be a good thing to do in general.  Want to update
your arches (powerpc, arm(64), s390, tile, and hexagon -- did I miss
any?)?

--Andy

> Signed-off-by: Andy Lutomirski <luto@amacapital.net>
> ---
>
> For review.  I'll add it to my (currently empty) 4.3 pull request if
> people like it, unless Ingo feels like adding it to -tip directly.
>
>  arch/x86/entry/vdso/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/entry/vdso/Makefile b/arch/x86/entry/vdso/Makefile
> index e97032069f88..20f3ac53148d 100644
> --- a/arch/x86/entry/vdso/Makefile
> +++ b/arch/x86/entry/vdso/Makefile
> @@ -175,7 +175,7 @@ quiet_cmd_vdso = VDSO    $@
>                        -Wl,-T,$(filter %.lds,$^) $(filter %.o,$^) && \
>                  sh $(srctree)/$(src)/checkundef.sh '$(NM)' '$@'
>
> -VDSO_LDFLAGS = -fPIC -shared $(call cc-ldoption, -Wl$(comma)--hash-style=sysv) \
> +VDSO_LDFLAGS = -fPIC -shared $(call cc-ldoption, -Wl$(comma)--hash-style=both) \
>         $(call cc-ldoption, -Wl$(comma)--build-id) -Wl,-Bsymbolic $(LTO_CFLAGS)
>  GCOV_PROFILE := n
>
> --
> 2.4.3
>



-- 
Andy Lutomirski
AMA Capital Management, LLC


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

* [PATCH] tile/vdso: emit a GNU hash as well
  2015-08-06 22:52 ` Andy Lutomirski
@ 2015-08-07  0:48   ` Chris Metcalf
  2015-08-07  7:02   ` [PATCH] s390/vdso: emit a GNU hash Martin Schwidefsky
  2015-08-07 16:10   ` [PATCH] x86/vdso: Emit " Nathan Lynch
  2 siblings, 0 replies; 7+ messages in thread
From: Chris Metcalf @ 2015-08-07  0:48 UTC (permalink / raw)
  To: Andy Lutomirski, Anton Blanchard, Martin Schwidefsky, Richard Kuo
  Cc: Chris Metcalf, X86 ML, linux-kernel, Nathan Lynch, Isaac Dunham,
	Rich Felker, musl

In principle, including the GNU hash can allow libc to avoid
calculating SysV hashes at all.

Signed-off-by: Chris Metcalf <cmetcalf@ezchip.com>
---
 arch/tile/kernel/vdso/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/tile/kernel/vdso/Makefile b/arch/tile/kernel/vdso/Makefile
index a025f63d54cd..c54fff37b5ff 100644
--- a/arch/tile/kernel/vdso/Makefile
+++ b/arch/tile/kernel/vdso/Makefile
@@ -54,7 +54,7 @@ $(obj)/built-in.o: $(obj)/vdso-syms.o
 $(obj)/built-in.o: ld_flags += -R $(obj)/vdso-syms.o
 
 SYSCFLAGS_vdso.so.dbg = -shared -s -Wl,-soname=linux-vdso.so.1 \
-                            $(call cc-ldoption, -Wl$(comma)--hash-style=sysv)
+                            $(call cc-ldoption, -Wl$(comma)--hash-style=both)
 SYSCFLAGS_vdso_syms.o = -r
 $(obj)/vdso-syms.o: $(src)/vdso.lds $(obj)/vrt_sigreturn.o FORCE
 	$(call if_changed,vdsold)
@@ -113,6 +113,6 @@ $(obj)/vrt_sigreturn32.o: $(obj)/vrt_sigreturn.S
 $(obj)/vdso32.o: $(obj)/vdso32.so
 
 SYSCFLAGS_vdso32.so.dbg = -m32 -shared -s -Wl,-soname=linux-vdso32.so.1 \
-			    $(call cc-ldoption, -Wl$(comma)--hash-style=sysv)
+			    $(call cc-ldoption, -Wl$(comma)--hash-style=both)
 $(obj)/vdso32.so.dbg: $(src)/vdso.lds $(obj-vdso32)
 	$(call if_changed,vdsold)
-- 
2.1.2


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

* [PATCH] s390/vdso: emit a GNU hash
  2015-08-06 22:52 ` Andy Lutomirski
  2015-08-07  0:48   ` [PATCH] tile/vdso: emit a GNU hash as well Chris Metcalf
@ 2015-08-07  7:02   ` Martin Schwidefsky
  2015-08-07 16:10   ` [PATCH] x86/vdso: Emit " Nathan Lynch
  2 siblings, 0 replies; 7+ messages in thread
From: Martin Schwidefsky @ 2015-08-07  7:02 UTC (permalink / raw)
  To: Andy Lutomirski
  Cc: Andy Lutomirski, Anton Blanchard, Chris Metcalf, Richard Kuo,
	X86 ML, linux-kernel, Nathan Lynch, Isaac Dunham, Rich Felker,
	musl

From 9a3d93634bd74b07a988fa0fc729d1f711253a91 Mon Sep 17 00:00:00 2001
From: Martin Schwidefsky <schwidefsky@de.ibm.com>
Date: Fri, 7 Aug 2015 08:55:48 +0200
Subject: [PATCH] s390/vdso: emit a GNU hash

As proposed by Andy Lutomirski create the SysV and the GNU hash
for the vdso objects. This may make some dynamic loaders a bit
faster.

Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
---
 arch/s390/kernel/vdso32/Makefile | 2 +-
 arch/s390/kernel/vdso64/Makefile | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/s390/kernel/vdso32/Makefile b/arch/s390/kernel/vdso32/Makefile
index 8ad2b34..ee8a18e 100644
--- a/arch/s390/kernel/vdso32/Makefile
+++ b/arch/s390/kernel/vdso32/Makefile
@@ -13,7 +13,7 @@ KBUILD_AFLAGS_31 += -m31 -s
 KBUILD_CFLAGS_31 := $(filter-out -m64,$(KBUILD_CFLAGS))
 KBUILD_CFLAGS_31 += -m31 -fPIC -shared -fno-common -fno-builtin
 KBUILD_CFLAGS_31 += -nostdlib -Wl,-soname=linux-vdso32.so.1 \
-			$(call cc-ldoption, -Wl$(comma)--hash-style=sysv)
+			$(call cc-ldoption, -Wl$(comma)--hash-style=both)
 
 $(targets:%=$(obj)/%.dbg): KBUILD_CFLAGS = $(KBUILD_CFLAGS_31)
 $(targets:%=$(obj)/%.dbg): KBUILD_AFLAGS = $(KBUILD_AFLAGS_31)
diff --git a/arch/s390/kernel/vdso64/Makefile b/arch/s390/kernel/vdso64/Makefile
index 2a8ddfd..c4b03f9 100644
--- a/arch/s390/kernel/vdso64/Makefile
+++ b/arch/s390/kernel/vdso64/Makefile
@@ -13,7 +13,7 @@ KBUILD_AFLAGS_64 += -m64 -s
 KBUILD_CFLAGS_64 := $(filter-out -m64,$(KBUILD_CFLAGS))
 KBUILD_CFLAGS_64 += -m64 -fPIC -shared -fno-common -fno-builtin
 KBUILD_CFLAGS_64 += -nostdlib -Wl,-soname=linux-vdso64.so.1 \
-			$(call cc-ldoption, -Wl$(comma)--hash-style=sysv)
+			$(call cc-ldoption, -Wl$(comma)--hash-style=both)
 
 $(targets:%=$(obj)/%.dbg): KBUILD_CFLAGS = $(KBUILD_CFLAGS_64)
 $(targets:%=$(obj)/%.dbg): KBUILD_AFLAGS = $(KBUILD_AFLAGS_64)
-- 
2.3.8


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

* Re: [PATCH] x86/vdso: Emit a GNU hash
  2015-08-06 22:52 ` Andy Lutomirski
  2015-08-07  0:48   ` [PATCH] tile/vdso: emit a GNU hash as well Chris Metcalf
  2015-08-07  7:02   ` [PATCH] s390/vdso: emit a GNU hash Martin Schwidefsky
@ 2015-08-07 16:10   ` Nathan Lynch
  2015-08-07 18:13     ` Andy Lutomirski
  2 siblings, 1 reply; 7+ messages in thread
From: Nathan Lynch @ 2015-08-07 16:10 UTC (permalink / raw)
  To: Andy Lutomirski
  Cc: Andy Lutomirski, Anton Blanchard, Martin Schwidefsky,
	Chris Metcalf, Richard Kuo, X86 ML, linux-kernel, Isaac Dunham,
	Rich Felker, musl

On 08/06/2015 05:52 PM, Andy Lutomirski wrote:
> [adding lots of cc's]
> 
> On Thu, Aug 6, 2015 at 2:45 PM, Andy Lutomirski <luto@kernel.org> wrote:
>> From: Andy Lutomirski <luto@amacapital.net>
>>
>> Some dynamic loaders may be slightly faster if a GNU hash is
>> available.  Strangely, this seems to have no effect at all on the
>> vdso size.

FWIW, I see arch/x86/entry/vdso/vdso64.so increase by 168 bytes here,
using GCC 4.9.2, Binutils 2.24 as packaged by Fedora 21.

I see a similar increase when I make the equivalent change for ARM.



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

* Re: [PATCH] x86/vdso: Emit a GNU hash
  2015-08-07 16:10   ` [PATCH] x86/vdso: Emit " Nathan Lynch
@ 2015-08-07 18:13     ` Andy Lutomirski
  0 siblings, 0 replies; 7+ messages in thread
From: Andy Lutomirski @ 2015-08-07 18:13 UTC (permalink / raw)
  To: Nathan Lynch
  Cc: Andy Lutomirski, Anton Blanchard, Martin Schwidefsky,
	Chris Metcalf, Richard Kuo, X86 ML, linux-kernel, Isaac Dunham,
	Rich Felker, musl

On Fri, Aug 7, 2015 at 9:10 AM, Nathan Lynch <Nathan_Lynch@mentor.com> wrote:
> On 08/06/2015 05:52 PM, Andy Lutomirski wrote:
>> [adding lots of cc's]
>>
>> On Thu, Aug 6, 2015 at 2:45 PM, Andy Lutomirski <luto@kernel.org> wrote:
>>> From: Andy Lutomirski <luto@amacapital.net>
>>>
>>> Some dynamic loaders may be slightly faster if a GNU hash is
>>> available.  Strangely, this seems to have no effect at all on the
>>> vdso size.
>
> FWIW, I see arch/x86/entry/vdso/vdso64.so increase by 168 bytes here,
> using GCC 4.9.2, Binutils 2.24 as packaged by Fedora 21.
>
> I see a similar increase when I make the equivalent change for ARM.
>
>

At least on my configuration, that doesn't push it across a page
boundary, so it doesn't really matter.

--Andy


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

* [tip:x86/asm] x86/vdso: Emit a GNU hash
  2015-08-06 21:45 [PATCH] x86/vdso: Emit a GNU hash Andy Lutomirski
  2015-08-06 22:52 ` Andy Lutomirski
@ 2015-08-09 10:25 ` tip-bot for Andy Lutomirski
  1 sibling, 0 replies; 7+ messages in thread
From: tip-bot for Andy Lutomirski @ 2015-08-09 10:25 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: bp, dvlasenk, nathan_lynch, brgerst, mingo, musl, peterz, dalias,
	ibid.ag, linux-kernel, torvalds, luto, tglx, hpa

Commit-ID:  6b7e26547fad7ace3dcb27a5babd2317fb9d1e12
Gitweb:     http://git.kernel.org/tip/6b7e26547fad7ace3dcb27a5babd2317fb9d1e12
Author:     Andy Lutomirski <luto@amacapital.net>
AuthorDate: Thu, 6 Aug 2015 14:45:45 -0700
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Sat, 8 Aug 2015 10:42:07 +0200

x86/vdso: Emit a GNU hash

Some dynamic loaders may be slightly faster if a GNU hash is
available.  Strangely, this seems to have no effect at all on
the vdso size.

This is unlikely to have any measurable effect on the time it
takes to resolve vdso symbols (since there are so few of them).
In some contexts, it can be a win for a different reason: if
every DSO has a GNU hash section, then libc can avoid
calculating SysV hashes at all.  Both musl and glibc appear to
have this optimization.

It's plausible that this breaks some ancient glibc version.  If
so, then, depending on what glibc versions break, we could
either require COMPAT_VDSO for them or consider reverting.

Signed-off-by: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Isaac Dunham <ibid.ag@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Nathan Lynch <nathan_lynch@mentor.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rich Felker <dalias@libc.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: musl@lists.openwall.com <musl@lists.openwall.com>
Link: http://lkml.kernel.org/r/fd56cc057a2d62ab31c56a48d04fccb435b3fd4f.1438897382.git.luto@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/entry/vdso/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/entry/vdso/Makefile b/arch/x86/entry/vdso/Makefile
index 96c0617..a3d0767 100644
--- a/arch/x86/entry/vdso/Makefile
+++ b/arch/x86/entry/vdso/Makefile
@@ -175,7 +175,7 @@ quiet_cmd_vdso = VDSO    $@
 		       -Wl,-T,$(filter %.lds,$^) $(filter %.o,$^) && \
 		 sh $(srctree)/$(src)/checkundef.sh '$(NM)' '$@'
 
-VDSO_LDFLAGS = -fPIC -shared $(call cc-ldoption, -Wl$(comma)--hash-style=sysv) \
+VDSO_LDFLAGS = -fPIC -shared $(call cc-ldoption, -Wl$(comma)--hash-style=both) \
 	$(call cc-ldoption, -Wl$(comma)--build-id) -Wl,-Bsymbolic $(LTO_CFLAGS)
 GCOV_PROFILE := n
 

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

end of thread, other threads:[~2015-08-09 10:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-06 21:45 [PATCH] x86/vdso: Emit a GNU hash Andy Lutomirski
2015-08-06 22:52 ` Andy Lutomirski
2015-08-07  0:48   ` [PATCH] tile/vdso: emit a GNU hash as well Chris Metcalf
2015-08-07  7:02   ` [PATCH] s390/vdso: emit a GNU hash Martin Schwidefsky
2015-08-07 16:10   ` [PATCH] x86/vdso: Emit " Nathan Lynch
2015-08-07 18:13     ` Andy Lutomirski
2015-08-09 10:25 ` [tip:x86/asm] " tip-bot for Andy Lutomirski

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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