Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions interpreter/golabels/golabels.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package golabels // import "go.opentelemetry.io/ebpf-profiler/interpreter/golabels"

import (
"debug/elf"
"errors"
"fmt"
"go/version"
Expand Down Expand Up @@ -59,6 +60,25 @@ func Loader(_ interpreter.EbpfHandler, info *interpreter.LoaderInfo) (interprete
return nil, nil
}

// Go plugins are shared objects that share the runtime with the main
// binary. The offsets we need are determined by the main binary so
// there is no reason to create a duplicate golabels instance for
// a plugin. A shared library is ET_DYN without a PT_INTERP segment
// (PIE executables are also ET_DYN but have PT_INTERP).
if file.Type == elf.ET_DYN {
hasInterp := false
for i := range file.Progs {
if file.Progs[i].Type == elf.PT_INTERP {
hasInterp = true
break
}
}
if !hasInterp {
log.Debugf("file %s is a Go shared library, skipping golabels", info.FileName())
return nil, nil
}
}

if version.Compare(goVersion, "go1.27") >= 0 {
return nil, fmt.Errorf("unsupported Go version %s (need >= 1.13 and <= 1.26)", goVersion)
}
Expand Down
2 changes: 1 addition & 1 deletion processmanager/ebpf/ebpf.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ func (impl *ebpfMapsImpl) DeleteProcData(typ libpf.InterpreterType, pid libpf.PI

pid32 := uint32(pid)
if err := ebpfMap.Delete(unsafe.Pointer(&pid32)); err != nil {
return fmt.Errorf("failed to remove info: %v", err)
return fmt.Errorf("failed to remove info: %w", err)
}
return nil
}
Expand Down
Loading