Documentation
¶
Overview ¶
Copyright (C) 2025 go-delve, parca-agent
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------------- Package elfwriter is a package to write ELF files without having their entire contents in memory at any one time.
Original work started from https://github.com/go-delve/delve/blob/master/pkg/elfwriter/writer.go and additional functionality added on top.
This package does not provide completeness guarantees. Some of the missing features: - Consistency and soundness of relocations - Consistency and preservation of linked sections (when target removed (sh_link)) - partially supported - Consistency and existence of overlapping segments when a section removed (offset, range check)
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OnlyKeepDebug ¶
func OnlyKeepDebug(dst io.WriteSeeker, src ReadAtCloser) error
Types ¶
type NullifyingWriter ¶
type NullifyingWriter struct {
Writer
// contains filtered or unexported fields
}
NullifyingWriter is a wrapper around another Writer that nullifies all the sections except the whitelisted ones.
func NewNullifyingWriter ¶
func NewNullifyingWriter(dst io.WriteSeeker, src io.ReaderAt, opts ...Option) (*NullifyingWriter, error)
NewNullifyingWriter creates a new NullifyingWriter.
func (*NullifyingWriter) FilterPrograms ¶
func (w *NullifyingWriter) FilterPrograms(predicates ...func(*elf.Prog) bool)
FilterPrograms filters out programs from the source.
func (*NullifyingWriter) Flush ¶
func (w *NullifyingWriter) Flush() error
func (*NullifyingWriter) KeepSections ¶
func (w *NullifyingWriter) KeepSections(predicates ...func(*elf.Section) bool)
KeepSections keeps only the sections that match the predicates. If no predicates are given, all sections are nullified.
type Option ¶
type Option func(w *Writer)
func WithCompressDWARFSections ¶
func WithCompressDWARFSections() Option
WithCompressDWARFSections compresses DWARF sections.
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer writes ELF files.
func (*Writer) AddNotes ¶
AddNotes adds additional notes to write to in the underlying io.WriterSeeker.
func (*Writer) Reset ¶
func (w *Writer) Reset(ws io.WriteSeeker)
Reset discards any unflushed buffered data, clears any error, and resets data to write its output to dst.