Re: Re: git: be04fec42638 - main - Import _FORTIFY_SOURCE implementation from NetBSD

From: Pedro Giffuni <pfg_at_freebsd.org>
Date: Sun, 19 May 2024 14:10:49 UTC
 For the record ...
When I was working on this, the default compiler on FreeBSD was still GCC 4.2 and the static checks worked fine with it but not on clang. The runtime checks worked fine on both.
Pedro.
    On Sunday, May 19, 2024 at 12:11:15 AM GMT-5, Jörg Sonnenberger <joerg@bec.de> wrote:  
 
  
On Sunday, May 19, 2024 6:39:59 AM GMT+2 Pedro Giffuni wrote:

>  FWIW .. and let me be clear I haven't worked on this in ages and I am not planning to retake this either...

> clang just couldn't do the static  fortify_source checks  due to the way llvm uses an intermediate representation; the size just couldn't be handled in the preprocessor.


That hasn't been true for a long time. __builtin_object_size is only

folded in the frontend if it absolutely has to because the context

requires an Integer Constant Expression, otherwise it is folded only

if the answer is definite. In all other cases it is left for the IR passes to

lower.


> fortify_source does replace some key libc functions with memory checking alternatives and that turns out to be annoying when debugging.


Since the wrapper functions are always_inline, they are pretty much invisible to debuggers.


Joerg