[PATCH v4 1/2] string: _FORTIFY_SOURCE=3 using __builtin_dynamic_object_size
Jakub Jelinek
jakub@redhat.com
Tue Dec 15 18:33:31 GMT 2020
On Tue, Dec 15, 2020 at 11:52:37PM +0530, Siddhesh Poyarekar wrote:
> -# elif _FORTIFY_SOURCE > 1
> +# elif _FORTIFY_SOURCE == 3 && !__glibc_clang_prereq(9, 0)
> +# warning _FORTIFY_SOURCE > 2 requires LLVM 9.0 or later, falling back to 2
The == 3 above should be really > 2 instead.
> # define __USE_FORTIFY_LEVEL 2
> +# elif _FORTIFY_SOURCE > 2
> +# if __glibc_clang_prereq(9, 0)
> +# define __USE_FORTIFY_LEVEL 3
> +# else
> +# define __USE_FORTIFY_LEVEL 2
> +# endif
and then I don't really understand the above #if, you know that
__glibc_clang_prereq(9, 0) is already true and so can just define
__USE_FORTIFY_LEVEl to 3.
Though, perhaps better would be to remove the #elif == 3 above and
add the warning next to the define to 2.
> # else
> -# define __USE_FORTIFY_LEVEL 1
> +# define __USE_FORTIFY_LEVEL _FORTIFY_SOURCE
Is it a good idea to define __USE_FORTIFY_LEVEL to _FORTIFY_SOURCE
directly? I mean, one can e.g. use -D_FORTIFY_SOURCE=2LL etc.
and not sure if all the code that uses it will deal with 2LL properly.
Jakub
More information about the Libc-alpha
mailing list