public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/azanella/clang] i686: Do not build ifunc tests if compiler does not generate supported relocations
@ 2024-04-17 20:13 Adhemerval Zanella
  0 siblings, 0 replies; 8+ messages in thread
From: Adhemerval Zanella @ 2024-04-17 20:13 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=4a17a44be54cd9db56117641c3e21c994cf31e27

commit 4a17a44be54cd9db56117641c3e21c994cf31e27
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Aug 22 16:27:15 2023 -0300

    i686: Do not build ifunc tests if compiler does not generate supported relocations
    
    clang with --target i668 might not produce supported relocations
    that ld.bfd can use for -static-pie without -fPIC, which are used
    on some tests.  Disable them for now.

Diff:
---
 aclocal.m4                |  6 +++---
 configure                 |  4 ++++
 configure.ac              |  3 +++
 elf/Makefile              | 18 +++++++++++++++---
 sysdeps/i386/configure    | 31 +++++++++++++++++++++++++++++++
 sysdeps/i386/configure.ac | 15 +++++++++++++++
 6 files changed, 71 insertions(+), 6 deletions(-)

diff --git a/aclocal.m4 b/aclocal.m4
index a097d66a49..25735e4881 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -148,7 +148,7 @@ AC_SUBST(NM)
 ])
 
 dnl Run a static link test with -nostdlib -nostartfiles.
-dnl LIBC_TRY_LINK_STATIC([code], [action-if-true], [action-if-false])
+dnl LIBC_TRY_LINK_STATIC([code], [opts], [action-if-true], [action-if-false])
 AC_DEFUN([LIBC_TRY_LINK_STATIC],
 [cat > conftest.c <<EOF
 int _start (void) { return 0; }
@@ -156,9 +156,9 @@ int __start (void) { return 0; }
 $1
 EOF
 AS_IF([AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -o conftest
-		       conftest.c -static -nostartfiles -nostdlib
+		       conftest.c $2 -static -nostartfiles -nostdlib
 		       1>&AS_MESSAGE_LOG_FD])],
-      [$2], [$3])
+      [$3], [$4])
 rm -f conftest*])
 
 dnl Test a compiler option or options with an empty input file.
diff --git a/configure b/configure
index c01ae25e90..a7a649eb5b 100755
--- a/configure
+++ b/configure
@@ -8002,6 +8002,7 @@ libc_cv_localstatedir=$localstatedir
 libc_cv_gcc_unwind_find_fde=no
 libc_cv_idn=no
 pthread_in_libc=yes
+libc_cv_ifunc_static_pie=yes
 
 # Iterate over all the sysdep directories we will use, running their
 # configure fragments.
@@ -8017,6 +8018,9 @@ printf "%s\n" "running configure fragment for $dir" >&6; }
   fi
 done
 
+config_vars="$config_vars
+ifunc-static-pie = $libc_cv_ifunc_static_pie"
+
 if test x"$build_mathvec" = xnotset; then
   build_mathvec=no
 fi
diff --git a/configure.ac b/configure.ac
index 826d55de64..2b2e2f4927 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1761,6 +1761,7 @@ libc_cv_localstatedir=$localstatedir
 libc_cv_gcc_unwind_find_fde=no
 libc_cv_idn=no
 pthread_in_libc=yes
+libc_cv_ifunc_static_pie=yes
 
 # Iterate over all the sysdep directories we will use, running their
 # configure fragments.
@@ -1775,6 +1776,8 @@ for dir in $sysnames; do
   fi
 done
 
+LIBC_CONFIG_VAR([ifunc-static-pie], [$libc_cv_ifunc_static_pie])
+
 if test x"$build_mathvec" = xnotset; then
   build_mathvec=no
 fi
diff --git a/elf/Makefile b/elf/Makefile
index 0a901aef6a..9c91e8bed1 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -1061,16 +1061,20 @@ tests += $(tests-static)
 ifeq (yes,$(have-ifunc))
 tests-ifuncstatic := \
   ifuncmain1picstatic \
-  ifuncmain1static \
   ifuncmain2picstatic \
   ifuncmain2static \
   ifuncmain4picstatic \
-  ifuncmain4static \
   ifuncmain5picstatic \
   ifuncmain5static \
+  # tests-ifuncstatic
+ifeq (yes,$(ifunc-static-pie))
+tests-ifuncstatic += \
+  ifuncmain1static \
+  ifuncmain4static \
   ifuncmain7picstatic \
   ifuncmain7static \
   # tests-ifuncstatic
+endif
 ifeq (yes,$(have-gcc-ifunc))
 tests-ifuncstatic += ifuncmain9static ifuncmain9picstatic
 endif
@@ -1090,11 +1094,15 @@ tests-internal += \
   ifuncmain2 \
   ifuncmain2pic \
   ifuncmain3 \
-  ifuncmain4 \
   ifuncmain5staticpic \
+  # tests-internal
+ifeq (yes,$(ifunc-static-pie))
+tests-internal += \
+  ifuncmain4 \
   ifuncmain7 \
   ifuncmain7pic \
   # tests-internal
+endif
 ifeq (no,$(with-lld))
 tests-internal += \
   ifuncmain1 \
@@ -1123,9 +1131,13 @@ ifunc-pie-tests = \
   ifuncmain1pie \
   ifuncmain1staticpie \
   ifuncmain1vispie \
+  # ifunc-pie-tests
+ifeq (yes,$(ifunc-static-pie))
+ifunc-pie-tests += \
   ifuncmain6pie \
   ifuncmain7pie \
   # ifunc-pie-tests
+endif
 ifeq (yes,$(have-gcc-ifunc))
 ifunc-pie-tests += ifuncmain9pie
 endif
diff --git a/sysdeps/i386/configure b/sysdeps/i386/configure
index 84656cef6e..d10a9b6fd0 100644
--- a/sysdeps/i386/configure
+++ b/sysdeps/i386/configure
@@ -89,6 +89,37 @@ printf "%s\n" "$libc_cv_ld_static_pie" >&6; }
   fi
 fi
 
+if test "$libc_cv_static_pie" == "yes"; then
+  cat > conftest.c <<EOF
+int _start (void) { return 0; }
+int __start (void) { return 0; }
+int foo (void) __attribute__ ((ifunc ("foo_ifunc")));
+void *
+foo_ifunc (void)
+{
+  return 0;
+}
+int main (void)
+{
+  return foo ();
+}
+EOF
+if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -o conftest
+		       conftest.c -fPIE -static-pie -static -nostartfiles -nostdlib
+		       1>&5'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }
+then :
+  libc_cv_ifunc_static_pie=yes
+else $as_nop
+  libc_cv_ifunc_static_pie=no
+fi
+rm -f conftest*
+fi
+
 if test x"$multi_arch" != xno; then
   printf "%s\n" "#define NO_HIDDEN_EXTERN_FUNC_IN_PIE 1" >>confdefs.h
 
diff --git a/sysdeps/i386/configure.ac b/sysdeps/i386/configure.ac
index 7f68e6210a..d61ab42927 100644
--- a/sysdeps/i386/configure.ac
+++ b/sysdeps/i386/configure.ac
@@ -58,6 +58,21 @@ rm -f conftest*])
   fi
 fi
 
+if test "$libc_cv_static_pie" == "yes"; then
+  LIBC_TRY_LINK_STATIC([dnl
+int foo (void) __attribute__ ((ifunc ("foo_ifunc")));
+void *
+foo_ifunc (void)
+{
+  return 0;
+}
+int main (void)
+{
+  return foo ();
+}],
+    [-fPIE -static-pie], libc_cv_ifunc_static_pie=yes, libc_cv_ifunc_static_pie=no)
+fi
+
 dnl When multi-arch is enabled, all external functions must be called
 dnl via PIC PLT in PIE, which requires setting up EBX register.
 if test x"$multi_arch" != xno; then

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [glibc/azanella/clang] i686: Do not build ifunc tests if compiler does not generate supported relocations
@ 2024-04-02 16:00 Adhemerval Zanella
  0 siblings, 0 replies; 8+ messages in thread
