Skip to content

Instantly share code, notes, and snippets.

@nathanchance
Created September 9, 2019 21:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nathanchance/0472b44f1403e98c4a10bdc5e46d2d0b to your computer and use it in GitHub Desktop.
Save nathanchance/0472b44f1403e98c4a10bdc5e46d2d0b to your computer and use it in GitHub Desktop.
From 07711535cf7725ca2d13b053451df0f162ef0d36 Mon Sep 17 00:00:00 2001
From: Nathan Chancellor <natechancellor@gmail.com>
Date: Thu, 5 Sep 2019 08:40:20 -0700
Subject: [PATCH] powerpc/prom_init: Use -ffreestanding to avoid a reference to
bcmp
r370454 gives LLVM the ability to convert certain loops into a reference
to bcmp as an optimization; this breaks prom_init_check.sh:
CALL arch/powerpc/kernel/prom_init_check.sh
Error: External symbol 'bcmp' referenced from prom_init.c
make[2]: *** [arch/powerpc/kernel/Makefile:196: prom_init_check] Error 1
bcmp is defined in lib/string.c but commit 450e7dd4001f ("powerpc/prom_init:
don't use string functions from lib/") specifically wants to avoid using
these functions; to prevent LLVM from making this transformation, use
-ffreestanding.
Link: https://github.com/ClangBuiltLinux/linux/issues/647
Link: https://github.com/llvm/llvm-project/commit/5c9f3cfec78f9e9ae013de9a0d092a68e3e79e00
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
arch/powerpc/kernel/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 890d2ff805d0..d67ee9cdb654 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -22,7 +22,7 @@ CFLAGS_prom_init.o += $(DISABLE_LATENT_ENTROPY_PLUGIN)
CFLAGS_btext.o += $(DISABLE_LATENT_ENTROPY_PLUGIN)
CFLAGS_prom.o += $(DISABLE_LATENT_ENTROPY_PLUGIN)
-CFLAGS_prom_init.o += $(call cc-option, -fno-stack-protector)
+CFLAGS_prom_init.o += $(call cc-option, -fno-stack-protector) -ffreestanding
ifdef CONFIG_FUNCTION_TRACER
# Do not trace early boot code
--
2.23.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment