]> git.feebdaed.xyz Git - 0xmirror/ebpf.git/commit
bpf2go, btf: emit structs.HostLayout in GoFormatter
authorLorenz Bauer <lmb@isovalent.com>
Wed, 7 May 2025 09:20:44 +0000 (10:20 +0100)
committerLorenz Bauer <lmb@users.noreply.github.com>
Wed, 7 May 2025 09:38:19 +0000 (11:38 +0200)
commit5c1db4f533947f8a9ab18f85bf0b959de5fac3df
tree1fa431ccfb6bada05fe03618cfed06290c1000a0
parenta396f37def8da05d2411027ffba7c848d8e851e9
bpf2go, btf: emit structs.HostLayout in GoFormatter

Types described by BTF essentially follow C rules for laying out a
struct. Use the newly introduced structs.HostLayout to hint at the
compiler that reordering is not permissible.

Fixes https://github.com/cilium/ebpf/issues/1686

Signed-off-by: Lorenz Bauer <lmb@isovalent.com>
17 files changed:
btf/format.go
btf/format_test.go
cmd/bpf2go/gen/output.go
cmd/bpf2go/gen/output.tpl
cmd/bpf2go/test/test_bpfeb.go
cmd/bpf2go/test/test_bpfel.go
examples/fentry/bpf_bpfeb.go
examples/fentry/bpf_bpfel.go
examples/ringbuffer/bpf_bpfeb.go
examples/ringbuffer/bpf_bpfel.go
examples/tcprtt/bpf_bpfeb.go
examples/tcprtt/bpf_bpfel.go
examples/tcprtt_sockops/bpf_bpfeb.go
examples/tcprtt_sockops/bpf_bpfel.go
examples/uretprobe/bpf_x86_bpfel.go
internal/cmd/gentypes/main.go
internal/sys/types.go