diff mbox series

elf/Makefile: Run IFUNC tests if binutils supports IFUNC

Message ID 20190220162903.13315-1-hjl.tools@gmail.com
State New
Headers show
Series elf/Makefile: Run IFUNC tests if binutils supports IFUNC | expand

Commit Message

H.J. Lu Feb. 20, 2019, 4:29 p.m. UTC
We should run IFUNC tests with --disable-multi-arch if the toolchain
supports IFUNCs.  For correctness, --disable-multi-arch must not
remove IFUNC support from the loader.

Tested on x86-64, x32 and i686 with and without --disable-multi-arch.

	* configure.ac (have-ifunc): New LIBC_CONFIG_VAR.
	* configure: Regenerated.
	* elf/Makefile: Run IFUNC tests if binutils supports IFUNC.
---
 configure    | 2 ++
 configure.ac | 1 +
 elf/Makefile | 2 +-
 3 files changed, 4 insertions(+), 1 deletion(-)

Comments

Tulio Magno Quites Machado Filho Feb. 22, 2019, 2:34 p.m. UTC | #1
"H.J. Lu" <hjl.tools@gmail.com> writes:

> We should run IFUNC tests with --disable-multi-arch if the toolchain
> supports IFUNCs.  For correctness, --disable-multi-arch must not
> remove IFUNC support from the loader.
>
> Tested on x86-64, x32 and i686 with and without --disable-multi-arch.
>
> 	* configure.ac (have-ifunc): New LIBC_CONFIG_VAR.
> 	* configure: Regenerated.
> 	* elf/Makefile: Run IFUNC tests if binutils supports IFUNC.

We should also change this powerpc test:

diff --git a/sysdeps/powerpc/Makefile b/sysdeps/powerpc/Makefile
index bac5a3a73c..5c6ea0a95e 100644
--- a/sysdeps/powerpc/Makefile
+++ b/sysdeps/powerpc/Makefile
@@ -14,7 +14,7 @@ mod-tlsopt-powerpc.so-no-z-defs = yes
 tests += tst-tlsopt-powerpc
 $(objpfx)tst-tlsopt-powerpc: $(objpfx)mod-tlsopt-powerpc.so
 
-ifneq (no,$(multi-arch))
+ifeq (yes,$(have-ifunc))
 tests-static += tst-tlsifunc-static
 tests-internal += tst-tlsifunc-static
 ifeq (yes,$(build-shared))

Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
H.J. Lu Feb. 22, 2019, 2:37 p.m. UTC | #2
On Fri, Feb 22, 2019 at 6:35 AM Tulio Magno Quites Machado Filho
<tuliom@ascii.art.br> wrote:
>
> "H.J. Lu" <hjl.tools@gmail.com> writes:
>
> > We should run IFUNC tests with --disable-multi-arch if the toolchain
> > supports IFUNCs.  For correctness, --disable-multi-arch must not
> > remove IFUNC support from the loader.
> >
> > Tested on x86-64, x32 and i686 with and without --disable-multi-arch.
> >
> >       * configure.ac (have-ifunc): New LIBC_CONFIG_VAR.
> >       * configure: Regenerated.
> >       * elf/Makefile: Run IFUNC tests if binutils supports IFUNC.
>
> We should also change this powerpc test:
>
> diff --git a/sysdeps/powerpc/Makefile b/sysdeps/powerpc/Makefile
> index bac5a3a73c..5c6ea0a95e 100644
> --- a/sysdeps/powerpc/Makefile
> +++ b/sysdeps/powerpc/Makefile
> @@ -14,7 +14,7 @@ mod-tlsopt-powerpc.so-no-z-defs = yes
>  tests += tst-tlsopt-powerpc
>  $(objpfx)tst-tlsopt-powerpc: $(objpfx)mod-tlsopt-powerpc.so
>
> -ifneq (no,$(multi-arch))
> +ifeq (yes,$(have-ifunc))
>  tests-static += tst-tlsifunc-static
>  tests-internal += tst-tlsifunc-static
>  ifeq (yes,$(build-shared))
>
> Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
>

If all supported powerpc binutils have IFUNC, you can drop this test
like x86.
Tulio Magno Quites Machado Filho Feb. 26, 2019, 12:01 p.m. UTC | #3
"H.J. Lu" <hjl.tools@gmail.com> writes:

> On Fri, Feb 22, 2019 at 6:35 AM Tulio Magno Quites Machado Filho
> <tuliom@ascii.art.br> wrote:
>>
>> "H.J. Lu" <hjl.tools@gmail.com> writes:
>>
>> > We should run IFUNC tests with --disable-multi-arch if the toolchain
>> > supports IFUNCs.  For correctness, --disable-multi-arch must not
>> > remove IFUNC support from the loader.
>> >
>> > Tested on x86-64, x32 and i686 with and without --disable-multi-arch.
>> >
>> >       * configure.ac (have-ifunc): New LIBC_CONFIG_VAR.
>> >       * configure: Regenerated.
>> >       * elf/Makefile: Run IFUNC tests if binutils supports IFUNC.
>>
>> We should also change this powerpc test:
>>
>> diff --git a/sysdeps/powerpc/Makefile b/sysdeps/powerpc/Makefile
>> index bac5a3a73c..5c6ea0a95e 100644
>> --- a/sysdeps/powerpc/Makefile
>> +++ b/sysdeps/powerpc/Makefile
>> @@ -14,7 +14,7 @@ mod-tlsopt-powerpc.so-no-z-defs = yes
>>  tests += tst-tlsopt-powerpc
>>  $(objpfx)tst-tlsopt-powerpc: $(objpfx)mod-tlsopt-powerpc.so
>>
>> -ifneq (no,$(multi-arch))
>> +ifeq (yes,$(have-ifunc))
>>  tests-static += tst-tlsifunc-static
>>  tests-internal += tst-tlsifunc-static
>>  ifeq (yes,$(build-shared))
>>
>> Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
>>
>
> If all supported powerpc binutils have IFUNC, you can drop this test
> like x86.

Indeed.
I've modified build-many-glibcs to use Binutils 2.25 and confirmed that all
powerpc builds there enable have-ifunc.
diff mbox series

Patch

diff --git a/configure b/configure
index 2643db9fb7..c773c487b5 100755
--- a/configure
+++ b/configure
@@ -6794,6 +6794,8 @@  if test x"$libc_cv_ld_gnu_indirect_function" = xyes; then
   $as_echo "#define HAVE_IFUNC 1" >>confdefs.h
 
 fi
+config_vars="$config_vars
+have-ifunc = $libc_cv_ld_gnu_indirect_function"
 
 if test x"$libc_cv_gcc_indirect_function" = xyes; then
   $as_echo "#define HAVE_GCC_IFUNC 1" >>confdefs.h
diff --git a/configure.ac b/configure.ac
index ad50e290d4..598ba6c4ae 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1804,6 +1804,7 @@  AC_SUBST(libc_cv_gcc_unwind_find_fde)
 if test x"$libc_cv_ld_gnu_indirect_function" = xyes; then
   AC_DEFINE(HAVE_IFUNC)
 fi
+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)
diff --git a/elf/Makefile b/elf/Makefile
index faec577d1c..e44960e5fe 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -321,7 +321,7 @@  modules-names-nobuild := filtmod1
 
 tests += $(tests-static)
 
-ifneq (no,$(multi-arch))
+ifeq (yes,$(have-ifunc))
 tests-ifuncstatic := ifuncmain1static ifuncmain1picstatic \
 		ifuncmain2static ifuncmain2picstatic \
 		ifuncmain4static ifuncmain4picstatic \