Module: MachO::Sections

Defined in:
lib/macho/sections.rb

Overview

Classes and constants for parsing sections in Mach-O binaries.

Defined Under Namespace

Classes: Section, Section64

Constant Summary collapse

SECTION_TYPE_MASK =

type mask

0x000000ff
SECTION_ATTRIBUTES_MASK =

attributes mask

0xffffff00
SECTION_ATTRIBUTES_USR_MASK =

user settable attributes mask

0xff000000
SECTION_ATTRIBUTES_SYS_MASK =

system settable attributes mask

0x00ffff00
MAX_SECT_ALIGN =
Note:

see MAXSECTALIGN macro in cctools/misc/lipo.c

maximum specifiable section alignment, as a power of 2

15
SECTION_TYPES =

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.

association of section type symbols to values

{
  :S_REGULAR => 0x0,
  :S_ZEROFILL => 0x1,
  :S_CSTRING_LITERALS => 0x2,
  :S_4BYTE_LITERALS => 0x3,
  :S_8BYTE_LITERALS => 0x4,
  :S_LITERAL_POINTERS => 0x5,
  :S_NON_LAZY_SYMBOL_POINTERS => 0x6,
  :S_LAZY_SYMBOL_POINTERS => 0x7,
  :S_SYMBOL_STUBS => 0x8,
  :S_MOD_INIT_FUNC_POINTERS => 0x9,
  :S_MOD_TERM_FUNC_POINTERS => 0xa,
  :S_COALESCED => 0xb,
  :S_GB_ZEROFILE => 0xc,
  :S_INTERPOSING => 0xd,
  :S_16BYTE_LITERALS => 0xe,
  :S_DTRACE_DOF => 0xf,
  :S_LAZY_DYLIB_SYMBOL_POINTERS => 0x10,
  :S_THREAD_LOCAL_REGULAR => 0x11,
  :S_THREAD_LOCAL_ZEROFILL => 0x12,
  :S_THREAD_LOCAL_VARIABLES => 0x13,
  :S_THREAD_LOCAL_VARIABLE_POINTERS => 0x14,
  :S_THREAD_LOCAL_INIT_FUNCTION_POINTERS => 0x15,
  :S_INIT_FUNC_OFFSETS => 0x16,
}.freeze
SECTION_ATTRIBUTES =

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.

association of section attribute symbols to values

{
  :S_ATTR_PURE_INSTRUCTIONS => 0x80000000,
  :S_ATTR_NO_TOC => 0x40000000,
  :S_ATTR_STRIP_STATIC_SYMS => 0x20000000,
  :S_ATTR_NO_DEAD_STRIP => 0x10000000,
  :S_ATTR_LIVE_SUPPORT => 0x08000000,
  :S_ATTR_SELF_MODIFYING_CODE => 0x04000000,
  :S_ATTR_DEBUG => 0x02000000,
  :S_ATTR_SOME_INSTRUCTIONS => 0x00000400,
  :S_ATTR_EXT_RELOC => 0x00000200,
  :S_ATTR_LOC_RELOC => 0x00000100,
}.freeze
SECTION_FLAGS =

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.

association of section flag symbols to values

{
  **SECTION_TYPES,
  **SECTION_ATTRIBUTES,
}.freeze
SECTION_NAMES =

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.

association of section name symbols to names

{
  :SECT_TEXT => "__text",
  :SECT_FVMLIB_INIT0 => "__fvmlib_init0",
  :SECT_FVMLIB_INIT1 => "__fvmlib_init1",
  :SECT_DATA => "__data",
  :SECT_BSS => "__bss",
  :SECT_COMMON => "__common",
  :SECT_OBJC_SYMBOLS => "__symbol_table",
  :SECT_OBJC_MODULES => "__module_info",
  :SECT_OBJC_STRINGS => "__selector_strs",
  :SECT_OBJC_REFS => "__selector_refs",
  :SECT_ICON_HEADER => "__header",
  :SECT_ICON_TIFF => "__tiff",
}.freeze