Skip to content

Commit 75d0f9d

Browse files
Hou TaoNobody
authored andcommitted
bpf, arm64: call build_prologue() first in first JIT pass
BPF line info needs ctx->offset to be the instruction offset in the whole jited image instead of the body itself, so also call build_prologue() first in first JIT pass. Fixes: 37ab566 ("bpf: arm64: Enable arm64 jit to provide bpf_line_info") Signed-off-by: Hou Tao <[email protected]>
1 parent 292de4d commit 75d0f9d

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

arch/arm64/net/bpf_jit_comp.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,15 +1049,18 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog)
10491049
goto out_off;
10501050
}
10511051

1052-
/* 1. Initial fake pass to compute ctx->idx. */
1053-
1054-
/* Fake pass to fill in ctx->offset. */
1055-
if (build_body(&ctx, extra_pass)) {
1052+
/*
1053+
* 1. Initial fake pass to compute ctx->idx and ctx->offset.
1054+
*
1055+
* BPF line info needs ctx->offset[i] to be the offset of
1056+
* instruction[i] in jited image, so build prologue first.
1057+
*/
1058+
if (build_prologue(&ctx, was_classic)) {
10561059
prog = orig_prog;
10571060
goto out_off;
10581061
}
10591062

1060-
if (build_prologue(&ctx, was_classic)) {
1063+
if (build_body(&ctx, extra_pass)) {
10611064
prog = orig_prog;
10621065
goto out_off;
10631066
}

0 commit comments

Comments
 (0)