From: Adhemerval Zanella @ 2024-04-02 16:00 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=e7b63f40c3daa3142e6ab60883b75140ac451367

commit e7b63f40c3daa3142e6ab60883b75140ac451367
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Aug 22 16:27:15 2023 -0300

    i686: Do not build ifunc tests if compiler does not generate supported relocations
    
    clang with --target i668 might not produce supported relocations
    that ld.bfd can use for -static-pie without -fPIC, which are used
    on some tests.  Disable them for now.

Diff:
---
 aclocal.m4                |  6 +++---
 configure                 |  4 ++++
 configure.ac              |  3 +++
 elf/Makefile              | 18 +++++++++++++++---
 sysdeps/i386/configure    | 31 +++++++++++++++++++++++++++++++
 sysdeps/i386/configure.ac | 15 +++++++++++++++
 6 files changed, 71 insertions(+), 6 deletions(-)

diff --git a/aclocal.m4 b/aclocal.m4
index a097d66a49..25735e4881 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -148,7 +148,7 @@ AC_SUBST(NM)
 ])
 
 dnl Run a static link test with -nostdlib -nostartfiles.
-dnl LIBC_TRY_LINK_STATIC([code], [action-if-true], [action-if-false])
+dnl LIBC_TRY_LINK_STATIC([code], [opts], [action-if-true], [action-if-false])
 AC_DEFUN([LIBC_TRY_LINK_STATIC],
 [cat > conftest.c <<EOF
 int _start (void) { return 0; }
@@ -156,9 +156,9 @@ int __start (void) { return 0; }
 $1
 EOF
 AS_IF([AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -o conftest
-		       conftest.c -static -nostartfiles -nostdlib
+		       conftest.c $2 -static -nostartfiles -nostdlib
 		       1>&AS_MESSAGE_LOG_FD])],
-      [$2], [$3])
+      [$3], [$4])
 rm -f conftest*])
 
 dnl Test a compiler option or options with an empty input file.
diff --git a/configure b/configure
index c01ae25e90..a7a649eb5b 100755
--- a/configure
+++ b/configure
@@ -8002,6 +8002,7 @@ libc_cv_localstatedir=$localstatedir
 libc_cv_gcc_unwind_find_fde=no
 libc_cv_idn=no
 pthread_in_libc=yes
+libc_cv_ifunc_static_pie=yes
 
 # Iterate over all the sysdep directories we will use, running their
 # configure fragments.
@@ -8017,6 +8018,9 @@ printf "%s\n" "running configure fragment for $dir" >&6; }
   fi
 done
 
+config_vars="$config_vars
+ifunc-static-pie = $libc_cv_ifunc_static_pie"
+
 if test x"$build_mathvec" = xnotset; then
   build_mathvec=no
 fi
diff --git a/configure.ac b/configure.ac
index 826d55de64..2b2e2f4927 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1761,6 +1761,7 @@ libc_cv_localstatedir=$localstatedir
 libc_cv_gcc_unwind_find_fde=no
 libc_cv_idn=no
 pthread_in_libc=yes
+libc_cv_ifunc_static_pie=yes
 
 # Iterate over all the sysdep directories we will use, running their
 # configure fragments.
@@ -1775,6 +1776,8 @@ for dir in $sysnames; do
   fi
 done
 
+LIBC_CONFIG_VAR([ifunc-static-pie], [$libc_cv_ifunc_static_pie])
+
 if test x"$build_mathvec" = xnotset; then
   build_mathvec=no
 fi
diff --git a/elf/Makefile b/elf/Makefile
index d1e4df03c1..c271095eb7 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -1054,16 +1054,20 @@ tests += $(tests-static)
 ifeq (yes,$(have-ifunc))
 tests-ifuncstatic := \
   ifuncmain1picstatic \
-  ifuncmain1static \
   ifuncmain2picstatic \
   ifuncmain2static \
   ifuncmain4picstatic \
-  ifuncmain4static \
   ifuncmain5picstatic \
   ifuncmain5static \
+  # tests-ifuncstatic
+ifeq (yes,$(ifunc-static-pie))
+tests-ifuncstatic += \
+  ifuncmain1static \
+  ifuncmain4static \
   ifuncmain7picstatic \
   ifuncmain7static \
   # tests-ifuncstatic
+endif
 ifeq (yes,$(have-gcc-ifunc))
 tests-ifuncstatic += ifuncmain9static ifuncmain9picstatic
 endif
@@ -1083,11 +1087,15 @@ tests-internal += \
   ifuncmain2 \
   ifuncmain2pic \
   ifuncmain3 \
-  ifuncmain4 \
   ifuncmain5staticpic \
+  # tests-internal
+ifeq (yes,$(ifunc-static-pie))
+tests-internal += \
+  ifuncmain4 \
   ifuncmain7 \
   ifuncmain7pic \
   # tests-internal
+endif
 ifeq (no,$(with-lld))
 tests-internal += \
   ifuncmain1 \
@@ -1116,9 +1124,13 @@ ifunc-pie-tests = \
   ifuncmain1pie \
   ifuncmain1staticpie \
   ifuncmain1vispie \
+  # ifunc-pie-tests
+ifeq (yes,$(ifunc-static-pie))
+ifunc-pie-tests += \
   ifuncmain6pie \
   ifuncmain7pie \
   # ifunc-pie-tests
+endif
 ifeq (yes,$(have-gcc-ifunc))
 ifunc-pie-tests += ifuncmain9pie
 endif
diff --git a/sysdeps/i386/configure b/sysdeps/i386/configure
index 84656cef6e..d10a9b6fd0 100644
--- a/sysdeps/i386/configure
+++ b/sysdeps/i386/configure
@@ -89,6 +89,37 @@ printf "%s\n" "$libc_cv_ld_static_pie" >&6; }
   fi
 fi
 
+if test "$libc_cv_static_pie" == "yes"; then
+  cat > conftest.c <<EOF
+int _start (void) { return 0; }
+int __start (void) { return 0; }
+int foo (void) __attribute__ ((ifunc ("foo_ifunc")));
+void *
+foo_ifunc (void)
+{
+  return 0;
+}
+int main (void)
+{
+  return foo ();
+}
+EOF
+if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -o conftest
+		       conftest.c -fPIE -static-pie -static -nostartfiles -nostdlib
+		       1>&5'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }
+then :
+  libc_cv_ifunc_static_pie=yes
+else $as_nop
+  libc_cv_ifunc_static_pie=no
+fi
+rm -f conftest*
+fi
+
 if test x"$multi_arch" != xno; then
   printf "%s\n" "#define NO_HIDDEN_EXTERN_FUNC_IN_PIE 1" >>confdefs.h
 
diff --git a/sysdeps/i386/configure.ac b/sysdeps/i386/configure.ac
index 7f68e6210a..d61ab42927 100644
--- a/sysdeps/i386/configure.ac
+++ b/sysdeps/i386/configure.ac
@@ -58,6 +58,21 @@ rm -f conftest*])
   fi
 fi
 
+if test "$libc_cv_static_pie" == "yes"; then
+  LIBC_TRY_LINK_STATIC([dnl
+int foo (void) __attribute__ ((ifunc ("foo_ifunc")));
+void *
+foo_ifunc (void)
+{
+  return 0;
+}
+int main (void)
+{
+  return foo ();
+}],
+    [-fPIE -static-pie], libc_cv_ifunc_static_pie=yes, libc_cv_ifunc_static_pie=no)
+fi
+
 dnl When multi-arch is enabled, all external functions must be called
 dnl via PIC PLT in PIE, which requires setting up EBX register.
 if test x"$multi_arch" != xno; then

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [glibc/azanella/clang] i686: Do not build ifunc tests if compiler does not generate supported relocations
@ 2024-02-09 17:38 Adhemerval Zanella
  0 siblings, 0 replies; 8+ messages in thread
