|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. ! 3: * ! 4: * @APPLE_LICENSE_HEADER_START@ ! 5: * ! 6: * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights ! 7: * Reserved. This file contains Original Code and/or Modifications of ! 8: * Original Code as defined in and that are subject to the Apple Public ! 9: * Source License Version 1.1 (the "License"). You may not use this file ! 10: * except in compliance with the License. Please obtain a copy of the ! 11: * License at http://www.apple.com/publicsource and read it before using ! 12: * this file. ! 13: * ! 14: * The Original Code and all software distributed under the License are ! 15: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER ! 16: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, ! 17: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, ! 18: * FITNESS FOR A PARTICULAR PURPOSE OR NON- INFRINGEMENT. Please see the ! 19: * License for the specific language governing rights and limitations ! 20: * under the License. ! 21: * ! 22: * @APPLE_LICENSE_HEADER_END@ ! 23: */ ! 24: #ifndef _MACHO_NLIST_H_ ! 25: #define _MACHO_NLIST_H_ ! 26: /* $NetBSD: nlist.h,v 1.5 1994/10/26 00:56:11 cgd Exp $ */ ! 27: ! 28: /*- ! 29: * Copyright (c) 1991, 1993 ! 30: * The Regents of the University of California. All rights reserved. ! 31: * (c) UNIX System Laboratories, Inc. ! 32: * All or some portions of this file are derived from material licensed ! 33: * to the University of California by American Telephone and Telegraph ! 34: * Co. or Unix System Laboratories, Inc. and are reproduced herein with ! 35: * the permission of UNIX System Laboratories, Inc. ! 36: * ! 37: * Redistribution and use in source and binary forms, with or without ! 38: * modification, are permitted provided that the following conditions ! 39: * are met: ! 40: * 1. Redistributions of source code must retain the above copyright ! 41: * notice, this list of conditions and the following disclaimer. ! 42: * 2. Redistributions in binary form must reproduce the above copyright ! 43: * notice, this list of conditions and the following disclaimer in the ! 44: * documentation and/or other materials provided with the distribution. ! 45: * 3. All advertising materials mentioning features or use of this software ! 46: * must display the following acknowledgement: ! 47: * This product includes software developed by the University of ! 48: * California, Berkeley and its contributors. ! 49: * 4. Neither the name of the University nor the names of its contributors ! 50: * may be used to endorse or promote products derived from this software ! 51: * without specific prior written permission. ! 52: * ! 53: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ! 54: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ! 55: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ! 56: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE ! 57: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ! 58: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS ! 59: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ! 60: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT ! 61: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY ! 62: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ! 63: * SUCH DAMAGE. ! 64: * ! 65: * @(#)nlist.h 8.2 (Berkeley) 1/21/94 ! 66: */ ! 67: ! 68: /* ! 69: * Format of a symbol table entry of a Mach-O file. Modified from the BSD ! 70: * format. The modifications from the original format were changing n_other ! 71: * (an unused field) to n_sect and the addition of the N_SECT type. These ! 72: * modifications are required to support symbols in an arbitrary number of ! 73: * sections not just the three sections (text, data and bss) in a BSD file. ! 74: */ ! 75: struct nlist { ! 76: union { ! 77: char *n_name; /* for use when in-core */ ! 78: long n_strx; /* index into the string table */ ! 79: } n_un; ! 80: unsigned char n_type; /* type flag, see below */ ! 81: unsigned char n_sect; /* section number or NO_SECT */ ! 82: short n_desc; /* see <mach-o/stab.h> */ ! 83: unsigned long n_value; /* value of this symbol (or stab offset) */ ! 84: }; ! 85: ! 86: /* ! 87: * Symbols with a index into the string table of zero (n_un.n_strx == 0) are ! 88: * defined to have a null, "", name. Therefore all string indexes to non null ! 89: * names must not have a zero string index. This is bit historical information ! 90: * that has never been well documented. ! 91: */ ! 92: ! 93: /* ! 94: * The n_type field really contains three fields: ! 95: * unsigned char N_STAB:3, ! 96: * N_PEXT:1, ! 97: * N_TYPE:3, ! 98: * N_EXT:1; ! 99: * which are used via the following masks. ! 100: */ ! 101: #define N_STAB 0xe0 /* if any of these bits set, a symbolic debugging entry */ ! 102: #define N_PEXT 0x10 /* private external symbol bit */ ! 103: #define N_TYPE 0x0e /* mask for the type bits */ ! 104: #define N_EXT 0x01 /* external symbol bit, set for external symbols */ ! 105: ! 106: /* ! 107: * Only symbolic debugging entries have some of the N_STAB bits set and if any ! 108: * of these bits are set then it is a symbolic debugging entry (a stab). In ! 109: * which case then the values of the n_type field (the entire field) are given ! 110: * in <mach-o/stab.h> ! 111: */ ! 112: ! 113: /* ! 114: * Values for N_TYPE bits of the n_type field. ! 115: */ ! 116: #define N_UNDF 0x0 /* undefined, n_sect == NO_SECT */ ! 117: #define N_ABS 0x2 /* absolute, n_sect == NO_SECT */ ! 118: #define N_SECT 0xe /* defined in section number n_sect */ ! 119: #define N_PBUD 0xc /* prebound undefined (defined in a dylib) */ ! 120: #define N_INDR 0xa /* indirect */ ! 121: ! 122: /* ! 123: * If the type is N_INDR then the symbol is defined to be the same as another ! 124: * symbol. In this case the n_value field is an index into the string table ! 125: * of the other symbol's name. When the other symbol is defined then they both ! 126: * take on the defined type and value. ! 127: */ ! 128: ! 129: /* ! 130: * If the type is N_SECT then the n_sect field contains an ordinal of the ! 131: * section the symbol is defined in. The sections are numbered from 1 and ! 132: * refer to sections in order they appear in the load commands for the file ! 133: * they are in. This means the same ordinal may very well refer to different ! 134: * sections in different files. ! 135: * ! 136: * The n_value field for all symbol table entries (including N_STAB's) gets ! 137: * updated by the link editor based on the value of it's n_sect field and where ! 138: * the section n_sect references gets relocated. If the value of the n_sect ! 139: * field is NO_SECT then it's n_value field is not changed by the link editor. ! 140: */ ! 141: #define NO_SECT 0 /* symbol is not in any section */ ! 142: #define MAX_SECT 255 /* 1 thru 255 inclusive */ ! 143: ! 144: /* ! 145: * Common symbols are represented by undefined (N_UNDF) external (N_EXT) types ! 146: * who's values (n_value) are non-zero. In which case the value of the n_value ! 147: * field is the size (in bytes) of the common symbol. The n_sect field is set ! 148: * to NO_SECT. ! 149: */ ! 150: ! 151: /* ! 152: * To support the lazy binding of undefined symbols in the dynamic link-editor, ! 153: * the undefined symbols in the symbol table (the nlist structures) are marked ! 154: * with the indication if the undefined reference is a lazy reference or ! 155: * non-lazy reference. If both a non-lazy reference and a lazy reference is ! 156: * made to the same symbol the non-lazy reference takes precedence. A reference ! 157: * is lazy only when all references to that symbol are made through a symbol ! 158: * pointer in a lazy symbol pointer section. ! 159: * ! 160: * The implementation of marking nlist structures in the symbol table for ! 161: * undefined symbols will be to use some of the bits of the n_desc field as a ! 162: * reference type. The mask REFERENCE_TYPE will be applied to the n_desc field ! 163: * of an nlist structure for an undefined symbol to determine the type of ! 164: * undefined reference (lazy or non-lazy). ! 165: * ! 166: * The constants for the REFERENCE FLAGS are propagated to the reference table ! 167: * in a shared library file. In that case the constant for a defined symbol, ! 168: * REFERENCE_FLAG_DEFINED, is also used. ! 169: */ ! 170: /* Reference type bits of the n_desc field of undefined symbols */ ! 171: #define REFERENCE_TYPE 0xf ! 172: /* types of references */ ! 173: #define REFERENCE_FLAG_UNDEFINED_NON_LAZY 0 ! 174: #define REFERENCE_FLAG_UNDEFINED_LAZY 1 ! 175: #define REFERENCE_FLAG_DEFINED 2 ! 176: #define REFERENCE_FLAG_PRIVATE_DEFINED 3 ! 177: #define REFERENCE_FLAG_PRIVATE_UNDEFINED_NON_LAZY 4 ! 178: #define REFERENCE_FLAG_PRIVATE_UNDEFINED_LAZY 5 ! 179: ! 180: /* ! 181: * To simplify stripping of objects that use are used with the dynamic link ! 182: * editor, the static link editor marks the symbols defined an object that are ! 183: * referenced by a dynamicly bound object (dynamic shared libraries, bundles). ! 184: * With this marking strip knows not to strip these symbols. ! 185: */ ! 186: #define REFERENCED_DYNAMICALLY 0x0010 ! 187: ! 188: /* ! 189: * The non-reference type bits of the n_desc field for global symbols are ! 190: * reserved for the dynamic link editor. All of these bits must start out ! 191: * zero in the object file. ! 192: */ ! 193: #define N_DESC_DISCARDED 0x8000 /* symbol is discarded */ ! 194: ! 195: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.