Pin dependency github.com/cilium/ebpf
Use same as opencontainers/runc
This commit is contained in:
28
vendor/github.com/cilium/ebpf/linker.go
generated
vendored
28
vendor/github.com/cilium/ebpf/linker.go
generated
vendored
@@ -2,35 +2,23 @@ package ebpf
|
||||
|
||||
import (
|
||||
"github.com/cilium/ebpf/asm"
|
||||
"github.com/cilium/ebpf/internal/btf"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// link resolves bpf-to-bpf calls.
|
||||
//
|
||||
// Each library may contain multiple functions / labels, and is only linked
|
||||
// Each section may contain multiple functions / labels, and is only linked
|
||||
// if the program being edited references one of these functions.
|
||||
//
|
||||
// Libraries must not require linking themselves.
|
||||
func link(prog *ProgramSpec, libs []*ProgramSpec) error {
|
||||
for _, lib := range libs {
|
||||
insns, err := linkSection(prog.Instructions, lib.Instructions)
|
||||
// Sections must not require linking themselves.
|
||||
func link(insns asm.Instructions, sections ...asm.Instructions) (asm.Instructions, error) {
|
||||
for _, section := range sections {
|
||||
var err error
|
||||
insns, err = linkSection(insns, section)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "linking %s", lib.Name)
|
||||
}
|
||||
|
||||
if len(insns) == len(prog.Instructions) {
|
||||
continue
|
||||
}
|
||||
|
||||
prog.Instructions = insns
|
||||
if prog.BTF != nil && lib.BTF != nil {
|
||||
if err := btf.ProgramAppend(prog.BTF, lib.BTF); err != nil {
|
||||
return errors.Wrapf(err, "linking BTF of %s", lib.Name)
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
return insns, nil
|
||||
}
|
||||
|
||||
func linkSection(insns, section asm.Instructions) (asm.Instructions, error) {
|
||||
|
Reference in New Issue
Block a user