Imports #
"debug/dwarf"
"encoding/binary"
"errors"
"fmt"
"internal/saferio"
"io"
"os"
"strings"
"encoding/binary"
"fmt"
"io"
"os"
"strconv"
"strings"
"debug/dwarf"
"encoding/binary"
"errors"
"fmt"
"internal/saferio"
"io"
"os"
"strings"
"encoding/binary"
"fmt"
"io"
"os"
"strconv"
"strings"
const AIAFMAG = "`\n"
const AIAMAG = "\n"
const AIAMAGBIG = "\n"
const AR_HSZ_BIG = 0x70
Storage Class.
const C_BCOMM = 135
Storage Class.
const C_BINCL = 108
Storage Class.
const C_BLOCK = 100
Storage Class.
const C_BSTAT = 143
Storage Class.
const C_DECL = 140
Storage Class.
const C_DWARF = 112
Storage Class.
const C_ECOML = 136
Storage Class.
const C_ECOMM = 137
Storage Class.
const C_EINCL = 109
Storage Class.
const C_ENTRY = 141
Storage Class.
const C_ESTAT = 144
Storage Class.
const C_EXT = 2
Storage Class.
const C_FCN = 101
Storage Class.
const C_FILE = 103
Storage Class.
const C_FUN = 142
Storage Class.
const C_GSYM = 128
Storage Class.
const C_GTLS = 145
Storage Class.
const C_HIDEXT = 107
Storage Class.
const C_LSYM = 129
Storage Class.
const C_NULL = 0
Storage Class.
const C_PSYM = 130
Storage Class.
const C_RPSYM = 132
Storage Class.
const C_RSYM = 131
Storage Class.
const C_STAT = 3
Storage Class.
const C_STSYM = 133
Storage Class.
const C_STTLS = 146
Storage Class.
const C_WEAKEXT = 111
const FILHSZ_32 = 20
const FILHSZ_64 = 24
Sizeof
const FL_HSZ_BIG = 0x80
Flags that describe the type of the object file.
const F_DSA = 0x0040
Flags that describe the type of the object file.
const F_DYNLOAD = 0x1000
Flags that describe the type of the object file.
const F_EXEC = 0x0002
Flags that describe the type of the object file.
const F_FDPR_OPTI = 0x0020
Flags that describe the type of the object file.
const F_FDPR_PROF = 0x0010
Flags that describe the type of the object file.
const F_LNNO = 0x0004
Flags that describe the type of the object file.
const F_LOADONLY = 0x4000
Flags that describe the type of the object file.
const F_RELFLG = 0x0001
Flags that describe the type of the object file.
const F_SHROBJ = 0x2000
Flags that describe the type of the object file.
const F_VARPG = 0x0100
const LDHDRSZ_32 = 32
const LDHDRSZ_64 = 56
const N_ABS = *ast.UnaryExpr
Nscnum
const N_DEBUG = *ast.UnaryExpr
const N_UNDEF = 0
const R_BA = 0x08
const R_BR = 0x0A
const R_GL = 0x05
const R_NEG = 0x01
const R_POS = 0x00
const R_RBA = 0x18
const R_RBR = 0x1A
const R_REF = 0x0F
const R_REL = 0x02
const R_RL = 0x0C
const R_RLA = 0x0D
const R_TCL = 0x06
const R_TLS = 0x20
const R_TLSM = 0x24
const R_TLSML = 0x25
const R_TLS_IE = 0x21
const R_TLS_LD = 0x22
const R_TLS_LE = 0x23
const R_TOC = 0x03
const R_TOCL = 0x31
const R_TOCU = 0x30
const R_TRL = 0x12
const R_TRLA = 0x13
const SAIAMAG = 0x8
const SSUBTYP_DWABREV = 0x60000
const SSUBTYP_DWARNGE = 0x50000
const SSUBTYP_DWFRAME = 0xA0000
const SSUBTYP_DWINFO = 0x10000
const SSUBTYP_DWLINE = 0x20000
const SSUBTYP_DWLOC = 0x90000
const SSUBTYP_DWMAC = 0xB0000
const SSUBTYP_DWPBNMS = 0x30000
const SSUBTYP_DWPBTYP = 0x40000
const SSUBTYP_DWRNGES = 0x80000
const SSUBTYP_DWSTR = 0x70000
Flags defining the section type.
const STYP_BSS = 0x0080
Flags defining the section type.
const STYP_DATA = 0x0040
Flags defining the section type.
const STYP_DEBUG = 0x2000
Flags defining the section type.
const STYP_DWARF = 0x0010
Flags defining the section type.
const STYP_EXCEPT = 0x0100
Flags defining the section type.
const STYP_INFO = 0x0200
Flags defining the section type.
const STYP_LOADER = 0x1000
Flags defining the section type.
const STYP_OVRFLO = 0x8000
Flags defining the section type.
const STYP_TBSS = 0x0800
Flags defining the section type.
const STYP_TDATA = 0x0400
Flags defining the section type.
const STYP_TEXT = 0x0020
Flags defining the section type.
const STYP_TYPCHK = 0x4000
const SYMESZ = 18
const SYM_TYPE_FUNC = 0x0020
const SYM_V_EXPORTED = 0x4000
const SYM_V_HIDDEN = 0x2000
Ntype
const SYM_V_INTERNAL = 0x1000
const SYM_V_PROTECTED = 0x3000
const U64_TOCMAGIC = 0767
const U802TOCMAGIC = 0737
Defines for File auxiliary definitions: x_ftype field of x_file
const XFT_CD = 128
Defines for File auxiliary definitions: x_ftype field of x_file
const XFT_CT = 1
Defines for File auxiliary definitions: x_ftype field of x_file
const XFT_CV = 2
Defines for File auxiliary definitions: x_ftype field of x_file
const XFT_FN = 0
Storage-mapping class.
const XMC_BS = 9
Storage-mapping class.
const XMC_DB = 2
Storage-mapping class.
const XMC_DS = 10
Storage-mapping class.
const XMC_GL = 6
Storage-mapping class.
const XMC_PR = 0
Storage-mapping class.
const XMC_RO = 1
Storage-mapping class.
const XMC_RW = 5
Storage-mapping class.
const XMC_SV = 8
Storage-mapping class.
const XMC_SV3264 = 18
Storage-mapping class.
const XMC_SV64 = 17
Storage-mapping class.
const XMC_TC = 3
Storage-mapping class.
const XMC_TC0 = 15
Storage-mapping class.
const XMC_TD = 16
Storage-mapping class.
const XMC_TE = 22
Storage-mapping class.
const XMC_TL = 20
Storage-mapping class.
const XMC_UA = 4
Storage-mapping class.
const XMC_UC = 11
Storage-mapping class.
const XMC_UL = 21
Storage-mapping class.
const XMC_XO = 7
Symbol type field.
const XTY_CM = 3
Symbol type field.
const XTY_ER = 0
Symbol type field.
const XTY_LD = 2
Symbol type field.
const XTY_SD = 1
Auxiliary type
const _AUX_CSECT = 251
Auxiliary type
const _AUX_EXCEPT = 255
Auxiliary type
const _AUX_FCN = 254
Auxiliary type
const _AUX_FILE = 252
Auxiliary type
const _AUX_SECT = 250
Auxiliary type
const _AUX_SYM = 253
Archive represents an open AIX big archive.
type Archive struct {
ArchiveHeader
Members []*Member
closer io.Closer
}
ArchiveHeader holds information about a big archive file header
type ArchiveHeader struct {
magic string
}
csect Auxiliary Entry.
type AuxCSect32 struct {
Xscnlen uint32
Xparmhash uint32
Xsnhash uint16
Xsmtyp uint8
Xsmclas uint8
Xstab uint32
Xsnstab uint16
}
type AuxCSect64 struct {
Xscnlenlo uint32
Xparmhash uint32
Xsnhash uint16
Xsmtyp uint8
Xsmclas uint8
Xscnlenhi uint32
Xpad uint8
Xauxtype uint8
}
Function Auxiliary Entry
type AuxFcn32 struct {
Xexptr uint32
Xfsize uint32
Xlnnoptr uint32
Xendndx uint32
Xpad uint16
}
type AuxFcn64 struct {
Xlnnoptr uint64
Xfsize uint32
Xendndx uint32
Xpad uint8
Xauxtype uint8
}
File Auxiliary Entry
type AuxFile64 struct {
Xfname [8]byte
Xftype uint8
Xauxtype uint8
}
type AuxSect64 struct {
Xscnlen uint64
Xnreloc uint64
pad uint8
Xauxtype uint8
}
AuxiliaryCSect holds information about an XCOFF symbol in an AUX_CSECT entry.
type AuxiliaryCSect struct {
Length int64
StorageMappingClass int
SymbolType int
}
AuxiliaryFcn holds information about an XCOFF symbol in an AUX_FCN entry.
type AuxiliaryFcn struct {
Size int64
}
A File represents an open XCOFF file.
type File struct {
FileHeader
Sections []*Section
Symbols []*Symbol
StringTable []byte
LibraryPaths []string
closer io.Closer
}
FileHeader holds information about an XCOFF file header.
type FileHeader struct {
TargetMachine uint16
}
File Header.
type FileHeader32 struct {
Fmagic uint16
Fnscns uint16
Ftimedat uint32
Fsymptr uint32
Fnsyms uint32
Fopthdr uint16
Fflags uint16
}
type FileHeader64 struct {
Fmagic uint16
Fnscns uint16
Ftimedat uint32
Fsymptr uint64
Fopthdr uint16
Fflags uint16
Fnsyms uint32
}
ImportedSymbol holds information about an imported XCOFF symbol.
type ImportedSymbol struct {
Name string
Library string
}
Loader Header.
type LoaderHeader32 struct {
Lversion uint32
Lnsyms uint32
Lnreloc uint32
Listlen uint32
Lnimpid uint32
Limpoff uint32
Lstlen uint32
Lstoff uint32
}
type LoaderHeader64 struct {
Lversion uint32
Lnsyms uint32
Lnreloc uint32
Listlen uint32
Lnimpid uint32
Lstlen uint32
Limpoff uint64
Lstoff uint64
Lsymoff uint64
Lrldoff uint64
}
Loader Symbol.
type LoaderSymbol32 struct {
Lname [8]byte
Lvalue uint32
Lscnum uint16
Lsmtype uint8
Lsmclas uint8
Lifile uint32
Lparm uint32
}
type LoaderSymbol64 struct {
Lvalue uint64
Loffset uint32
Lscnum uint16
Lsmtype uint8
Lsmclas uint8
Lifile uint32
Lparm uint32
}
Member represents a member of an AIX big archive.
type Member struct {
MemberHeader
sr *io.SectionReader
}
MemberHeader holds information about a big archive member
type MemberHeader struct {
Name string
Size uint64
}
type Reloc struct {
VirtualAddress uint64
Symbol *Symbol
Signed bool
InstructionFixed bool
Length uint8
Type uint8
}
type Reloc32 struct {
Rvaddr uint32
Rsymndx uint32
Rsize uint8
Rtype uint8
}
type Reloc64 struct {
Rvaddr uint64
Rsymndx uint32
Rsize uint8
Rtype uint8
}
type Section struct {
SectionHeader
Relocs []Reloc
io.ReaderAt
sr *io.SectionReader
}
SectionHeader holds information about an XCOFF section header.
type SectionHeader struct {
Name string
VirtualAddress uint64
Size uint64
Type uint32
Relptr uint64
Nreloc uint32
}
Section Header.
type SectionHeader32 struct {
Sname [8]byte
Spaddr uint32
Svaddr uint32
Ssize uint32
Sscnptr uint32
Srelptr uint32
Slnnoptr uint32
Snreloc uint16
Snlnno uint16
Sflags uint32
}
type SectionHeader64 struct {
Sname [8]byte
Spaddr uint64
Svaddr uint64
Ssize uint64
Sscnptr uint64
Srelptr uint64
Slnnoptr uint64
Snreloc uint32
Snlnno uint32
Sflags uint32
Spad uint32
}
Symbol Table Entry.
type SymEnt32 struct {
Nname [8]byte
Nvalue uint32
Nscnum uint16
Ntype uint16
Nsclass uint8
Nnumaux uint8
}
type SymEnt64 struct {
Nvalue uint64
Noffset uint32
Nscnum uint16
Ntype uint16
Nsclass uint8
Nnumaux uint8
}
type Symbol struct {
Name string
Value uint64
SectionNumber int
StorageClass int
AuxFcn AuxiliaryFcn
AuxCSect AuxiliaryCSect
}
type bigarFileHeader struct {
Flmagic [SAIAMAG]byte
Flmemoff [20]byte
Flgstoff [20]byte
Flgst64off [20]byte
Flfstmoff [20]byte
Fllstmoff [20]byte
Flfreeoff [20]byte
}
type bigarMemberHeader struct {
Arsize [20]byte
Arnxtmem [20]byte
Arprvmem [20]byte
Ardate [12]byte
Aruid [12]byte
Argid [12]byte
Armode [12]byte
Arnamlen [4]byte
}
type nobitsSectionReader struct {
}
CSect reads and returns the contents of a csect.
func (f *File) CSect(name string) []byte
Close closes the File. If the File was created using NewFile directly instead of Open, Close has no effect.
func (f *File) Close() error
Close closes the Archive. If the Archive was created using NewArchive directly instead of OpenArchive, Close has no effect.
func (a *Archive) Close() error
func (f *File) DWARF() (*dwarf.Data, error)
Data reads and returns the contents of the XCOFF section s.
func (s *Section) Data() ([]byte, error)
GetFile returns the XCOFF file defined by member name. FIXME: This doesn't work if an archive has two members with the same name which can occur if an archive has both 32-bits and 64-bits files.
func (arch *Archive) GetFile(name string) (*File, error)
ImportedLibraries returns the names of all libraries referred to by the binary f that are expected to be linked with the binary at dynamic link time.
func (f *File) ImportedLibraries() ([]string, error)
ImportedSymbols returns the names of all symbols referred to by the binary f that are expected to be satisfied by other libraries at dynamic load time. It does not return weak symbols.
func (f *File) ImportedSymbols() ([]ImportedSymbol, error)
NewArchive creates a new Archive for accessing an AIX big archive in an underlying reader.
func NewArchive(r io.ReaderAt) (*Archive, error)
NewFile creates a new File for accessing an XCOFF binary in an underlying reader.
func NewFile(r io.ReaderAt) (*File, error)
Open opens the named file using os.Open and prepares it for use as an XCOFF binary.
func Open(name string) (*File, error)
OpenArchive opens the named archive using os.Open and prepares it for use as an AIX big archive.
func OpenArchive(name string) (*Archive, error)
func (*nobitsSectionReader) ReadAt(p []byte, off int64) (n int, err error)
Section returns the first section with the given name, or nil if no such section exists. Xcoff have section's name limited to 8 bytes. Some sections like .gosymtab can be trunked but this method will still find them.
func (f *File) Section(name string) *Section
SectionByType returns the first section in f with the given type, or nil if there is no such section.
func (f *File) SectionByType(typ uint32) *Section
cstring converts ASCII byte sequence b to string. It stops once it finds 0 or reaches end of b.
func cstring(b []byte) string
getString extracts a string from an XCOFF string table.
func getString(st []byte, offset uint32) (string, bool)
readImportID returns the import file IDs stored inside the .loader section. Library name pattern is either path/base/member or base/member
func (f *File) readImportIDs(s *Section) ([]string, error)
Generated with Arrow