Documentation ¶
Overview ¶
Package elf provides utility functions for manipulating ELF files on the filesystem.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IgnoreSymbolPrefixes ¶
func IgnoreSymbolPrefixes(prefixes []string)
IgnoreSymbolPrefixes configures the ELF package to ignore symbols that have any of the specified prefixes. It must be called by only one thread at a time.
This slice will be iterated once per ELF.Write(), so try not to let it grow out of hand...
Types ¶
type ELF ¶
type ELF struct { // lock concurrent writes of the ELF. This library probably isn't far // off from allowing concurrent Write() execution, but it's just not // supported for now. lock.Mutex // contains filtered or unexported fields }
ELF is an in-memory representation of a BPF ELF object from the filesystem.
func NewELF ¶
NewELF returns a new object from the specified reader.
The ELF binary is expected to start at position 0 in the specified reader.
func (*ELF) Close ¶
Close closes the ELF. If the File was created using NewELF directly instead of Open, Close has no effect.
func (*ELF) Write ¶
func (elf *ELF) Write(path string, intOptions map[string]uint32, strOptions map[string]string) error
Write the received ELF to a new file at the specified location, with the specified options (indexed by name) substituted:
- intOptions: 32-bit values substituted in the data section.
- strOptions: strings susbtituted in the string table. For each key/value pair, both key and value must be same length.
Only one goroutine may Write() the same *ELF concurrently.
On success, writes the new file to the specified path. On failure, returns an error and no file is left on the filesystem.