From: Adhemerval Zanella @ 2024-02-09 17:38 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=5e3f17afa6350ac47cc0d349d240cc00f1172b94

commit 5e3f17afa6350ac47cc0d349d240cc00f1172b94
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Aug 22 16:27:15 2023 -0300

    i686: Do not build ifunc tests if compiler does not generate supported relocations
    
    clang with --target i668 might not produce supported relocations
    that ld.bfd can use for -static-pie without -fPIC, which are used
    on some tests.  Disable them for now.

Diff:
---
 aclocal.m4                |  6 +++---
 configure                 |  4 ++++
 configure.ac              |  3 +++
 elf/Makefile              | 18 +++++++++++++++---
 sysdeps/i386/configure    | 31 +++++++++++++++++++++++++++++++
 sysdeps/i386/configure.ac | 15 +++++++++++++++
 6 files changed, 71 insertions(+), 6 deletions(-)

diff --git a/aclocal.m4 b/aclocal.m4
index a097d66a49..25735e4881 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -148,7 +148,7 @@ AC_SUBST(NM)
 ])
 
 dnl Run a static link test with -nostdlib -nostartfiles.
-dnl LIBC_TRY_LINK_STATIC([code], [action-if-true], [action-if-false])
+dnl LIBC_TRY_LINK_STATIC([code], [opts], [action-if-true], [action-if-false])
 AC_DEFUN([LIBC_TRY_LINK_STATIC],
 [cat > conftest.c <<EOF
 int _start (void) { return 0; }
@@ -156,9 +156,9 @@ int __start (void) { return 0; }
 $1
 EOF
 AS_IF([AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -o conftest
-		       conftest.c -static -nostartfiles -nostdlib
+		       conftest.c $2 -static -nostartfiles -nostdlib
 		       1>&AS_MESSAGE_LOG_FD])],
-      [$2], [$3])
+      [$3], [$4])
 rm -f conftest*])
 
 dnl Test a compiler option or options with an empty input file.
diff --git a/configure b/configure
index 7dc395193a..c3084f3355 100755
--- a/configure
+++ b/configure
@@ -7999,6 +7999,7 @@ libc_cv_localstatedir=$localstatedir
 libc_cv_gcc_unwind_find_fde=no
 libc_cv_idn=no
 pthread_in_libc=yes
+libc_cv_ifunc_static_pie=yes
 
 # Iterate over all the sysdep directories we will use, running their
 # configure fragments.
@@ -8014,6 +8015,9 @@ printf "%s\n" "running configure fragment for $dir" >&6; }
   fi
 done
 
+config_vars="$config_vars
+ifunc-static-pie = $libc_cv_ifunc_static_pie"
+
 if test x"$build_mathvec" = xnotset; then
   build_mathvec=no
 fi
diff --git a/configure.ac b/configure.ac
index fc50642673..babf8db1bb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1758,6 +1758,7 @@ libc_cv_localstatedir=$localstatedir
 libc_cv_gcc_unwind_find_fde=no
 libc_cv_idn=no
 pthread_in_libc=yes
+libc_cv_ifunc_static_pie=yes
 
 # Iterate over all the sysdep directories we will use, running their
 # configure fragments.
@@ -1772,6 +1773,8 @@ for dir in $sysnames; do
   fi
 done
 
+LIBC_CONFIG_VAR([ifunc-static-pie], [$libc_cv_ifunc_static_pie])
+
 if test x"$build_mathvec" = xnotset; then
   build_mathvec=no
 fi
diff --git a/elf/Makefile b/elf/Makefile
index 2579234b26..49e205b38d 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -1048,16 +1048,20 @@ tests += $(tests-static)
 ifeq (yes,$(have-ifunc))
 tests-ifuncstatic := \
   ifuncmain1picstatic \
-  ifuncmain1static \
   ifuncmain2picstatic \
   ifuncmain2static \
   ifuncmain4picstatic \
-  ifuncmain4static \
   ifuncmain5picstatic \
   ifuncmain5static \
+  # tests-ifuncstatic
+ifeq (yes,$(ifunc-static-pie))
+tests-ifuncstatic += \
+  ifuncmain1static \
+  ifuncmain4static \
   ifuncmain7picstatic \
   ifuncmain7static \
   # tests-ifuncstatic
+endif
 ifeq (yes,$(have-gcc-ifunc))
 tests-ifuncstatic += ifuncmain9static ifuncmain9picstatic
 endif
@@ -1077,11 +1081,15 @@ tests-internal += \
   ifuncmain2 \
   ifuncmain2pic \
   ifuncmain3 \
-  ifuncmain4 \
   ifuncmain5staticpic \
+  # tests-internal
+ifeq (yes,$(ifunc-static-pie))
+tests-internal += \
+  ifuncmain4 \
   ifuncmain7 \
   ifuncmain7pic \
   # tests-internal
+endif
 ifeq (no,$(with-lld))
 tests-internal += \
   ifuncmain1 \
@@ -1110,9 +1118,13 @@ ifunc-pie-tests = \
   ifuncmain1pie \
   ifuncmain1staticpie \
   ifuncmain1vispie \
+  # ifunc-pie-tests
+ifeq (yes,$(ifunc-static-pie))
+ifunc-pie-tests += \
   ifuncmain6pie \
   ifuncmain7pie \
   # ifunc-pie-tests
+endif
 ifeq (yes,$(have-gcc-ifunc))
 ifunc-pie-tests += ifuncmain9pie
 endif
diff --git a/sysdeps/i386/configure b/sysdeps/i386/configure
index 84656cef6e..d10a9b6fd0 100644
--- a/sysdeps/i386/configure
+++ b/sysdeps/i386/configure
@@ -89,6 +89,37 @@ printf "%s\n" "$libc_cv_ld_static_pie" >&6; }
   fi
 fi
 
+if test "$libc_cv_static_pie" == "yes"; then
+  cat > conftest.c <<EOF
+int _start (void) { return 0; }
+int __start (void) { return 0; }
+int foo (void) __attribute__ ((ifunc ("foo_ifunc")));
+void *
+foo_ifunc (void)
+{
+  return 0;
+}
+int main (void)
+{
+  return foo ();
+}
+EOF
+if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -o conftest
+		       conftest.c -fPIE -static-pie -static -nostartfiles -nostdlib
+		       1>&5'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }
+then :
+  libc_cv_ifunc_static_pie=yes
+else $as_nop
+  libc_cv_ifunc_static_pie=no
+fi
+rm -f conftest*
+fi
+
 if test x"$multi_arch" != xno; then
   printf "%s\n" "#define NO_HIDDEN_EXTERN_FUNC_IN_PIE 1" >>confdefs.h
 
diff --git a/sysdeps/i386/configure.ac b/sysdeps/i386/configure.ac
index 7f68e6210a..d61ab42927 100644
--- a/sysdeps/i386/configure.ac
+++ b/sysdeps/i386/configure.ac
@@ -58,6 +58,21 @@ rm -f conftest*])
   fi
 fi
 
+if test "$libc_cv_static_pie" == "yes"; then
+  LIBC_TRY_LINK_STATIC([dnl
+int foo (void) __attribute__ ((ifunc ("foo_ifunc")));
+void *
+foo_ifunc (void)
+{
+  return 0;
+}
+int main (void)
+{
+  return foo ();
+}],
+    [-fPIE -static-pie], libc_cv_ifunc_static_pie=yes, libc_cv_ifunc_static_pie=no)
+fi
+
 dnl When multi-arch is enabled, all external functions must be called
 dnl via PIC PLT in PIE, which requires setting up EBX register.
 if test x"$multi_arch" != xno; then

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [glibc/azanella/clang] i686: Do not build ifunc tests if compiler does not generate supported relocations
@ 2024-02-07 14:13 Adhemerval Zanella
  0 siblings, 0 replies; 8+ messages in thread
