home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.2 (Developer) / NS_dev_3.2.iso / NextDeveloper / Source / GNU / cctools / include / stuff / breakout.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-05-07  |  4.5 KB  |  126 lines

  1. #import "stuff/ofile.h"
  2.  
  3. /*
  4.  * The input files are broken out in to their object files and then placed in
  5.  * these structures.  These structures are then used to edit the object files'
  6.  * symbol table.  And then finally used to reassemble the object file for
  7.  * output.
  8.  */
  9. struct arch {
  10.     char *file_name;        /* name of file this arch came from */
  11.     enum ofile_type type;    /* The type of file for this architecture */
  12.                 /*  can be OFILE_ARCHIVE, OFILE_Mach_O or */
  13.                     /*  OFILE_UNKNOWN. */
  14.     struct fat_arch *fat_arch;    /* If this came from fat file this is valid */
  15.                     /*  and not NULL (needed for the align value */
  16.                 /*  and to output a fat file if only one arch)*/
  17.     char *fat_arch_name;    /* If this came from fat file this is valid */
  18.                 /*  and is tthe name of this architecture */
  19.                 /*  (used for error messages). */
  20.  
  21.     /* if this is an archive: the members of this archive */
  22.     struct member *members;    /* the members of the library for this arch */
  23.     unsigned long nmembers;    /* the number of the above members */
  24.     /*
  25.      * The output table of contents (toc) for this arch in the library (this
  26.      * must be recreated, or at least the time of the toc member set, when
  27.      * the output is modified because modifiy time is shared by all libraries
  28.      * in the file).
  29.      */
  30.     unsigned long  toc_size;    /* total size of the toc including ar_hdr */
  31.     struct ar_hdr  toc_ar_hdr;    /* the archive header for this member */
  32.     struct ranlib *toc_ranlibs;    /* ranlib structs */
  33.     unsigned long  toc_nranlibs;/* number of ranlib structs */
  34.     char      *toc_strings;    /* strings of symbol names for ranlib structs */
  35.     unsigned long  toc_strsize;    /* number of bytes for the strings above */
  36.     unsigned long library_size;    /* current working size and final output size */
  37.                 /*  for this arch when it's a library (used */
  38.                 /*  for creating the toc entries). */
  39.  
  40.     /* if this is an object file: the object file */
  41.     struct object *object;    /* the object file */
  42.  
  43.     /* if this is an unknown file: the addr and size of the file */
  44.     char *unknown_addr;
  45.     unsigned long unknown_size;
  46. };
  47.  
  48. struct member {
  49.     enum ofile_type type;    /* the type of this member can be OFILE_Mach_O*/
  50.                 /*  or OFILE_UNKNOWN */
  51.     struct ar_hdr *ar_hdr;    /* the archive header for this member */
  52.     unsigned long offset;    /* current working offset and final offset */
  53.                 /*  use in creating the table of contents */
  54.  
  55.     /* if this member is an object file: the object file */
  56.     struct object *object;    /* the object file */
  57.  
  58.     /* if this member is an unknown file: the addr and size of the member */
  59.     char *unknown_addr;
  60.     unsigned long unknown_size;
  61.  
  62.     /*
  63.      * If this member was created from a file then input_file_name is set else
  64.      * it is NULL and input_ar_hdr is set (these are recorded to allow
  65.      * warn_member() messages to be printed)
  66.      */
  67.     char *input_file_name;
  68.     struct ar_hdr *input_ar_hdr;
  69. };
  70.  
  71. struct object {
  72.     char *object_addr;            /* the address of the object file */
  73.     unsigned long object_size;        /* the size of the object file on input */
  74.     enum byte_sex object_byte_sex;  /* the byte sex of the object file */
  75.     struct mach_header *mh;        /* the mach_header of the object file */
  76.     struct load_command            /* the start of the load commands */
  77.     *load_commands;
  78.     struct symtab_command *st;        /* the symbol table command */
  79.     struct segment_command
  80.     *seg_linkedit;                /* the link edit segment command */
  81.  
  82.     unsigned long input_sym_info_size;
  83.     unsigned long output_sym_info_size;
  84.     struct nlist *output_symbols;
  85.     unsigned long output_nsymbols;
  86.     char     *output_strings;
  87.     unsigned long output_strings_size;
  88. };
  89.  
  90. extern void breakout(
  91.     char *filename,
  92.     struct arch **archs,
  93.     unsigned long *narchs);
  94.  
  95. extern void free_archs(
  96.     struct arch *archs,
  97.     unsigned long narchs);
  98.  
  99. extern void writeout(
  100.     struct arch *archs,
  101.     unsigned long narchs,
  102.     char *output,
  103.     unsigned short mode,
  104.     enum bool sort_toc,
  105.     enum bool commons_in_toc,
  106.     enum bool library_warnings);
  107.  
  108. void checkout(
  109.     struct arch *archs,
  110.     unsigned long narchs);
  111.  
  112. void warning_arch(
  113.     struct arch *arch,
  114.     struct member *member,
  115.     char *format, ...) __attribute__ ((format (printf, 3, 4)));
  116.  
  117. void error_arch(
  118.     struct arch *arch,
  119.     struct member *member,
  120.     char *format, ...) __attribute__ ((format (printf, 3, 4)));
  121.  
  122. void fatal_arch(
  123.     struct arch *arch,
  124.     struct member *member,
  125.     char *format, ...) __attribute__ ((format (printf, 3, 4)));
  126.