[libcamera-devel] [PATCH] meson: Don't set _FORTIFY_SOURCE for ChromeOS

Jacopo Mondi jacopo.mondi at ideasonboard.com
Fri Sep 8 09:05:23 CEST 2023


Hi George

On Thu, Sep 07, 2023 at 10:12:59AM -0600, George Burgess IV via libcamera-devel wrote:
> ChromeOS is moving to a platform default of `_FORTIFY_SOURCE=3`, and
> this definition conflicts with that:
>
> ```
> <command line>:4:9: error: '_FORTIFY_SOURCE' macro redefined
> [-Werror,-Wmacro-redefined]
> ```

I think we can drop the ``` ?

>
> Rather than adding logic to keep up with their local configuration, it
> seems best to leave setting _FORTIFY_SOURCE on ChromeOS up to ChromeOS.
>
> Signed-off-by: George Burgess IV <gbiv at google.com>
> ---
>  meson.build | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/meson.build b/meson.build
> index 7959b538..109923ac 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -101,7 +101,8 @@ if cc.get_id() == 'clang'
>
>      # Turn _FORTIFY_SOURCE by default on optimised builds (as it requires -O1
>      # or higher). This is needed on clang only as gcc enables it by default.
> -    if get_option('optimization') != '0'
> +    # CrOS sets their preferred FORTIFY level in platform-level CFLAGS.

Not a native speaker here but, is "sets" and "their" in the same
phrase ok ? Shouldn't this be either ("set" and "their") or ("sets" and
"its") ?

> +    if get_option('optimization') != '0' and get_option('android_platform') != 'cros'

Minor nitpicking apart, I think the patch is fine. Just curious to
know if switching to FORTIFY_SOURCE=3 will generate new bug reports :)

Reviewed-by: Jacopo Mondi <jacopo.mondi at ideasonboard.com>


>          common_arguments += [
>              '-D_FORTIFY_SOURCE=2',
>          ]
> --
> 2.42.0.283.g2d96d420d3-goog
>


More information about the libcamera-devel mailing list