diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2023-07-20 11:35:54 -0300 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2023-07-20 17:58:26 -0300 |
commit | a3090c2c98facbab3d47aa23a94f8d2caeb78d71 (patch) | |
tree | 73e79c30d449aff75fb3d7c72bdb1e29baf24533 /configure | |
parent | 6c85c5a1773d786ccdc375e34431488fbcdd88e0 (diff) | |
download | glibc-a3090c2c98facbab3d47aa23a94f8d2caeb78d71.tar.gz glibc-a3090c2c98facbab3d47aa23a94f8d2caeb78d71.tar.xz glibc-a3090c2c98facbab3d47aa23a94f8d2caeb78d71.zip |
scripts: Fix fortify checks if compiler does not support _FORTIFY_SOURCE=3
The 30379efad1 added _FORTIFY_SOURCE checks without check if compiler does support all used fortify levels. This patch fixes it by first checking at configure time the maximum support fortify level and using it instead of a pre-defined one. Checked on x86_64 with gcc 11, 12, and 13. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org> Tested-by: Florian Weimer <fweimer@redhat.com>
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/configure b/configure index d2a0eb9734..4ef387146d 100755 --- a/configure +++ b/configure @@ -7610,9 +7610,9 @@ fi no_fortify_source="-Wp,-U_FORTIFY_SOURCE" fortify_source="${no_fortify_source}" -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for __builtin_dynamic_object_size" >&5 -printf %s "checking for __builtin_dynamic_object_size... " >&6; } -if test ${libc_cv___builtin_dynamic_object_size+y} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for maximum supported _FORTIFY_SOURCE level" >&5 +printf %s "checking for maximum supported _FORTIFY_SOURCE level... " >&6; } +if test ${libc_cv_supported_fortify_source+y} then : printf %s "(cached) " >&6 else $as_nop @@ -7630,30 +7630,24 @@ __builtin_dynamic_object_size("", 0) _ACEOF if ac_fn_c_try_link "$LINENO" then : - libc_cv___builtin_dynamic_object_size=yes - if test "$enable_fortify_source" = yes -then : - enable_fortify_source=3 -fi + libc_cv_supported_fortify_source=3 else $as_nop - libc_cv___builtin_dynamic_object_size=no - if test "$enable_fortify_source" = yes -then : - enable_fortify_source=2 -fi + libc_cv_supported_fortify_source=2 fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv___builtin_dynamic_object_size" >&5 -printf "%s\n" "$libc_cv___builtin_dynamic_object_size" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_supported_fortify_source" >&5 +printf "%s\n" "$libc_cv_supported_fortify_source" >&6; } case $enable_fortify_source in #( + yes) : + libc_cv_fortify_source=yes enable_fortify_source=$libc_cv_supported_fortify_source ;; #( 1|2) : libc_cv_fortify_source=yes ;; #( 3) : - if test "$libc_cv___builtin_dynamic_object_size" = yes + if test $libc_cv_supported_fortify_source = 3 then : libc_cv_fortify_source=yes else $as_nop @@ -7673,6 +7667,8 @@ fi +config_vars="$config_vars +supported-fortify = $libc_cv_supported_fortify_source" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the assembler requires one version per symbol" >&5 printf %s "checking whether the assembler requires one version per symbol... " >&6; } |