public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Samuel Thibault <samuel.thibault@ens-lyon.org>
Cc: GNU C Library <libc-alpha@sourceware.org>, commit-hurd@gnu.org
Subject: Re: [PATCH] elf: Fix not compiling ifunc tests that need gcc ifunc support
Date: Tue, 23 Mar 2021 17:22:48 -0700	[thread overview]
Message-ID: <CAMe9rOqHmtCn2QyWtObqUvcokXemDtyVmqwsHTzM0UkyfaK3Nw@mail.gmail.com> (raw)
In-Reply-To: <20210324001150.336441-1-samuel.thibault@ens-lyon.org>

On Tue, Mar 23, 2021 at 5:13 PM Samuel Thibault
<samuel.thibault@ens-lyon.org> wrote:
>
> ---
>  configure.ac         |  1 +
>  elf/Makefile         | 17 ++++++++++++-----
>  elf/ifuncmain9.c     | 16 ----------------
>  sysdeps/x86/Makefile |  2 ++
>  4 files changed, 15 insertions(+), 21 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 16b15b6f90..6a3a9ab620 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -1770,6 +1770,7 @@ LIBC_CONFIG_VAR([have-ifunc], [$libc_cv_ld_gnu_indirect_function])
>  if test x"$libc_cv_gcc_indirect_function" = xyes; then
>    AC_DEFINE(HAVE_GCC_IFUNC)
>  fi
> +LIBC_CONFIG_VAR([have-gcc-ifunc], [$libc_cv_gcc_indirect_function])
>
>  # This is far from the AC_ARG_ENABLE that sets it so that a sysdeps
>  # configure fragment can override the value to prevent this AC_DEFINE.
> diff --git a/elf/Makefile b/elf/Makefile
> index 3b8e13e066..0bef49e53d 100644
> --- a/elf/Makefile
> +++ b/elf/Makefile
> @@ -395,8 +395,10 @@ tests-ifuncstatic := ifuncmain1static ifuncmain1picstatic \
>                 ifuncmain2static ifuncmain2picstatic \
>                 ifuncmain4static ifuncmain4picstatic \
>                 ifuncmain5static ifuncmain5picstatic \
> -               ifuncmain7static ifuncmain7picstatic \
> -               ifuncmain9static ifuncmain9picstatic
> +               ifuncmain7static ifuncmain7picstatic
> +ifeq (yes,$(have-gcc-ifunc))
> +tests-ifuncstatic += ifuncmain9static ifuncmain9picstatic
> +endif
>  tests-static += $(tests-ifuncstatic)
>  tests-internal += $(tests-ifuncstatic)
>  ifeq (yes,$(build-shared))
> @@ -407,15 +409,20 @@ tests-internal += \
>          ifuncmain1staticpic \
>          ifuncmain2 ifuncmain2pic ifuncmain3 ifuncmain4 \
>          ifuncmain5 ifuncmain5pic ifuncmain5staticpic \
> -        ifuncmain7 ifuncmain7pic \
> -        ifuncmain9 ifuncmain9pic
> +        ifuncmain7 ifuncmain7pic
> +ifeq (yes,$(have-gcc-ifunc))
> +tests-internal += ifuncmain9 ifuncmain9pic
> +endif
>  ifunc-test-modules = ifuncdep1 ifuncdep1pic ifuncdep2 ifuncdep2pic \
>                      ifuncdep5 ifuncdep5pic
>  extra-test-objs += $(ifunc-test-modules:=.o)
>  test-internal-extras += $(ifunc-test-modules)
>  ifeq (yes,$(have-fpie))
>  ifunc-pie-tests = ifuncmain1pie ifuncmain1vispie ifuncmain1staticpie \
> -                 ifuncmain5pie ifuncmain6pie ifuncmain7pie ifuncmain9pie
> +                 ifuncmain5pie ifuncmain6pie ifuncmain7pie
> +ifeq (yes,$(have-gcc-ifunc))
> +ifunc-pie-tests += ifuncmain9pie
> +endif
>  ifeq (yes,$(have-textrel_ifunc))
>  ifunc-pie-tests += tst-ifunc-textrel
>  endif
> diff --git a/elf/ifuncmain9.c b/elf/ifuncmain9.c
> index e775c5cfa9..15419a159a 100644
> --- a/elf/ifuncmain9.c
> +++ b/elf/ifuncmain9.c
> @@ -20,8 +20,6 @@
>
>  #include <config.h>
>
> -#ifdef HAVE_GCC_IFUNC
> -
>  # include <stdbool.h>
>  # include <stdio.h>
>
> @@ -92,17 +90,3 @@ main (void)
>
>    return errors;
>  }
> -
> -#else  /* !HAVE_GCC_IFUNC */
> -
> -# include <support/check.h>
> -
> -static int
> -do_test (void)
> -{
> -  FAIL_UNSUPPORTED ("GCC does not support the ifunc attribute");
> -  return 1;                     /* Not reachable.  */
> -}
> -
> -# include <support/test-driver.c>
> -#endif
> diff --git a/sysdeps/x86/Makefile b/sysdeps/x86/Makefile
> index 3ca7bfefe4..8186e45fec 100644
> --- a/sysdeps/x86/Makefile
> +++ b/sysdeps/x86/Makefile
> @@ -16,6 +16,7 @@ tests-static += tst-get-cpu-features-static \
>                 tst-cpu-features-cpuinfo-static \
>                 tst-cpu-features-supports-static
>  ifeq (yes,$(have-ifunc))
> +ifeq (yes,$(have-gcc-ifunc))
>  tests += \
>    tst-ifunc-isa-1 \
>    tst-ifunc-isa-1-static \
> @@ -25,6 +26,7 @@ tests-static += \
>    tst-ifunc-isa-1-static \
>    tst-ifunc-isa-2-static
>  endif
> +endif
>  ifeq (yes,$(enable-x86-isa-level))
>  tests += tst-isa-level-1
>  modules-names += tst-isa-level-mod-1-baseline \
> --
> 2.30.2
>

LGTM.

Thanks.

-- 
H.J.

  reply	other threads:[~2021-03-24  0:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-24  0:11 Samuel Thibault
2021-03-24  0:22 ` H.J. Lu [this message]
2021-03-24  8:12   ` Samuel Thibault

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=CAMe9rOqHmtCn2QyWtObqUvcokXemDtyVmqwsHTzM0UkyfaK3Nw@mail.gmail.com \
    --to=hjl.tools@gmail.com \
    --cc=commit-hurd@gnu.org \
    --cc=libc-alpha@sourceware.org \
    --cc=samuel.thibault@ens-lyon.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).