From: Adhemerval Zanella @ 2024-02-07 14:13 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=9ced8ef12a11b7d8dc19a05f2f5cf8ce89e61190

commit 9ced8ef12a11b7d8dc19a05f2f5cf8ce89e61190
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Aug 22 16:27:15 2023 -0300

    i686: Do not build ifunc tests if compiler does not generate supported relocations
    
    clang with --target i668 might not produce supported relocations
    that ld.bfd can use for -static-pie without -fPIC, which are used
    on some tests.  Disable them for now.

Diff:
---
 aclocal.m4                |  6 +++---
 configure                 |  4 ++++
 configure.ac              |  3 +++
 elf/Makefile              | 18 +++++++++++++++---
 sysdeps/i386/configure    | 31 +++++++++++++++++++++++++++++++
 sysdeps/i386/configure.ac | 15 +++++++++++++++
 6 files changed, 71 insertions(+), 6 deletions(-)

diff --git a/aclocal.m4 b/aclocal.m4
index a097d66a49..25735e4881 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -148,7 +148,7 @@ AC_SUBST(NM)
 ])
 
 dnl Run a static link test with -nostdlib -nostartfiles.
-dnl LIBC_TRY_LINK_STATIC([code], [action-if-true], [action-if-false])
+dnl LIBC_TRY_LINK_STATIC([code], [opts], [action-if-true], [action-if-false])
 AC_DEFUN([LIBC_TRY_LINK_STATIC],
 [cat > conftest.c <<EOF
 int _start (void) { return 0; }
@@ -156,9 +156,9 @@ int __start (void) { return 0; }
 $1
 EOF
 AS_IF([AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -o conftest
-		       conftest.c -static -nostartfiles -nostdlib
+		       conftest.c $2 -static -nostartfiles -nostdlib
 		       1>&AS_MESSAGE_LOG_FD])],
-      [$2], [$3])
+      [$3], [$4])
 rm -f conftest*])
 
 dnl Test a compiler option or options with an empty input file.
diff --git a/configure b/configure
index 7dc395193a..c3084f3355 100755
--- a/configure
+++ b/configure
@@ -7999,6 +7999,7 @@ libc_cv_localstatedir=$localstatedir
 libc_cv_gcc_unwind_find_fde=no
 libc_cv_idn=no
 pthread_in_libc=yes
+libc_cv_ifunc_static_pie=yes
 
 # Iterate over all the sysdep directories we will use, running their
 # configure fragments.
@@ -8014,6 +8015,9 @@ printf "%s\n" "running configure fragment for $dir" >&6; }
   fi
 done
 
+config_vars="$config_vars
+ifunc-static-pie = $libc_cv_ifunc_static_pie"
+
 if test x"$build_mathvec" = xnotset; then
   build_mathvec=no
 fi
diff --git a/configure.ac b/configure.ac
index fc50642673..babf8db1bb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1758,6 +1758,7 @@ libc_cv_localstatedir=$localstatedir
 libc_cv_gcc_unwind_find_fde=no
 libc_cv_idn=no
 pthread_in_libc=yes
+libc_cv_ifunc_static_pie=yes
 
 # Iterate over all the sysdep directories we will use, running their
 # configure fragments.
@@ -1772,6 +1773,8 @@ for dir in $sysnames; do
   fi
 done
 
+LIBC_CONFIG_VAR([ifunc-static-pie], [$libc_cv_ifunc_static_pie])
+
 if test x"$build_mathvec" = xnotset; then
   build_mathvec=no
 fi
diff --git a/elf/Makefile b/elf/Makefile
index 2579234b26..49e205b38d 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -1048,16 +1048,20 @@ tests += $(tests-static)
 ifeq (yes,$(have-ifunc))
 tests-ifuncstatic := \
   ifuncmain1picstatic \
-  ifuncmain1static \
   ifuncmain2picstatic \
   ifuncmain2static \
   ifuncmain4picstatic \
-  ifuncmain4static \
   ifuncmain5picstatic \
   ifuncmain5static \
+  # tests-ifuncstatic
+ifeq (yes,$(ifunc-static-pie))
+tests-ifuncstatic += \
+  ifuncmain1static \
+  ifuncmain4static \
   ifuncmain7picstatic \
   ifuncmain7static \
   # tests-ifuncstatic
+endif
 ifeq (yes,$(have-gcc-ifunc))
 tests-ifuncstatic += ifuncmain9static ifuncmain9picstatic
 endif
@@ -1077,11 +1081,15 @@ tests-internal += \
   ifuncmain2 \
   ifuncmain2pic \
   ifuncmain3 \
-  ifuncmain4 \
   ifuncmain5staticpic \
+  # tests-internal
+ifeq (yes,$(ifunc-static-pie))
+tests-internal += \
+  ifuncmain4 \
   ifuncmain7 \
   ifuncmain7pic \
   # tests-internal
+endif
 ifeq (no,$(with-lld))
 tests-internal += \
   ifuncmain1 \
@@ -1110,9 +1118,13 @@ ifunc-pie-tests = \
   ifuncmain1pie \
   ifuncmain1staticpie \
   ifuncmain1vispie \
+  # ifunc-pie-tests
+ifeq (yes,$(ifunc-static-pie))
+ifunc-pie-tests += \
   ifuncmain6pie \
   ifuncmain7pie \
   # ifunc-pie-tests
+endif
 ifeq (yes,$(have-gcc-ifunc))
 ifunc-pie-tests += ifuncmain9pie
 endif
diff --git a/sysdeps/i386/configure b/sysdeps/i386/configure
index 84656cef6e..d10a9b6fd0 100644
--- a/sysdeps/i386/configure
+++ b/sysdeps/i386/configure
@@ -89,6 +89,37 @@ printf "%s\n" "$libc_cv_ld_static_pie" >&6; }
   fi
 fi
 
+if test "$libc_cv_static_pie" == "yes"; then
+  cat > conftest.c <<EOF
+int _start (void) { return 0; }
+int __start (void) { return 0; }
+int foo (void) __attribute__ ((ifunc ("foo_ifunc")));
+void *
+foo_ifunc (void)
+{
+  return 0;
+}
+int main (void)
+{
+  return foo ();
+}
+EOF
+if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -o conftest
+		       conftest.c -fPIE -static-pie -static -nostartfiles -nostdlib
+		       1>&5'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }
+then :
+  libc_cv_ifunc_static_pie=yes
+else $as_nop
+  libc_cv_ifunc_static_pie=no
+fi
+rm -f conftest*
+fi
+
 if test x"$multi_arch" != xno; then
   printf "%s\n" "#define NO_HIDDEN_EXTERN_FUNC_IN_PIE 1" >>confdefs.h
 
diff --git a/sysdeps/i386/configure.ac b/sysdeps/i386/configure.ac
index 7f68e6210a..d61ab42927 100644
--- a/sysdeps/i386/configure.ac
+++ b/sysdeps/i386/configure.ac
@@ -58,6 +58,21 @@ rm -f conftest*])
   fi
 fi
 
+if test "$libc_cv_static_pie" == "yes"; then
+  LIBC_TRY_LINK_STATIC([dnl
+int foo (void) __attribute__ ((ifunc ("foo_ifunc")));
+void *
+foo_ifunc (void)
+{
+  return 0;
+}
+int main (void)
+{
+  return foo ();
+}],
+    [-fPIE -static-pie], libc_cv_ifunc_static_pie=yes, libc_cv_ifunc_static_pie=no)
+fi
+
 dnl When multi-arch is enabled, all external functions must be called
 dnl via PIC PLT in PIE, which requires setting up EBX register.
 if test x"$multi_arch" != xno; then

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [glibc/azanella/clang] i686: Do not build ifunc tests if compiler does not generate supported relocations
@ 2024-01-29 18:04 Adhemerval Zanella
  0 siblings, 0 replies; 8+ messages in thread
From: Adhemerval Zanella @ 2024-01-29 18:04 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=c96a11d50e25e7da1012c2b99f1bf33532a6bb0d

commit c96a11d50e25e7da1012c2b99f1bf33532a6bb0d
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Aug 22 16:27:15 2023 -0300

    i686: Do not build ifunc tests if compiler does not generate supported relocations
    
    clang with --target i668 might not produce supported relocations
    that ld.bfd can use for -static-pie without -fPIC, which are used
    on some tests.  Disable them for now.

Diff:
---
 aclocal.m4                |  6 +++---
 configure                 |  4 ++++
 configure.ac              |  3 +++
 elf/Makefile              | 18 +++++++++++++++---
 sysdeps/i386/configure    | 31 +++++++++++++++++++++++++++++++
 sysdeps/i386/configure.ac | 15 +++++++++++++++
 6 files changed, 71 insertions(+), 6 deletions(-)

diff --git a/aclocal.m4 b/aclocal.m4
index a097d66a49..25735e4881 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -148,7 +148,7 @@ AC_SUBST(NM)
 ])
 
 dnl Run a static link test with -nostdlib -nostartfiles.
-dnl LIBC_TRY_LINK_STATIC([code], [action-if-true], [action-if-false])
+dnl LIBC_TRY_LINK_STATIC([code], [opts], [action-if-true], [action-if-false])
 AC_DEFUN([LIBC_TRY_LINK_STATIC],
 [cat > conftest.c <<EOF
 int _start (void) { return 0; }
@@ -156,9 +156,9 @@ int __start (void) { return 0; }
 $1
 EOF
 AS_IF([AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -o conftest
-		       conftest.c -static -nostartfiles -nostdlib
+		       conftest.c $2 -static -nostartfiles -nostdlib
 		       1>&AS_MESSAGE_LOG_FD])],
-      [$2], [$3])
+      [$3], [$4])
 rm -f conftest*])
 
 dnl Test a compiler option or options with an empty input file.
diff --git a/configure b/configure
index 7dc395193a..c3084f3355 100755
--- a/configure
+++ b/configure
@@ -7999,6 +7999,7 @@ libc_cv_localstatedir=$localstatedir
 libc_cv_gcc_unwind_find_fde=no
 libc_cv_idn=no
 pthread_in_libc=yes
+libc_cv_ifunc_static_pie=yes
 
 # Iterate over all the sysdep directories we will use, running their
 # configure fragments.
@@ -8014,6 +8015,9 @@ printf "%s\n" "running configure fragment for $dir" >&6; }
   fi
 done
 
+config_vars="$config_vars
+ifunc-static-pie = $libc_cv_ifunc_static_pie"
+
 if test x"$build_mathvec" = xnotset; then
   build_mathvec=no
 fi
diff --git a/configure.ac b/configure.ac
index fc50642673..babf8db1bb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1758,6 +1758,7 @@ libc_cv_localstatedir=$localstatedir
 libc_cv_gcc_unwind_find_fde=no
 libc_cv_idn=no
 pthread_in_libc=yes
+libc_cv_ifunc_static_pie=yes
 
 # Iterate over all the sysdep directories we will use, running their
 # configure fragments.
@@ -1772,6 +1773,8 @@ for dir in $sysnames; do
   fi
 done
 
+LIBC_CONFIG_VAR([ifunc-static-pie], [$libc_cv_ifunc_static_pie])
+
 if test x"$build_mathvec" = xnotset; then
   build_mathvec=no
 fi
diff --git a/elf/Makefile b/elf/Makefile
index 2579234b26..49e205b38d 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -1048,16 +1048,20 @@ tests += $(tests-static)
 ifeq (yes,$(have-ifunc))
 tests-ifuncstatic := \
   ifuncmain1picstatic \
-  ifuncmain1static \
   ifuncmain2picstatic \
   ifuncmain2static \
   ifuncmain4picstatic \
-  ifuncmain4static \
   ifuncmain5picstatic \
   ifuncmain5static \
+  # tests-ifuncstatic
+ifeq (yes,$(ifunc-static-pie))
+tests-ifuncstatic += \
+  ifuncmain1static \
+  ifuncmain4static \
   ifuncmain7picstatic \
   ifuncmain7static \
   # tests-ifuncstatic
+endif
 ifeq (yes,$(have-gcc-ifunc))
 tests-ifuncstatic += ifuncmain9static ifuncmain9picstatic
 endif
@@ -1077,11 +1081,15 @@ tests-internal += \
   ifuncmain2 \
   ifuncmain2pic \
   ifuncmain3 \
-  ifuncmain4 \
   ifuncmain5staticpic \
+  # tests-internal
+ifeq (yes,$(ifunc-static-pie))
+tests-internal += \
+  ifuncmain4 \
   ifuncmain7 \
   ifuncmain7pic \
   # tests-internal
+endif
 ifeq (no,$(with-lld))
 tests-internal += \
   ifuncmain1 \
@@ -1110,9 +1118,13 @@ ifunc-pie-tests = \
   ifuncmain1pie \
   ifuncmain1staticpie \
   ifuncmain1vispie \
+  # ifunc-pie-tests
+ifeq (yes,$(ifunc-static-pie))
+ifunc-pie-tests += \
   ifuncmain6pie \
   ifuncmain7pie \
   # ifunc-pie-tests
+endif
 ifeq (yes,$(have-gcc-ifunc))
 ifunc-pie-tests += ifuncmain9pie
 endif
diff --git a/sysdeps/i386/configure b/sysdeps/i386/configure
index 84656cef6e..d10a9b6fd0 100644
--- a/sysdeps/i386/configure
+++ b/sysdeps/i386/configure
@@ -89,6 +89,37 @@ printf "%s\n" "$libc_cv_ld_static_pie" >&6; }
   fi
 fi
 
+if test "$libc_cv_static_pie" == "yes"; then
+  cat > conftest.c <<EOF
+int _start (void) { return 0; }
+int __start (void) { return 0; }
+int foo (void) __attribute__ ((ifunc ("foo_ifunc")));
+void *
+foo_ifunc (void)
+{
+  return 0;
+}
+int main (void)
+{
+  return foo ();
+}
+EOF
+if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -o conftest
+		       conftest.c -fPIE -static-pie -static -nostartfiles -nostdlib
+		       1>&5'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }
+then :
+  libc_cv_ifunc_static_pie=yes
+else $as_nop
+  libc_cv_ifunc_static_pie=no
+fi
+rm -f conftest*
+fi
+
 if test x"$multi_arch" != xno; then
   printf "%s\n" "#define NO_HIDDEN_EXTERN_FUNC_IN_PIE 1" >>confdefs.h
 
diff --git a/sysdeps/i386/configure.ac b/sysdeps/i386/configure.ac
index 7f68e6210a..d61ab42927 100644
--- a/sysdeps/i386/configure.ac
+++ b/sysdeps/i386/configure.ac
@@ -58,6 +58,21 @@ rm -f conftest*])
   fi
 fi
 
+if test "$libc_cv_static_pie" == "yes"; then
+  LIBC_TRY_LINK_STATIC([dnl
+int foo (void) __attribute__ ((ifunc ("foo_ifunc")));
+void *
+foo_ifunc (void)
+{
+  return 0;
+}
+int main (void)
+{
+  return foo ();
+}],
+    [-fPIE -static-pie], libc_cv_ifunc_static_pie=yes, libc_cv_ifunc_static_pie=no)
+fi
+
 dnl When multi-arch is enabled, all external functions must be called
 dnl via PIC PLT in PIE, which requires setting up EBX register.
 if test x"$multi_arch" != xno; then

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [glibc/azanella/clang] i686: Do not build ifunc tests if compiler does not generate supported relocations
@ 2023-12-21 19:00 Adhemerval Zanella
  0 siblings, 0 replies; 8+ messages in thread
From: Adhemerval Zanella @ 2023-12-21 19:00 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=5d92f682f9a4ee3d7aebf7328866c35a1255032c

