Format represents the saved binary file format.
type Format int
const (
// ELF indicates it should be saved as an ELF binary.
ELF Format = iota
// MachO indicates it should be saved as a Mach-O binary.
MachO
)
func (self Format) Generate(name string, code []byte, base uint64, entry uint64) error
Generate generates a binary executable file from the specified code.
func (self Format) String() string
String returns the name of a specified format.
func (self Format) Write(w io.Writer, code []byte, base uint64, entry uint64) error
Write assembles a binary executable.
type MachOHeader struct {
Magic uint32
CPUType uint32
CPUSubType uint32
FileType uint32
CmdCount uint32
CmdSize uint32
Flags uint32
// contains filtered or unexported fields
}
type Registers struct {
RAX uint64
RBX uint64
RCX uint64
RDX uint64
RDI uint64
RSI uint64
RBP uint64
RSP uint64
R8 uint64
R9 uint64
R10 uint64
R11 uint64
R12 uint64
R13 uint64
R14 uint64
R15 uint64
RIP uint64
RFLAGS uint64
CS uint64
FS uint64
GS uint64
}
type SegmentCommand struct {
Cmd uint32
Size uint32
Name [16]byte
VMAddr uint64
VMSize uint64
FileOffset uint64
FileSize uint64
MaxProtect uint32
InitProtect uint32
SectionCount uint32
Flags uint32
}
type SegmentSection struct {
Name [16]byte
SegName [16]byte
Addr uint64
Size uint64
Offset uint32
Align uint32
RelOffset uint32
RelCount uint32
Flags uint32
// contains filtered or unexported fields
}
type UnixThreadCommand struct {
Cmd uint32
Size uint32
Flavor uint32
Count uint32
Regs Registers
}