home *** CD-ROM | disk | FTP | other *** search
/ H4CK3R 4 / hacker04 / 04_HACK04.ISO / darwin / darwinx86.iso / usr / include / mach-o / ldsyms.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-09-14  |  5.2 KB  |  111 lines

  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.  
  25. #ifndef _MACHO_LDSYMS_H_
  26. #define _MACHO_LDSYMS_H_
  27.  
  28. #import <mach-o/loader.h>
  29.  
  30. /*
  31.  * This file describes the link editor defined symbols.  The semantics of a
  32.  * link editor symbol is that it is defined by the link editor only if it is
  33.  * referenced and it is an error for the user to define them (see the man page
  34.  * ld(1)).  The standard UNIX link editor symbols: __end, __etext and __edata
  35.  * are not not supported by the Apple Mach-O link editor.  These symbols are
  36.  * really not meaningful in a Mach-O object file and the link editor symbols
  37.  * that are supported (described here) replace them.  In the case of the
  38.  * standard UNIX link editor symbols the program can use the symbol
  39.  * __mh_execute_header and walk the load commands of it's program to determine
  40.  * the ending (or beginning) of any section or segment in the program.  Note
  41.  * that the compiler prepends an underbar to all external symbol names coded
  42.  * in a high level language.  Thus in 'C' names are coded without an underbar
  43.  * and symbol names in the symbol table have an underbar.  There are two cpp
  44.  * macros for each link editor defined name in this file.  The macro with a
  45.  * leading underbar is the symbol name and the one without is the name as
  46.  * coded in 'C'.
  47.  */
  48.  
  49. /*
  50.  * The value of the link editor defined symbol _MH_EXECUTE_SYM is the address
  51.  * of the mach header in a Mach-O executable file type.  It does not appear in
  52.  * any file type other than a MH_EXECUTE file type.  The type of the symbol is
  53.  * absolute as the header is not part of any section.
  54.  */
  55. #define _MH_EXECUTE_SYM    "__mh_execute_header"
  56. #define MH_EXECUTE_SYM    "_mh_execute_header"
  57. extern const struct mach_header _mh_execute_header;
  58.  
  59. /*
  60.  * The value of the link editor defined symbol _MH_BUNDLE_SYM is the address
  61.  * of the mach header in a Mach-O bundle file type.  It does not appear in
  62.  * any file type other than a MH_BUNDLE file type.  The type of the symbol is
  63.  * an N_SECT symbol even thought the header is not part of any section.  This
  64.  * symbol is private to the code in the bundle it is a part of.
  65.  */
  66. #define _MH_BUNDLE_SYM    "__mh_bundle_header"
  67. #define MH_BUNDLE_SYM    "_mh_bundle_header"
  68. extern const struct mach_header _mh_bundle_header;
  69.  
  70. /*
  71.  * The value of the link editor defined symbol _MH_DYLIB_SYM is the address
  72.  * of the mach header in a Mach-O dylib file type.  It does not appear in
  73.  * any file type other than a MH_DYLIB file type.  The type of the symbol is
  74.  * an N_SECT symbol even thought the header is not part of any section.  This
  75.  * symbol is private to the code in the library it is a part of.
  76.  */
  77. #define _MH_DYLIB_SYM    "__mh_dylib_header"
  78. #define MH_DYLIB_SYM    "_mh_dylib_header"
  79. extern const struct mach_header _mh_dylib_header;
  80.  
  81. /*
  82.  * The value of the link editor defined symbol _MH_DYLINKER_SYM is the address
  83.  * of the mach header in a Mach-O dylinker file type.  It does not appear in
  84.  * any file type other than a MH_DYLINKER file type.  The type of the symbol is
  85.  * an N_SECT symbol even thought the header is not part of any section.  This
  86.  * symbol is private to the code in the dynamic linker it is a part of.
  87.  */
  88. #define _MH_DYLINKER_SYM    "__mh_dylinker_header"
  89. #define MH_DYLINKER_SYM        "_mh_dylinker_header"
  90. extern const struct mach_header _mh_dylinker_header;
  91.  
  92. /*
  93.  * For the MH_PRELOAD file type the headers are not loaded as part of any
  94.  * segment so the link editor defines symbols defined for the beginning
  95.  * and ending of each segment and each section in each segment.  The names for
  96.  * the symbols for a segment's beginning and end will have the form:
  97.  * __SEGNAME__begin and  __SEGNAME__end where __SEGNAME is the name of the
  98.  * segment.  The names for the symbols for a section's beginning and end will
  99.  * have the form: __SEGNAME__sectname__begin and __SEGNAME__sectname__end
  100.  * where __sectname is the name of the section and __SEGNAME is the segment it
  101.  * is in.
  102.  * 
  103.  * The above symbols' types are those of the section they are referring to.
  104.  * This is true even for symbols who's values are end's of a section and
  105.  * that value is next address after that section and not really in that
  106.  * section.  This results in these symbols having types referring to sections
  107.  * who's values are not in that section.
  108.  */
  109.  
  110. #endif /* _MACHO_LDSYMS_H_ */
  111.