Re: [PATCH] vDSO hash-style fix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux