[igt-dev] [PATCH i-g-t 1/5] meson/cc: Disable memory-allocating builtins

Daniel Vetter daniel at ffwll.ch
Fri May 10 08:28:15 UTC 2019


On Thu, May 09, 2019 at 01:03:22PM +0300, Arkadiusz Hiler wrote:
> Disable the memory allocating builtins as they may cause unexpected behavior
> with our framework. They *may* get optimized out in favor of a register or
> stack variable, making them effectively local.
> 
> Local variables do not play well with longjmp, which we use for fixtures
> and subtests.
> 
> Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler at intel.com>

Uh ... occasionally I have regrest about the igt design I started years
ago. Maybe we should have used C++ exceptions for this to get something
more well-defined. Or Rust (but that wasn't a thing back then).

On the series:

Acked-by: Daniel Vetter <daniel.vetter at ffwll.ch>
> ---
>  meson.build | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/meson.build b/meson.build
> index 8196ab63..2d54c28f 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -62,6 +62,12 @@ cc_args = [
>  	'-Werror=sequence-point',
>  	'-Werror=trigraphs',
>  	'-Werror=write-strings',
> +# Disable the memory allocating builtins as they may cause unexpected behavior
> +# with our framework. They *may* get optimized out in favor of a register or
> +# stack variable, making them effectively local. Local variables do not play
> +# well with longjmp which is heavily used by IGT framework.
> +	'-fno-builtin-malloc',
> +	'-fno-builtin-calloc',
>  ]
>  
>  foreach cc_arg : cc_args
> -- 
> 2.20.1
> 
> _______________________________________________
> igt-dev mailing list
> igt-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the igt-dev mailing list