Em Wed, Sep 25, 2019 at 12:59:23PM -0700, Ian Rogers escreveu:
> Unconditionally defining _FORTIFY_SOURCE can break tools that don't work
> with it, such as memory sanitizers:
> https://github.com/google/sanitizers/wiki/AddressSanitizer#faq

Thanks, and added this:

Cc: Josh Poimboeuf <[email protected]>
Fixes: 4b6ab94eabe4 ("perf subcmd: Create subcmd library")
 
> Signed-off-by: Ian Rogers <[email protected]>
> ---
>  tools/lib/subcmd/Makefile | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/lib/subcmd/Makefile b/tools/lib/subcmd/Makefile
> index ed61fb3a46c0..5b2cd5e58df0 100644
> --- a/tools/lib/subcmd/Makefile
> +++ b/tools/lib/subcmd/Makefile
> @@ -20,7 +20,13 @@ MAKEFLAGS += --no-print-directory
>  LIBFILE = $(OUTPUT)libsubcmd.a
>  
>  CFLAGS := $(EXTRA_WARNINGS) $(EXTRA_CFLAGS)
> -CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -U_FORTIFY_SOURCE 
> -D_FORTIFY_SOURCE=2 -fPIC
> +CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -fPIC
> +
> +ifeq ($(DEBUG),0)
> +  ifeq ($(feature-fortify-source), 1)
> +    CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
> +  endif
> +endif
>  
>  ifeq ($(CC_NO_CLANG), 0)
>    CFLAGS += -O3
> -- 
> 2.23.0.351.gc4317032e6-goog

-- 

- Arnaldo

Reply via email to