1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
<h1> Package plan9obj </h1> <ul id="short-nav">
<li><code>import "debug/plan9obj"</code></li>
<li><a href="#pkg-overview" class="overviewLink">Overview</a></li>
<li><a href="#pkg-index" class="indexLink">Index</a></li>
</ul> <h2 id="pkg-overview">Overview </h2> <p>Package plan9obj implements access to Plan 9 a.out object files. </p>
<h3 id="hdr-Security">Security</h3> <p>This package is not designed to be hardened against adversarial inputs, and is outside the scope of <a href="https://go.dev/security/policy">https://go.dev/security/policy</a>. 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. </p> <h2 id="pkg-index">Index </h2> <ul id="manual-nav">
<li><a href="#pkg-constants">Constants</a></li>
<li><a href="#pkg-variables">Variables</a></li>
<li><a href="#File">type File</a></li>
<li> <a href="#NewFile">func NewFile(r io.ReaderAt) (*File, error)</a>
</li>
<li> <a href="#Open">func Open(name string) (*File, error)</a>
</li>
<li> <a href="#File.Close">func (f *File) Close() error</a>
</li>
<li> <a href="#File.Section">func (f *File) Section(name string) *Section</a>
</li>
<li> <a href="#File.Symbols">func (f *File) Symbols() ([]Sym, error)</a>
</li>
<li><a href="#FileHeader">type FileHeader</a></li>
<li><a href="#Section">type Section</a></li>
<li> <a href="#Section.Data">func (s *Section) Data() ([]byte, error)</a>
</li>
<li> <a href="#Section.Open">func (s *Section) Open() io.ReadSeeker</a>
</li>
<li><a href="#SectionHeader">type SectionHeader</a></li>
<li><a href="#Sym">type Sym</a></li>
</ul> <h3>Package files</h3> <p> <span>file.go</span> <span>plan9obj.go</span> </p> <h2 id="pkg-constants">Constants</h2> <pre data-language="go">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
)</pre> <h2 id="pkg-variables">Variables</h2> <p>ErrNoSymbols is returned by <a href="#File.Symbols">File.Symbols</a> if there is no such section in the File. </p>
<pre data-language="go">var ErrNoSymbols = errors.New("no symbol section")</pre> <h2 id="File">type <span>File</span> <span title="Added in Go 1.3">1.3</span> </h2> <p>A File represents an open Plan 9 a.out file. </p>
<pre data-language="go">type File struct {
FileHeader
Sections []*Section
// contains filtered or unexported fields
}
</pre> <h3 id="NewFile">func <span>NewFile</span> <span title="Added in Go 1.3">1.3</span> </h3> <pre data-language="go">func NewFile(r io.ReaderAt) (*File, error)</pre> <p>NewFile creates a new <a href="#File">File</a> for accessing a Plan 9 binary in an underlying reader. The Plan 9 binary is expected to start at position 0 in the ReaderAt. </p>
<h3 id="Open">func <span>Open</span> <span title="Added in Go 1.3">1.3</span> </h3> <pre data-language="go">func Open(name string) (*File, error)</pre> <p>Open opens the named file using <span>os.Open</span> and prepares it for use as a Plan 9 a.out binary. </p>
<h3 id="File.Close">func (*File) <span>Close</span> <span title="Added in Go 1.3">1.3</span> </h3> <pre data-language="go">func (f *File) Close() error</pre> <p>Close closes the <a href="#File">File</a>. If the <a href="#File">File</a> was created using <a href="#NewFile">NewFile</a> directly instead of <a href="#Open">Open</a>, Close has no effect. </p>
<h3 id="File.Section">func (*File) <span>Section</span> <span title="Added in Go 1.3">1.3</span> </h3> <pre data-language="go">func (f *File) Section(name string) *Section</pre> <p>Section returns a section with the given name, or nil if no such section exists. </p>
<h3 id="File.Symbols">func (*File) <span>Symbols</span> <span title="Added in Go 1.3">1.3</span> </h3> <pre data-language="go">func (f *File) Symbols() ([]Sym, error)</pre> <p>Symbols returns the symbol table for f. </p>
<h2 id="FileHeader">type <span>FileHeader</span> <span title="Added in Go 1.3">1.3</span> </h2> <p>A FileHeader represents a Plan 9 a.out file header. </p>
<pre data-language="go">type FileHeader struct {
Magic uint32
Bss uint32
Entry uint64
PtrSize int
LoadAddress uint64 // Go 1.4
HdrSize uint64 // Go 1.4
}
</pre> <h2 id="Section">type <span>Section</span> <span title="Added in Go 1.3">1.3</span> </h2> <p>A Section represents a single section in a Plan 9 a.out file. </p>
<pre data-language="go">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
}
</pre> <h3 id="Section.Data">func (*Section) <span>Data</span> <span title="Added in Go 1.3">1.3</span> </h3> <pre data-language="go">func (s *Section) Data() ([]byte, error)</pre> <p>Data reads and returns the contents of the Plan 9 a.out section. </p>
<h3 id="Section.Open">func (*Section) <span>Open</span> <span title="Added in Go 1.3">1.3</span> </h3> <pre data-language="go">func (s *Section) Open() io.ReadSeeker</pre> <p>Open returns a new ReadSeeker reading the Plan 9 a.out section. </p>
<h2 id="SectionHeader">type <span>SectionHeader</span> <span title="Added in Go 1.3">1.3</span> </h2> <p>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. </p>
<pre data-language="go">type SectionHeader struct {
Name string
Size uint32
Offset uint32
}
</pre> <h2 id="Sym">type <span>Sym</span> <span title="Added in Go 1.3">1.3</span> </h2> <p>A Symbol represents an entry in a Plan 9 a.out symbol table section. </p>
<pre data-language="go">type Sym struct {
Value uint64
Type rune
Name string
}
</pre><div class="_attribution">
<p class="_attribution-p">
© Google, Inc.<br>Licensed under the Creative Commons Attribution License 3.0.<br>
<a href="http://golang.org/pkg/debug/plan9obj/" class="_attribution-link">http://golang.org/pkg/debug/plan9obj/</a>
</p>
</div>
|