This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] x86: Don't use apply_irel in static PIE
- From: Siva Chandra <sivachandra at google dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Thu, 21 Mar 2019 08:18:42 -0700
- Subject: Re: [PATCH] x86: Don't use apply_irel in static PIE
- References: <20190321122445.28990-1-hjl.tools@gmail.com>
On Thu, Mar 21, 2019 at 5:36 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On x86, since _dl_relocate_static_pie also processes IFUNC relocations,
> there is no need to call apply_irel.
>
> Tested on i686 and x86-64.
>
> * csu/libc-start.c (apply_irel): Add unused attribute.
> * sysdeps/x86/libc-start.h (ARCH_SETUP_IREL): Defined as empty
> for static PIE.
> ---
> csu/libc-start.c | 1 +
> sysdeps/x86/libc-start.h | 7 ++++++-
> 2 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/csu/libc-start.c b/csu/libc-start.c
> index 5d9c3675fa..07be05f1e9 100644
> --- a/csu/libc-start.c
> +++ b/csu/libc-start.c
> @@ -66,6 +66,7 @@ uintptr_t __pointer_chk_guard_local
> # endif
>
> static void
> +__attribute__ ((unused))
> apply_irel (void)
> {
> # ifdef IREL
> diff --git a/sysdeps/x86/libc-start.h b/sysdeps/x86/libc-start.h
> index c76b1d917f..e544867c1d 100644
> --- a/sysdeps/x86/libc-start.h
> +++ b/sysdeps/x86/libc-start.h
> @@ -17,7 +17,12 @@
> <http://www.gnu.org/licenses/>. */
>
> #ifndef SHARED
> -# define ARCH_SETUP_IREL() apply_irel ()
> +# if ENABLE_STATIC_PIE
> +/* NB: x86 doesn't use apply_irel in static PIE. */
> +# define ARCH_SETUP_IREL()
Will this break non-PIE static when glibc is configured --enable-static-pie?
> +# else
> +# define ARCH_SETUP_IREL() apply_irel ()
> +# endif
> # define ARCH_APPLY_IREL()
> # ifndef ARCH_SETUP_TLS
> # define ARCH_SETUP_TLS() __libc_setup_tls ()
> --
> 2.20.1
>