From a4723aca5f13984010556d190be7d8790406d678 Mon Sep 17 00:00:00 2001 From: Leo Di Donato Date: Thu, 14 Apr 2022 12:58:30 +0200 Subject: update(rules/platform/linux/bpf): enforce -O2 when compiling BPF To avoid compiler optimizations messing up with generated IR and BPF instructions is paramount to enforce the optimization level to 2 disregarding the mode (whether it is set to debug or release etc.) Signed-off-by: Leonardo Di Donato --- xmake/rules/platform/linux/bpf/xmake.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/xmake/rules/platform/linux/bpf/xmake.lua b/xmake/rules/platform/linux/bpf/xmake.lua index d2afd9160..b14e6a9a0 100644 --- a/xmake/rules/platform/linux/bpf/xmake.lua +++ b/xmake/rules/platform/linux/bpf/xmake.lua @@ -46,6 +46,7 @@ rule("platform.linux.bpf") targetarch = "__TARGET_ARCH_powerpc" end target:add("includedirs", path.directory(headerfile)) + target:set("optimize", "faster") batchcmds:show_progress(opt.progress, "${color.build.object}compiling.bpf %s", sourcefile) batchcmds:mkdir(path.directory(objectfile)) batchcmds:compile(sourcefile, objectfile, {configs = {force = {cxflags = {"-target bpf", "-g"}}, defines = targetarch}}) -- cgit v1.3.1 From 77ed9022bce7632272ed7f187f7a46774062def2 Mon Sep 17 00:00:00 2001 From: ruki Date: Sun, 17 Apr 2022 08:11:53 +0800 Subject: Update xmake.lua --- xmake/rules/platform/linux/bpf/xmake.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/xmake/rules/platform/linux/bpf/xmake.lua b/xmake/rules/platform/linux/bpf/xmake.lua index b14e6a9a0..d78693708 100644 --- a/xmake/rules/platform/linux/bpf/xmake.lua +++ b/xmake/rules/platform/linux/bpf/xmake.lua @@ -46,10 +46,9 @@ rule("platform.linux.bpf") targetarch = "__TARGET_ARCH_powerpc" end target:add("includedirs", path.directory(headerfile)) - target:set("optimize", "faster") batchcmds:show_progress(opt.progress, "${color.build.object}compiling.bpf %s", sourcefile) batchcmds:mkdir(path.directory(objectfile)) - batchcmds:compile(sourcefile, objectfile, {configs = {force = {cxflags = {"-target bpf", "-g"}}, defines = targetarch}}) + batchcmds:compile(sourcefile, objectfile, {configs = {force = {cxflags = {"-target bpf", "-g", "-O2"}}, defines = targetarch}}) batchcmds:mkdir(path.directory(headerfile)) batchcmds:execv("bpftool", {"gen", "skeleton", objectfile}, {stdout = headerfile}) batchcmds:add_depfiles(sourcefile) -- cgit v1.3.1