commit 5d92f682f9a4ee3d7aebf7328866c35a1255032c
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Aug 22 16:27:15 2023 -0300

    i686: Do not build ifunc tests if compiler does not generate supported relocations
    
    clang with --target i668 might not produce supported relocations
    that ld.bfd can use for -static-pie without -fPIC, which are used
    on some tests.  Disable them for now.

Diff:
---
 aclocal.m4                |  6 +++---
 configure                 |  4 ++++
 configure.ac              |  3 +++
 elf/Makefile              | 18 +++++++++++++++---
 sysdeps/i386/configure    | 31 +++++++++++++++++++++++++++++++
 sysdeps/i386/configure.ac | 15 +++++++++++++++
 6 files changed, 71 insertions(+), 6 deletions(-)

diff --git a/aclocal.m4 b/aclocal.m4
index a097d66a49..25735e4881 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -148,7 +148,7 @@ AC_SUBST(NM)
 ])
 
 dnl Run a static link test with -nostdlib -nostartfiles.
-dnl LIBC_TRY_LINK_STATIC([code], [action-if-true], [action-if-false])
+dnl LIBC_TRY_LINK_STATIC([code], [opts], [action-if-true], [action-if-false])
 AC_DEFUN([LIBC_TRY_LINK_STATIC],
 [cat > conftest.c <<EOF
 int _start (void) { return 0; }
@@ -156,9 +156,9 @@ int __start (void) { return 0; }
 $1
 EOF
 AS_IF([AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -o conftest
-		       conftest.c -static -nostartfiles -nostdlib
+		       conftest.c $2 -static -nostartfiles -nostdlib
 		       1>&AS_MESSAGE_LOG_FD])],
-      [$2], [$3])
+      [$3], [$4])
 rm -f conftest*])
 
 dnl Test a compiler option or options with an empty input file.
diff --git a/configure b/configure
index 07f5ddedc0..7b758c4981 100755
--- a/configure
+++ b/configure
@@ -7998,6 +7998,7 @@ libc_cv_localstatedir=$localstatedir
 libc_cv_gcc_unwind_find_fde=no
 libc_cv_idn=no
 pthread_in_libc=yes
+libc_cv_ifunc_static_pie=yes
 
 # Iterate over all the sysdep directories we will use, running their
 # configure fragments.
@@ -8013,6 +8014,9 @@ printf "%s\n" "running configure fragment for $dir" >&6; }
   fi
 done
 
+config_vars="$config_vars
+ifunc-static-pie = $libc_cv_ifunc_static_pie"
+
 if test x"$build_mathvec" = xnotset; then
   build_mathvec=no
 fi
diff --git a/configure.ac b/configure.ac
index fc50642673..babf8db1bb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1758,6 +1758,7 @@ libc_cv_localstatedir=$localstatedir
 libc_cv_gcc_unwind_find_fde=no
 libc_cv_idn=no
 pthread_in_libc=yes
+libc_cv_ifunc_static_pie=yes
 
 # Iterate over all the sysdep directories we will use, running their
 # configure fragments.
@@ -1772,6 +1773,8 @@ for dir in $sysnames; do
   fi
 done
 
+LIBC_CONFIG_VAR([ifunc-static-pie], [$libc_cv_ifunc_static_pie])
+
 if test x"$build_mathvec" = xnotset; then
   build_mathvec=no
 fi
diff --git a/elf/Makefile b/elf/Makefile
index 5310113f73..3ab19249d0 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -1048,16 +1048,20 @@ tests += $(tests-static)
 ifeq (yes,$(have-ifunc))
 tests-ifuncstatic := \
   ifuncmain1picstatic \
-  ifuncmain1static \
   ifuncmain2picstatic \
   ifuncmain2static \
   ifuncmain4picstatic \
-  ifuncmain4static \
   ifuncmain5picstatic \
   ifuncmain5static \
+  # tests-ifuncstatic
+ifeq (yes,$(ifunc-static-pie))
+tests-ifuncstatic += \
+  ifuncmain1static \
+  ifuncmain4static \
   ifuncmain7picstatic \
   ifuncmain7static \
   # tests-ifuncstatic
+endif
 ifeq (yes,$(have-gcc-ifunc))
 tests-ifuncstatic += ifuncmain9static ifuncmain9picstatic
 endif
@@ -1077,11 +1081,15 @@ tests-internal += \
   ifuncmain2 \
   ifuncmain2pic \
   ifuncmain3 \
-  ifuncmain4 \
   ifuncmain5staticpic \
+  # tests-internal
+ifeq (yes,$(ifunc-static-pie))
+tests-internal += \
+  ifuncmain4 \
   ifuncmain7 \
   ifuncmain7pic \
   # tests-internal
+endif
 ifeq (no,$(with-lld))
 tests-internal += \
   ifuncmain1 \
@@ -1110,9 +1118,13 @@ ifunc-pie-tests = \
   ifuncmain1pie \
   ifuncmain1staticpie \
   ifuncmain1vispie \
+  # ifunc-pie-tests
+ifeq (yes,$(ifunc-static-pie))
+ifunc-pie-tests += \
   ifuncmain6pie \
   ifuncmain7pie \
   # ifunc-pie-tests
+endif
 ifeq (yes,$(have-gcc-ifunc))
 ifunc-pie-tests += ifuncmain9pie
 endif
diff --git a/sysdeps/i386/configure b/sysdeps/i386/configure
index f5c3a281ac..bf362fb72e 100644
--- a/sysdeps/i386/configure
+++ b/sysdeps/i386/configure
@@ -84,6 +84,37 @@ printf "%s\n" "$libc_cv_ld_static_pie" >&6; }
   fi
 fi
 
+if test "$libc_cv_static_pie" == "yes"; then
+  cat > conftest.c <<EOF
+int _start (void) { return 0; }
+int __start (void) { return 0; }
+int foo (void) __attribute__ ((ifunc ("foo_ifunc")));
+void *
+foo_ifunc (void)
+{
+  return 0;
+}
+int main (void)
+{
+  return foo ();
+}
+EOF
+if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -o conftest
+		       conftest.c -fPIE -static-pie -static -nostartfiles -nostdlib
+		       1>&5'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }
+then :
+  libc_cv_ifunc_static_pie=yes
+else $as_nop
+  libc_cv_ifunc_static_pie=no
+fi
+rm -f conftest*
+fi
+
 if test x"$multi_arch" != xno; then
   printf "%s\n" "#define NO_HIDDEN_EXTERN_FUNC_IN_PIE 1" >>confdefs.h
 
diff --git a/sysdeps/i386/configure.ac b/sysdeps/i386/configure.ac
index 234ef2454a..88f0c06ccd 100644
--- a/sysdeps/i386/configure.ac
+++ b/sysdeps/i386/configure.ac
@@ -53,6 +53,21 @@ rm -f conftest*])
   fi
 fi
 
+if test "$libc_cv_static_pie" == "yes"; then
+  LIBC_TRY_LINK_STATIC([dnl
+int foo (void) __attribute__ ((ifunc ("foo_ifunc")));
+void *
+foo_ifunc (void)
+{
+  return 0;
+}
+int main (void)
+{
+  return foo ();
+}],
+    [-fPIE -static-pie], libc_cv_ifunc_static_pie=yes, libc_cv_ifunc_static_pie=no)
+fi
+
 dnl When multi-arch is enabled, all external functions must be called
 dnl via PIC PLT in PIE, which requires setting up EBX register.
 if test x"$multi_arch" != xno; then

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [glibc/azanella/clang] i686: Do not build ifunc tests if compiler does not generate supported relocations
@ 2023-09-28 17:58 Adhemerval Zanella
  0 siblings, 0 replies; 8+ messages in thread
From: Adhemerval Zanella @ 2023-09-28 17:58 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=bf49aea618dd0376acdd1d2ac8ce46533dd44566

