/* Mach-O support for BFD.
Copyright (C) 2011-2024 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
/* Zero fill on demand section. */
BFD_MACH_O_S_ZEROFILL = 0x1,
/* Section with only literal C strings. */
BFD_MACH_O_S_CSTRING_LITERALS = 0x2,
/* Section with only 4 byte literals. */
BFD_MACH_O_S_4BYTE_LITERALS = 0x3,
/* Section with only 8 byte literals. */
BFD_MACH_O_S_8BYTE_LITERALS = 0x4,
/* Section with only pointers to literals. */
BFD_MACH_O_S_LITERAL_POINTERS = 0x5,
/* For the two types of symbol pointers sections and the symbol stubs
section they have indirect symbol table entries. For each of the
entries in the section the indirect symbol table entries, in
corresponding order in the indirect symbol table, start at the index
stored in the reserved1 field of the section structure. Since the
indirect symbol table entries correspond to the entries in the
section the number of indirect symbol table entries is inferred from
the size of the section divided by the size of the entries in the
section. For symbol pointers sections the size of the entries in
the section is 4 bytes and for symbol stubs sections the byte size
of the stubs is stored in the reserved2 field of the section
structure. */
/* Section with only non-lazy symbol pointers. */
BFD_MACH_O_S_NON_LAZY_SYMBOL_POINTERS = 0x6,
/* Section with only lazy symbol pointers. */
BFD_MACH_O_S_LAZY_SYMBOL_POINTERS = 0x7,
/* Section with only symbol stubs, byte size of stub in the reserved2
field. */
BFD_MACH_O_S_SYMBOL_STUBS = 0x8,
/* Section with only function pointers for initialization. */
BFD_MACH_O_S_MOD_INIT_FUNC_POINTERS = 0x9,
/* Section with only function pointers for termination. */
BFD_MACH_O_S_MOD_FINI_FUNC_POINTERS = 0xa,
/* Section contains symbols that are coalesced by the linkers. */
BFD_MACH_O_S_COALESCED = 0xb,
/* Zero fill on demand section (possibly larger than 4 GB). */
BFD_MACH_O_S_GB_ZEROFILL = 0xc,
/* Section with only pairs of function pointers for interposing. */
BFD_MACH_O_S_INTERPOSING = 0xd,
/* Section with only 16 byte literals. */
BFD_MACH_O_S_16BYTE_LITERALS = 0xe,
/* Section with only lazy symbol pointers to lazy loaded dylibs. */
BFD_MACH_O_S_LAZY_DYLIB_SYMBOL_POINTERS = 0x10
}
bfd_mach_o_section_type;
/* The flags field of a section structure is separated into two parts a section
type and section attributes. The section types are mutually exclusive (it
can only have one type) but the section attributes are not (it may have more
than one attribute). */
#define BFD_MACH_O_SECTION_TYPE_MASK 0x000000ff
/* Constants for the section attributes part of the flags field of a section
structure. */
#define BFD_MACH_O_SECTION_ATTRIBUTES_MASK 0xffffff00
/* System setable attributes. */
#define BFD_MACH_O_SECTION_ATTRIBUTES_SYS 0x00ffff00
/* User attributes. */
#define BFD_MACH_O_SECTION_ATTRIBUTES_USR 0xff000000
typedef enum bfd_mach_o_section_attribute
{
/* Section has no specified attibutes. */
BFD_MACH_O_S_ATTR_NONE = 0,
/* Section has local relocation entries. */
BFD_MACH_O_S_ATTR_LOC_RELOC = 0x00000100,
/* Section has external relocation entries. */
BFD_MACH_O_S_ATTR_EXT_RELOC = 0x00000200,
/* Section contains some machine instructions. */
BFD_MACH_O_S_ATTR_SOME_INSTRUCTIONS = 0x00000400,
/* A debug section. */
BFD_MACH_O_S_ATTR_DEBUG = 0x02000000,
/* Used with i386 stubs. */
BFD_MACH_O_S_SELF_MODIFYING_CODE = 0x04000000,
/* Blocks are live if they reference live blocks. */
BFD_MACH_O_S_ATTR_LIVE_SUPPORT = 0x08000000,
/* No dead stripping. */
BFD_MACH_O_S_ATTR_NO_DEAD_STRIP = 0x10000000,
/* Section symbols can be stripped in files with MH_DYLDLINK flag. */
BFD_MACH_O_S_ATTR_STRIP_STATIC_SYMS = 0x20000000,
/* Section contains coalesced symbols that are not to be in the TOC of an
archive. */
BFD_MACH_O_S_ATTR_NO_TOC = 0x40000000,