This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [COMMITTED PATCH] Support static IFUNC calls irrespective ofUSE_MULTIARCH.
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Roland McGrath <roland at hack dot frob dot com>
- Cc: <libc-alpha at sourceware dot org>
- Date: Wed, 22 Aug 2012 19:30:48 +0000
- Subject: Re: [COMMITTED PATCH] Support static IFUNC calls irrespective ofUSE_MULTIARCH.
- References: <20120821223030.115852C0B2@topped-with-meat.com>
On Tue, 21 Aug 2012, Roland McGrath wrote:
> +#ifndef SHARED
> +# include <link.h>
> +# include <dl-irel.h>
> +
> +# ifdef ELF_MACHINE_IRELA
> +# define IREL_T ElfW(Rela)
> +# define IPLT_START __rela_iplt_start
> +# define IPLT_END __rela_iplt_end
> +# define IREL elf_irela
> +# elif defined ELF_MACHINE_IREL
> +# define IREL_T ElfW(Rel)
> +# define IPLT_START __rel_iplt_start
> +# define IPLT_END __rel_iplt_end
> +# define IREL elf_irel
> +# endif
> +
> +/* We use weak references for these so that we'll still work with a linker
> + that doesn't define them. Such a linker doesn't support IFUNC at all
> + and so uses won't work, but a statically-linked program that doesn't
> + use any IFUNC symbols won't have a problem. */
> +extern const IREL_T IPLT_START[] __attribute__ ((weak));
> +extern const IREL_T IPLT_END[] __attribute__ ((weak));
> +
> +static void
> +apply_irel (void)
> +{
> + for (const IREL_T *ipltent = IPLT_START; ipltent < IPLT_END; ++ipltent)
> + IREL (ipltent);
> +}
> +#endif
This has broken the build for architectures with no ifunc support at all
(such as MIPS). Anything using IREL_T needs to be conditional on
ELF_MACHINE_IRELA || ELF_MACHINE_IREL....
--
Joseph S. Myers
joseph@codesourcery.com