Back to index

cell-binutils  2.17cvs20070401
common.h
Go to the documentation of this file.
00001 /* ELF support for BFD.
00002    Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
00003    2001, 2002, 2003, 2004, 2005, 2006, 2007
00004    Free Software Foundation, Inc.
00005 
00006    Written by Fred Fish @ Cygnus Support, from information published
00007    in "UNIX System V Release 4, Programmers Guide: ANSI C and
00008    Programming Support Tools".
00009 
00010    This file is part of BFD, the Binary File Descriptor library.
00011 
00012    This program is free software; you can redistribute it and/or modify
00013    it under the terms of the GNU General Public License as published by
00014    the Free Software Foundation; either version 2 of the License, or
00015    (at your option) any later version.
00016 
00017    This program is distributed in the hope that it will be useful,
00018    but WITHOUT ANY WARRANTY; without even the implied warranty of
00019    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020    GNU General Public License for more details.
00021 
00022    You should have received a copy of the GNU General Public License
00023    along with this program; if not, write to the Free Software
00024    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
00025 
00026 
00027 /* This file is part of ELF support for BFD, and contains the portions
00028    that are common to both the internal and external representations.
00029    For example, ELFMAG0 is the byte 0x7F in both the internal (in-memory)
00030    and external (in-file) representations.  */
00031 
00032 #ifndef _ELF_COMMON_H
00033 #define _ELF_COMMON_H
00034 
00035 /* Fields in e_ident[].  */
00036 
00037 #define EI_MAG0             0      /* File identification byte 0 index */
00038 #define ELFMAG0                0x7F       /* Magic number byte 0 */
00039 
00040 #define EI_MAG1             1      /* File identification byte 1 index */
00041 #define ELFMAG1                 'E'       /* Magic number byte 1 */
00042 
00043 #define EI_MAG2             2      /* File identification byte 2 index */
00044 #define ELFMAG2                 'L'       /* Magic number byte 2 */
00045 
00046 #define EI_MAG3             3      /* File identification byte 3 index */
00047 #define ELFMAG3                 'F'       /* Magic number byte 3 */
00048 
00049 #define EI_CLASS     4      /* File class */
00050 #define ELFCLASSNONE       0       /* Invalid class */
00051 #define ELFCLASS32         1       /* 32-bit objects */
00052 #define ELFCLASS64         2       /* 64-bit objects */
00053 
00054 #define EI_DATA             5      /* Data encoding */
00055 #define ELFDATANONE        0       /* Invalid data encoding */
00056 #define ELFDATA2LSB        1       /* 2's complement, little endian */
00057 #define ELFDATA2MSB        2       /* 2's complement, big endian */
00058 
00059 #define EI_VERSION   6      /* File version */
00060 
00061 #define EI_OSABI     7      /* Operating System/ABI indication */
00062 #define ELFOSABI_NONE             0       /* UNIX System V ABI */
00063 #define ELFOSABI_HPUX             1       /* HP-UX operating system */
00064 #define ELFOSABI_NETBSD           2       /* NetBSD */
00065 #define ELFOSABI_LINUX            3       /* GNU/Linux */
00066 #define ELFOSABI_HURD             4       /* GNU/Hurd */
00067 #define ELFOSABI_SOLARIS      6    /* Solaris */
00068 #define ELFOSABI_AIX       7       /* AIX */
00069 #define ELFOSABI_IRIX             8       /* IRIX */
00070 #define ELFOSABI_FREEBSD      9    /* FreeBSD */
00071 #define ELFOSABI_TRU64           10       /* TRU64 UNIX */
00072 #define ELFOSABI_MODESTO     11    /* Novell Modesto */
00073 #define ELFOSABI_OPENBSD     12    /* OpenBSD */
00074 #define ELFOSABI_OPENVMS     13    /* OpenVMS */
00075 #define ELFOSABI_NSK      14       /* Hewlett-Packard Non-Stop Kernel */
00076 #define ELFOSABI_AROS            15       /* Amiga Research OS */
00077 #define ELFOSABI_ARM      97       /* ARM */
00078 #define ELFOSABI_STANDALONE 255    /* Standalone (embedded) application */
00079 
00080 #define EI_ABIVERSION       8      /* ABI version */
00081 
00082 #define EI_PAD              9      /* Start of padding bytes */
00083 
00084 
00085 /* Values for e_type, which identifies the object file type.  */
00086 
00087 #define ET_NONE             0      /* No file type */
00088 #define ET_REL              1      /* Relocatable file */
00089 #define ET_EXEC             2      /* Executable file */
00090 #define ET_DYN              3      /* Shared object file */
00091 #define ET_CORE             4      /* Core file */
00092 #define ET_LOOS             0xFE00 /* Operating system-specific */
00093 #define ET_HIOS             0xFEFF /* Operating system-specific */
00094 #define ET_LOPROC    0xFF00 /* Processor-specific */
00095 #define ET_HIPROC    0xFFFF /* Processor-specific */
00096 
00097 /* Values for e_machine, which identifies the architecture.  These numbers
00098    are officially assigned by registry@caldera.com.  See below for a list of
00099    ad-hoc numbers used during initial development.  */
00100 
00101 #define EM_NONE               0    /* No machine */
00102 #define EM_M32                1    /* AT&T WE 32100 */
00103 #define EM_SPARC       2    /* SUN SPARC */
00104 #define EM_386                3    /* Intel 80386 */
00105 #define EM_68K                4    /* Motorola m68k family */
00106 #define EM_88K                5    /* Motorola m88k family */
00107 #define EM_486                6    /* Intel 80486 *//* Reserved for future use */
00108 #define EM_860                7    /* Intel 80860 */
00109 #define EM_MIPS               8    /* MIPS R3000 (officially, big-endian only) */
00110 #define EM_S370               9    /* IBM System/370 */
00111 #define EM_MIPS_RS3_LE       10    /* MIPS R3000 little-endian (Oct 4 1999 Draft) Deprecated */
00112 
00113 #define EM_PARISC     15    /* HPPA */
00114 
00115 #define EM_VPP550     17    /* Fujitsu VPP500 */
00116 #define EM_SPARC32PLUS       18    /* Sun's "v8plus" */
00117 #define EM_960               19    /* Intel 80960 */
00118 #define EM_PPC               20    /* PowerPC */
00119 #define EM_PPC64      21    /* 64-bit PowerPC */
00120 #define EM_S390              22    /* IBM S/390 */
00121 #define EM_SPU               23    /* Sony/Toshiba/IBM SPU */
00122 
00123 #define EM_V800              36    /* NEC V800 series */
00124 #define EM_FR20              37    /* Fujitsu FR20 */
00125 #define EM_RH32              38    /* TRW RH32 */
00126 #define EM_MCORE      39    /* Motorola M*Core */ /* May also be taken by Fujitsu MMA */
00127 #define EM_RCE               39    /* Old name for MCore */
00128 #define EM_ARM               40    /* ARM */
00129 #define EM_OLD_ALPHA  41    /* Digital Alpha */
00130 #define EM_SH         42    /* Renesas (formerly Hitachi) / SuperH SH */
00131 #define EM_SPARCV9    43    /* SPARC v9 64-bit */
00132 #define EM_TRICORE    44    /* Siemens Tricore embedded processor */
00133 #define EM_ARC               45    /* ARC Cores */
00134 #define EM_H8_300     46    /* Renesas (formerly Hitachi) H8/300 */
00135 #define EM_H8_300H    47    /* Renesas (formerly Hitachi) H8/300H */
00136 #define EM_H8S               48    /* Renesas (formerly Hitachi) H8S */
00137 #define EM_H8_500     49    /* Renesas (formerly Hitachi) H8/500 */
00138 #define EM_IA_64      50    /* Intel IA-64 Processor */
00139 #define EM_MIPS_X     51    /* Stanford MIPS-X */
00140 #define EM_COLDFIRE   52    /* Motorola Coldfire */
00141 #define EM_68HC12     53    /* Motorola M68HC12 */
00142 #define EM_MMA               54    /* Fujitsu Multimedia Accelerator */
00143 #define EM_PCP               55    /* Siemens PCP */
00144 #define EM_NCPU              56    /* Sony nCPU embedded RISC processor */
00145 #define EM_NDR1              57    /* Denso NDR1 microprocesspr */
00146 #define EM_STARCORE   58    /* Motorola Star*Core processor */
00147 #define EM_ME16              59    /* Toyota ME16 processor */
00148 #define EM_ST100      60    /* STMicroelectronics ST100 processor */
00149 #define EM_TINYJ      61    /* Advanced Logic Corp. TinyJ embedded processor */
00150 #define EM_X86_64     62    /* Advanced Micro Devices X86-64 processor */
00151 
00152 #define EM_PDP10      64    /* Digital Equipment Corp. PDP-10 */
00153 #define EM_PDP11      65    /* Digital Equipment Corp. PDP-11 */
00154 #define EM_FX66              66    /* Siemens FX66 microcontroller */
00155 #define EM_ST9PLUS    67    /* STMicroelectronics ST9+ 8/16 bit microcontroller */
00156 #define EM_ST7               68    /* STMicroelectronics ST7 8-bit microcontroller */
00157 #define EM_68HC16     69    /* Motorola MC68HC16 Microcontroller */
00158 #define EM_68HC11     70    /* Motorola MC68HC11 Microcontroller */
00159 #define EM_68HC08     71    /* Motorola MC68HC08 Microcontroller */
00160 #define EM_68HC05     72    /* Motorola MC68HC05 Microcontroller */
00161 #define EM_SVX               73    /* Silicon Graphics SVx */
00162 #define EM_ST19              74    /* STMicroelectronics ST19 8-bit cpu */
00163 #define EM_VAX               75    /* Digital VAX */
00164 #define EM_CRIS              76    /* Axis Communications 32-bit embedded processor */
00165 #define EM_JAVELIN    77    /* Infineon Technologies 32-bit embedded cpu */
00166 #define EM_FIREPATH   78    /* Element 14 64-bit DSP processor */
00167 #define EM_ZSP               79    /* LSI Logic's 16-bit DSP processor */
00168 #define EM_MMIX              80    /* Donald Knuth's educational 64-bit processor */
00169 #define EM_HUANY      81    /* Harvard's machine-independent format */
00170 #define EM_PRISM      82    /* SiTera Prism */
00171 #define EM_AVR               83    /* Atmel AVR 8-bit microcontroller */
00172 #define EM_FR30              84    /* Fujitsu FR30 */
00173 #define EM_D10V              85    /* Mitsubishi D10V */
00174 #define EM_D30V              86    /* Mitsubishi D30V */
00175 #define EM_V850              87    /* NEC v850 */
00176 #define EM_M32R              88    /* Renesas M32R (formerly Mitsubishi M32R) */
00177 #define EM_MN10300    89    /* Matsushita MN10300 */
00178 #define EM_MN10200    90    /* Matsushita MN10200 */
00179 #define EM_PJ         91    /* picoJava */
00180 #define EM_OPENRISC   92    /* OpenRISC 32-bit embedded processor */
00181 #define EM_ARC_A5     93    /* ARC Cores Tangent-A5 */
00182 #define EM_XTENSA     94    /* Tensilica Xtensa Architecture */
00183 #define EM_IP2K             101    /* Ubicom IP2022 micro controller */
00184 #define EM_CR        103    /* National Semiconductor CompactRISC */
00185 #define EM_MSP430    105    /* TI msp430 micro controller */
00186 #define EM_BLACKFIN  106    /* ADI Blackfin */
00187 #define EM_ALTERA_NIOS2     113    /* Altera Nios II soft-core processor */
00188 #define EM_CRX              114    /* National Semiconductor CRX */
00189 #define EM_SCORE        135     /* Sunplus Score */ 
00190 
00191 /* If it is necessary to assign new unofficial EM_* values, please pick large
00192    random numbers (0x8523, 0xa7f2, etc.) to minimize the chances of collision
00193    with official or non-GNU unofficial values.
00194 
00195    NOTE: Do not just increment the most recent number by one.
00196    Somebody else somewhere will do exactly the same thing, and you
00197    will have a collision.  Instead, pick a random number.
00198 
00199    Normally, each entity or maintainer responsible for a machine with an
00200    unofficial e_machine number should eventually ask registry@caldera.com for
00201    an officially blessed number to be added to the list above. */
00202 
00203 /* Old version of Sparc v9, from before the ABI;
00204    This should be removed shortly.  */
00205 #define EM_OLD_SPARCV9             11
00206 
00207 /* Old version of PowerPC, this should be removed shortly. */
00208 #define EM_PPC_OLD          17
00209 
00210 /* picoJava */
00211 #define EM_PJ_OLD                  99
00212 
00213 /* AVR magic number.  Written in the absense of an ABI.  */
00214 #define EM_AVR_OLD          0x1057
00215 
00216 /* MSP430 magic number.  Written in the absense of everything.  */
00217 #define EM_MSP430_OLD              0x1059
00218 
00219 /* Morpho MT.   Written in the absense of an ABI.  */
00220 #define EM_MT                   0x2530
00221 
00222 /* FR30 magic number - no EABI available.  */
00223 #define EM_CYGNUS_FR30             0x3330
00224 
00225 /* OpenRISC magic number.  Written in the absense of an ABI.  */
00226 #define EM_OPENRISC_OLD            0x3426
00227 
00228 /* DLX magic number.  Written in the absense of an ABI.  */
00229 #define EM_DLX                     0x5aa5
00230 
00231 /* FRV magic number - no EABI available??.  */
00232 #define EM_CYGNUS_FRV              0x5441
00233 
00234 /* Infineon Technologies 16-bit microcontroller with C166-V2 core.  */
00235 #define EM_XC16X            0x4688
00236 
00237 /* D10V backend magic number.  Written in the absence of an ABI.  */
00238 #define EM_CYGNUS_D10V             0x7650
00239 
00240 /* D30V backend magic number.  Written in the absence of an ABI.  */
00241 #define EM_CYGNUS_D30V             0x7676
00242 
00243 /* Ubicom IP2xxx;   Written in the absense of an ABI.  */
00244 #define EM_IP2K_OLD         0x8217
00245 
00246 /* (Deprecated) Temporary number for the OpenRISC processor.  */
00247 #define EM_OR32                    0x8472
00248 
00249 /* Cygnus PowerPC ELF backend.  Written in the absence of an ABI.  */
00250 #define EM_CYGNUS_POWERPC   0x9025
00251 
00252 /* Alpha backend magic number.  Written in the absence of an ABI.  */
00253 #define EM_ALPHA            0x9026
00254 
00255 /* Cygnus M32R ELF backend.  Written in the absence of an ABI.  */
00256 #define EM_CYGNUS_M32R             0x9041
00257 
00258 /* V850 backend magic number.  Written in the absense of an ABI.  */
00259 #define EM_CYGNUS_V850             0x9080
00260 
00261 /* old S/390 backend magic number. Written in the absence of an ABI.  */
00262 #define EM_S390_OLD         0xa390
00263 
00264 /* Old, unofficial value for Xtensa.  */
00265 #define EM_XTENSA_OLD              0xabc7
00266 
00267 #define EM_XSTORMY16        0xad45
00268 
00269 /* mn10200 and mn10300 backend magic numbers.
00270    Written in the absense of an ABI.  */
00271 #define EM_CYGNUS_MN10300   0xbeef
00272 #define EM_CYGNUS_MN10200   0xdead
00273 
00274 /* Renesas M32C and M16C.  */
00275 #define EM_M32C                    0xFEB0
00276 
00277 /* Vitesse IQ2000.  */
00278 #define EM_IQ2000           0xFEBA
00279 
00280 /* NIOS magic number - no EABI available.  */
00281 #define EM_NIOS32           0xFEBB
00282 
00283 #define EM_CYGNUS_MEP              0xF00D  /* Toshiba MeP */
00284 
00285 /* See the above comment before you add a new EM_* value here.  */
00286 
00287 /* Values for e_version.  */
00288 
00289 #define EV_NONE             0             /* Invalid ELF version */
00290 #define EV_CURRENT   1             /* Current version */
00291 
00292 /* Values for program header, p_type field.  */
00293 
00294 #define PT_NULL             0             /* Program header table entry unused */
00295 #define PT_LOAD             1             /* Loadable program segment */
00296 #define PT_DYNAMIC   2             /* Dynamic linking information */
00297 #define PT_INTERP    3             /* Program interpreter */
00298 #define PT_NOTE             4             /* Auxiliary information */
00299 #define PT_SHLIB     5             /* Reserved, unspecified semantics */
00300 #define PT_PHDR             6             /* Entry for header table itself */
00301 #define PT_TLS              7             /* Thread local storage segment */
00302 #define PT_LOOS             0x60000000    /* OS-specific */
00303 #define PT_HIOS             0x6fffffff    /* OS-specific */
00304 #define PT_LOPROC    0x70000000    /* Processor-specific */
00305 #define PT_HIPROC    0x7FFFFFFF    /* Processor-specific */
00306 
00307 #define PT_GNU_EH_FRAME     (PT_LOOS + 0x474e550) /* Frame unwind information */
00308 #define PT_SUNW_EH_FRAME PT_GNU_EH_FRAME      /* Solaris uses the same value */
00309 #define PT_GNU_STACK (PT_LOOS + 0x474e551) /* Stack flags */
00310 #define PT_GNU_RELRO (PT_LOOS + 0x474e552) /* Read-only after relocation */
00311 
00312 /* Program segment permissions, in program header p_flags field.  */
00313 
00314 #define PF_X         (1 << 0)      /* Segment is executable */
00315 #define PF_W         (1 << 1)      /* Segment is writable */
00316 #define PF_R         (1 << 2)      /* Segment is readable */
00317 /* #define PF_MASKOS 0x0F000000    *//* OS-specific reserved bits */
00318 #define PF_MASKOS    0x0FF00000    /* New value, Oct 4, 1999 Draft */
00319 #define PF_MASKPROC  0xF0000000    /* Processor-specific reserved bits */
00320 
00321 /* Values for section header, sh_type field.  */
00322 
00323 #define SHT_NULL     0             /* Section header table entry unused */
00324 #define SHT_PROGBITS 1             /* Program specific (private) data */
00325 #define SHT_SYMTAB   2             /* Link editing symbol table */
00326 #define SHT_STRTAB   3             /* A string table */
00327 #define SHT_RELA     4             /* Relocation entries with addends */
00328 #define SHT_HASH     5             /* A symbol hash table */
00329 #define SHT_DYNAMIC  6             /* Information for dynamic linking */
00330 #define SHT_NOTE     7             /* Information that marks file */
00331 #define SHT_NOBITS   8             /* Section occupies no space in file */
00332 #define SHT_REL             9             /* Relocation entries, no addends */
00333 #define SHT_SHLIB    10            /* Reserved, unspecified semantics */
00334 #define SHT_DYNSYM   11            /* Dynamic linking symbol table */
00335 
00336 #define SHT_INIT_ARRAY        14          /* Array of ptrs to init functions */
00337 #define SHT_FINI_ARRAY        15          /* Array of ptrs to finish functions */
00338 #define SHT_PREINIT_ARRAY 16              /* Array of ptrs to pre-init funcs */
00339 #define SHT_GROUP      17          /* Section contains a section group */
00340 #define SHT_SYMTAB_SHNDX  18              /* Indicies for SHN_XINDEX entries */
00341 
00342 #define SHT_LOOS     0x60000000    /* First of OS specific semantics */
00343 #define SHT_HIOS     0x6fffffff    /* Last of OS specific semantics */
00344 
00345 #define SHT_GNU_HASH 0x6ffffff6    /* GNU style symbol hash table */
00346 #define SHT_GNU_LIBLIST     0x6ffffff7    /* List of prelink dependencies */
00347 
00348 /* The next three section types are defined by Solaris, and are named
00349    SHT_SUNW*.  We use them in GNU code, so we also define SHT_GNU*
00350    versions.  */
00351 #define SHT_SUNW_verdef     0x6ffffffd    /* Versions defined by file */
00352 #define SHT_SUNW_verneed 0x6ffffffe       /* Versions needed by file */
00353 #define SHT_SUNW_versym     0x6fffffff    /* Symbol versions */
00354 
00355 #define SHT_GNU_verdef      SHT_SUNW_verdef
00356 #define SHT_GNU_verneed     SHT_SUNW_verneed
00357 #define SHT_GNU_versym      SHT_SUNW_versym
00358 
00359 #define SHT_LOPROC   0x70000000    /* Processor-specific semantics, lo */
00360 #define SHT_HIPROC   0x7FFFFFFF    /* Processor-specific semantics, hi */
00361 #define SHT_LOUSER   0x80000000    /* Application-specific semantics */
00362 /* #define SHT_HIUSER       0x8FFFFFFF    *//* Application-specific semantics */
00363 #define SHT_HIUSER   0xFFFFFFFF    /* New value, defined in Oct 4, 1999 Draft */
00364 
00365 /* Values for section header, sh_flags field.  */
00366 
00367 #define SHF_WRITE    (1 << 0)      /* Writable data during execution */
00368 #define SHF_ALLOC    (1 << 1)      /* Occupies memory during execution */
00369 #define SHF_EXECINSTR       (1 << 2)      /* Executable machine instructions */
00370 #define SHF_MERGE    (1 << 4)      /* Data in this section can be merged */
00371 #define SHF_STRINGS  (1 << 5)      /* Contains null terminated character strings */
00372 #define SHF_INFO_LINK       (1 << 6)      /* sh_info holds section header table index */
00373 #define SHF_LINK_ORDER      (1 << 7)      /* Preserve section ordering when linking */
00374 #define SHF_OS_NONCONFORMING (1 << 8)     /* OS specific processing required */
00375 #define SHF_GROUP    (1 << 9)      /* Member of a section group */
00376 #define SHF_TLS             (1 << 10)     /* Thread local storage section */
00377 
00378 /* #define SHF_MASKOS       0x0F000000    *//* OS-specific semantics */
00379 #define SHF_MASKOS   0x0FF00000    /* New value, Oct 4, 1999 Draft */
00380 #define SHF_MASKPROC 0xF0000000    /* Processor-specific semantics */
00381 
00382 /* Values of note segment descriptor types for core files.  */
00383 
00384 #define NT_PRSTATUS  1             /* Contains copy of prstatus struct */
00385 #define NT_FPREGSET  2             /* Contains copy of fpregset struct */
00386 #define NT_PRPSINFO  3             /* Contains copy of prpsinfo struct */
00387 #define NT_TASKSTRUCT       4             /* Contains copy of task struct */
00388 #define NT_AUXV             6             /* Contains copy of Elfxx_auxv_t */
00389 #define NT_PRXFPREG  0x46e62b7f    /* Contains a user_xfpregs_struct; */
00390                                    /*   note name must be "LINUX".  */
00391 
00392 /* Note segments for core files on dir-style procfs systems.  */
00393 
00394 #define NT_PSTATUS   10            /* Has a struct pstatus */
00395 #define NT_FPREGS    12            /* Has a struct fpregset */
00396 #define NT_PSINFO    13            /* Has a struct psinfo */
00397 #define NT_LWPSTATUS 16            /* Has a struct lwpstatus_t */
00398 #define NT_LWPSINFO  17            /* Has a struct lwpsinfo_t */
00399 #define NT_WIN32PSTATUS     18            /* Has a struct win32_pstatus */
00400 
00401 
00402 /* Note segments for core files on NetBSD systems.  Note name
00403    must start with "NetBSD-CORE".  */
00404 
00405 #define NT_NETBSDCORE_PROCINFO     1      /* Has a struct procinfo */
00406 #define NT_NETBSDCORE_FIRSTMACH    32     /* start of machdep note types */
00407 
00408 
00409 /* Values of note segment descriptor types for object files.  */
00410 
00411 #define NT_VERSION   1             /* Contains a version string.  */
00412 #define NT_ARCH             2             /* Contains an architecture string.  */
00413 
00414 /* Values for GNU .note.ABI-tag notes.  Note name is "GNU".  */
00415 
00416 #define NT_GNU_ABI_TAG             1
00417 #define GNU_ABI_TAG_LINUX   0
00418 #define GNU_ABI_TAG_HURD    1
00419 #define GNU_ABI_TAG_SOLARIS 2
00420 #define GNU_ABI_TAG_FREEBSD 3
00421 #define GNU_ABI_TAG_NETBSD  4
00422 
00423 /* Values for NetBSD .note.netbsd.ident notes.  Note name is "NetBSD".  */
00424 
00425 #define NT_NETBSD_IDENT            1
00426 
00427 /* Values for OpenBSD .note.openbsd.ident notes.  Note name is "OpenBSD".  */
00428 
00429 #define NT_OPENBSD_IDENT    1
00430 
00431 /* Values for FreeBSD .note.ABI-tag notes.  Note name is "FreeBSD".  */
00432 
00433 #define NT_FREEBSD_ABI_TAG  1
00434 
00435 /* These three macros disassemble and assemble a symbol table st_info field,
00436    which contains the symbol binding and symbol type.  The STB_ and STT_
00437    defines identify the binding and type.  */
00438 
00439 #define ELF_ST_BIND(val)           (((unsigned int)(val)) >> 4)
00440 #define ELF_ST_TYPE(val)           ((val) & 0xF)
00441 #define ELF_ST_INFO(bind,type)            (((bind) << 4) + ((type) & 0xF))
00442 
00443 /* The 64bit and 32bit versions of these macros are identical, but
00444    the ELF spec defines them, so here they are.  */
00445 #define ELF32_ST_BIND  ELF_ST_BIND
00446 #define ELF32_ST_TYPE  ELF_ST_TYPE
00447 #define ELF32_ST_INFO  ELF_ST_INFO
00448 #define ELF64_ST_BIND  ELF_ST_BIND
00449 #define ELF64_ST_TYPE  ELF_ST_TYPE
00450 #define ELF64_ST_INFO  ELF_ST_INFO
00451 
00452 /* This macro disassembles and assembles a symbol's visibility into
00453    the st_other field.  The STV_ defines specify the actual visibility.  */
00454 
00455 #define ELF_ST_VISIBILITY(v)              ((v) & 0x3)
00456 /* The remaining bits in the st_other field are not currently used.
00457    They should be set to zero.  */
00458 
00459 #define ELF32_ST_VISIBILITY  ELF_ST_VISIBILITY
00460 #define ELF64_ST_VISIBILITY  ELF_ST_VISIBILITY
00461 
00462 
00463 #define STN_UNDEF    0             /* Undefined symbol index */
00464 
00465 #define STB_LOCAL    0             /* Symbol not visible outside obj */
00466 #define STB_GLOBAL   1             /* Symbol visible outside obj */
00467 #define STB_WEAK     2             /* Like globals, lower precedence */
00468 #define STB_LOOS     10            /* OS-specific semantics */
00469 #define STB_HIOS     12            /* OS-specific semantics */
00470 #define STB_LOPROC   13            /* Application-specific semantics */
00471 #define STB_HIPROC   15            /* Application-specific semantics */
00472 
00473 #define STT_NOTYPE   0             /* Symbol type is unspecified */
00474 #define STT_OBJECT   1             /* Symbol is a data object */
00475 #define STT_FUNC     2             /* Symbol is a code object */
00476 #define STT_SECTION  3             /* Symbol associated with a section */
00477 #define STT_FILE     4             /* Symbol gives a file name */
00478 #define STT_COMMON   5             /* An uninitialised common block */
00479 #define STT_TLS             6             /* Thread local data object */
00480 #define STT_RELC        8               /* Complex relocation expression */
00481 #define STT_SRELC       9               /* Signed Complex relocation expression */
00482 #define STT_LOOS     10            /* OS-specific semantics */
00483 #define STT_HIOS     12            /* OS-specific semantics */
00484 #define STT_LOPROC   13            /* Application-specific semantics */
00485 #define STT_HIPROC   15            /* Application-specific semantics */
00486 
00487 /* Special section indices, which may show up in st_shndx fields, among
00488    other places.  */
00489 
00490 #define SHN_UNDEF    0             /* Undefined section reference */
00491 #define SHN_LORESERVE       0xFF00        /* Begin range of reserved indices */
00492 #define SHN_LOPROC   0xFF00        /* Begin range of appl-specific */
00493 #define SHN_HIPROC   0xFF1F        /* End range of appl-specific */
00494 #define SHN_LOOS     0xFF20        /* OS specific semantics, lo */
00495 #define SHN_HIOS     0xFF3F        /* OS specific semantics, hi */
00496 #define SHN_ABS             0xFFF1        /* Associated symbol is absolute */
00497 #define SHN_COMMON   0xFFF2        /* Associated symbol is in common */
00498 #define SHN_XINDEX   0xFFFF        /* Section index is held elsewhere */
00499 #define SHN_HIRESERVE       0xFFFF        /* End range of reserved indices */
00500 #define SHN_BAD             ((unsigned) -1) /* Used internally by bfd */
00501 
00502 /* The following constants control how a symbol may be accessed once it has
00503    become part of an executable or shared library.  */
00504 
00505 #define STV_DEFAULT  0             /* Visibility is specified by binding type */
00506 #define STV_INTERNAL 1             /* OS specific version of STV_HIDDEN */
00507 #define STV_HIDDEN   2             /* Can only be seen inside currect component */
00508 #define STV_PROTECTED       3             /* Treat as STB_LOCAL inside current component */
00509 
00510 /* Relocation info handling macros.  */
00511 
00512 #define ELF32_R_SYM(i)             ((i) >> 8)
00513 #define ELF32_R_TYPE(i)            ((i) & 0xff)
00514 #define ELF32_R_INFO(s,t)   (((s) << 8) + ((t) & 0xff))
00515 
00516 #define ELF64_R_SYM(i)             ((i) >> 32)
00517 #define ELF64_R_TYPE(i)            ((i) & 0xffffffff)
00518 #define ELF64_R_INFO(s,t)   (((bfd_vma) (s) << 31 << 1) + (bfd_vma) (t))
00519 
00520 /* Dynamic section tags.  */
00521 
00522 #define DT_NULL             0
00523 #define DT_NEEDED    1
00524 #define DT_PLTRELSZ  2
00525 #define DT_PLTGOT    3
00526 #define DT_HASH             4
00527 #define DT_STRTAB    5
00528 #define DT_SYMTAB    6
00529 #define DT_RELA             7
00530 #define DT_RELASZ    8
00531 #define DT_RELAENT   9
00532 #define DT_STRSZ     10
00533 #define DT_SYMENT    11
00534 #define DT_INIT             12
00535 #define DT_FINI             13
00536 #define DT_SONAME    14
00537 #define DT_RPATH     15
00538 #define DT_SYMBOLIC  16
00539 #define DT_REL              17
00540 #define DT_RELSZ     18
00541 #define DT_RELENT    19
00542 #define DT_PLTREL    20
00543 #define DT_DEBUG     21
00544 #define DT_TEXTREL   22
00545 #define DT_JMPREL    23
00546 #define DT_BIND_NOW  24
00547 #define DT_INIT_ARRAY       25
00548 #define DT_FINI_ARRAY       26
00549 #define DT_INIT_ARRAYSZ 27
00550 #define DT_FINI_ARRAYSZ 28
00551 #define DT_RUNPATH   29
00552 #define DT_FLAGS     30
00553 #define DT_ENCODING  31
00554 #define DT_PREINIT_ARRAY   32
00555 #define DT_PREINIT_ARRAYSZ 33
00556 
00557 /* Note, the Oct 4, 1999 draft of the ELF ABI changed the values
00558    for DT_LOOS and DT_HIOS.  Some implementations however, use
00559    values outside of the new range (see below).   */
00560 #define OLD_DT_LOOS  0x60000000
00561 #define DT_LOOS             0x6000000d
00562 #define DT_HIOS             0x6ffff000
00563 #define OLD_DT_HIOS  0x6fffffff
00564 
00565 #define DT_LOPROC    0x70000000
00566 #define DT_HIPROC    0x7fffffff
00567 
00568 /* The next four dynamic tags are used on Solaris.  We support them
00569    everywhere.       Note these values lie outside of the (new) range for
00570    OS specific values.      This is a deliberate special case and we
00571    maintain it for backwards compatability.  */
00572 #define DT_VALRNGLO  0x6ffffd00
00573 #define DT_GNU_PRELINKED 0x6ffffdf5
00574 #define DT_GNU_CONFLICTSZ 0x6ffffdf6
00575 #define DT_GNU_LIBLISTSZ 0x6ffffdf7
00576 #define DT_CHECKSUM  0x6ffffdf8
00577 #define DT_PLTPADSZ  0x6ffffdf9
00578 #define DT_MOVEENT   0x6ffffdfa
00579 #define DT_MOVESZ    0x6ffffdfb
00580 #define DT_FEATURE   0x6ffffdfc
00581 #define DT_POSFLAG_1 0x6ffffdfd
00582 #define DT_SYMINSZ   0x6ffffdfe
00583 #define DT_SYMINENT  0x6ffffdff
00584 #define DT_VALRNGHI  0x6ffffdff
00585 
00586 #define DT_ADDRRNGLO 0x6ffffe00
00587 #define DT_GNU_HASH  0x6ffffef5
00588 #define DT_TLSDESC_PLT      0x6ffffef6
00589 #define DT_TLSDESC_GOT      0x6ffffef7
00590 #define DT_GNU_CONFLICT     0x6ffffef8
00591 #define DT_GNU_LIBLIST      0x6ffffef9
00592 #define DT_CONFIG    0x6ffffefa
00593 #define DT_DEPAUDIT  0x6ffffefb
00594 #define DT_AUDIT     0x6ffffefc
00595 #define DT_PLTPAD    0x6ffffefd
00596 #define DT_MOVETAB   0x6ffffefe
00597 #define DT_SYMINFO   0x6ffffeff
00598 #define DT_ADDRRNGHI 0x6ffffeff
00599 
00600 #define DT_RELACOUNT 0x6ffffff9
00601 #define DT_RELCOUNT  0x6ffffffa
00602 #define DT_FLAGS_1   0x6ffffffb
00603 #define DT_VERDEF    0x6ffffffc
00604 #define DT_VERDEFNUM 0x6ffffffd
00605 #define DT_VERNEED   0x6ffffffe
00606 #define DT_VERNEEDNUM       0x6fffffff
00607 
00608 /* This tag is a GNU extension to the Solaris version scheme.  */
00609 #define DT_VERSYM    0x6ffffff0
00610 
00611 #define DT_LOPROC    0x70000000
00612 #define DT_HIPROC    0x7fffffff
00613 
00614 /* These section tags are used on Solaris.  We support them
00615    everywhere, and hope they do not conflict.  */
00616 
00617 #define DT_AUXILIARY 0x7ffffffd
00618 #define DT_USED             0x7ffffffe
00619 #define DT_FILTER    0x7fffffff
00620 
00621 
00622 /* Values used in DT_FEATURE .dynamic entry.  */
00623 #define DTF_1_PARINIT       0x00000001
00624 /* From
00625 
00626    http://docs.sun.com:80/ab2/coll.45.13/LLM/@Ab2PageView/21165?Ab2Lang=C&Ab2Enc=iso-8859-1
00627 
00628    DTF_1_CONFEXP is the same as DTF_1_PARINIT. It is a typo. The value
00629    defined here is the same as the one in <sys/link.h> on Solaris 8.  */
00630 #define DTF_1_CONFEXP       0x00000002
00631 
00632 /* Flag values used in the DT_POSFLAG_1 .dynamic entry.  */
00633 #define DF_P1_LAZYLOAD      0x00000001
00634 #define DF_P1_GROUPPERM     0x00000002
00635 
00636 /* Flag value in in the DT_FLAGS_1 .dynamic entry.  */
00637 #define DF_1_NOW     0x00000001
00638 #define DF_1_GLOBAL  0x00000002
00639 #define DF_1_GROUP   0x00000004
00640 #define DF_1_NODELETE       0x00000008
00641 #define DF_1_LOADFLTR       0x00000010
00642 #define DF_1_INITFIRST      0x00000020
00643 #define DF_1_NOOPEN  0x00000040
00644 #define DF_1_ORIGIN  0x00000080
00645 #define DF_1_DIRECT  0x00000100
00646 #define DF_1_TRANS   0x00000200
00647 #define DF_1_INTERPOSE      0x00000400
00648 #define DF_1_NODEFLIB       0x00000800
00649 #define DF_1_NODUMP  0x00001000
00650 #define DF_1_CONLFAT 0x00002000
00651 
00652 /* Flag values for the DT_FLAGS entry.    */
00653 #define DF_ORIGIN    (1 << 0)
00654 #define DF_SYMBOLIC  (1 << 1)
00655 #define DF_TEXTREL   (1 << 2)
00656 #define DF_BIND_NOW  (1 << 3)
00657 #define DF_STATIC_TLS       (1 << 4)
00658 
00659 /* These constants are used for the version number of a Elf32_Verdef
00660    structure.  */
00661 
00662 #define VER_DEF_NONE        0
00663 #define VER_DEF_CURRENT            1
00664 
00665 /* These constants appear in the vd_flags field of a Elf32_Verdef
00666    structure.  */
00667 
00668 #define VER_FLG_BASE        0x1
00669 #define VER_FLG_WEAK        0x2
00670 
00671 /* These special constants can be found in an Elf32_Versym field.  */
00672 
00673 #define VER_NDX_LOCAL              0
00674 #define VER_NDX_GLOBAL             1
00675 
00676 /* These constants are used for the version number of a Elf32_Verneed
00677    structure.  */
00678 
00679 #define VER_NEED_NONE              0
00680 #define VER_NEED_CURRENT    1
00681 
00682 /* This flag appears in a Versym structure.  It means that the symbol
00683    is hidden, and is only visible with an explicit version number.
00684    This is a GNU extension.  */
00685 
00686 #define VERSYM_HIDDEN              0x8000
00687 
00688 /* This is the mask for the rest of the Versym information.  */
00689 
00690 #define VERSYM_VERSION             0x7fff
00691 
00692 /* This is a special token which appears as part of a symbol name.  It
00693    indictes that the rest of the name is actually the name of a
00694    version node, and is not part of the actual name.  This is a GNU
00695    extension.  For example, the symbol name `stat@ver2' is taken to
00696    mean the symbol `stat' in version `ver2'.  */
00697 
00698 #define ELF_VER_CHR  '@'
00699 
00700 /* Possible values for si_boundto.  */
00701 
00702 #define SYMINFO_BT_SELF            0xffff /* Symbol bound to self */
00703 #define SYMINFO_BT_PARENT   0xfffe /* Symbol bound to parent */
00704 #define SYMINFO_BT_LOWRESERVE      0xff00 /* Beginning of reserved entries */
00705 
00706 /* Possible bitmasks for si_flags.  */
00707 
00708 #define SYMINFO_FLG_DIRECT  0x0001 /* Direct bound symbol */
00709 #define SYMINFO_FLG_PASSTHRU       0x0002 /* Pass-thru symbol for translator */
00710 #define SYMINFO_FLG_COPY    0x0004 /* Symbol is a copy-reloc */
00711 #define SYMINFO_FLG_LAZYLOAD       0x0008 /* Symbol bound to object to be lazy loaded */
00712 
00713 /* Syminfo version values.  */
00714 
00715 #define SYMINFO_NONE        0
00716 #define SYMINFO_CURRENT            1
00717 #define SYMINFO_NUM         2
00718 
00719 /* Section Group Flags.      */
00720 
00721 #define GRP_COMDAT          0x1    /* A COMDAT group */
00722 
00723 /* Auxv a_type values.  */
00724 
00725 #define AT_NULL             0             /* End of vector */
00726 #define AT_IGNORE    1             /* Entry should be ignored */
00727 #define AT_EXECFD    2             /* File descriptor of program */
00728 #define AT_PHDR             3             /* Program headers for program */
00729 #define AT_PHENT     4             /* Size of program header entry */
00730 #define AT_PHNUM     5             /* Number of program headers */
00731 #define AT_PAGESZ    6             /* System page size */
00732 #define AT_BASE             7             /* Base address of interpreter */
00733 #define AT_FLAGS     8             /* Flags */
00734 #define AT_ENTRY     9             /* Entry point of program */
00735 #define AT_NOTELF    10            /* Program is not ELF */
00736 #define AT_UID              11            /* Real uid */
00737 #define AT_EUID             12            /* Effective uid */
00738 #define AT_GID              13            /* Real gid */
00739 #define AT_EGID             14            /* Effective gid */
00740 #define AT_CLKTCK    17            /* Frequency of times() */
00741 #define AT_PLATFORM  15            /* String identifying platform.  */
00742 #define AT_HWCAP     16            /* Machine dependent hints about
00743                                       processor capabilities.  */
00744 #define AT_FPUCW     18            /* Used FPU control word.  */
00745 #define AT_DCACHEBSIZE      19            /* Data cache block size.  */
00746 #define AT_ICACHEBSIZE      20            /* Instruction cache block size.  */
00747 #define AT_UCACHEBSIZE      21            /* Unified cache block size.  */
00748 #define AT_IGNOREPPC 22            /* Entry should be ignored */
00749 #define       AT_SECURE     23            /* Boolean, was exec setuid-like?  */
00750 /* Pointer to the global system page used for system calls and other
00751    nice things.  */
00752 #define AT_SYSINFO   32
00753 #define AT_SYSINFO_EHDR     33 /* Pointer to ELF header of system-supplied DSO.  */
00754 
00755 #define AT_SUN_UID      2000    /* Effective user ID.  */
00756 #define AT_SUN_RUID     2001    /* Real user ID.  */
00757 #define AT_SUN_GID      2002    /* Effective group ID.  */
00758 #define AT_SUN_RGID     2003    /* Real group ID.  */
00759 #define AT_SUN_LDELF    2004    /* Dynamic linker's ELF header.  */
00760 #define AT_SUN_LDSHDR   2005    /* Dynamic linker's section headers.  */
00761 #define AT_SUN_LDNAME   2006    /* String giving name of dynamic linker.  */
00762 #define AT_SUN_LPAGESZ  2007    /* Large pagesize.   */
00763 #define AT_SUN_PLATFORM 2008    /* Platform name string.  */
00764 #define AT_SUN_HWCAP    2009       /* Machine dependent hints about
00765                                processor capabilities.  */
00766 #define AT_SUN_IFLUSH   2010    /* Should flush icache? */
00767 #define AT_SUN_CPU      2011    /* CPU name string.  */
00768 #define AT_SUN_EMUL_ENTRY 2012     /* COFF entry point address.  */
00769 #define AT_SUN_EMUL_EXECFD 2013    /* COFF executable file descriptor.  */
00770 #define AT_SUN_EXECNAME 2014    /* Canonicalized file name given to execve.  */
00771 #define AT_SUN_MMU      2015    /* String for name of MMU module.   */
00772 #define AT_SUN_LDDATA   2016    /* Dynamic linker's data segment address.  */
00773 
00774 
00775 #endif /* _ELF_COMMON_H */