commit bf49aea618dd0376acdd1d2ac8ce46533dd44566
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Aug 22 16:27:15 2023 -0300

    i686: Do not build ifunc tests if compiler does not generate supported relocations
    
    clang with --target i668 might not produce supported relocations
    that ld.bfd can use for -static-pie without -fPIC, which are used
    on some tests.  Disable them for now.

Diff:
---
 aclocal.m4                |  6 +++---
 configure                 |  4 ++++
 configure.ac              |  3 +++
 elf/Makefile              | 18 +++++++++++++++---
 sysdeps/i386/configure    | 31 +++++++++++++++++++++++++++++++
 sysdeps/i386/configure.ac | 15 +++++++++++++++
 6 files changed, 71 insertions(+), 6 deletions(-)

diff --git a/aclocal.m4 b/aclocal.m4
index a097d66a49..25735e4881 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -148,7 +148,7 @@ AC_SUBST(NM)
 ])
 
 dnl Run a static link test with -nostdlib -nostartfiles.
-dnl LIBC_TRY_LINK_STATIC([code], [action-if-true], [action-if-false])
+dnl LIBC_TRY_LINK_STATIC([code], [opts], [action-if-true], [action-if-false])
 AC_DEFUN([LIBC_TRY_LINK_STATIC],
 [cat > conftest.c <<EOF
 int _start (void) { return 0; }
@@ -156,9 +156,9 @@ int __start (void) { return 0; }
 $1
 EOF
 AS_IF([AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -o conftest
-		       conftest.c -static -nostartfiles -nostdlib
+		       conftest.c $2 -static -nostartfiles -nostdlib
 		       1>&AS_MESSAGE_LOG_FD])],
-      [$2], [$3])
+      [$3], [$4])
 rm -f conftest*])
 
 dnl Test a compiler option or options with an empty input file.
diff --git a/configure b/configure
index 19053863f7..315f801c59 100755
--- a/configure
+++ b/configure
@@ -8124,6 +8124,7 @@ libc_cv_localstatedir=$localstatedir
 libc_cv_gcc_unwind_find_fde=no
 libc_cv_idn=no
 pthread_in_libc=yes
+libc_cv_ifunc_static_pie=yes
 
 # Iterate over all the sysdep directories we will use, running their
 # configure fragments.
@@ -8139,6 +8140,9 @@ printf "%s\n" "running configure fragment for $dir" >&6; }
   fi
 done
 
+config_vars="$config_vars
+ifunc-static-pie = $libc_cv_ifunc_static_pie"
+
 if test x"$build_mathvec" = xnotset; then
   build_mathvec=no
 fi
diff --git a/configure.ac b/configure.ac
index ed7ec0ca74..bacc212048 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1823,6 +1823,7 @@ libc_cv_localstatedir=$localstatedir
 libc_cv_gcc_unwind_find_fde=no
 libc_cv_idn=no
 pthread_in_libc=yes
+libc_cv_ifunc_static_pie=yes
 
 # Iterate over all the sysdep directories we will use, running their
 # configure fragments.
@@ -1837,6 +1838,8 @@ for dir in $sysnames; do
   fi
 done
 
+LIBC_CONFIG_VAR([ifunc-static-pie], [$libc_cv_ifunc_static_pie])
+
 if test x"$build_mathvec" = xnotset; then
   build_mathvec=no
 fi
diff --git a/elf/Makefile b/elf/Makefile
index 77db83dfb2..f29a31cf5e 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -1029,16 +1029,20 @@ tests += $(tests-static)
 ifeq (yes,$(have-ifunc))
 tests-ifuncstatic := \
   ifuncmain1picstatic \
-  ifuncmain1static \
   ifuncmain2picstatic \
   ifuncmain2static \
   ifuncmain4picstatic \
-  ifuncmain4static \
   ifuncmain5picstatic \
   ifuncmain5static \
+  # tests-ifuncstatic
+ifeq (yes,$(ifunc-static-pie))
+tests-ifuncstatic += \
+  ifuncmain1static \
+  ifuncmain4static \
   ifuncmain7picstatic \
   ifuncmain7static \
   # tests-ifuncstatic
+endif
 ifeq (yes,$(have-gcc-ifunc))
 tests-ifuncstatic += ifuncmain9static ifuncmain9picstatic
 endif
@@ -1058,11 +1062,15 @@ tests-internal += \
   ifuncmain2 \
   ifuncmain2pic \
   ifuncmain3 \
-  ifuncmain4 \
   ifuncmain5staticpic \
+  # tests-internal
+ifeq (yes,$(ifunc-static-pie))
+tests-internal += \
+  ifuncmain4 \
   ifuncmain7 \
   ifuncmain7pic \
   # tests-internal
+endif
 ifeq (no,$(with-lld))
 tests-internal += \
   ifuncmain1 \
@@ -1091,9 +1099,13 @@ ifunc-pie-tests = \
   ifuncmain1pie \
   ifuncmain1staticpie \
   ifuncmain1vispie \
+  # ifunc-pie-tests
+ifeq (yes,$(ifunc-static-pie))
+ifunc-pie-tests += \
   ifuncmain6pie \
   ifuncmain7pie \
   # ifunc-pie-tests
+endif
 ifeq (yes,$(have-gcc-ifunc))
 ifunc-pie-tests += ifuncmain9pie
 endif
diff --git a/sysdeps/i386/configure b/sysdeps/i386/configure
index f5c3a281ac..bf362fb72e 100644
--- a/sysdeps/i386/configure
+++ b/sysdeps/i386/configure
@@ -84,6 +84,37 @@ printf "%s\n" "$libc_cv_ld_static_pie" >&6; }
   fi
 fi
 
+if test "$libc_cv_static_pie" == "yes"; then
+  cat > conftest.c <<EOF
+int _start (void) { return 0; }
+int __start (void) { return 0; }
+int foo (void) __attribute__ ((ifunc ("foo_ifunc")));
+void *
+foo_ifunc (void)
+{
+  return 0;
+}
+int main (void)
+{
+  return foo ();
+}
+EOF
+if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -o conftest
+		       conftest.c -fPIE -static-pie -static -nostartfiles -nostdlib
+		       1>&5'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }
+then :
+  libc_cv_ifunc_static_pie=yes
+else $as_nop
+  libc_cv_ifunc_static_pie=no
+fi
+rm -f conftest*
+fi
+
 if test x"$multi_arch" != xno; then
   printf "%s\n" "#define NO_HIDDEN_EXTERN_FUNC_IN_PIE 1" >>confdefs.h
 
diff --git a/sysdeps/i386/configure.ac b/sysdeps/i386/configure.ac
index 234ef2454a..88f0c06ccd 100644
--- a/sysdeps/i386/configure.ac
+++ b/sysdeps/i386/configure.ac
@@ -53,6 +53,21 @@ rm -f conftest*])
   fi
 fi
 
+if test "$libc_cv_static_pie" == "yes"; then
+  LIBC_TRY_LINK_STATIC([dnl
+int foo (void) __attribute__ ((ifunc ("foo_ifunc")));
+void *
+foo_ifunc (void)
+{
+  return 0;
+}
+int main (void)
+{
+  return foo ();
+}],
+    [-fPIE -static-pie], libc_cv_ifunc_static_pie=yes, libc_cv_ifunc_static_pie=no)
+fi
+
 dnl When multi-arch is enabled, all external functions must be called
 dnl via PIC PLT in PIE, which requires setting up EBX register.
 if test x"$multi_arch" != xno; then

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [glibc/azanella/clang] i686: Do not build ifunc tests if compiler does not generate supported relocations
@ 2023-08-30 12:43 Adhemerval Zanella
  0 siblings, 0 replies; 8+ messages in thread
From: Adhemerval Zanella @ 2023-08-30 12:43 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=8df227f62609873e90cfa620f2899d28c388951f

commit 8df227f62609873e90cfa620f2899d28c388951f
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Aug 22 16:27:15 2023 -0300

    i686: Do not build ifunc tests if compiler does not generate supported relocations
    
    clang with --target i668 might not produce supported relocations
    that ld.bfd can use for -static-pie without -fPIC, which are used
    on some tests.  Disable them for now.

