Class: MachO::Headers::FatArch

Inherits:
MachOStructure show all
Defined in:
lib/macho/headers.rb

Overview

Fat binary header architecture structure. A Fat binary has one or more of these, representing one or more internal Mach-O blobs.

See Also:

Constant Summary collapse

FORMAT =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

always big-endian

"N5".freeze
SIZEOF =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

20

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from MachOStructure

bytesize, new_from_bin

Constructor Details

#initialize(cputype, cpusubtype, offset, size, align) ⇒ FatArch

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of FatArch.



509
510
511
512
513
514
515
# File 'lib/macho/headers.rb', line 509

def initialize(cputype, cpusubtype, offset, size, align)
  @cputype = cputype
  @cpusubtype = cpusubtype
  @offset = offset
  @size = size
  @align = align
end

Instance Attribute Details

#alignInteger (readonly)

Returns the alignment, as a power of 2.

Returns:

  • (Integer)

    the alignment, as a power of 2



497
498
499
# File 'lib/macho/headers.rb', line 497

def align
  @align
end

#cpusubtypeInteger (readonly)

Returns the CPU subtype of the Mach-O.

Returns:

  • (Integer)

    the CPU subtype of the Mach-O



488
489
490
# File 'lib/macho/headers.rb', line 488

def cpusubtype
  @cpusubtype
end

#cputypeInteger (readonly)

Returns the CPU type of the Mach-O.

Returns:

  • (Integer)

    the CPU type of the Mach-O



485
486
487
# File 'lib/macho/headers.rb', line 485

def cputype
  @cputype
end

#offsetInteger (readonly)

Returns the file offset to the beginning of the Mach-O data.

Returns:

  • (Integer)

    the file offset to the beginning of the Mach-O data



491
492
493
# File 'lib/macho/headers.rb', line 491

def offset
  @offset
end

#sizeInteger (readonly)

Returns the size, in bytes, of the Mach-O data.

Returns:

  • (Integer)

    the size, in bytes, of the Mach-O data



494
495
496
# File 'lib/macho/headers.rb', line 494

def size
  @size
end

Instance Method Details

#serializeString

Returns the serialized fields of the fat arch.

Returns:

  • (String)

    the serialized fields of the fat arch



518
519
520
# File 'lib/macho/headers.rb', line 518

def serialize
  [cputype, cpusubtype, offset, size, align].pack(FORMAT)
end