|
|
1.1 ! root 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 dysymtab_command *dyst; /* the dynamic symbol table command */ ! 80: struct segment_command ! 81: *seg_linkedit; /* the link edit segment command */ ! 82: ! 83: unsigned long input_sym_info_size; ! 84: unsigned long output_sym_info_size; ! 85: ! 86: struct nlist *output_symbols; ! 87: unsigned long output_nsymbols; ! 88: char *output_strings; ! 89: unsigned long output_strings_size; ! 90: ! 91: unsigned long output_ilocalsym; ! 92: unsigned long output_nlocalsym; ! 93: unsigned long output_iextdefsym; ! 94: unsigned long output_nextdefsym; ! 95: unsigned long output_iundefsym; ! 96: unsigned long output_nundefsym; ! 97: ! 98: struct relocation_info *output_loc_relocs; ! 99: struct relocation_info *output_ext_relocs; ! 100: unsigned long *output_indirect_symtab; ! 101: ! 102: struct dylib_table_of_contents *output_tocs; ! 103: unsigned long output_ntoc; ! 104: struct dylib_module *output_mods; ! 105: unsigned long output_nmodtab; ! 106: struct dylib_reference *output_refs; ! 107: unsigned long output_nextrefsyms; ! 108: }; ! 109: ! 110: extern void breakout( ! 111: char *filename, ! 112: struct arch **archs, ! 113: unsigned long *narchs); ! 114: ! 115: extern void free_archs( ! 116: struct arch *archs, ! 117: unsigned long narchs); ! 118: ! 119: extern void writeout( ! 120: struct arch *archs, ! 121: unsigned long narchs, ! 122: char *output, ! 123: unsigned short mode, ! 124: enum bool sort_toc, ! 125: enum bool commons_in_toc, ! 126: enum bool library_warnings); ! 127: ! 128: void checkout( ! 129: struct arch *archs, ! 130: unsigned long narchs); ! 131: ! 132: void warning_arch( ! 133: struct arch *arch, ! 134: struct member *member, ! 135: char *format, ...) __attribute__ ((format (printf, 3, 4))); ! 136: ! 137: void error_arch( ! 138: struct arch *arch, ! 139: struct member *member, ! 140: char *format, ...) __attribute__ ((format (printf, 3, 4))); ! 141: ! 142: void fatal_arch( ! 143: struct arch *arch, ! 144: struct member *member, ! 145: char *format, ...) __attribute__ ((format (printf, 3, 4)));
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.