Re: [PATCH v2 2/5] Makefile: add -fno-builtin-bcmp

From: Nathan Chancellor
Date: Wed Aug 19 2020 - 23:33:42 EST


On Wed, Aug 19, 2020 at 12:16:51PM -0700, Nick Desaulniers wrote:
> The issue with using `-fno-builtin-*` flags was that they were not
> retained during an LTO link with LLVM. This was fixed in clang-11 by
> https://reviews.llvm.org/D71193
> (0508c994f0b14144041f2cfd3ba9f9a80f03de08), which is also the minimum
> supported version of clang for LTO. Use `-fno-builtin-bcmp` instead.
>
> With this applid, we can cleanly revert
> commit 5f074f3e192f ("lib/string.c: implement a basic bcmp")
>
> Reviewed-by: Kees Cook <keescook@xxxxxxxxxxxx>
> Suggested-by: Nathan Chancellor <natechancellor@xxxxxxxxx>
> Signed-off-by: Nick Desaulniers <ndesaulniers@xxxxxxxxxx>

Reviewed-by: Nathan Chancellor <natechancellor@xxxxxxxxx>

> ---
> Makefile | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/Makefile b/Makefile
> index e523dc8d30e0..def590b743a9 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -579,6 +579,7 @@ CLANG_FLAGS += -no-integrated-as
> endif
> CLANG_FLAGS += -Werror=unknown-warning-option
> CLANG_FLAGS += -fno-builtin-stpcpy
> +CLANG_FLAGS += -fno-builtin-bcmp
> KBUILD_CFLAGS += $(CLANG_FLAGS)
> KBUILD_AFLAGS += $(CLANG_FLAGS)
> export CLANG_FLAGS
> --
> 2.28.0.297.g1956fa8f8d-goog
>