Debian Codegraph @

src/cmd/link/internal/sym/segment.go

raw
1 // Inferno utils/8l/asm.c
2 // https://bitbucket.org/inferno-os/inferno-os/src/master/utils/8l/asm.c
3 //
4 // Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved.
5 // Portions Copyright © 1995-1997 C H Forsyth ([email protected])
6 // Portions Copyright © 1997-1999 Vita Nuova Limited
7 // Portions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuova.com)
8 // Portions Copyright © 2004,2006 Bruce Ellis
9 // Portions Copyright © 2005-2007 C H Forsyth ([email protected])
10 // Revisions Copyright © 2000-2007 Lucent Technologies Inc. and others
11 // Portions Copyright © 2009 The Go Authors. All rights reserved.
12 //
13 // Permission is hereby granted, free of charge, to any person obtaining a copy
14 // of this software and associated documentation files (the "Software"), to deal
15 // in the Software without restriction, including without limitation the rights
16 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17 // copies of the Software, and to permit persons to whom the Software is
18 // furnished to do so, subject to the following conditions:
19 //
20 // The above copyright notice and this permission notice shall be included in
21 // all copies or substantial portions of the Software.
22 //
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
29 // THE SOFTWARE.
30
31 package sym
32
33 // Terrible but standard terminology.
34 // A segment describes a block of file to load into memory.
35 // A section further describes the pieces of that block for
36 // use in debuggers and such.
37
38 type Segment struct {
39 Rwx uint8 // permission as usual unix bits (5 = r-x etc)
40 Vaddr uint64 // virtual address
41 Length uint64 // length in memory
42 Fileoff uint64 // file offset
43 Filelen uint64 // length on disk
44 Sections []*Section
45 }
46
47 type Section struct {
48 Rwx uint8
49 Extnum int16
50 Align int32
51 Name string
52 Vaddr uint64
53 Length uint64
54 Seg *Segment
55 Elfsect any // an *ld.ElfShdr
56 Reloff uint64
57 Rellen uint64
58 // Relcount is the number of *host* relocations applied to this section
59 // (when external linking).
60 // Incremented atomically on multiple goroutines.
61 // Note: this may differ from number of Go relocations, as one Go relocation
62 // may turn into multiple host relocations.
63 Relcount uint32
64 Sym LoaderSym // symbol for the section, if any
65 Index uint16 // each section has a unique index, used internally
66
67 Compressed bool
68 }