* [PATCH] samples/bpf: fix compilation errors with cf-protection option
@ 2024-08-15 13:55 Jiangshan Yi
2024-08-15 23:00 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Jiangshan Yi @ 2024-08-15 13:55 UTC (permalink / raw)
To: andrii, ast, daniel
Cc: bpf, haoluo, john.fastabend, jolsa, kpsingh, martin.lau, song,
yonghong.song, eddyz87, sdf, danieltimlee, linux-kernel,
13667453960, Jiangshan Yi, Qiang Wang
From: Jiangshan Yi <yijiangshan@kylinos.cn>
Currently, compiling the bpf programs will result the compilation errors
with the cf-protection option as follows in arm64 and loongarch64 machine
when using gcc 12.3.1 and clang 17.0.6. This commit fixes the compilation
errors by limited the cf-protection option only used in x86 platform.
[root@localhost linux]# make M=samples/bpf
......
CLANG-bpf samples/bpf/xdp2skb_meta_kern.o
error: option 'cf-protection=return' cannot be specified on this target
error: option 'cf-protection=branch' cannot be specified on this target
2 errors generated.
CLANG-bpf samples/bpf/syscall_tp_kern.o
error: option 'cf-protection=return' cannot be specified on this target
error: option 'cf-protection=branch' cannot be specified on this target
2 errors generated.
......
Fixes: 34f6e38f58db ("samples/bpf: fix warning with ignored-attributes")
Reported-by: Jiangshan Yi <yijiangshan@kylinos.cn>
Tested-by: Qiang Wang <wangqiang1@kylinos.cn>
Signed-off-by: Jiangshan Yi <yijiangshan@kylinos.cn>
---
samples/bpf/Makefile | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
index 3e003dd6bea0..dca56aa360ff 100644
--- a/samples/bpf/Makefile
+++ b/samples/bpf/Makefile
@@ -169,6 +169,10 @@ BPF_EXTRA_CFLAGS += -I$(srctree)/arch/mips/include/asm/mach-generic
endif
endif
+ifeq ($(ARCH), x86)
+BPF_EXTRA_CFLAGS += -fcf-protection
+endif
+
TPROGS_CFLAGS += -Wall -O2
TPROGS_CFLAGS += -Wmissing-prototypes
TPROGS_CFLAGS += -Wstrict-prototypes
@@ -405,7 +409,7 @@ $(obj)/%.o: $(src)/%.c
-Wno-gnu-variable-sized-type-not-at-end \
-Wno-address-of-packed-member -Wno-tautological-compare \
-Wno-unknown-warning-option $(CLANG_ARCH_ARGS) \
- -fno-asynchronous-unwind-tables -fcf-protection \
+ -fno-asynchronous-unwind-tables \
-I$(srctree)/samples/bpf/ -include asm_goto_workaround.h \
-O2 -emit-llvm -Xclang -disable-llvm-passes -c $< -o - | \
$(OPT) -O2 -mtriple=bpf-pc-linux | $(LLVM_DIS) | \
--
2.27.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] samples/bpf: fix compilation errors with cf-protection option
2024-08-15 13:55 [PATCH] samples/bpf: fix compilation errors with cf-protection option Jiangshan Yi
@ 2024-08-15 23:00 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-08-15 23:00 UTC (permalink / raw)
To: Jiangshan Yi
Cc: andrii, ast, daniel, bpf, haoluo, john.fastabend, jolsa, kpsingh,
martin.lau, song, yonghong.song, eddyz87, sdf, danieltimlee,
linux-kernel, yijiangshan, wangqiang1
Hello:
This patch was applied to bpf/bpf-next.git (master)
by Andrii Nakryiko <andrii@kernel.org>:
On Thu, 15 Aug 2024 21:55:24 +0800 you wrote:
> From: Jiangshan Yi <yijiangshan@kylinos.cn>
>
> Currently, compiling the bpf programs will result the compilation errors
> with the cf-protection option as follows in arm64 and loongarch64 machine
> when using gcc 12.3.1 and clang 17.0.6. This commit fixes the compilation
> errors by limited the cf-protection option only used in x86 platform.
>
> [...]
Here is the summary with links:
- samples/bpf: fix compilation errors with cf-protection option
https://git.kernel.org/bpf/bpf-next/c/fdf1c728fac5
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-08-15 23:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-15 13:55 [PATCH] samples/bpf: fix compilation errors with cf-protection option Jiangshan Yi
2024-08-15 23:00 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox