[PATCH 1/2] string: _FORTIFY_SOURCE=3 using __builtin_dynamic_object_size
Paul Eggert
eggert@cs.ucla.edu
Thu Dec 10 19:10:45 GMT 2020
On 12/10/20 10:13 AM, Siddhesh Poyarekar via Libc-alpha wrote:
> +checks are applied. If defined to @math{3}, @theglibc{} attempts to use
> +compiler-specific checks that may be more computationally expensive.
Please change "attempts to use compiler-specific checks" to "may also use
checks". The documentation need not mention compilers here, and the "also"
documents that 3 subsumes 2.
> # elif !__GNUC_PREREQ (4, 1)
> # warning _FORTIFY_SOURCE requires GCC 4.1 or later
> -# elif _FORTIFY_SOURCE > 1
> -# define __USE_FORTIFY_LEVEL 2
> +# elif _FORTIFY_SOURCE > 2
> +# define __USE_FORTIFY_LEVEL 3
> # else
> -# define __USE_FORTIFY_LEVEL 1
> +# define __USE_FORTIFY_LEVEL _FORTIFY_SOURCE
> # endif
The existing code warns if you define _FORTIFY_SOURCE on a platform that
doesn't support _FORTIFY_SOURCE. Shouldn't the revised code warn if you
define _FORTIFY_SOURCE to 3 on a platform that doesn't support that?
Otherwise people may be lulled into the belief that -D_FORTIFY_SOURCE=3
means something even on platforms where it doesn't.
More information about the Libc-alpha
mailing list