| 1 | /* |
| 2 | * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. |
| 3 | * |
| 4 | * @APPLE_LICENSE_HEADER_START@ |
| 5 | * |
| 6 | * This file contains Original Code and/or Modifications of Original Code |
| 7 | * as defined in and that are subject to the Apple Public Source License |
| 8 | * Version 2.0 (the 'License'). You may not use this file except in |
| 9 | * compliance with the License. Please obtain a copy of the License at |
| 10 | * http://www.opensource.apple.com/apsl/ and read it before using this |
| 11 | * file. |
| 12 | * |
| 13 | * The Original Code and all software distributed under the License are |
| 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER |
| 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
| 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, |
| 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
| 18 | * Please see the License for the specific language governing rights and |
| 19 | * limitations under the License. |
| 20 | * |
| 21 | * @APPLE_LICENSE_HEADER_END@ |
| 22 | */ |
| 23 | #ifndef _MACH_O_SWAP_H_ |
| 24 | #define _MACH_O_SWAP_H_ |
| 25 | |
| 26 | #include <stdint.h> |
| 27 | #include <architecture/byte_order.h> |
| 28 | #include <mach-o/fat.h> |
| 29 | #include <mach-o/loader.h> |
| 30 | #include <mach-o/nlist.h> |
| 31 | #include <mach-o/reloc.h> |
| 32 | #include <mach-o/ranlib.h> |
| 33 | #include <Availability.h> |
| 34 | #include <TargetConditionals.h> |
| 35 | |
| 36 | #ifndef __CCTOOLS_DEPRECATED |
| 37 | #define __CCTOOLS_DEPRECATED __API_DEPRECATED("No longer supported", macos(10.0, 13.0), ios(1.0, 16.0), watchos(1.0, 8.0), tvos(1.0, 16.0)) |
| 38 | #define __CCTOOLS_DEPRECATED_MSG(_msg) __API_DEPRECATED_WITH_REPLACEMENT(_msg, macos(10.0, 13.0), ios(1.0, 16.0), watchos(1.0, 8.0), tvos(1.0, 16.0)) |
| 39 | #endif |
| 40 | |
| 41 | #ifdef __cplusplus |
| 42 | extern "C" { |
| 43 | #endif /* __cplusplus */ |
| 44 | |
| 45 | extern void swap_fat_header( |
| 46 | struct fat_header *fat_header, |
| 47 | enum NXByteOrder target_byte_order) __CCTOOLS_DEPRECATED_MSG("use macho_for_each_slice()"); |
| 48 | |
| 49 | extern void swap_fat_arch( |
| 50 | struct fat_arch *fat_archs, |
| 51 | uint32_t nfat_arch, |
| 52 | enum NXByteOrder target_byte_order) __CCTOOLS_DEPRECATED_MSG("use macho_for_each_slice()"); |
| 53 | |
| 54 | extern void swap_fat_arch_64( |
| 55 | struct fat_arch_64 *fat_archs64, |
| 56 | uint32_t nfat_arch, |
| 57 | enum NXByteOrder target_byte_order) __CCTOOLS_DEPRECATED_MSG("use macho_for_each_slice()"); |
| 58 | |
| 59 | extern void swap_mach_header( |
| 60 | struct mach_header *mh, |
| 61 | enum NXByteOrder target_byte_order) __CCTOOLS_DEPRECATED; |
| 62 | |
| 63 | extern void swap_mach_header_64( |
| 64 | struct mach_header_64 *mh, |
| 65 | enum NXByteOrder target_byte_order) __CCTOOLS_DEPRECATED; |
| 66 | |
| 67 | extern void swap_load_command( |
| 68 | struct load_command *lc, |
| 69 | enum NXByteOrder target_byte_order) __CCTOOLS_DEPRECATED; |
| 70 | |
| 71 | extern void swap_segment_command( |
| 72 | struct segment_command *sg, |
| 73 | enum NXByteOrder target_byte_order) __CCTOOLS_DEPRECATED; |
| 74 | |
| 75 | extern void swap_segment_command_64( |
| 76 | struct segment_command_64 *sg, |
| 77 | enum NXByteOrder target_byte_order) __CCTOOLS_DEPRECATED; |
| 78 | |
| 79 | extern void swap_section( |
| 80 | struct section *s, |
| 81 | uint32_t nsects, |
| 82 | enum NXByteOrder target_byte_order) __CCTOOLS_DEPRECATED; |
| 83 | |
| 84 | extern void swap_section_64( |
| 85 | struct section_64 *s, |
| 86 | uint32_t nsects, |
| 87 | enum NXByteOrder target_byte_order) __CCTOOLS_DEPRECATED; |
| 88 | |
| 89 | extern void swap_symtab_command( |
| 90 | struct symtab_command *st, |
| 91 | enum NXByteOrder target_byte_order) __CCTOOLS_DEPRECATED; |
| 92 | |
| 93 | extern void swap_dysymtab_command( |
| 94 | struct dysymtab_command *dyst, |
| 95 | enum NXByteOrder target_byte_sex) __CCTOOLS_DEPRECATED; |
| 96 | |
| 97 | extern void swap_symseg_command( |
| 98 | struct symseg_command *ss, |
| 99 | enum NXByteOrder target_byte_order) __CCTOOLS_DEPRECATED; |
| 100 | |
| 101 | extern void swap_fvmlib_command( |
| 102 | struct fvmlib_command *fl, |
| 103 | enum NXByteOrder target_byte_order) __CCTOOLS_DEPRECATED; |
| 104 | |
| 105 | extern void swap_dylib_command( |
| 106 | struct dylib_command *dl, |
| 107 | enum NXByteOrder target_byte_sex) __CCTOOLS_DEPRECATED; |
| 108 | |
| 109 | extern void swap_sub_framework_command( |
| 110 | struct sub_framework_command *sub, |
| 111 | enum NXByteOrder target_byte_sex) __CCTOOLS_DEPRECATED; |
| 112 | |
| 113 | extern void swap_sub_umbrella_command( |
| 114 | struct sub_umbrella_command *usub, |
| 115 | enum NXByteOrder target_byte_sex) __CCTOOLS_DEPRECATED; |
| 116 | |
| 117 | extern void swap_sub_library_command( |
| 118 | struct sub_library_command *lsub, |
| 119 | enum NXByteOrder target_byte_sex) __CCTOOLS_DEPRECATED; |
| 120 | |
| 121 | extern void swap_sub_client_command( |
| 122 | struct sub_client_command *csub, |
| 123 | enum NXByteOrder target_byte_sex) __CCTOOLS_DEPRECATED; |
| 124 | |
| 125 | extern void swap_prebound_dylib_command( |
| 126 | struct prebound_dylib_command *pbdylib, |
| 127 | enum NXByteOrder target_byte_sex) __CCTOOLS_DEPRECATED; |
| 128 | |
| 129 | extern void swap_dylinker_command( |
| 130 | struct dylinker_command *dyld, |
| 131 | enum NXByteOrder target_byte_sex) __CCTOOLS_DEPRECATED; |
| 132 | |
| 133 | extern void swap_fvmfile_command( |
| 134 | struct fvmfile_command *ff, |
| 135 | enum NXByteOrder target_byte_order) __CCTOOLS_DEPRECATED; |
| 136 | |
| 137 | extern void swap_thread_command( |
| 138 | struct thread_command *ut, |
| 139 | enum NXByteOrder target_byte_order) __CCTOOLS_DEPRECATED; |
| 140 | |
| 141 | extern void swap_ident_command( |
| 142 | struct ident_command *ident, |
| 143 | enum NXByteOrder target_byte_order) __CCTOOLS_DEPRECATED; |
| 144 | |
| 145 | extern void swap_routines_command( |
| 146 | struct routines_command *r_cmd, |
| 147 | enum NXByteOrder target_byte_sex) __CCTOOLS_DEPRECATED; |
| 148 | |
| 149 | extern void swap_routines_command_64( |
| 150 | struct routines_command_64 *r_cmd, |
| 151 | enum NXByteOrder target_byte_sex) __CCTOOLS_DEPRECATED; |
| 152 | |
| 153 | extern void swap_twolevel_hints_command( |
| 154 | struct twolevel_hints_command *hints_cmd, |
| 155 | enum NXByteOrder target_byte_sex) __CCTOOLS_DEPRECATED; |
| 156 | |
| 157 | extern void swap_prebind_cksum_command( |
| 158 | struct prebind_cksum_command *cksum_cmd, |
| 159 | enum NXByteOrder target_byte_sex) __CCTOOLS_DEPRECATED; |
| 160 | |
| 161 | extern void swap_uuid_command( |
| 162 | struct uuid_command *uuid_cmd, |
| 163 | enum NXByteOrder target_byte_sex) __CCTOOLS_DEPRECATED; |
| 164 | |
| 165 | extern void swap_linkedit_data_command( |
| 166 | struct linkedit_data_command *ld, |
| 167 | enum NXByteOrder target_byte_sex) __CCTOOLS_DEPRECATED; |
| 168 | |
| 169 | extern void swap_version_min_command( |
| 170 | struct version_min_command *ver_cmd, |
| 171 | enum NXByteOrder target_byte_sex) __CCTOOLS_DEPRECATED; |
| 172 | extern void swap_rpath_command( |
| 173 | struct rpath_command *rpath_cmd, |
| 174 | enum NXByteOrder target_byte_sex) __CCTOOLS_DEPRECATED; |
| 175 | |
| 176 | extern void swap_encryption_command( |
| 177 | struct encryption_info_command *ec, |
| 178 | enum NXByteOrder target_byte_sex) __CCTOOLS_DEPRECATED; |
| 179 | |
| 180 | extern void swap_encryption_command_64( |
| 181 | struct encryption_info_command_64 *ec, |
| 182 | enum NXByteOrder target_byte_sex) __CCTOOLS_DEPRECATED; |
| 183 | |
| 184 | extern void swap_linker_option_command( |
| 185 | struct linker_option_command *lo, |
| 186 | enum NXByteOrder target_byte_sex) __CCTOOLS_DEPRECATED; |
| 187 | |
| 188 | extern void swap_dyld_info_command( |
| 189 | struct dyld_info_command *ed, |
| 190 | enum NXByteOrder target_byte_sex) __CCTOOLS_DEPRECATED; |
| 191 | |
| 192 | extern void swap_entry_point_command( |
| 193 | struct entry_point_command *ep, |
| 194 | enum NXByteOrder target_byte_sex) __CCTOOLS_DEPRECATED; |
| 195 | |
| 196 | extern void swap_source_version_command( |
| 197 | struct source_version_command *sv, |
| 198 | enum NXByteOrder target_byte_sex) __CCTOOLS_DEPRECATED; |
| 199 | |
| 200 | extern void swap_note_command( |
| 201 | struct note_command *nc, |
| 202 | enum NXByteOrder target_byte_sex) __CCTOOLS_DEPRECATED; |
| 203 | |
| 204 | extern void swap_build_version_command( |
| 205 | struct build_version_command *bv, |
| 206 | enum NXByteOrder target_byte_sex) __CCTOOLS_DEPRECATED; |
| 207 | |
| 208 | extern void swap_build_tool_version( |
| 209 | struct build_tool_version *bt, |
| 210 | uint32_t ntools, |
| 211 | enum NXByteOrder target_byte_sex) __CCTOOLS_DEPRECATED; |
| 212 | |
| 213 | extern void swap_prebind_cksum_command( |
| 214 | struct prebind_cksum_command *cksum_cmd, |
| 215 | enum NXByteOrder target_byte_sex) __CCTOOLS_DEPRECATED; |
| 216 | |
| 217 | extern void swap_uuid_command( |
| 218 | struct uuid_command *uuid_cmd, |
| 219 | enum NXByteOrder target_byte_sex) __CCTOOLS_DEPRECATED; |
| 220 | |
| 221 | extern void swap_twolevel_hint( |
| 222 | struct twolevel_hint *hints, |
| 223 | uint32_t nhints, |
| 224 | enum NXByteOrder target_byte_sex) __CCTOOLS_DEPRECATED; |
| 225 | |
| 226 | extern void swap_fileset_entry_command( |
| 227 | struct fileset_entry_command *lc, |
| 228 | enum NXByteOrder target_byte_sex) __CCTOOLS_DEPRECATED; |
| 229 | |
| 230 | extern void swap_nlist( |
| 231 | struct nlist *symbols, |
| 232 | uint32_t nsymbols, |
| 233 | enum NXByteOrder target_byte_order) __CCTOOLS_DEPRECATED; |
| 234 | |
| 235 | extern void swap_nlist_64( |
| 236 | struct nlist_64 *symbols, |
| 237 | uint32_t nsymbols, |
| 238 | enum NXByteOrder target_byte_order) __CCTOOLS_DEPRECATED; |
| 239 | |
| 240 | extern void swap_ranlib( |
| 241 | struct ranlib *ranlibs, |
| 242 | uint32_t nranlibs, |
| 243 | enum NXByteOrder target_byte_order) __CCTOOLS_DEPRECATED; |
| 244 | |
| 245 | extern void swap_ranlib_64( |
| 246 | struct ranlib_64 *ranlibs, |
| 247 | uint64_t nranlibs, |
| 248 | enum NXByteOrder target_byte_order) __CCTOOLS_DEPRECATED; |
| 249 | |
| 250 | extern void swap_relocation_info( |
| 251 | struct relocation_info *relocs, |
| 252 | uint32_t nrelocs, |
| 253 | enum NXByteOrder target_byte_order) __CCTOOLS_DEPRECATED; |
| 254 | |
| 255 | extern void swap_indirect_symbols( |
| 256 | uint32_t *indirect_symbols, |
| 257 | uint32_t nindirect_symbols, |
| 258 | enum NXByteOrder target_byte_sex) __CCTOOLS_DEPRECATED; |
| 259 | |
| 260 | extern void swap_dylib_reference( |
| 261 | struct dylib_reference *refs, |
| 262 | uint32_t nrefs, |
| 263 | enum NXByteOrder target_byte_sex) __CCTOOLS_DEPRECATED; |
| 264 | |
| 265 | extern void swap_dylib_module( |
| 266 | struct dylib_module *mods, |
| 267 | uint32_t nmods, |
| 268 | enum NXByteOrder target_byte_sex) __CCTOOLS_DEPRECATED; |
| 269 | |
| 270 | extern void swap_dylib_module_64( |
| 271 | struct dylib_module_64 *mods, |
| 272 | uint32_t nmods, |
| 273 | enum NXByteOrder target_byte_sex) __CCTOOLS_DEPRECATED; |
| 274 | |
| 275 | extern void swap_dylib_table_of_contents( |
| 276 | struct dylib_table_of_contents *tocs, |
| 277 | uint32_t ntocs, |
| 278 | enum NXByteOrder target_byte_sex) __CCTOOLS_DEPRECATED; |
| 279 | |
| 280 | #ifdef __cplusplus |
| 281 | } |
| 282 | #endif /* __cplusplus */ |
| 283 | |
| 284 | #endif /* _MACH_O_SWAP_H_ */ |