Skip to content

Commit 3f06175

Browse files
fix return value error
1 parent 6d5d634 commit 3f06175

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

pythonbpf/functions_pass.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ def process_stmt(
385385
)
386386
elif isinstance(stmt, ast.Return):
387387
if stmt.value is None:
388-
builder.ret(ir.Constant(ir.IntType(32), 0))
388+
builder.ret(ir.Constant(ir.IntType(64), 0))
389389
did_return = True
390390
elif (
391391
isinstance(stmt.value, ast.Call)
@@ -582,7 +582,7 @@ def process_func_body(
582582
)
583583

584584
if not did_return:
585-
builder.ret(ir.Constant(ir.IntType(32), 0))
585+
builder.ret(ir.Constant(ir.IntType(64), 0))
586586

587587

588588
def process_bpf_chunk(func_node, module, return_type, map_sym_tab, structs_sym_tab):
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
from pythonbpf import compile, bpf, section, bpfglobal
1+
import logging
2+
3+
from pythonbpf import compile, bpf, section, bpfglobal, compile_to_ir
24
from ctypes import c_void_p, c_int64
35

46

@@ -14,5 +16,5 @@ def sometag(ctx: c_void_p) -> c_int64:
1416
def LICENSE() -> str:
1517
return "GPL"
1618

17-
18-
compile()
19+
compile_to_ir("var_rval.py", "var_rval.ll")
20+
compile(loglevel=logging.INFO)

0 commit comments

Comments
 (0)