diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2025-03-07 08:58:47 +0800 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2025-03-07 09:34:34 +0800 |
commit | 9b91484bee8f6f1bf1e2d26a8df461b553784528 (patch) | |
tree | 964a161290261066dd75d986920d4f04837d71d5 | |
parent | 4e68a5ca5da468c7e8a710a94455d5b27722f8e6 (diff) | |
download | glibc-9b91484bee8f6f1bf1e2d26a8df461b553784528.zip glibc-9b91484bee8f6f1bf1e2d26a8df461b553784528.tar.gz glibc-9b91484bee8f6f1bf1e2d26a8df461b553784528.tar.bz2 |
elf: Check if __attribute__ ((aligned (65536))) is supported
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>
-rwxr-xr-x | configure | 30 | ||||
-rw-r--r-- | configure.ac | 11 | ||||
-rw-r--r-- | elf/Makefile | 12 |
3 files changed, 48 insertions, 5 deletions
@@ -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} diff --git a/configure.ac b/configure.ac index 7d04b54..5f6f0b7 100644 --- a/configure.ac +++ b/configure.ac @@ -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++]) diff --git a/elf/Makefile b/elf/Makefile index 6f2489c..18b59a8 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -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 |