mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: Roland McGrath <roland@redhat.com>
Cc: Linus Torvalds <torvalds@osdl.org>, Andrew Morton <akpm@osdl.org>,
	linux-kernel@vger.kernel.org, Jakub Jelinek <jakub@redhat.com>
Subject: Re: [PATCH] vDSO hash-style fix
Date: Thu, 27 Jul 2006 13:04:54 +0200	[thread overview]
Message-ID: <20060727110453.GA27162@mars.ravnborg.org> (raw)
In-Reply-To: <20060726201502.A14FE18003A@magilla.sf.frob.com>

On Wed, Jul 26, 2006 at 01:15:02PM -0700, Roland McGrath wrote:
> The latest toolchains can produce a new ELF section in DSOs and
> dynamically-linked executables.  The new section ".gnu.hash" replaces
> ".hash", and allows for more efficient runtime symbol lookups by the
> dynamic linker.  The new ld option --hash-style={sysv|gnu|both}
> controls whether to produce the old ".hash", the new ".gnu.hash", or
> both.  In some new systems such as Fedora Core 6, gcc by default
> passes --hash-style=gnu to the linker, so that a standard invocation
> of "gcc -shared" results in producing a DSO with only ".gnu.hash".
> The new ".gnu.hash" sections need to be dealt with the same way as
> ".hash" sections in all respects; only the dynamic linker cares about
> their contents.  To work with older dynamic linkers (i.e. preexisting
> releases of glibc), a binary must have the old ".hash" section.  The
> --hash-style=both option produces binaries that a new dynamic linker
> can use more efficiently, but an old dynamic linker can still handle.
> 
> The new section runs afoul of the custom linker scripts used to
> build vDSO images for the kernel.  On ia64, the failure mode for
> this is a boot-time panic because the vDSO's PT_IA_64_UNWIND
> segment winds up ill-formed.
> 
> This patch addresses the problem in two ways.
> 
> First, it mentions ".gnu.hash" in all the linker scripts alongside
> ".hash".
Any possibility to push this to include/asm-generic/vmlinux.lds.h?

> diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
> index 2180c88..a3c0fdc 100644  
> --- a/scripts/Kbuild.include
> +++ b/scripts/Kbuild.include
> @@ -85,6 +85,12 @@ cc-version = $(shell $(CONFIG_SHELL) $(s
>  cc-ifversion = $(shell if [ $(call cc-version, $(CC)) $(1) $(2) ]; then \
>                         echo $(3); fi;)
>  
> +# ld-option
> +# Usage: ldflags += $(call ld-option, -Wl$(comma)--hash-style=both)
> +ld-option = $(shell if $(CC) $(1) \
> +			     -nostdlib -o /dev/null -xc /dev/null \
> +             > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi)

This is not good. When I introduced something similar for lxdialog I
received lots of reports about /dev/null becoming a regular file.
ld does something strange with the output file when it fails.

When re-done ld-option shall be accompanied by documentation in
Documentation/makefiles.txt like cc-option.

	Sam

  reply	other threads:[~2006-07-27 11:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-26 20:15 Roland McGrath
2006-07-27 11:04 ` Sam Ravnborg [this message]
2006-07-27 22:14   ` Roland McGrath

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060727110453.GA27162@mars.ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=akpm@osdl.org \
    --cc=jakub@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=roland@redhat.com \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®