]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
elf: Check if __attribute__ ((aligned (65536))) is supported
authorH.J. Lu <hjl.tools@gmail.com>
Fri, 7 Mar 2025 00:58:47 +0000 (08:58 +0800)
committerH.J. Lu <hjl.tools@gmail.com>
Fri, 7 Mar 2025 01:34:34 +0000 (09:34 +0800)
The BZ #32763 tests fail to build for MicroBlaze (which defines
MAX_OFILE_ALIGNMENT to (32768*8) in GCC, so __attribute__ ((aligned
(65536))) is unsupported).  Add a configure-time check to enable BZ #32763
tests only if __attribute__ ((aligned (65536))) is supported.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
configure
configure.ac
elf/Makefile

index 80b4a63f1ba4fc54baf627ce6f2f0f2847b1fa70..2a996cb0d9cfdf281c8a894f57994d9c178aa49e 100755 (executable)
--- a/configure
+++ b/configure
@@ -8678,6 +8678,35 @@ if test $libc_cv_builtin_trap = yes; then
 
 fi
 
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports __attribute__ ((aligned (65536)))" >&5
+printf %s "checking whether the compiler supports __attribute__ ((aligned (65536)))... " >&6; }
+if test ${libc_cv_aligned_65536+y}
+then :
+  printf %s "(cached) " >&6
+else case e in #(
+  e)
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+char bss0xb5dce8 __attribute__ ((aligned (65536)));
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"
+then :
+  libc_cv_aligned_65536=yes
+else case e in #(
+  e) libc_cv_aligned_65536=no ;;
+esac
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+ ;;
+esac
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_aligned_65536" >&5
+printf "%s\n" "$libc_cv_aligned_65536" >&6; }
+config_vars="$config_vars
+aligned-65536 = $libc_cv_aligned_65536"
+
 ac_ext=cpp
 ac_cpp='$CXXCPP $CPPFLAGS'
 ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -8945,7 +8974,6 @@ load-address-ldflag = $libc_cv_load_address_ldflag"
 
 # Check if compilers support GCS in branch protection:
 
-
 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if compiler supports -mbranch-protection=gcs" >&5
 printf %s "checking if compiler supports -mbranch-protection=gcs... " >&6; }
 if test ${libc_cv_cc_gcs+y}
index 7d04b54c98f58daeec1faf313d8fcc211b1a769a..5f6f0b72bc6a380b6d2f999385fc1f76faebeb52 100644 (file)
@@ -1824,6 +1824,17 @@ if test $libc_cv_builtin_trap = yes; then
   AC_DEFINE([HAVE_BUILTIN_TRAP])
 fi
 
+dnl Check if
+AC_CACHE_CHECK([whether the compiler supports __attribute__ ((aligned (65536)))],
+              libc_cv_aligned_65536, [
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([
+char bss[0xb5dce8] __attribute__ ((aligned (65536)));
+])],
+              [libc_cv_aligned_65536=yes],
+              [libc_cv_aligned_65536=no])
+])
+LIBC_CONFIG_VAR([aligned-65536], [$libc_cv_aligned_65536])
+
 dnl C++ feature tests.
 AC_LANG_PUSH([C++])
 
index 6f2489cce1b2289dd5410c3cf4a86a8f311ab75c..18b59a86327c026a6afbabca9ac71249eed70f55 100644 (file)
@@ -1137,17 +1137,19 @@ tests += \
   tst-dlopen-pie \
   tst-dlopen-self-pie \
   tst-dlopen-tlsmodid-pie \
-  tst-pie-bss \
   tst-pie1 \
   tst-pie2 \
   # tests
 tests-pie += \
   tst-dlopen-self-pie \
   tst-dlopen-tlsmodid-pie \
-  tst-pie-bss \
   tst-pie1 \
   tst-pie2 \
   # tests-pie
+ifeq (yes,$(aligned-65536))
+tests += tst-pie-bss
+tests-pie += tst-pie-bss
+endif
 ifneq (,$(load-address-ldflag))
 tests += \
   tst-pie-address \
@@ -1159,12 +1161,14 @@ LDFLAGS-tst-pie-address += $(load-address-ldflag)=$(pde-load-address)
 ifeq (yes,$(enable-static-pie))
 tests += \
   tst-pie-address-static \
-  tst-pie-bss-static \
   # tests
 tests-static += \
   tst-pie-address-static \
-  tst-pie-bss-static \
   # tests-static
+ifeq (yes,$(aligned-65536))
+tests += tst-pie-bss-static
+tests-static += tst-pie-bss-static
+endif
 LDFLAGS-tst-pie-address-static += \
   $(load-address-ldflag)=$(pde-load-address)
 endif