Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpf2go: enable ebpf code reuse across go packages #1509

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Commits on Oct 29, 2024

  1. bpf2go: enable ebpf code reuse across go packages

    Extract imports from "bpf2go.hfiles.go" in the output dir, scan packages
    for header files, and expose headers to clang. C code consumes headers
    by providing a go package path in include directive, e.g.
    
    bpf2go.hfiles.go:
      package awesome
      import (
        _ "example.org/foo"
      )
    
    frob.c:
      #include "example.org/foo/foo.h"
    
    It is handy for sharing code between multiple ebpf blobs withing a
    project. Even better, it enables sharing ebpf code between multiple
    projects using go modules as delivery vehicle.
    
    By listing build dependencies in a .go file, we ensure that they are
    properly reflected in go.mod.
    
    Signed-off-by: Nick Zavaritsky <mejedi@gmail.com>
    mejedi committed Oct 29, 2024
    Configuration menu
    Copy the full SHA
    2d46635 View commit details
    Browse the repository at this point in the history