With gcc-9 and gcc-10, kernel is not able to build. Major error is like this:
error: ‘-mindirect-branch’ and ‘-fcf-protection’ are not compatible
warning: objtool: $(CODE_LOCATION): sibling call from callable instruction with modified stack frame
First error can suppress by this patch:
diff --git a/Linux-DSM-4.18/Makefile b/Linux-DSM-4.18/Makefile
index 15be63c27..a38d2ce4b 100644
--- a/Linux-DSM-4.18/Makefile
+++ b/Linux-DSM-4.18/Makefile
@@ -492,8 +492,8 @@ KBUILD_CFLAGS += $(call cc-option, -no-integrated-as)
KBUILD_AFLAGS += $(call cc-option, -no-integrated-as)
endif
-RETPOLINE_CFLAGS_GCC := -mindirect-branch=thunk-extern -mindirect-branch-register
-RETPOLINE_VDSO_CFLAGS_GCC := -mindirect-branch=thunk-inline -mindirect-branch-register
+RETPOLINE_CFLAGS_GCC := -mindirect-branch=thunk-extern -mindirect-branch-register -fcf-protection=none
+RETPOLINE_VDSO_CFLAGS_GCC := -mindirect-branch=thunk-extern -mindirect-branch-register -fcf-protection=none
RETPOLINE_CFLAGS_CLANG := -mretpoline-external-thunk
RETPOLINE_VDSO_CFLAGS_CLANG := -mretpoline
RETPOLINE_CFLAGS := $(call cc-option,$(RETPOLINE_CFLAGS_GCC),$(call cc-option,$(RETPOLINE_CFLAGS_CLANG)))
However, the second warning can't be suppressed by this one. vmlinux and bzImage is come out normally, but I didn't test it so I'm not sure it works properly.
References
- First error patch
- Second warning patch?
With gcc-9 and gcc-10, kernel is not able to build. Major error is like this:
error: ‘-mindirect-branch’ and ‘-fcf-protection’ are not compatiblewarning: objtool: $(CODE_LOCATION): sibling call from callable instruction with modified stack frameFirst error can suppress by this patch:
However, the second warning can't be suppressed by this one.
vmlinuxandbzImageis come out normally, but I didn't test it so I'm not sure it works properly.References