GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Why Go
  • Case Studies
  • Use Cases
  • Security
  • Learn
  • Effective Go
  • Go User Manual
  • Standard library
  • Release Notes
  • API
  • Packages
  • Recorded Talks
  • Meetups
  • Conferences

This view

  • Original page
  • New address

GeezerVison is showing pkg.go.dev — plan9obj package - debug/plan9obj - Go Packages

Details

  • checked Valid go.mod file

    The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.

  • checked Redistributable license

    Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.

  • checked Tagged version

    Modules with tagged versions give importers more predictable builds.

  • checked Stable version

    When a project reaches major version v1 it is considered stable.

  • Learn more about best practices

Repository

cs.opensource.google/go/go

Links

  • Report a Vulnerability

Documentation ¶

Overview ¶

Package plan9obj implements access to Plan 9 a.out object files.

Security ¶

This package is not designed to be hardened against adversarial inputs, and is outside the scope of https://go.dev/security/policy. In particular, only basic validation is done when parsing object files. As such, care should be taken when parsing untrusted inputs, as parsing malformed files may consume significant resources, or cause panics.

Index ¶

  • Constants
  • Variables
  • type File
    • func NewFile(r io.ReaderAt) (*File, error)
    • func Open(name string) (*File, error)
    • func (f *File) Close() error
    • func (f *File) Section(name string) *Section
    • func (f *File) Symbols() ([]Sym, error)
  • type FileHeader
  • type Section
    • func (s *Section) Data() ([]byte, error)
    • func (s *Section) Open() io.ReadSeeker
  • type SectionHeader
  • type Sym

Constants ¶

View Source
const (
	Magic64 = 0x8000 // 64-bit expanded header

	Magic386   = (4*11+0)*11 + 7
	MagicAMD64 = (4*26+0)*26 + 7 + Magic64
	MagicARM   = (4*20+0)*20 + 7
)

Variables ¶

View Source
var ErrNoSymbols = errors.New("no symbol section")

ErrNoSymbols is returned by File.Symbols if there is no such section in the File.

Functions ¶

This section is empty.

Types ¶

type File ¶

type File struct {
	FileHeader
	Sections []*Section
	// contains filtered or unexported fields
}

A File represents an open Plan 9 a.out file.

func NewFile ¶

func NewFile(r io.ReaderAt) (*File, error)

NewFile creates a new File for accessing a Plan 9 binary in an underlying reader. The Plan 9 binary is expected to start at position 0 in the ReaderAt.

func Open ¶

func Open(name string) (*File, error)

Open opens the named file using os.Open and prepares it for use as a Plan 9 a.out binary.

func (*File) Close ¶

func (f *File) Close() error

Close closes the File. If the File was created using NewFile directly instead of Open, Close has no effect.

func (*File) Section ¶

func (f *File) Section(name string) *Section

Section returns a section with the given name, or nil if no such section exists.

func (*File) Symbols ¶

func (f *File) Symbols() ([]Sym, error)

Symbols returns the symbol table for f.

type FileHeader ¶

type FileHeader struct {
	Magic       uint32
	Bss         uint32
	Entry       uint64
	PtrSize     int
	LoadAddress uint64
	HdrSize     uint64
}

A FileHeader represents a Plan 9 a.out file header.

type Section ¶

type Section struct {
	SectionHeader

	// Embed ReaderAt for ReadAt method.
	// Do not embed SectionReader directly
	// to avoid having Read and Seek.
	// If a client wants Read and Seek it must use
	// Open() to avoid fighting over the seek offset
	// with other clients.
	io.ReaderAt
	// contains filtered or unexported fields
}

A Section represents a single section in a Plan 9 a.out file.

func (*Section) Data ¶

func (s *Section) Data() ([]byte, error)

Data reads and returns the contents of the Plan 9 a.out section.

func (*Section) Open ¶

func (s *Section) Open() io.ReadSeeker

Open returns a new ReadSeeker reading the Plan 9 a.out section.

type SectionHeader ¶

type SectionHeader struct {
	Name   string
	Size   uint32
	Offset uint32
}

A SectionHeader represents a single Plan 9 a.out section header. This structure doesn't exist on-disk, but eases navigation through the object file.

type Sym ¶

type Sym struct {
	Value uint64
	Type  rune
	Name  string
}

A Symbol represents an entry in a Plan 9 a.out symbol table section.

Source Files ¶

View all Source files
  • file.go
  • plan9obj.go
Click to show internal directories.
Click to hide internal directories.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.