Diff:
---
 aclocal.m4                |  6 +++---
 configure                 |  4 ++++
 configure.ac              |  3 +++
 elf/Makefile              | 18 +++++++++++++++---
 sysdeps/i386/configure    | 31 +++++++++++++++++++++++++++++++
 sysdeps/i386/configure.ac | 15 +++++++++++++++
 6 files changed, 71 insertions(+), 6 deletions(-)

diff --git a/aclocal.m4 b/aclocal.m4
index a097d66a49..25735e4881 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -148,7 +148,7 @@ AC_SUBST(NM)
 ])
 
 dnl Run a static link test with -nostdlib -nostartfiles.
-dnl LIBC_TRY_LINK_STATIC([code], [action-if-true], [action-if-false])
+dnl LIBC_TRY_LINK_STATIC([code], [opts], [action-if-true], [action-if-false])
 AC_DEFUN([LIBC_TRY_LINK_STATIC],
 [cat > conftest.c <<EOF
 int _start (void) { return 0; }
@@ -156,9 +156,9 @@ int __start (void) { return 0; }
 $1
 EOF
 AS_IF([AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -o conftest
-		       conftest.c -static -nostartfiles -nostdlib
+		       conftest.c $2 -static -nostartfiles -nostdlib
 		       1>&AS_MESSAGE_LOG_FD])],
-      [$2], [$3])
+      [$3], [$4])
 rm -f conftest*])
 
 dnl Test a compiler option or options with an empty input file.
diff --git a/configure b/configure
index 52c049c0ba..d4689bc96b 100755
--- a/configure
+++ b/configure
@@ -8100,6 +8100,7 @@ libc_cv_localstatedir=$localstatedir
 libc_cv_gcc_unwind_find_fde=no
 libc_cv_idn=no
 pthread_in_libc=yes
+libc_cv_ifunc_static_pie=yes
 
 # Iterate over all the sysdep directories we will use, running their
 # configure fragments.
@@ -8115,6 +8116,9 @@ printf "%s\n" "running configure fragment for $dir" >&6; }
   fi
 done
 
+config_vars="$config_vars
+ifunc-static-pie = $libc_cv_ifunc_static_pie"
+
 if test x"$build_mathvec" = xnotset; then
   build_mathvec=no
 fi
diff --git a/configure.ac b/configure.ac
index e8735c3b0b..c4cd650e62 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1815,6 +1815,7 @@ libc_cv_localstatedir=$localstatedir
 libc_cv_gcc_unwind_find_fde=no
 libc_cv_idn=no
 pthread_in_libc=yes
+libc_cv_ifunc_static_pie=yes
 
 # Iterate over all the sysdep directories we will use, running their
 # configure fragments.
@@ -1829,6 +1830,8 @@ for dir in $sysnames; do
   fi
 done
 
+LIBC_CONFIG_VAR([ifunc-static-pie], [$libc_cv_ifunc_static_pie])
+
 if test x"$build_mathvec" = xnotset; then
   build_mathvec=no
 fi
diff --git a/elf/Makefile b/elf/Makefile
index 77db83dfb2..f29a31cf5e 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -1029,16 +1029,20 @@ tests += $(tests-static)
 ifeq (yes,$(have-ifunc))
 tests-ifuncstatic := \
   ifuncmain1picstatic \
-  ifuncmain1static \
   ifuncmain2picstatic \
   ifuncmain2static \
   ifuncmain4picstatic \
-  ifuncmain4static \
   ifuncmain5picstatic \
   ifuncmain5static \
+  # tests-ifuncstatic
+ifeq (yes,$(ifunc-static-pie))
+tests-ifuncstatic += \
+  ifuncmain1static \
+  ifuncmain4static \
   ifuncmain7picstatic \
   ifuncmain7static \
   # tests-ifuncstatic
+endif
 ifeq (yes,$(have-gcc-ifunc))
 tests-ifuncstatic += ifuncmain9static ifuncmain9picstatic
 endif
@@ -1058,11 +1062,15 @@ tests-internal += \
   ifuncmain2 \
   ifuncmain2pic \
   ifuncmain3 \
-  ifuncmain4 \
   ifuncmain5staticpic \
+  # tests-internal
+ifeq (yes,$(ifunc-static-pie))
+tests-internal += \
+  ifuncmain4 \
   ifuncmain7 \
   ifuncmain7pic \
   # tests-internal
+endif
 ifeq (no,$(with-lld))
 tests-internal += \
   ifuncmain1 \
@@ -1091,9 +1099,13 @@ ifunc-pie-tests = \
   ifuncmain1pie \
   ifuncmain1staticpie \
   ifuncmain1vispie \
+  # ifunc-pie-tests
+ifeq (yes,$(ifunc-static-pie))
+ifunc-pie-tests += \
   ifuncmain6pie \
   ifuncmain7pie \
   # ifunc-pie-tests
+endif
 ifeq (yes,$(have-gcc-ifunc))
 ifunc-pie-tests += ifuncmain9pie
 endif
diff --git a/sysdeps/i386/configure b/sysdeps/i386/configure
index f5c3a281ac..bf362fb72e 100644
--- a/sysdeps/i386/configure
+++ b/sysdeps/i386/configure
@@ -84,6 +84,37 @@ printf "%s\n" "$libc_cv_ld_static_pie" >&6; }
   fi
 fi
 
+if test "$libc_cv_static_pie" == "yes"; then
+  cat > conftest.c <<EOF
+int _start (void) { return 0; }
+int __start (void) { return 0; }
+int foo (void) __attribute__ ((ifunc ("foo_ifunc")));
+void *
+foo_ifunc (void)
+{
+  return 0;
+}
+int main (void)
+{
+  return foo ();
+}
+EOF
+if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -o conftest
+		       conftest.c -fPIE -static-pie -static -nostartfiles -nostdlib
+		       1>&5'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }
+then :
+  libc_cv_ifunc_static_pie=yes
+else $as_nop
+  libc_cv_ifunc_static_pie=no
+fi
+rm -f conftest*
+fi
+
 if test x"$multi_arch" != xno; then
   printf "%s\n" "#define NO_HIDDEN_EXTERN_FUNC_IN_PIE 1" >>confdefs.h
 
diff --git a/sysdeps/i386/configure.ac b/sysdeps/i386/configure.ac
index 234ef2454a..88f0c06ccd 100644
--- a/sysdeps/i386/configure.ac
+++ b/sysdeps/i386/configure.ac
@@ -53,6 +53,21 @@ rm -f conftest*])
   fi
 fi
 
+if test "$libc_cv_static_pie" == "yes"; then
+  LIBC_TRY_LINK_STATIC([dnl
+int foo (void) __attribute__ ((ifunc ("foo_ifunc")));
+void *
+foo_ifunc (void)
+{
+  return 0;
+}
+int main (void)
+{
+  return foo ();
+}],
+    [-fPIE -static-pie], libc_cv_ifunc_static_pie=yes, libc_cv_ifunc_static_pie=no)
+fi
+
 dnl When multi-arch is enabled, all external functions must be called
 dnl via PIC PLT in PIE, which requires setting up EBX register.
 if test x"$multi_arch" != xno; then

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-04-17 20:13 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-17 20:13 [glibc/azanella/clang] i686: Do not build ifunc tests if compiler does not generate supported relocations Adhemerval Zanella
  -- strict thread matches above, loose matches on Subject: below --
2024-04-02 16:00 Adhemerval Zanella
2024-02-09 17:38 Adhemerval Zanella
2024-02-07 14:13 Adhemerval Zanella
2024-01-29 18:04 Adhemerval Zanella
2023-12-21 19:00 Adhemerval Zanella
2023-09-28 17:58 Adhemerval Zanella
2023-08-30 12:43 Adhemerval Zanella

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).