mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-07 06:43:00 +03:00
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>
This commit is contained in:
28
configure
vendored
28
configure
vendored
@@ -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; }
|
||||
|
Reference in New Issue
Block a user