aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-devtools/odcctools/files/cctools-287-1.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-devtools/odcctools/files/cctools-287-1.patch')
-rw-r--r--recipes-devtools/odcctools/files/cctools-287-1.patch3208
1 files changed, 3208 insertions, 0 deletions
diff --git a/recipes-devtools/odcctools/files/cctools-287-1.patch b/recipes-devtools/odcctools/files/cctools-287-1.patch
new file mode 100644
index 0000000..6ababd5
--- /dev/null
+++ b/recipes-devtools/odcctools/files/cctools-287-1.patch
@@ -0,0 +1,3208 @@
+Index: odcctools-9.2-ld/libmacho/arch.c
+===================================================================
+--- odcctools-9.2-ld.orig/libmacho/arch.c 2013-08-15 11:27:10.000000000 +0000
++++ odcctools-9.2-ld/libmacho/arch.c 2013-09-03 13:41:28.785830066 +0000
+@@ -73,6 +73,8 @@
+ "PowerPC 64-bit"},
+ {"sparc", CPU_TYPE_SPARC, CPU_SUBTYPE_SPARC_ALL, NX_BigEndian,
+ "SPARC"},
++ {"arm", CPU_TYPE_ARM, CPU_SUBTYPE_ARM_ALL, NX_LittleEndian,
++ "ARM"},
+ {"any", CPU_TYPE_ANY, CPU_SUBTYPE_MULTIPLE, NX_UnknownByteOrder,
+ "Architecture Independent"},
+ {"veo", CPU_TYPE_VEO, CPU_SUBTYPE_VEO_ALL, NX_BigEndian,
+@@ -124,6 +126,22 @@
+ "PowerPC 970" },
+ {"ppc970-64", CPU_TYPE_POWERPC64, CPU_SUBTYPE_POWERPC_970, NX_BigEndian,
+ "PowerPC 970 64-bit"},
++ {"armv4t", CPU_TYPE_ARM, CPU_SUBTYPE_ARM_V4T, NX_LittleEndian,
++ "arm v4t"},
++ {"armv5", CPU_TYPE_ARM, CPU_SUBTYPE_ARM_V5TEJ, NX_LittleEndian,
++ "arm v5"},
++ {"xscale", CPU_TYPE_ARM, CPU_SUBTYPE_ARM_XSCALE, NX_LittleEndian,
++ "arm xscale"},
++ {"armv6", CPU_TYPE_ARM, CPU_SUBTYPE_ARM_V6, NX_LittleEndian,
++ "arm v6"},
++ {"armv7", CPU_TYPE_ARM, CPU_SUBTYPE_ARM_V7, NX_LittleEndian,
++ "arm v7"},
++ {"armv7f", CPU_TYPE_ARM, CPU_SUBTYPE_ARM_V7F, NX_LittleEndian,
++ "arm v7f"},
++ {"armv7s", CPU_TYPE_ARM, CPU_SUBTYPE_ARM_V7S, NX_LittleEndian,
++ "arm v7s"},
++ {"armv7k", CPU_TYPE_ARM, CPU_SUBTYPE_ARM_V7K, NX_LittleEndian,
++ "arm v7k"},
+ {"little", CPU_TYPE_ANY, CPU_SUBTYPE_LITTLE_ENDIAN, NX_LittleEndian,
+ "Little Endian"},
+ {"big", CPU_TYPE_ANY, CPU_SUBTYPE_BIG_ENDIAN, NX_BigEndian,
+@@ -218,7 +236,8 @@
+ for(ai = ArchInfoTable; ai->name != NULL; ai++)
+ if(ai->cputype == cputype &&
+ (cpusubtype == CPU_SUBTYPE_MULTIPLE ||
+- (ai->cpusubtype == cpusubtype)))
++ ((ai->cpusubtype & ~CPU_SUBTYPE_MASK) ==
++ (cpusubtype & ~CPU_SUBTYPE_MASK))))
+ return(ai);
+
+ if(cputype == CPU_TYPE_I386){
+@@ -234,8 +253,8 @@
+ if(q->description == NULL)
+ return(NULL);
+ sprintf((char *)q->description, "Intel family %u model %u",
+- CPU_SUBTYPE_INTEL_FAMILY(cpusubtype),
+- CPU_SUBTYPE_INTEL_MODEL(cpusubtype));
++ CPU_SUBTYPE_INTEL_FAMILY(cpusubtype & ~CPU_SUBTYPE_MASK),
++ CPU_SUBTYPE_INTEL_MODEL(cpusubtype & ~CPU_SUBTYPE_MASK));
+ return((const NXArchInfo *)q);
+ }
+ else if(cputype == CPU_TYPE_POWERPC){
+@@ -274,15 +293,16 @@
+ struct fat_arch *fat_archs,
+ uint32_t nfat_archs)
+ {
+- unsigned long i;
+- long lowest_family, lowest_model, lowest_index;
++ uint32_t i;
++ int32_t lowest_family, lowest_model, lowest_index;
+
+ /*
+ * Look for the first exact match.
+ */
+ for(i = 0; i < nfat_archs; i++){
+ if(fat_archs[i].cputype == cputype &&
+- fat_archs[i].cpusubtype == cpusubtype)
++ (fat_archs[i].cpusubtype & ~CPU_SUBTYPE_MASK) ==
++ (cpusubtype & ~CPU_SUBTYPE_MASK))
+ return(fat_archs + i);
+ }
+
+@@ -292,7 +312,7 @@
+ */
+ switch(cputype){
+ case CPU_TYPE_I386:
+- switch(cpusubtype){
++ switch(cpusubtype & ~CPU_SUBTYPE_MASK){
+ default:
+ /*
+ * Intel cpusubtypes after the pentium (same as 586) are handled
+@@ -303,7 +323,8 @@
+ for(i = 0; i < nfat_archs; i++){
+ if(fat_archs[i].cputype != cputype)
+ continue;
+- if(fat_archs[i].cpusubtype == CPU_SUBTYPE_PENT)
++ if((fat_archs[i].cpusubtype & ~CPU_SUBTYPE_MASK) ==
++ CPU_SUBTYPE_PENT)
+ return(fat_archs + i);
+ }
+ case CPU_SUBTYPE_PENT:
+@@ -315,7 +336,8 @@
+ for(i = 0; i < nfat_archs; i++){
+ if(fat_archs[i].cputype != cputype)
+ continue;
+- if(fat_archs[i].cpusubtype == CPU_SUBTYPE_486)
++ if((fat_archs[i].cpusubtype & ~CPU_SUBTYPE_MASK) ==
++ CPU_SUBTYPE_486)
+ return(fat_archs + i);
+ }
+ break;
+@@ -327,7 +349,8 @@
+ for(i = 0; i < nfat_archs; i++){
+ if(fat_archs[i].cputype != cputype)
+ continue;
+- if(fat_archs[i].cpusubtype == CPU_SUBTYPE_I386_ALL)
++ if((fat_archs[i].cpusubtype & ~CPU_SUBTYPE_MASK) ==
++ CPU_SUBTYPE_I386_ALL)
+ return(fat_archs + i);
+ }
+
+@@ -337,19 +360,22 @@
+ for(i = 0; i < nfat_archs; i++){
+ if(fat_archs[i].cputype != cputype)
+ continue;
+- if(fat_archs[i].cpusubtype == CPU_SUBTYPE_486)
++ if((fat_archs[i].cpusubtype & ~CPU_SUBTYPE_MASK) ==
++ CPU_SUBTYPE_486)
+ return(fat_archs + i);
+ }
+ for(i = 0; i < nfat_archs; i++){
+ if(fat_archs[i].cputype != cputype)
+ continue;
+- if(fat_archs[i].cpusubtype == CPU_SUBTYPE_486SX)
++ if((fat_archs[i].cpusubtype & ~CPU_SUBTYPE_MASK) ==
++ CPU_SUBTYPE_486SX)
+ return(fat_archs + i);
+ }
+ for(i = 0; i < nfat_archs; i++){
+ if(fat_archs[i].cputype != cputype)
+ continue;
+- if(fat_archs[i].cpusubtype == CPU_SUBTYPE_586)
++ if((fat_archs[i].cpusubtype & ~CPU_SUBTYPE_MASK) ==
++ CPU_SUBTYPE_586)
+ return(fat_archs + i);
+ }
+ /*
+@@ -359,25 +385,26 @@
+ for(i = 0; i < nfat_archs; i++){
+ if(fat_archs[i].cputype != cputype)
+ continue;
+- if(CPU_SUBTYPE_INTEL_FAMILY(fat_archs[i].cpusubtype) <
+- lowest_family)
++ if(CPU_SUBTYPE_INTEL_FAMILY(fat_archs[i].cpusubtype &
++ ~CPU_SUBTYPE_MASK) < lowest_family)
+ lowest_family = CPU_SUBTYPE_INTEL_FAMILY(
+- fat_archs[i].cpusubtype);
++ fat_archs[i].cpusubtype & ~CPU_SUBTYPE_MASK);
+ }
+ /* if no intel cputypes found return NULL */
+ if(lowest_family == CPU_SUBTYPE_INTEL_FAMILY_MAX + 1)
+ return(NULL);
+- lowest_model = LONG_MAX;
++ lowest_model = INT_MAX;
+ lowest_index = -1;
+ for(i = 0; i < nfat_archs; i++){
+ if(fat_archs[i].cputype != cputype)
+ continue;
+- if(CPU_SUBTYPE_INTEL_FAMILY(fat_archs[i].cpusubtype) ==
+- lowest_family){
+- if(CPU_SUBTYPE_INTEL_MODEL(fat_archs[i].cpusubtype) <
+- lowest_model){
++ if(CPU_SUBTYPE_INTEL_FAMILY(fat_archs[i].cpusubtype &
++ ~CPU_SUBTYPE_MASK) == lowest_family){
++ if(CPU_SUBTYPE_INTEL_MODEL(fat_archs[i].cpusubtype &
++ ~CPU_SUBTYPE_MASK) < lowest_model){
+ lowest_model = CPU_SUBTYPE_INTEL_MODEL(
+- fat_archs[i].cpusubtype);
++ fat_archs[i].cpusubtype &
++ ~CPU_SUBTYPE_MASK);
+ lowest_index = i;
+ }
+ }
+@@ -387,7 +414,8 @@
+ for(i = 0; i < nfat_archs; i++){
+ if(fat_archs[i].cputype != cputype)
+ continue;
+- if(fat_archs[i].cpusubtype == CPU_SUBTYPE_X86_64_ALL)
++ if((fat_archs[i].cpusubtype & ~CPU_SUBTYPE_MASK) ==
++ CPU_SUBTYPE_X86_64_ALL)
+ return(fat_archs + i);
+ }
+ break;
+@@ -395,24 +423,27 @@
+ for(i = 0; i < nfat_archs; i++){
+ if(fat_archs[i].cputype != cputype)
+ continue;
+- if(fat_archs[i].cpusubtype == CPU_SUBTYPE_MC680x0_ALL)
++ if((fat_archs[i].cpusubtype & ~CPU_SUBTYPE_MASK) ==
++ CPU_SUBTYPE_MC680x0_ALL)
+ return(fat_archs + i);
+ }
+ /*
+ * Try to promote if starting from CPU_SUBTYPE_MC680x0_ALL and
+ * favor the CPU_SUBTYPE_MC68040 over the CPU_SUBTYPE_MC68030_ONLY.
+ */
+- if(cpusubtype == CPU_SUBTYPE_MC680x0_ALL){
++ if((cpusubtype & ~CPU_SUBTYPE_MASK) == CPU_SUBTYPE_MC680x0_ALL){
+ for(i = 0; i < nfat_archs; i++){
+ if(fat_archs[i].cputype != cputype)
+ continue;
+- if(fat_archs[i].cpusubtype == CPU_SUBTYPE_MC68040)
++ if((fat_archs[i].cpusubtype & ~CPU_SUBTYPE_MASK) ==
++ CPU_SUBTYPE_MC68040)
+ return(fat_archs + i);
+ }
+ for(i = 0; i < nfat_archs; i++){
+ if(fat_archs[i].cputype != cputype)
+ continue;
+- if(fat_archs[i].cpusubtype == CPU_SUBTYPE_MC68030_ONLY)
++ if((fat_archs[i].cpusubtype & ~CPU_SUBTYPE_MASK) ==
++ CPU_SUBTYPE_MC68030_ONLY)
+ return(fat_archs + i);
+ }
+ }
+@@ -428,7 +459,7 @@
+ * an exact match. For an unknown subtype pick only the ALL type if
+ * it exists.
+ */
+- switch(cpusubtype){
++ switch(cpusubtype & ~CPU_SUBTYPE_MASK){
+ case CPU_SUBTYPE_POWERPC_ALL:
+ /*
+ * The CPU_SUBTYPE_POWERPC_ALL is only used by the development
+@@ -440,7 +471,8 @@
+ for(i = 0; i < nfat_archs; i++){
+ if(fat_archs[i].cputype != cputype)
+ continue;
+- if(fat_archs[i].cpusubtype == CPU_SUBTYPE_POWERPC_970)
++ if((fat_archs[i].cpusubtype & ~CPU_SUBTYPE_MASK) ==
++ CPU_SUBTYPE_POWERPC_970)
+ return(fat_archs + i);
+ }
+ case CPU_SUBTYPE_POWERPC_7450:
+@@ -448,13 +480,15 @@
+ for(i = 0; i < nfat_archs; i++){
+ if(fat_archs[i].cputype != cputype)
+ continue;
+- if(fat_archs[i].cpusubtype == CPU_SUBTYPE_POWERPC_7450)
++ if((fat_archs[i].cpusubtype & ~CPU_SUBTYPE_MASK) ==
++ CPU_SUBTYPE_POWERPC_7450)
+ return(fat_archs + i);
+ }
+ for(i = 0; i < nfat_archs; i++){
+ if(fat_archs[i].cputype != cputype)
+ continue;
+- if(fat_archs[i].cpusubtype == CPU_SUBTYPE_POWERPC_7400)
++ if((fat_archs[i].cpusubtype & ~CPU_SUBTYPE_MASK) ==
++ CPU_SUBTYPE_POWERPC_7400)
+ return(fat_archs + i);
+ }
+ case CPU_SUBTYPE_POWERPC_750:
+@@ -466,44 +500,51 @@
+ for(i = 0; i < nfat_archs; i++){
+ if(fat_archs[i].cputype != cputype)
+ continue;
+- if(fat_archs[i].cpusubtype == CPU_SUBTYPE_POWERPC_750)
++ if((fat_archs[i].cpusubtype & CPU_SUBTYPE_MASK) ==
++ CPU_SUBTYPE_POWERPC_750)
+ return(fat_archs + i);
+ }
+ for(i = 0; i < nfat_archs; i++){
+ if(fat_archs[i].cputype != cputype)
+ continue;
+- if(fat_archs[i].cpusubtype == CPU_SUBTYPE_POWERPC_604e)
++ if((fat_archs[i].cpusubtype & ~CPU_SUBTYPE_MASK) ==
++ CPU_SUBTYPE_POWERPC_604e)
+ return(fat_archs + i);
+ }
+ for(i = 0; i < nfat_archs; i++){
+ if(fat_archs[i].cputype != cputype)
+ continue;
+- if(fat_archs[i].cpusubtype == CPU_SUBTYPE_POWERPC_604)
++ if((fat_archs[i].cpusubtype & ~CPU_SUBTYPE_MASK) ==
++ CPU_SUBTYPE_POWERPC_604)
+ return(fat_archs + i);
+ }
+ for(i = 0; i < nfat_archs; i++){
+- if(fat_archs[i].cputype != cputype)
++ if((fat_archs[i].cputype & ~CPU_SUBTYPE_MASK) != cputype)
+ continue;
+- if(fat_archs[i].cpusubtype == CPU_SUBTYPE_POWERPC_603ev)
++ if((fat_archs[i].cpusubtype & ~CPU_SUBTYPE_MASK) ==
++ CPU_SUBTYPE_POWERPC_603ev)
+ return(fat_archs + i);
+ }
+ for(i = 0; i < nfat_archs; i++){
+ if(fat_archs[i].cputype != cputype)
+ continue;
+- if(fat_archs[i].cpusubtype == CPU_SUBTYPE_POWERPC_603e)
++ if((fat_archs[i].cpusubtype & ~CPU_SUBTYPE_MASK) ==
++ CPU_SUBTYPE_POWERPC_603e)
+ return(fat_archs + i);
+ }
+ for(i = 0; i < nfat_archs; i++){
+ if(fat_archs[i].cputype != cputype)
+ continue;
+- if(fat_archs[i].cpusubtype == CPU_SUBTYPE_POWERPC_603)
++ if((fat_archs[i].cpusubtype & ~CPU_SUBTYPE_MASK) ==
++ CPU_SUBTYPE_POWERPC_603)
+ return(fat_archs + i);
+ }
+ default:
+ for(i = 0; i < nfat_archs; i++){
+ if(fat_archs[i].cputype != cputype)
+ continue;
+- if(fat_archs[i].cpusubtype == CPU_SUBTYPE_POWERPC_ALL)
++ if((fat_archs[i].cpusubtype & ~CPU_SUBTYPE_MASK) ==
++ CPU_SUBTYPE_POWERPC_ALL)
+ return(fat_archs + i);
+ }
+ }
+@@ -517,7 +558,7 @@
+ * 970 (currently only the one 64-bit subtype)
+ * For an unknown subtype pick only the ALL type if it exists.
+ */
+- switch(cpusubtype){
++ switch(cpusubtype & ~CPU_SUBTYPE_MASK){
+ case CPU_SUBTYPE_POWERPC_ALL:
+ /*
+ * The CPU_SUBTYPE_POWERPC_ALL is only used by the development
+@@ -529,14 +570,16 @@
+ for(i = 0; i < nfat_archs; i++){
+ if(fat_archs[i].cputype != cputype)
+ continue;
+- if(fat_archs[i].cpusubtype == CPU_SUBTYPE_POWERPC_970)
++ if((fat_archs[i].cpusubtype & ~CPU_SUBTYPE_MASK) ==
++ CPU_SUBTYPE_POWERPC_970)
+ return(fat_archs + i);
+ }
+ default:
+ for(i = 0; i < nfat_archs; i++){
+ if(fat_archs[i].cputype != cputype)
+ continue;
+- if(fat_archs[i].cpusubtype == CPU_SUBTYPE_POWERPC_ALL)
++ if((fat_archs[i].cpusubtype & ~CPU_SUBTYPE_MASK) ==
++ CPU_SUBTYPE_POWERPC_ALL)
+ return(fat_archs + i);
+ }
+ }
+@@ -545,7 +588,8 @@
+ for(i = 0; i < nfat_archs; i++){
+ if(fat_archs[i].cputype != cputype)
+ continue;
+- if(fat_archs[i].cpusubtype == CPU_SUBTYPE_MC88000_ALL)
++ if((fat_archs[i].cpusubtype & ~CPU_SUBTYPE_MASK) ==
++ CPU_SUBTYPE_MC88000_ALL)
+ return(fat_archs + i);
+ }
+ break;
+@@ -553,7 +597,8 @@
+ for(i = 0; i < nfat_archs; i++){
+ if(fat_archs[i].cputype != cputype)
+ continue;
+- if(fat_archs[i].cpusubtype == CPU_SUBTYPE_I860_ALL)
++ if((fat_archs[i].cpusubtype & ~CPU_SUBTYPE_MASK) ==
++ CPU_SUBTYPE_I860_ALL)
+ return(fat_archs + i);
+ }
+ break;
+@@ -561,7 +606,8 @@
+ for(i = 0; i < nfat_archs; i++){
+ if(fat_archs[i].cputype != cputype)
+ continue;
+- if(fat_archs[i].cpusubtype == CPU_SUBTYPE_HPPA_ALL)
++ if((fat_archs[i].cpusubtype & ~CPU_SUBTYPE_MASK) ==
++ CPU_SUBTYPE_HPPA_ALL)
+ return(fat_archs + i);
+ }
+ break;
+@@ -569,10 +615,38 @@
+ for(i = 0; i < nfat_archs; i++){
+ if(fat_archs[i].cputype != cputype)
+ continue;
+- if(fat_archs[i].cpusubtype == CPU_SUBTYPE_SPARC_ALL)
++ if((fat_archs[i].cpusubtype & ~CPU_SUBTYPE_MASK) ==
++ CPU_SUBTYPE_SPARC_ALL)
+ return(fat_archs + i);
+ }
+ break;
++ case CPU_TYPE_ARM:
++ {
++ /*
++ * ARM is straightforward, since each architecture is backward
++ * compatible with previous architectures. So, we just take the
++ * highest that is less than our target.
++ */
++ int fat_match_found = 0;
++ uint32_t best_fat_arch = 0;
++ for(i = 0; i < nfat_archs; i++){
++ if(fat_archs[i].cputype != cputype)
++ continue;
++ if(fat_archs[i].cpusubtype > cpusubtype)
++ continue;
++ if(!fat_match_found){
++ fat_match_found = 1;
++ best_fat_arch = i;
++ continue;
++ }
++ if(fat_archs[i].cpusubtype >
++ fat_archs[best_fat_arch].cpusubtype)
++ best_fat_arch = i;
++ }
++ if(fat_match_found)
++ return fat_archs + best_fat_arch;
++ }
++ break;
+ default:
+ return(NULL);
+ }
+@@ -603,33 +677,34 @@
+ if(cputype == CPU_TYPE_X86_64)
+ return(CPU_SUBTYPE_X86_64_ALL);
+
+- if(cpusubtype1 == cpusubtype2)
++ if((cpusubtype1 & ~CPU_SUBTYPE_MASK) ==
++ (cpusubtype2 & ~CPU_SUBTYPE_MASK))
+ return(cpusubtype1);
+
+ switch(cputype){
+ case CPU_TYPE_MC680x0:
+- if(cpusubtype1 != CPU_SUBTYPE_MC680x0_ALL &&
+- cpusubtype1 != CPU_SUBTYPE_MC68030_ONLY &&
+- cpusubtype1 != CPU_SUBTYPE_MC68040)
++ if((cpusubtype1 & ~CPU_SUBTYPE_MASK) != CPU_SUBTYPE_MC680x0_ALL &&
++ (cpusubtype1 & ~CPU_SUBTYPE_MASK) != CPU_SUBTYPE_MC68030_ONLY &&
++ (cpusubtype1 & ~CPU_SUBTYPE_MASK) != CPU_SUBTYPE_MC68040)
+ return((cpu_subtype_t)-1);
+- if(cpusubtype2 != CPU_SUBTYPE_MC680x0_ALL &&
+- cpusubtype2 != CPU_SUBTYPE_MC68030_ONLY &&
+- cpusubtype2 != CPU_SUBTYPE_MC68040)
++ if((cpusubtype2 & ~CPU_SUBTYPE_MASK) != CPU_SUBTYPE_MC680x0_ALL &&
++ (cpusubtype2 & ~CPU_SUBTYPE_MASK) != CPU_SUBTYPE_MC68030_ONLY &&
++ (cpusubtype2 & ~CPU_SUBTYPE_MASK) != CPU_SUBTYPE_MC68040)
+ return((cpu_subtype_t)-1);
+
+- if(cpusubtype1 == CPU_SUBTYPE_MC68030_ONLY &&
+- cpusubtype2 == CPU_SUBTYPE_MC68040)
++ if((cpusubtype1 & ~CPU_SUBTYPE_MASK) == CPU_SUBTYPE_MC68030_ONLY &&
++ (cpusubtype2 & ~CPU_SUBTYPE_MASK) == CPU_SUBTYPE_MC68040)
+ return((cpu_subtype_t)-1);
+- if(cpusubtype1 == CPU_SUBTYPE_MC68040 &&
+- cpusubtype2 == CPU_SUBTYPE_MC68030_ONLY)
++ if((cpusubtype1 & ~CPU_SUBTYPE_MASK) == CPU_SUBTYPE_MC68040 &&
++ (cpusubtype2 & ~CPU_SUBTYPE_MASK) == CPU_SUBTYPE_MC68030_ONLY)
+ return((cpu_subtype_t)-1);
+
+- if(cpusubtype1 == CPU_SUBTYPE_MC68030_ONLY ||
+- cpusubtype2 == CPU_SUBTYPE_MC68030_ONLY)
++ if((cpusubtype1 & ~CPU_SUBTYPE_MASK) == CPU_SUBTYPE_MC68030_ONLY ||
++ (cpusubtype2 & ~CPU_SUBTYPE_MASK) == CPU_SUBTYPE_MC68030_ONLY)
+ return(CPU_SUBTYPE_MC68030_ONLY);
+
+- if(cpusubtype1 == CPU_SUBTYPE_MC68040 ||
+- cpusubtype2 == CPU_SUBTYPE_MC68040)
++ if((cpusubtype1 & ~CPU_SUBTYPE_MASK) == CPU_SUBTYPE_MC68040 ||
++ (cpusubtype2 & ~CPU_SUBTYPE_MASK) == CPU_SUBTYPE_MC68040)
+ return(CPU_SUBTYPE_MC68040);
+ break; /* logically can't get here */
+
+@@ -639,66 +714,124 @@
+ * anything with the 601 becomes 601. All other non exact matches
+ * combine to the higher value subtype.
+ */
+- if(cpusubtype1 == CPU_SUBTYPE_POWERPC_ALL)
++ if((cpusubtype1 & ~CPU_SUBTYPE_MASK) == CPU_SUBTYPE_POWERPC_ALL)
+ return(cpusubtype2);
+- if(cpusubtype2 == CPU_SUBTYPE_POWERPC_ALL)
++ if((cpusubtype2 & ~CPU_SUBTYPE_MASK) == CPU_SUBTYPE_POWERPC_ALL)
+ return(cpusubtype1);
+
+- if(cpusubtype1 == CPU_SUBTYPE_POWERPC_601 ||
+- cpusubtype2 == CPU_SUBTYPE_POWERPC_601)
++ if((cpusubtype1 & ~CPU_SUBTYPE_MASK) == CPU_SUBTYPE_POWERPC_601 ||
++ (cpusubtype2 & ~CPU_SUBTYPE_MASK) == CPU_SUBTYPE_POWERPC_601)
+ return(CPU_SUBTYPE_POWERPC_601);
+
+- if(cpusubtype1 > cpusubtype2)
++ if((cpusubtype1 & ~CPU_SUBTYPE_MASK) >
++ (cpusubtype2 & ~CPU_SUBTYPE_MASK))
+ return(cpusubtype1);
+ else
+ return(cpusubtype2);
+ break; /* logically can't get here */
+
+ case CPU_TYPE_MC88000:
+- if(cpusubtype1 != CPU_SUBTYPE_MC88000_ALL &&
+- cpusubtype1 != CPU_SUBTYPE_MC88110)
++ if((cpusubtype1 & ~CPU_SUBTYPE_MASK) != CPU_SUBTYPE_MC88000_ALL &&
++ (cpusubtype1 & ~CPU_SUBTYPE_MASK) != CPU_SUBTYPE_MC88110)
+ return((cpu_subtype_t)-1);
+- if(cpusubtype2 != CPU_SUBTYPE_MC88000_ALL &&
+- cpusubtype2 != CPU_SUBTYPE_MC88110)
++ if((cpusubtype2 & ~CPU_SUBTYPE_MASK) != CPU_SUBTYPE_MC88000_ALL &&
++ (cpusubtype2 & ~CPU_SUBTYPE_MASK) != CPU_SUBTYPE_MC88110)
+ return((cpu_subtype_t)-1);
+
+- if(cpusubtype1 == CPU_SUBTYPE_MC88110 ||
+- cpusubtype2 == CPU_SUBTYPE_MC88110)
++ if((cpusubtype1 & ~CPU_SUBTYPE_MASK) == CPU_SUBTYPE_MC88110 ||
++ (cpusubtype2 & ~CPU_SUBTYPE_MASK) == CPU_SUBTYPE_MC88110)
+ return(CPU_SUBTYPE_MC88110);
+
+ break; /* logically can't get here */
+
+ case CPU_TYPE_I860:
+- if(cpusubtype1 != CPU_SUBTYPE_I860_ALL &&
+- cpusubtype1 != CPU_SUBTYPE_I860_860)
++ if((cpusubtype1 & ~CPU_SUBTYPE_MASK) != CPU_SUBTYPE_I860_ALL &&
++ (cpusubtype1 & ~CPU_SUBTYPE_MASK) != CPU_SUBTYPE_I860_860)
+ return((cpu_subtype_t)-1);
+- if(cpusubtype2 != CPU_SUBTYPE_I860_ALL &&
+- cpusubtype2 != CPU_SUBTYPE_I860_860)
++ if((cpusubtype2 & ~CPU_SUBTYPE_MASK) != CPU_SUBTYPE_I860_ALL &&
++ (cpusubtype2 & ~CPU_SUBTYPE_MASK) != CPU_SUBTYPE_I860_860)
+ return((cpu_subtype_t)-1);
+
+- if(cpusubtype1 == CPU_SUBTYPE_I860_860 ||
+- cpusubtype2 == CPU_SUBTYPE_I860_860)
++ if((cpusubtype1 & ~CPU_SUBTYPE_MASK) == CPU_SUBTYPE_I860_860 ||
++ (cpusubtype2 & ~CPU_SUBTYPE_MASK) == CPU_SUBTYPE_I860_860)
+ return(CPU_SUBTYPE_I860_860);
+ break; /* logically can't get here */
+
+ case CPU_TYPE_HPPA:
+- if(cpusubtype1 != CPU_SUBTYPE_HPPA_ALL &&
+- cpusubtype1 != CPU_SUBTYPE_HPPA_7100LC)
++ if((cpusubtype1 & ~CPU_SUBTYPE_MASK) != CPU_SUBTYPE_HPPA_ALL &&
++ (cpusubtype1 & ~CPU_SUBTYPE_MASK) != CPU_SUBTYPE_HPPA_7100LC)
+ return((cpu_subtype_t)-1);
+- if(cpusubtype2 != CPU_SUBTYPE_HPPA_ALL &&
+- cpusubtype2 != CPU_SUBTYPE_HPPA_7100LC)
++ if((cpusubtype2 & ~CPU_SUBTYPE_MASK) != CPU_SUBTYPE_HPPA_ALL &&
++ (cpusubtype2 & ~CPU_SUBTYPE_MASK) != CPU_SUBTYPE_HPPA_7100LC)
+ return((cpu_subtype_t)-1);
+
+ return(CPU_SUBTYPE_HPPA_7100LC);
+ break; /* logically can't get here */
+
+ case CPU_TYPE_SPARC:
+- if(cpusubtype1 != CPU_SUBTYPE_SPARC_ALL)
++ if((cpusubtype1 & ~CPU_SUBTYPE_MASK) != CPU_SUBTYPE_SPARC_ALL)
+ return((cpu_subtype_t)-1);
+- if(cpusubtype2 != CPU_SUBTYPE_SPARC_ALL)
++ if((cpusubtype2 & ~CPU_SUBTYPE_MASK) != CPU_SUBTYPE_SPARC_ALL)
+ return((cpu_subtype_t)-1);
+ break; /* logically can't get here */
+
++ case CPU_TYPE_ARM:
++ /*
++ * Combinability matrix for ARM:
++ * V4T V5 XSCALE V6 V7 ALL
++ * ~~~ ~~ ~~~~~~ ~~ ~~ ~~~
++ * V4T V4T V5 XSCALE V6 V7 ALL
++ * V5 V5 V5 -- V6 V7 ALL
++ * XSCALE XSCALE -- XSCALE -- -- ALL
++ * V6 V6 V6 -- V6 V7 ALL
++ * V7 V7 V7 -- V7 V7 ALL
++ * ALL ALL ALL ALL ALL ALL ALL
++ */
++ if((cpusubtype1 & ~CPU_SUBTYPE_MASK) == CPU_SUBTYPE_ARM_ALL)
++ return(cpusubtype2);
++ if((cpusubtype2 & ~CPU_SUBTYPE_MASK) == CPU_SUBTYPE_ARM_ALL)
++ return(cpusubtype1);
++ switch((cpusubtype1 & ~CPU_SUBTYPE_MASK)){
++ case CPU_SUBTYPE_ARM_V7:
++ switch((cpusubtype2 & ~CPU_SUBTYPE_MASK)){
++ case CPU_SUBTYPE_ARM_XSCALE:
++ return((cpu_subtype_t)-1);
++ default:
++ return(CPU_SUBTYPE_ARM_V7);
++ }
++ case CPU_SUBTYPE_ARM_V6:
++ switch((cpusubtype2 & ~CPU_SUBTYPE_MASK)){
++ case CPU_SUBTYPE_ARM_XSCALE:
++ return((cpu_subtype_t)-1);
++ default:
++ return(CPU_SUBTYPE_ARM_V6);
++ }
++ case CPU_SUBTYPE_ARM_XSCALE:
++ switch((cpusubtype2 & ~CPU_SUBTYPE_MASK)){
++ case CPU_SUBTYPE_ARM_V7:
++ case CPU_SUBTYPE_ARM_V6:
++ case CPU_SUBTYPE_ARM_V5TEJ:
++ return((cpu_subtype_t)-1);
++ default:
++ return(CPU_SUBTYPE_ARM_XSCALE);
++ }
++ case CPU_SUBTYPE_ARM_V5TEJ:
++ switch((cpusubtype2 & ~CPU_SUBTYPE_MASK)){
++ case CPU_SUBTYPE_ARM_XSCALE:
++ return((cpu_subtype_t)-1);
++ case CPU_SUBTYPE_ARM_V7:
++ return(CPU_SUBTYPE_ARM_V7);
++ case CPU_SUBTYPE_ARM_V6:
++ return(CPU_SUBTYPE_ARM_V6);
++ default:
++ return(CPU_SUBTYPE_ARM_V5TEJ);
++ }
++ case CPU_SUBTYPE_ARM_V4T:
++ return((cpusubtype2 & ~CPU_SUBTYPE_MASK));
++ default:
++ return((cpu_subtype_t)-1);
++ }
++
+ default:
+ return((cpu_subtype_t)-1);
+ }
+Index: odcctools-9.2-ld/libmacho/get_end.c
+===================================================================
+--- odcctools-9.2-ld.orig/libmacho/get_end.c 2013-08-15 11:27:10.000000000 +0000
++++ odcctools-9.2-ld/libmacho/get_end.c 2013-09-03 14:12:37.137786960 +0000
+@@ -25,13 +25,7 @@
+ #include <mach-o/ldsyms.h>
+ #include <mach-o/getsect.h>
+ #ifndef __OPENSTEP__
+-
+-#ifdef __LP64__
+-extern struct mach_header_64 *_NSGetMachExecuteHeader(void);
+-#else /* !defined(__LP64__) */
+ #include <crt_externs.h>
+-#endif /* !defined(__LP64__) */
+-
+ #else /* defined(__OPENSTEP__) */
+ #ifdef __DYNAMIC__
+ #include "mach-o/dyld.h" /* defines _dyld_lookup_and_bind() */
+@@ -49,7 +43,7 @@
+ #define SETUP_VAR(var) \
+ if ( var ## _pointer == 0) { \
+ _dyld_lookup_and_bind( STRINGIFY(_ ## var), \
+- (unsigned long *) & var ## _pointer, 0); \
++ (uint32_t *) & var ## _pointer, 0); \
+ }
+ #define USE_VAR(var) (* var ## _pointer)
+ #endif
+@@ -70,13 +64,13 @@
+ {
+ #ifndef __LP64__
+
+- static struct mach_header *mhp = NULL;
+ struct segment_command *sgp;
+- unsigned long i, _end;
++ unsigned long _end;
++ uint32_t i;
+ #ifndef __OPENSTEP__
+- if(mhp == NULL)
+- mhp = _NSGetMachExecuteHeader();
++ struct mach_header *mhp = _NSGetMachExecuteHeader();
+ #else /* defined(__OPENSTEP__) */
++ static struct mach_header *mhp = NULL;
+ DECLARE_VAR(_mh_execute_header, struct mach_header);
+ SETUP_VAR(_mh_execute_header);
+
+@@ -95,12 +89,11 @@
+
+ #else /* defined(__LP64__) */
+
+- static struct mach_header_64 *mhp = NULL;
++ struct mach_header_64 *mhp = _NSGetMachExecuteHeader();
+ struct segment_command_64 *sgp;
+- unsigned long i, _end;
++ unsigned long _end;
++ uint32_t i;
+
+- if(mhp == NULL)
+- mhp = _NSGetMachExecuteHeader();
+ _end = 0;
+ sgp = (struct segment_command_64 *)
+ ((char *)mhp + sizeof(struct mach_header_64));
+Index: odcctools-9.2-ld/libmacho/getsecbyname.c
+===================================================================
+--- odcctools-9.2-ld.orig/libmacho/getsecbyname.c 2013-08-15 11:27:10.000000000 +0000
++++ odcctools-9.2-ld/libmacho/getsecbyname.c 2013-09-03 14:13:37.465785445 +0000
+@@ -28,13 +28,7 @@
+ #include <mach-o/dyld.h> /* defines _dyld_lookup_and_bind() */
+ #endif /* defined(__DYNAMIC__) */
+ #ifndef __OPENSTEP__
+-
+-#ifdef __LP64__
+-extern struct mach_header_64 *_NSGetMachExecuteHeader(void);
+-#else /* !defined(__LP64__) */
+ #include <crt_externs.h>
+-#endif /* !defined(__LP64__) */
+-
+ #else /* defined(__OPENSTEP__) */
+
+ #if !defined(__DYNAMIC__)
+@@ -49,7 +43,7 @@
+ #define SETUP_VAR(var) \
+ if ( var ## _pointer == NULL) { \
+ _dyld_lookup_and_bind( STRINGIFY(_ ## var), \
+- (unsigned long *) & var ## _pointer, NULL); \
++ (uint32_t *) & var ## _pointer, NULL); \
+ }
+ #define USE_VAR(var) (* var ## _pointer)
+ #endif
+@@ -68,7 +62,7 @@
+ {
+ struct segment_command *sgp;
+ struct section *sp;
+- unsigned long i, j;
++ uint32_t i, j;
+
+ sgp = (struct segment_command *)
+ ((char *)mhp + sizeof(struct mach_header));
+@@ -106,7 +100,7 @@
+ {
+ struct segment_command_64 *sgp;
+ struct section_64 *sp;
+- unsigned long i, j;
++ uint32_t i, j;
+
+ sgp = (struct segment_command_64 *)
+ ((char *)mhp + sizeof(struct mach_header_64));
+@@ -147,12 +141,12 @@
+ {
+ struct segment_command *sgp;
+ struct section *sp;
+- unsigned long i, j;
++ uint32_t i, j;
+
+ sgp = (struct segment_command *)
+ ((char *)mhp + sizeof(struct mach_header));
+ for(i = 0; i < mhp->ncmds; i++){
+- if(sgp->cmd == (fSwap ? NXSwapLong(LC_SEGMENT) : LC_SEGMENT)) {
++ if(sgp->cmd == (fSwap ? OSSwapInt32(LC_SEGMENT) : LC_SEGMENT)) {
+
+ if (fSwap) {
+ #ifdef __LITTLE_ENDIAN__
+@@ -188,7 +182,7 @@
+ sgp = (struct segment_command *)((char *)sgp + sgp->cmdsize);
+ } else {
+ sgp = (struct segment_command *)((char *)sgp +
+- (fSwap ? NXSwapLong(sgp->cmdsize) : sgp->cmdsize));
++ (fSwap ? OSSwapInt32(sgp->cmdsize) : sgp->cmdsize));
+ }
+ }
+ return((struct section *)0);
+@@ -206,11 +200,10 @@
+ const char *segname,
+ const char *sectname)
+ {
+- static struct mach_header *mhp = NULL;
+ #ifndef __OPENSTEP__
+- if(mhp == NULL)
+- mhp = _NSGetMachExecuteHeader();
++ struct mach_header *mhp = _NSGetMachExecuteHeader();
+ #else /* defined(__OPENSTEP__) */
++ static struct mach_header *mhp = NULL;
+ DECLARE_VAR(_mh_execute_header, struct mach_header);
+ SETUP_VAR(_mh_execute_header);
+ mhp = (struct mach_header *)(& USE_VAR(_mh_execute_header));
+@@ -225,10 +218,8 @@
+ const char *segname,
+ const char *sectname)
+ {
+- static struct mach_header_64 *mhp = NULL;
++ struct mach_header_64 *mhp = _NSGetMachExecuteHeader();
+
+- if(mhp == NULL)
+- mhp = _NSGetMachExecuteHeader();
+ return(getsectbynamefromheader_64(mhp, segname, sectname));
+ }
+
+@@ -262,6 +253,185 @@
+ }
+
+ /*
++ * This routine returns the a pointer to the section contents of the named
++ * section in the named segment if it exists in the image pointed to by the
++ * mach header. Otherwise it returns zero.
++ */
++#ifndef __LP64__
++
++uint8_t *
++getsectiondata(
++const struct mach_header *mhp,
++const char *segname,
++const char *sectname,
++unsigned long *size)
++{
++ struct segment_command *sgp, *zero;
++ struct section *sp, *find;
++ uint32_t i, j;
++
++ zero = 0;
++ find = 0;
++ sp = 0;
++ sgp = (struct segment_command *)
++ ((char *)mhp + sizeof(struct mach_header));
++ for(i = 0; i < mhp->ncmds; i++){
++ if(sgp->cmd == LC_SEGMENT){
++ if(zero == 0 && sgp->fileoff == 0 && sgp->nsects != 0){
++ zero = sgp;
++ if(find != 0)
++ goto done;
++ }
++ if(find == 0 &&
++ strncmp(sgp->segname, segname, sizeof(sgp->segname)) == 0){
++ sp = (struct section *)((char *)sgp +
++ sizeof(struct segment_command));
++ for(j = 0; j < sgp->nsects; j++){
++ if(strncmp(sp->sectname, sectname,
++ sizeof(sp->sectname)) == 0 &&
++ strncmp(sp->segname, segname,
++ sizeof(sp->segname)) == 0){
++ find = sp;
++ if(zero != 0)
++ goto done;
++ }
++ sp = (struct section *)((char *)sp +
++ sizeof(struct section));
++ }
++ }
++ }
++ sgp = (struct segment_command *)((char *)sgp + sgp->cmdsize);
++ }
++ return(0);
++done:
++ *size = sp->size;
++ return((uint8_t *)((uintptr_t)mhp - zero->vmaddr + sp->addr));
++}
++
++uint8_t *
++getsegmentdata(
++const struct mach_header *mhp,
++const char *segname,
++unsigned long *size)
++{
++ struct segment_command *sgp, *zero, *find;
++ uint32_t i;
++
++ zero = 0;
++ find = 0;
++ sgp = (struct segment_command *)
++ ((char *)mhp + sizeof(struct mach_header));
++ for(i = 0; i < mhp->ncmds; i++){
++ if(sgp->cmd == LC_SEGMENT){
++ if(zero == 0 && sgp->fileoff == 0 && sgp->nsects != 0){
++ zero = sgp;
++ if(find != 0)
++ goto done;
++ }
++ if(find == 0 &&
++ strncmp(sgp->segname, segname, sizeof(sgp->segname)) == 0){
++ find = sgp;
++ if(zero != 0)
++ goto done;
++ }
++ }
++ sgp = (struct segment_command *)((char *)sgp + sgp->cmdsize);
++ }
++ return(0);
++done:
++ *size = sgp->vmsize;
++ return((uint8_t *)((uintptr_t)mhp - zero->vmaddr + sgp->vmaddr));
++}
++
++#else /* defined(__LP64__) */
++
++uint8_t *
++getsectiondata(
++const struct mach_header_64 *mhp,
++const char *segname,
++const char *sectname,
++unsigned long *size)
++{
++ struct segment_command_64 *sgp, *zero;
++ struct section_64 *sp, *find;
++ uint32_t i, j;
++
++ zero = 0;
++ find = 0;
++ sp = 0;
++ sgp = (struct segment_command_64 *)
++ ((char *)mhp + sizeof(struct mach_header_64));
++ for(i = 0; i < mhp->ncmds; i++){
++ if(sgp->cmd == LC_SEGMENT_64){
++ if(zero == 0 && sgp->fileoff == 0 && sgp->nsects != 0){
++ zero = sgp;
++ if(find != 0)
++ goto done;
++ }
++ if(find == 0 &&
++ strncmp(sgp->segname, segname, sizeof(sgp->segname)) == 0){
++ sp = (struct section_64 *)((char *)sgp +
++ sizeof(struct segment_command_64));
++ for(j = 0; j < sgp->nsects; j++){
++ if(strncmp(sp->sectname, sectname,
++ sizeof(sp->sectname)) == 0 &&
++ strncmp(sp->segname, segname,
++ sizeof(sp->segname)) == 0){
++ find = sp;
++ if(zero != 0)
++ goto done;
++ }
++ sp = (struct section_64 *)((char *)sp +
++ sizeof(struct section_64));
++ }
++ }
++ }
++ sgp = (struct segment_command_64 *)((char *)sgp + sgp->cmdsize);
++ }
++ return(0);
++done:
++ *size = sp->size;
++ return((uint8_t *)((uintptr_t)mhp - zero->vmaddr + sp->addr));
++}
++
++uint8_t *
++getsegmentdata(
++const struct mach_header_64 *mhp,
++const char *segname,
++unsigned long *size)
++{
++ struct segment_command_64 *sgp, *zero, *find;
++ uint32_t i;
++
++ zero = 0;
++ find = 0;
++ sgp = (struct segment_command_64 *)
++ ((char *)mhp + sizeof(struct mach_header_64));
++ for(i = 0; i < mhp->ncmds; i++){
++ if(sgp->cmd == LC_SEGMENT_64){
++ if(zero == 0 && sgp->fileoff == 0 && sgp->nsects != 0){
++ zero = sgp;
++ if(find != 0)
++ goto done;
++ }
++ if(find == 0 &&
++ strncmp(sgp->segname, segname, sizeof(sgp->segname)) == 0){
++ find = sgp;
++ if(zero != 0)
++ goto done;
++ }
++ }
++ sgp = (struct segment_command_64 *)((char *)sgp + sgp->cmdsize);
++ }
++ return(0);
++done:
++ *size = sgp->vmsize;
++ return((uint8_t *)((uintptr_t)mhp - zero->vmaddr + sgp->vmaddr));
++}
++
++#endif /* defined(__LP64__) */
++
++/*
+ * This routine returns the a pointer to the data for the named section in the
+ * named segment if it exist in the mach header passed to it. Also it returns
+ * the size of the section data indirectly through the pointer size. Otherwise
+@@ -282,7 +452,7 @@
+ return(NULL);
+ }
+ *size = sp->size;
+- return((char *)((unsigned long)(sp->addr)));
++ return((char *)((uintptr_t)(sp->addr)));
+ }
+
+ /*
+@@ -306,7 +476,7 @@
+ return(NULL);
+ }
+ *size = sp->size;
+- return((char *)((unsigned long)(sp->addr)));
++ return((char *)((uintptr_t)(sp->addr)));
+ }
+
+ #ifdef __DYNAMIC__
+@@ -324,7 +494,8 @@
+ const char *sectname,
+ unsigned long *size)
+ {
+- unsigned long i, n, vmaddr_slide;
++ uint32_t i, n;
++ uintptr_t vmaddr_slide;
+ #ifndef __LP64__
+ struct mach_header *mh;
+ const struct section *s;
+Index: odcctools-9.2-ld/libmacho/getsegbyname.c
+===================================================================
+--- odcctools-9.2-ld.orig/libmacho/getsegbyname.c 2013-08-15 11:27:10.000000000 +0000
++++ odcctools-9.2-ld/libmacho/getsegbyname.c 2013-09-03 14:14:09.793784630 +0000
+@@ -25,11 +25,7 @@
+ #ifndef __OPENSTEP__
+
+ #ifndef RLD
+-#ifdef __LP64__
+-extern struct mach_header_64 *_NSGetMachExecuteHeader(void);
+-#else /* !defined(__LP64__) */
+ #include <crt_externs.h>
+-#endif /* !defined(__LP64__) */
+ #endif /* !defined(RLD) */
+
+ #else /* defined(__OPENSTEP__) */
+@@ -49,7 +45,7 @@
+ #define SETUP_VAR(var) \
+ if ( var ## _pointer == 0) { \
+ _dyld_lookup_and_bind( STRINGIFY(_ ## var), \
+- (unsigned long *) & var ## _pointer, 0); \
++ (uint32_t *) & var ## _pointer, 0); \
+ }
+ #define USE_VAR(var) (* var ## _pointer)
+ #endif
+@@ -68,14 +64,13 @@
+ getsegbyname(
+ char *segname)
+ {
+- static struct mach_header *mhp = NULL;
+ struct segment_command *sgp;
+- unsigned long i;
++ uint32_t i;
+ #ifndef RLD
+ #ifndef __OPENSTEP__
+- if(mhp == NULL)
+- mhp = _NSGetMachExecuteHeader();
++ struct mach_header *mhp = _NSGetMachExecuteHeader();
+ #else /* defined(__OPENSTEP__) */
++ static struct mach_header *mhp = NULL;
+ DECLARE_VAR(_mh_execute_header, struct mach_header);
+ SETUP_VAR(_mh_execute_header);
+ mhp = (struct mach_header *)(& USE_VAR(_mh_execute_header));
+@@ -101,15 +96,14 @@
+ getsegbyname(
+ char *segname)
+ {
+- static struct mach_header_64 *mhp = NULL;
++ struct mach_header_64 *mhp = NULL;
+ struct segment_command_64 *sgp;
+- unsigned long i;
++ uint32_t i;
+
+- if(mhp == NULL)
+ #ifndef RLD
+- mhp = _NSGetMachExecuteHeader();
++ mhp = _NSGetMachExecuteHeader();
+ #else /* defined(RLD) */
+- mhp = (struct mach_header_64 *)(&_mh_execute_header);
++ mhp = (struct mach_header_64 *)(&_mh_execute_header);
+ #endif /* defined(RLD) */
+
+ sgp = (struct segment_command_64 *)
+Index: odcctools-9.2-ld/libmacho/i386_swap.c
+===================================================================
+--- odcctools-9.2-ld.orig/libmacho/i386_swap.c 2013-08-15 11:27:10.000000000 +0000
++++ odcctools-9.2-ld/libmacho/i386_swap.c 2013-09-03 14:10:33.669788354 +0000
+@@ -132,6 +132,7 @@
+ #define __dr7 dr7
+
+ #include <string.h>
++#include <libkern/OSByteOrder.h>
+ #include <mach-o/i386/swap.h>
+
+ void
+@@ -139,22 +140,22 @@
+ i386_thread_state_t *cpu,
+ enum NXByteOrder target_byte_sex)
+ {
+- cpu->eax = NXSwapLong(cpu->eax);
+- cpu->ebx = NXSwapLong(cpu->ebx);
+- cpu->ecx = NXSwapLong(cpu->ecx);
+- cpu->edx = NXSwapLong(cpu->edx);
+- cpu->edi = NXSwapLong(cpu->edi);
+- cpu->esi = NXSwapLong(cpu->esi);
+- cpu->ebp = NXSwapLong(cpu->ebp);
+- cpu->esp = NXSwapLong(cpu->esp);
+- cpu->ss = NXSwapLong(cpu->ss);
+- cpu->eflags = NXSwapLong(cpu->eflags);
+- cpu->eip = NXSwapLong(cpu->eip);
+- cpu->cs = NXSwapLong(cpu->cs);
+- cpu->ds = NXSwapLong(cpu->ds);
+- cpu->es = NXSwapLong(cpu->es);
+- cpu->fs = NXSwapLong(cpu->fs);
+- cpu->gs = NXSwapLong(cpu->gs);
++ cpu->eax = OSSwapInt32(cpu->eax);
++ cpu->ebx = OSSwapInt32(cpu->ebx);
++ cpu->ecx = OSSwapInt32(cpu->ecx);
++ cpu->edx = OSSwapInt32(cpu->edx);
++ cpu->edi = OSSwapInt32(cpu->edi);
++ cpu->esi = OSSwapInt32(cpu->esi);
++ cpu->ebp = OSSwapInt32(cpu->ebp);
++ cpu->esp = OSSwapInt32(cpu->esp);
++ cpu->ss = OSSwapInt32(cpu->ss);
++ cpu->eflags = OSSwapInt32(cpu->eflags);
++ cpu->eip = OSSwapInt32(cpu->eip);
++ cpu->cs = OSSwapInt32(cpu->cs);
++ cpu->ds = OSSwapInt32(cpu->ds);
++ cpu->es = OSSwapInt32(cpu->es);
++ cpu->fs = OSSwapInt32(cpu->fs);
++ cpu->gs = OSSwapInt32(cpu->gs);
+ }
+
+ #ifdef x86_THREAD_STATE64
+@@ -163,27 +164,27 @@
+ x86_thread_state64_t *cpu,
+ enum NXByteOrder target_byte_sex)
+ {
+- cpu->rax = NXSwapLongLong(cpu->rax);
+- cpu->rbx = NXSwapLongLong(cpu->rbx);
+- cpu->rcx = NXSwapLongLong(cpu->rcx);
+- cpu->rdx = NXSwapLongLong(cpu->rdx);
+- cpu->rdi = NXSwapLongLong(cpu->rdi);
+- cpu->rsi = NXSwapLongLong(cpu->rsi);
+- cpu->rbp = NXSwapLongLong(cpu->rbp);
+- cpu->rsp = NXSwapLongLong(cpu->rsp);
+- cpu->rflags = NXSwapLongLong(cpu->rflags);
+- cpu->rip = NXSwapLongLong(cpu->rip);
+- cpu->r8 = NXSwapLongLong(cpu->r8);
+- cpu->r9 = NXSwapLongLong(cpu->r9);
+- cpu->r10 = NXSwapLongLong(cpu->r10);
+- cpu->r11 = NXSwapLongLong(cpu->r11);
+- cpu->r12 = NXSwapLongLong(cpu->r12);
+- cpu->r13 = NXSwapLongLong(cpu->r13);
+- cpu->r14 = NXSwapLongLong(cpu->r14);
+- cpu->r15 = NXSwapLongLong(cpu->r15);
+- cpu->cs = NXSwapLongLong(cpu->cs);
+- cpu->fs = NXSwapLongLong(cpu->fs);
+- cpu->gs = NXSwapLongLong(cpu->gs);
++ cpu->rax = OSSwapInt64(cpu->rax);
++ cpu->rbx = OSSwapInt64(cpu->rbx);
++ cpu->rcx = OSSwapInt64(cpu->rcx);
++ cpu->rdx = OSSwapInt64(cpu->rdx);
++ cpu->rdi = OSSwapInt64(cpu->rdi);
++ cpu->rsi = OSSwapInt64(cpu->rsi);
++ cpu->rbp = OSSwapInt64(cpu->rbp);
++ cpu->rsp = OSSwapInt64(cpu->rsp);
++ cpu->rflags = OSSwapInt64(cpu->rflags);
++ cpu->rip = OSSwapInt64(cpu->rip);
++ cpu->r8 = OSSwapInt64(cpu->r8);
++ cpu->r9 = OSSwapInt64(cpu->r9);
++ cpu->r10 = OSSwapInt64(cpu->r10);
++ cpu->r11 = OSSwapInt64(cpu->r11);
++ cpu->r12 = OSSwapInt64(cpu->r12);
++ cpu->r13 = OSSwapInt64(cpu->r13);
++ cpu->r14 = OSSwapInt64(cpu->r14);
++ cpu->r15 = OSSwapInt64(cpu->r15);
++ cpu->cs = OSSwapInt64(cpu->cs);
++ cpu->fs = OSSwapInt64(cpu->fs);
++ cpu->gs = OSSwapInt64(cpu->gs);
+ }
+
+ void
+@@ -191,8 +192,8 @@
+ x86_state_hdr_t *hdr,
+ enum NXByteOrder target_byte_sex)
+ {
+- hdr->flavor = NXSwapLong(hdr->flavor);
+- hdr->count = NXSwapLong(hdr->count);
++ hdr->flavor = OSSwapInt32(hdr->flavor);
++ hdr->count = OSSwapInt32(hdr->count);
+ }
+
+ void
+@@ -247,13 +248,13 @@
+
+ host_byte_sex = NXHostByteOrder();
+
+- fpu->fpu_reserved[0] = NXSwapLong(fpu->fpu_reserved[0]);
+- fpu->fpu_reserved[1] = NXSwapLong(fpu->fpu_reserved[1]);
++ fpu->fpu_reserved[0] = OSSwapInt32(fpu->fpu_reserved[0]);
++ fpu->fpu_reserved[1] = OSSwapInt32(fpu->fpu_reserved[1]);
+
+ if(target_byte_sex == host_byte_sex){
+ memcpy(&sfpc, &(fpu->fpu_fcw),
+ sizeof(struct swapped_fp_control));
+- sfpc.u.half = NXSwapShort(sfpc.u.half);
++ sfpc.u.half = OSSwapInt16(sfpc.u.half);
+ fpu->fpu_fcw.rc = sfpc.u.fields.rc;
+ fpu->fpu_fcw.pc = sfpc.u.fields.pc;
+ fpu->fpu_fcw.precis = sfpc.u.fields.precis;
+@@ -265,7 +266,7 @@
+
+ memcpy(&sfps, &(fpu->fpu_fsw),
+ sizeof(struct swapped_fp_status));
+- sfps.u.half = NXSwapShort(sfps.u.half);
++ sfps.u.half = OSSwapInt16(sfps.u.half);
+ fpu->fpu_fsw.busy = sfps.u.fields.busy;
+ fpu->fpu_fsw.c3 = sfps.u.fields.c3;
+ fpu->fpu_fsw.tos = sfps.u.fields.tos;
+@@ -290,7 +291,7 @@
+ sfpc.u.fields.zdiv = fpu->fpu_fcw.zdiv;
+ sfpc.u.fields.denorm = fpu->fpu_fcw.denorm;
+ sfpc.u.fields.invalid = fpu->fpu_fcw.invalid;
+- sfpc.u.half = NXSwapShort(sfpc.u.half);
++ sfpc.u.half = OSSwapInt16(sfpc.u.half);
+ memcpy(&(fpu->fpu_fcw), &sfpc,
+ sizeof(struct swapped_fp_control));
+
+@@ -308,20 +309,20 @@
+ sfps.u.fields.zdiv = fpu->fpu_fsw.zdiv;
+ sfps.u.fields.denorm = fpu->fpu_fsw.denorm;
+ sfps.u.fields.invalid = fpu->fpu_fsw.invalid;
+- sfps.u.half = NXSwapShort(sfps.u.half);
++ sfps.u.half = OSSwapInt16(sfps.u.half);
+ memcpy(&(fpu->fpu_fsw), &sfps,
+ sizeof(struct swapped_fp_status));
+ }
+- fpu->fpu_fop = NXSwapShort(fpu->fpu_fop);
+- fpu->fpu_ip = NXSwapLong(fpu->fpu_ip);
+- fpu->fpu_cs = NXSwapShort(fpu->fpu_cs);
+- fpu->fpu_rsrv2 = NXSwapShort(fpu->fpu_rsrv2);
+- fpu->fpu_dp = NXSwapLong(fpu->fpu_dp);
+- fpu->fpu_ds = NXSwapShort(fpu->fpu_ds);
+- fpu->fpu_rsrv3 = NXSwapShort(fpu->fpu_rsrv3);
+- fpu->fpu_mxcsr = NXSwapLong(fpu->fpu_mxcsr);
+- fpu->fpu_mxcsrmask = NXSwapLong(fpu->fpu_mxcsrmask);
+- fpu->fpu_reserved1 = NXSwapLong(fpu->fpu_reserved1);
++ fpu->fpu_fop = OSSwapInt16(fpu->fpu_fop);
++ fpu->fpu_ip = OSSwapInt32(fpu->fpu_ip);
++ fpu->fpu_cs = OSSwapInt16(fpu->fpu_cs);
++ fpu->fpu_rsrv2 = OSSwapInt16(fpu->fpu_rsrv2);
++ fpu->fpu_dp = OSSwapInt32(fpu->fpu_dp);
++ fpu->fpu_ds = OSSwapInt16(fpu->fpu_ds);
++ fpu->fpu_rsrv3 = OSSwapInt16(fpu->fpu_rsrv3);
++ fpu->fpu_mxcsr = OSSwapInt32(fpu->fpu_mxcsr);
++ fpu->fpu_mxcsrmask = OSSwapInt32(fpu->fpu_mxcsrmask);
++ fpu->fpu_reserved1 = OSSwapInt32(fpu->fpu_reserved1);
+ }
+
+ void
+@@ -329,9 +330,9 @@
+ x86_exception_state64_t *exc,
+ enum NXByteOrder target_byte_sex)
+ {
+- exc->trapno = NXSwapLong(exc->trapno);
+- exc->err = NXSwapLong(exc->err);
+- exc->faultvaddr = NXSwapLongLong(exc->faultvaddr);
++ exc->trapno = OSSwapInt32(exc->trapno);
++ exc->err = OSSwapInt32(exc->err);
++ exc->faultvaddr = OSSwapInt64(exc->faultvaddr);
+ }
+
+ void
+@@ -370,9 +371,13 @@
+
+ swap_x86_state_hdr(&fpu->fsh, target_byte_sex);
+
++/* current i386 thread states */
++#if i386_THREAD_STATE == 1
+ if(hdr.flavor == x86_FLOAT_STATE32)
+ swap_i386_float_state(&fpu->ufs.fs32, target_byte_sex);
+- else if(hdr.flavor == x86_FLOAT_STATE64)
++ else
++#endif
++ if(hdr.flavor == x86_FLOAT_STATE64)
+ swap_x86_float_state64(&fpu->ufs.fs64, target_byte_sex);
+ }
+
+@@ -391,9 +396,13 @@
+
+ swap_x86_state_hdr(&exc->esh, target_byte_sex);
+
++/* current i386 thread states */
++#if i386_THREAD_STATE == 1
+ if(hdr.flavor == x86_EXCEPTION_STATE32)
+ swap_i386_exception_state(&exc->ues.es32, target_byte_sex);
+- else if(hdr.flavor == x86_EXCEPTION_STATE64)
++ else
++#endif
++ if(hdr.flavor == x86_EXCEPTION_STATE64)
+ swap_x86_exception_state64(&exc->ues.es64, target_byte_sex);
+ }
+
+@@ -402,14 +411,14 @@
+ x86_debug_state32_t *debug,
+ enum NXByteOrder target_byte_sex)
+ {
+- debug->dr0 = NXSwapLong(debug->dr0);
+- debug->dr1 = NXSwapLong(debug->dr1);
+- debug->dr2 = NXSwapLong(debug->dr2);
+- debug->dr3 = NXSwapLong(debug->dr3);
+- debug->dr4 = NXSwapLong(debug->dr4);
+- debug->dr5 = NXSwapLong(debug->dr5);
+- debug->dr6 = NXSwapLong(debug->dr6);
+- debug->dr7 = NXSwapLong(debug->dr7);
++ debug->dr0 = OSSwapInt32(debug->dr0);
++ debug->dr1 = OSSwapInt32(debug->dr1);
++ debug->dr2 = OSSwapInt32(debug->dr2);
++ debug->dr3 = OSSwapInt32(debug->dr3);
++ debug->dr4 = OSSwapInt32(debug->dr4);
++ debug->dr5 = OSSwapInt32(debug->dr5);
++ debug->dr6 = OSSwapInt32(debug->dr6);
++ debug->dr7 = OSSwapInt32(debug->dr7);
+ }
+
+ void
+@@ -417,14 +426,14 @@
+ x86_debug_state64_t *debug,
+ enum NXByteOrder target_byte_sex)
+ {
+- debug->dr0 = NXSwapLongLong(debug->dr0);
+- debug->dr1 = NXSwapLongLong(debug->dr1);
+- debug->dr2 = NXSwapLongLong(debug->dr2);
+- debug->dr3 = NXSwapLongLong(debug->dr3);
+- debug->dr4 = NXSwapLongLong(debug->dr4);
+- debug->dr5 = NXSwapLongLong(debug->dr5);
+- debug->dr6 = NXSwapLongLong(debug->dr6);
+- debug->dr7 = NXSwapLongLong(debug->dr7);
++ debug->dr0 = OSSwapInt64(debug->dr0);
++ debug->dr1 = OSSwapInt64(debug->dr1);
++ debug->dr2 = OSSwapInt64(debug->dr2);
++ debug->dr3 = OSSwapInt64(debug->dr3);
++ debug->dr4 = OSSwapInt64(debug->dr4);
++ debug->dr5 = OSSwapInt64(debug->dr5);
++ debug->dr6 = OSSwapInt64(debug->dr6);
++ debug->dr7 = OSSwapInt64(debug->dr7);
+ }
+
+ void
+@@ -506,13 +515,13 @@
+
+ host_byte_sex = NXHostByteOrder();
+
+- fpu->fpu_reserved[0] = NXSwapLong(fpu->fpu_reserved[0]);
+- fpu->fpu_reserved[1] = NXSwapLong(fpu->fpu_reserved[1]);
++ fpu->fpu_reserved[0] = OSSwapInt32(fpu->fpu_reserved[0]);
++ fpu->fpu_reserved[1] = OSSwapInt32(fpu->fpu_reserved[1]);
+
+ if(target_byte_sex == host_byte_sex){
+ memcpy(&sfpc, &(fpu->fpu_fcw),
+ sizeof(struct swapped_fp_control));
+- sfpc.u.half = NXSwapShort(sfpc.u.half);
++ sfpc.u.half = OSSwapInt16(sfpc.u.half);
+ fpu->fpu_fcw.rc = sfpc.u.fields.rc;
+ fpu->fpu_fcw.pc = sfpc.u.fields.pc;
+ fpu->fpu_fcw.precis = sfpc.u.fields.precis;
+@@ -524,7 +533,7 @@
+
+ memcpy(&sfps, &(fpu->fpu_fsw),
+ sizeof(struct swapped_fp_status));
+- sfps.u.half = NXSwapShort(sfps.u.half);
++ sfps.u.half = OSSwapInt16(sfps.u.half);
+ fpu->fpu_fsw.busy = sfps.u.fields.busy;
+ fpu->fpu_fsw.c3 = sfps.u.fields.c3;
+ fpu->fpu_fsw.tos = sfps.u.fields.tos;
+@@ -549,7 +558,7 @@
+ sfpc.u.fields.zdiv = fpu->fpu_fcw.zdiv;
+ sfpc.u.fields.denorm = fpu->fpu_fcw.denorm;
+ sfpc.u.fields.invalid = fpu->fpu_fcw.invalid;
+- sfpc.u.half = NXSwapShort(sfpc.u.half);
++ sfpc.u.half = OSSwapInt16(sfpc.u.half);
+ memcpy(&(fpu->fpu_fcw), &sfpc,
+ sizeof(struct swapped_fp_control));
+
+@@ -567,20 +576,20 @@
+ sfps.u.fields.zdiv = fpu->fpu_fsw.zdiv;
+ sfps.u.fields.denorm = fpu->fpu_fsw.denorm;
+ sfps.u.fields.invalid = fpu->fpu_fsw.invalid;
+- sfps.u.half = NXSwapShort(sfps.u.half);
++ sfps.u.half = OSSwapInt16(sfps.u.half);
+ memcpy(&(fpu->fpu_fsw), &sfps,
+ sizeof(struct swapped_fp_status));
+ }
+- fpu->fpu_fop = NXSwapShort(fpu->fpu_fop);
+- fpu->fpu_ip = NXSwapLong(fpu->fpu_ip);
+- fpu->fpu_cs = NXSwapShort(fpu->fpu_cs);
+- fpu->fpu_rsrv2 = NXSwapShort(fpu->fpu_rsrv2);
+- fpu->fpu_dp = NXSwapLong(fpu->fpu_dp);
+- fpu->fpu_ds = NXSwapShort(fpu->fpu_ds);
+- fpu->fpu_rsrv3 = NXSwapShort(fpu->fpu_rsrv3);
+- fpu->fpu_mxcsr = NXSwapLong(fpu->fpu_mxcsr);
+- fpu->fpu_mxcsrmask = NXSwapLong(fpu->fpu_mxcsrmask);
+- fpu->fpu_reserved1 = NXSwapLong(fpu->fpu_reserved1);
++ fpu->fpu_fop = OSSwapInt16(fpu->fpu_fop);
++ fpu->fpu_ip = OSSwapInt32(fpu->fpu_ip);
++ fpu->fpu_cs = OSSwapInt16(fpu->fpu_cs);
++ fpu->fpu_rsrv2 = OSSwapInt16(fpu->fpu_rsrv2);
++ fpu->fpu_dp = OSSwapInt32(fpu->fpu_dp);
++ fpu->fpu_ds = OSSwapInt16(fpu->fpu_ds);
++ fpu->fpu_rsrv3 = OSSwapInt16(fpu->fpu_rsrv3);
++ fpu->fpu_mxcsr = OSSwapInt32(fpu->fpu_mxcsr);
++ fpu->fpu_mxcsrmask = OSSwapInt32(fpu->fpu_mxcsrmask);
++ fpu->fpu_reserved1 = OSSwapInt32(fpu->fpu_reserved1);
+
+ #endif /* !defined(i386_EXCEPTION_STATE_COUNT) */
+ }
+@@ -590,9 +599,9 @@
+ i386_exception_state_t *exc,
+ enum NXByteOrder target_byte_sex)
+ {
+- exc->trapno = NXSwapLong(exc->trapno);
+- exc->err = NXSwapLong(exc->err);
+- exc->faultvaddr = NXSwapLong(exc->faultvaddr);
++ exc->trapno = OSSwapInt32(exc->trapno);
++ exc->err = OSSwapInt32(exc->err);
++ exc->faultvaddr = OSSwapInt32(exc->faultvaddr);
+ }
+ #endif /* i386_THREAD_STATE == 1 */
+
+@@ -690,18 +699,18 @@
+ } ss;
+
+ enum NXByteOrder host_byte_sex;
+- unsigned long i;
++ int i;
+
+ host_byte_sex = NXHostByteOrder();
+
+- fpu->environ.ip = NXSwapLong(fpu->environ.ip);
+- fpu->environ.opcode = NXSwapShort(fpu->environ.opcode);
+- fpu->environ.dp = NXSwapLong(fpu->environ.dp);
++ fpu->environ.ip = OSSwapInt32(fpu->environ.ip);
++ fpu->environ.opcode = OSSwapInt16(fpu->environ.opcode);
++ fpu->environ.dp = OSSwapInt32(fpu->environ.dp);
+
+ if(target_byte_sex == host_byte_sex){
+ memcpy(&sfpc, &(fpu->environ.control),
+ sizeof(struct swapped_fp_control));
+- sfpc.u.half = NXSwapShort(sfpc.u.half);
++ sfpc.u.half = OSSwapInt16(sfpc.u.half);
+ fpu->environ.control.rc = sfpc.u.fields.rc;
+ fpu->environ.control.pc = sfpc.u.fields.pc;
+ fpu->environ.control.precis = sfpc.u.fields.precis;
+@@ -713,7 +722,7 @@
+
+ memcpy(&sfps, &(fpu->environ.status),
+ sizeof(struct swapped_fp_status));
+- sfps.u.half = NXSwapShort(sfps.u.half);
++ sfps.u.half = OSSwapInt16(sfps.u.half);
+ fpu->environ.status.busy = sfps.u.fields.busy;
+ fpu->environ.status.c3 = sfps.u.fields.c3;
+ fpu->environ.status.tos = sfps.u.fields.tos;
+@@ -731,7 +740,7 @@
+
+ memcpy(&sfpt, &(fpu->environ.tag),
+ sizeof(struct swapped_fp_tag));
+- sfpt.u.half = NXSwapShort(sfpt.u.half);
++ sfpt.u.half = OSSwapInt16(sfpt.u.half);
+ fpu->environ.tag.tag7 = sfpt.u.fields.tag7;
+ fpu->environ.tag.tag6 = sfpt.u.fields.tag6;
+ fpu->environ.tag.tag5 = sfpt.u.fields.tag5;
+@@ -743,14 +752,14 @@
+
+ memcpy(&ss, &(fpu->environ.cs),
+ sizeof(struct swapped_sel));
+- ss.u.half = NXSwapShort(ss.u.half);
++ ss.u.half = OSSwapInt16(ss.u.half);
+ fpu->environ.cs.index = ss.u.fields.index;
+ fpu->environ.cs.ti = ss.u.fields.ti;
+ fpu->environ.cs.rpl = ss.u.fields.rpl;
+
+ memcpy(&ss, &(fpu->environ.ds),
+ sizeof(struct swapped_sel));
+- ss.u.half = NXSwapShort(ss.u.half);
++ ss.u.half = OSSwapInt16(ss.u.half);
+ fpu->environ.ds.index = ss.u.fields.index;
+ fpu->environ.ds.ti = ss.u.fields.ti;
+ fpu->environ.ds.rpl = ss.u.fields.rpl;
+@@ -758,11 +767,11 @@
+ for(i = 0; i < 8; i++){
+ memcpy(&sfpd, &(fpu->stack.ST[i]),
+ sizeof(struct swapped_fp_data_reg));
+- fpu->stack.ST[i].mant = NXSwapShort(sfpd.mant);
+- fpu->stack.ST[i].mant1 = NXSwapShort(sfpd.mant1);
+- fpu->stack.ST[i].mant2 = NXSwapShort(sfpd.mant2);
+- fpu->stack.ST[i].mant3 = NXSwapShort(sfpd.mant3);
+- sfpd.u.half = NXSwapShort(sfpd.u.half);
++ fpu->stack.ST[i].mant = OSSwapInt16(sfpd.mant);
++ fpu->stack.ST[i].mant1 = OSSwapInt16(sfpd.mant1);
++ fpu->stack.ST[i].mant2 = OSSwapInt16(sfpd.mant2);
++ fpu->stack.ST[i].mant3 = OSSwapInt16(sfpd.mant3);
++ sfpd.u.half = OSSwapInt16(sfpd.u.half);
+ fpu->stack.ST[i].exp = sfpd.u.fields.exp;
+ fpu->stack.ST[i].sign = sfpd.u.fields.sign;
+ }
+@@ -776,7 +785,7 @@
+ sfpc.u.fields.zdiv = fpu->environ.control.zdiv;
+ sfpc.u.fields.denorm = fpu->environ.control.denorm;
+ sfpc.u.fields.invalid = fpu->environ.control.invalid;
+- sfpc.u.half = NXSwapShort(sfpc.u.half);
++ sfpc.u.half = OSSwapInt16(sfpc.u.half);
+ memcpy(&(fpu->environ.control), &sfpc,
+ sizeof(struct swapped_fp_control));
+
+@@ -794,7 +803,7 @@
+ sfps.u.fields.zdiv = fpu->environ.status.zdiv;
+ sfps.u.fields.denorm = fpu->environ.status.denorm;
+ sfps.u.fields.invalid = fpu->environ.status.invalid;
+- sfps.u.half = NXSwapShort(sfps.u.half);
++ sfps.u.half = OSSwapInt16(sfps.u.half);
+ memcpy(&(fpu->environ.status), &sfps,
+ sizeof(struct swapped_fp_status));
+
+@@ -806,32 +815,32 @@
+ sfpt.u.fields.tag2 = fpu->environ.tag.tag2;
+ sfpt.u.fields.tag1 = fpu->environ.tag.tag1;
+ sfpt.u.fields.tag0 = fpu->environ.tag.tag0;
+- sfpt.u.half = NXSwapShort(sfpt.u.half);
++ sfpt.u.half = OSSwapInt16(sfpt.u.half);
+ memcpy(&(fpu->environ.tag), &sfpt,
+ sizeof(struct swapped_fp_tag));
+
+ ss.u.fields.index = fpu->environ.cs.index;
+ ss.u.fields.ti = fpu->environ.cs.ti;
+ ss.u.fields.rpl = fpu->environ.cs.rpl;
+- ss.u.half = NXSwapShort(ss.u.half);
++ ss.u.half = OSSwapInt16(ss.u.half);
+ memcpy(&(fpu->environ.cs), &ss,
+ sizeof(struct swapped_sel));
+
+ ss.u.fields.index = fpu->environ.ds.index;
+ ss.u.fields.ti = fpu->environ.ds.ti;
+ ss.u.fields.rpl = fpu->environ.ds.rpl;
+- ss.u.half = NXSwapShort(ss.u.half);
++ ss.u.half = OSSwapInt16(ss.u.half);
+ memcpy(&(fpu->environ.cs), &ss,
+ sizeof(struct swapped_sel));
+
+ for(i = 0; i < 8; i++){
+- sfpd.mant = NXSwapShort(fpu->stack.ST[i].mant);
+- sfpd.mant1 = NXSwapShort(fpu->stack.ST[i].mant1);
+- sfpd.mant2 = NXSwapShort(fpu->stack.ST[i].mant2);
+- sfpd.mant3 = NXSwapShort(fpu->stack.ST[i].mant3);
++ sfpd.mant = OSSwapInt16(fpu->stack.ST[i].mant);
++ sfpd.mant1 = OSSwapInt16(fpu->stack.ST[i].mant1);
++ sfpd.mant2 = OSSwapInt16(fpu->stack.ST[i].mant2);
++ sfpd.mant3 = OSSwapInt16(fpu->stack.ST[i].mant3);
+ sfpd.u.fields.exp = fpu->stack.ST[i].exp;
+ sfpd.u.fields.sign = fpu->stack.ST[i].sign;
+- sfpd.u.half = NXSwapShort(sfpd.u.half);
++ sfpd.u.half = OSSwapInt16(sfpd.u.half);
+ memcpy(&(fpu->stack.ST[i]), &sfpd,
+ sizeof(struct swapped_fp_data_reg));
+ }
+@@ -857,19 +866,19 @@
+ wrtflt :1,
+ prot :1;
+ } pgfault;
+- unsigned long word;
++ uint32_t word;
+ } u;
+ } sec;
+- unsigned long word;
++ uint32_t word;
+ enum NXByteOrder host_byte_sex;
+
+ host_byte_sex = NXHostByteOrder();
+
+- exc->trapno = NXSwapLong(exc->trapno);
++ exc->trapno = OSSwapInt32(exc->trapno);
+ if(exc->trapno == 14){
+ if(target_byte_sex == host_byte_sex){
+ memcpy(&sec, &(exc->err), sizeof(struct swapped_err_code));
+- sec.u.word = NXSwapLong(sec.u.word);
++ sec.u.word = OSSwapInt32(sec.u.word);
+ exc->err.pgfault.user = sec.u.pgfault.user;
+ exc->err.pgfault.wrtflt = sec.u.pgfault.wrtflt;
+ exc->err.pgfault.prot = sec.u.pgfault.prot;
+@@ -878,16 +887,16 @@
+ sec.u.pgfault.prot = exc->err.pgfault.prot;
+ sec.u.pgfault.wrtflt = exc->err.pgfault.wrtflt;
+ sec.u.pgfault.user = exc->err.pgfault.user;
+- sec.u.word = NXSwapLong(sec.u.word);
++ sec.u.word = OSSwapInt32(sec.u.word);
+ memcpy(&(exc->err), &sec, sizeof(struct swapped_err_code));
+ }
+ }
+ else{
+ if(target_byte_sex == host_byte_sex){
+ memcpy(&sec, &(exc->err), sizeof(struct swapped_err_code));
+- sec.u.word = NXSwapLong(sec.u.word);
++ sec.u.word = OSSwapInt32(sec.u.word);
+ word = sec.u.normal.index;
+- exc->err.normal.index = NXSwapLong(word);
++ exc->err.normal.index = OSSwapInt32(word);
+ exc->err.normal.tbl = sec.u.normal.tbl;
+ exc->err.normal.ext = sec.u.normal.ext;
+ }
+@@ -895,8 +904,8 @@
+ sec.u.normal.ext = exc->err.normal.ext;
+ sec.u.normal.tbl = exc->err.normal.tbl;
+ word = exc->err.normal.index;
+- sec.u.normal.index = NXSwapLong(word);
+- sec.u.word = NXSwapLong(sec.u.word);
++ sec.u.normal.index = OSSwapInt32(word);
++ sec.u.word = OSSwapInt32(sec.u.word);
+ memcpy(&(exc->err), &sec, sizeof(struct swapped_err_code));
+ }
+ }
+@@ -907,7 +916,7 @@
+ i386_thread_cthreadstate_t *user,
+ enum NXByteOrder target_byte_sex)
+ {
+- user->self = NXSwapLong(user->self);
++ user->self = OSSwapInt32(user->self);
+ }
+ #endif /* i386_THREAD_STATE == -1 */
+ #endif /* !defined(RLD) */
+Index: odcctools-9.2-ld/libmacho/i860_swap.c
+===================================================================
+--- odcctools-9.2-ld.orig/libmacho/i860_swap.c 2013-08-15 11:27:10.000000000 +0000
++++ odcctools-9.2-ld/libmacho/i860_swap.c 2013-09-03 14:14:29.729781596 +0000
+@@ -28,34 +28,34 @@
+ struct i860_thread_state_regs *cpu,
+ enum NXByteOrder target_byte_sex)
+ {
+- unsigned long i;
++ int i;
+
+ for(i = 0; i < 31; i++)
+- cpu->ireg[i] = NXSwapLong(cpu->ireg[i]);
++ cpu->ireg[i] = OSSwapInt32(cpu->ireg[i]);
+ for(i = 0; i < 30; i++)
+- cpu->freg[i] = NXSwapLong(cpu->freg[i]);
+- cpu->psr = NXSwapLong(cpu->psr);
+- cpu->epsr = NXSwapLong(cpu->epsr);
+- cpu->db = NXSwapLong(cpu->db);
+- cpu->pc = NXSwapLong(cpu->pc);
+- cpu->_padding_ = NXSwapLong(cpu->_padding_);
+- cpu->Mres3 = NXSwapDouble(cpu->Mres3);
+- cpu->Ares3 = NXSwapDouble(cpu->Ares3);
+- cpu->Mres2 = NXSwapDouble(cpu->Mres2);
+- cpu->Ares2 = NXSwapDouble(cpu->Ares2);
+- cpu->Mres1 = NXSwapDouble(cpu->Mres1);
+- cpu->Ares1 = NXSwapDouble(cpu->Ares1);
+- cpu->Ires1 = NXSwapDouble(cpu->Ires1);
+- cpu->Lres3m = NXSwapDouble(cpu->Lres3m);
+- cpu->Lres2m = NXSwapDouble(cpu->Lres2m);
+- cpu->Lres1m = NXSwapDouble(cpu->Lres1m);
+- cpu->KR = NXSwapDouble(cpu->KR);
+- cpu->KI = NXSwapDouble(cpu->KI);
+- cpu->T = NXSwapDouble(cpu->T);
+- cpu->Fsr3 = NXSwapLong(cpu->Fsr3);
+- cpu->Fsr2 = NXSwapLong(cpu->Fsr2);
+- cpu->Fsr1 = NXSwapLong(cpu->Fsr1);
+- cpu->Mergelo32 = NXSwapLong(cpu->Mergelo32);
+- cpu->Mergehi32 = NXSwapLong(cpu->Mergehi32);
++ cpu->freg[i] = OSSwapInt32(cpu->freg[i]);
++ cpu->psr = OSSwapInt32(cpu->psr);
++ cpu->epsr = OSSwapInt32(cpu->epsr);
++ cpu->db = OSSwapInt32(cpu->db);
++ cpu->pc = OSSwapInt32(cpu->pc);
++ cpu->_padding_ = OSSwapInt32(cpu->_padding_);
++ cpu->Mres3 = OSSwapInt64(cpu->Mres3);
++ cpu->Ares3 = OSSwapInt64(cpu->Ares3);
++ cpu->Mres2 = OSSwapInt64(cpu->Mres2);
++ cpu->Ares2 = OSSwapInt64(cpu->Ares2);
++ cpu->Mres1 = OSSwapInt64(cpu->Mres1);
++ cpu->Ares1 = OSSwapInt64(cpu->Ares1);
++ cpu->Ires1 = OSSwapInt64(cpu->Ires1);
++ cpu->Lres3m = OSSwapInt64(cpu->Lres3m);
++ cpu->Lres2m = OSSwapInt64(cpu->Lres2m);
++ cpu->Lres1m = OSSwapInt64(cpu->Lres1m);
++ cpu->KR = OSSwapInt64(cpu->KR);
++ cpu->KI = OSSwapInt64(cpu->KI);
++ cpu->T = OSSwapInt64(cpu->T);
++ cpu->Fsr3 = OSSwapInt32(cpu->Fsr3);
++ cpu->Fsr2 = OSSwapInt32(cpu->Fsr2);
++ cpu->Fsr1 = OSSwapInt32(cpu->Fsr1);
++ cpu->Mergelo32 = OSSwapInt32(cpu->Mergelo32);
++ cpu->Mergehi32 = OSSwapInt32(cpu->Mergehi32);
+ }
+ #endif /* !defined(RLD) */
+Index: odcctools-9.2-ld/libmacho/m68k_swap.c
+===================================================================
+--- odcctools-9.2-ld.orig/libmacho/m68k_swap.c 2013-08-15 11:27:10.000000000 +0000
++++ odcctools-9.2-ld/libmacho/m68k_swap.c 2013-09-03 14:14:46.537783795 +0000
+@@ -28,15 +28,15 @@
+ struct m68k_thread_state_regs *cpu,
+ enum NXByteOrder target_byte_sex)
+ {
+- unsigned long i;
++ uint32_t i;
+
+ for(i = 0; i < 8; i++)
+- cpu->dreg[i] = NXSwapLong(cpu->dreg[i]);
++ cpu->dreg[i] = OSSwapInt32(cpu->dreg[i]);
+ for(i = 0; i < 8; i++)
+- cpu->areg[i] = NXSwapLong(cpu->areg[i]);
+- cpu->pad0 = NXSwapShort(cpu->pad0);
+- cpu->sr = NXSwapShort(cpu->sr);
+- cpu->pc = NXSwapLong(cpu->pc);
++ cpu->areg[i] = OSSwapInt32(cpu->areg[i]);
++ cpu->pad0 = OSSwapInt16(cpu->pad0);
++ cpu->sr = OSSwapInt16(cpu->sr);
++ cpu->pc = OSSwapInt32(cpu->pc);
+ }
+
+ void
+@@ -44,18 +44,18 @@
+ struct m68k_thread_state_68882 *fpu,
+ enum NXByteOrder target_byte_sex)
+ {
+- unsigned long i, tmp;
++ uint32_t i, tmp;
+
+ for(i = 0; i < 8; i++){
+- tmp = NXSwapLong(fpu->regs[i].fp[0]);
+- fpu->regs[i].fp[1] = NXSwapLong(fpu->regs[i].fp[1]);
+- fpu->regs[i].fp[0] = NXSwapLong(fpu->regs[i].fp[2]);
++ tmp = OSSwapInt32(fpu->regs[i].fp[0]);
++ fpu->regs[i].fp[1] = OSSwapInt32(fpu->regs[i].fp[1]);
++ fpu->regs[i].fp[0] = OSSwapInt32(fpu->regs[i].fp[2]);
+ fpu->regs[i].fp[2] = tmp;
+ }
+- fpu->cr = NXSwapLong(fpu->cr);
+- fpu->sr = NXSwapLong(fpu->sr);
+- fpu->iar = NXSwapLong(fpu->iar);
+- fpu->state = NXSwapLong(fpu->state);
++ fpu->cr = OSSwapInt32(fpu->cr);
++ fpu->sr = OSSwapInt32(fpu->sr);
++ fpu->iar = OSSwapInt32(fpu->iar);
++ fpu->state = OSSwapInt32(fpu->state);
+ }
+
+ void
+@@ -63,6 +63,6 @@
+ struct m68k_thread_state_user_reg *user_reg,
+ enum NXByteOrder target_byte_sex)
+ {
+- user_reg->user_reg = NXSwapLong(user_reg->user_reg);
++ user_reg->user_reg = OSSwapInt32(user_reg->user_reg);
+ }
+ #endif /* !defined(RLD) */
+Index: odcctools-9.2-ld/libmacho/m88k_swap.c
+===================================================================
+--- odcctools-9.2-ld.orig/libmacho/m88k_swap.c 2013-08-15 11:27:10.000000000 +0000
++++ odcctools-9.2-ld/libmacho/m88k_swap.c 2013-09-03 14:15:30.353782975 +0000
+@@ -30,40 +30,40 @@
+ m88k_thread_state_grf_t *cpu,
+ enum NXByteOrder target_byte_sex)
+ {
+- cpu->r1 = NXSwapLong(cpu->r1);
+- cpu->r2 = NXSwapLong(cpu->r2);
+- cpu->r3 = NXSwapLong(cpu->r3);
+- cpu->r4 = NXSwapLong(cpu->r4);
+- cpu->r5 = NXSwapLong(cpu->r5);
+- cpu->r6 = NXSwapLong(cpu->r6);
+- cpu->r7 = NXSwapLong(cpu->r7);
+- cpu->r8 = NXSwapLong(cpu->r8);
+- cpu->r9 = NXSwapLong(cpu->r9);
+- cpu->r10 = NXSwapLong(cpu->r10);
+- cpu->r11 = NXSwapLong(cpu->r11);
+- cpu->r12 = NXSwapLong(cpu->r12);
+- cpu->r13 = NXSwapLong(cpu->r13);
+- cpu->r14 = NXSwapLong(cpu->r14);
+- cpu->r15 = NXSwapLong(cpu->r15);
+- cpu->r16 = NXSwapLong(cpu->r16);
+- cpu->r17 = NXSwapLong(cpu->r17);
+- cpu->r18 = NXSwapLong(cpu->r18);
+- cpu->r19 = NXSwapLong(cpu->r19);
+- cpu->r20 = NXSwapLong(cpu->r20);
+- cpu->r21 = NXSwapLong(cpu->r21);
+- cpu->r22 = NXSwapLong(cpu->r22);
+- cpu->r23 = NXSwapLong(cpu->r23);
+- cpu->r24 = NXSwapLong(cpu->r24);
+- cpu->r25 = NXSwapLong(cpu->r25);
+- cpu->r26 = NXSwapLong(cpu->r26);
+- cpu->r27 = NXSwapLong(cpu->r27);
+- cpu->r28 = NXSwapLong(cpu->r28);
+- cpu->r29 = NXSwapLong(cpu->r29);
+- cpu->r30 = NXSwapLong(cpu->r30);
+- cpu->r31 = NXSwapLong(cpu->r31);
+- cpu->xip = NXSwapLong(cpu->xip);
+- cpu->xip_in_bd = NXSwapLong(cpu->xip_in_bd);
+- cpu->nip = NXSwapLong(cpu->nip);
++ cpu->r1 = OSSwapInt32(cpu->r1);
++ cpu->r2 = OSSwapInt32(cpu->r2);
++ cpu->r3 = OSSwapInt32(cpu->r3);
++ cpu->r4 = OSSwapInt32(cpu->r4);
++ cpu->r5 = OSSwapInt32(cpu->r5);
++ cpu->r6 = OSSwapInt32(cpu->r6);
++ cpu->r7 = OSSwapInt32(cpu->r7);
++ cpu->r8 = OSSwapInt32(cpu->r8);
++ cpu->r9 = OSSwapInt32(cpu->r9);
++ cpu->r10 = OSSwapInt32(cpu->r10);
++ cpu->r11 = OSSwapInt32(cpu->r11);
++ cpu->r12 = OSSwapInt32(cpu->r12);
++ cpu->r13 = OSSwapInt32(cpu->r13);
++ cpu->r14 = OSSwapInt32(cpu->r14);
++ cpu->r15 = OSSwapInt32(cpu->r15);
++ cpu->r16 = OSSwapInt32(cpu->r16);
++ cpu->r17 = OSSwapInt32(cpu->r17);
++ cpu->r18 = OSSwapInt32(cpu->r18);
++ cpu->r19 = OSSwapInt32(cpu->r19);
++ cpu->r20 = OSSwapInt32(cpu->r20);
++ cpu->r21 = OSSwapInt32(cpu->r21);
++ cpu->r22 = OSSwapInt32(cpu->r22);
++ cpu->r23 = OSSwapInt32(cpu->r23);
++ cpu->r24 = OSSwapInt32(cpu->r24);
++ cpu->r25 = OSSwapInt32(cpu->r25);
++ cpu->r26 = OSSwapInt32(cpu->r26);
++ cpu->r27 = OSSwapInt32(cpu->r27);
++ cpu->r28 = OSSwapInt32(cpu->r28);
++ cpu->r29 = OSSwapInt32(cpu->r29);
++ cpu->r30 = OSSwapInt32(cpu->r30);
++ cpu->r31 = OSSwapInt32(cpu->r31);
++ cpu->xip = OSSwapInt32(cpu->xip);
++ cpu->xip_in_bd = OSSwapInt32(cpu->xip_in_bd);
++ cpu->nip = OSSwapInt32(cpu->nip);
+ }
+
+ void
+@@ -85,7 +85,7 @@
+ unsigned xmod:BIT_WIDTH(16);
+ unsigned :BITS_WIDTH(31,17);
+ } fields;
+- unsigned long word;
++ uint32_t word;
+ } u;
+ } ssr;
+ struct swapped_m88k_fpcr {
+@@ -100,140 +100,140 @@
+ m88k_fpcr_rm_t rm:BITS_WIDTH(15,14);
+ unsigned :BITS_WIDTH(31,16);
+ } fields;
+- unsigned long word;
++ uint32_t word;
+ } u;
+ } scr;
+
+ host_byte_sex = NXHostByteOrder();
+
+- fpu->x1.x[0] = NXSwapLong(fpu->x1.x[0]);
+- fpu->x1.x[1] = NXSwapLong(fpu->x1.x[1]);
+- fpu->x1.x[2] = NXSwapLong(fpu->x1.x[2]);
+- fpu->x1.x[3] = NXSwapLong(fpu->x1.x[3]);
+- fpu->x2.x[0] = NXSwapLong(fpu->x2.x[0]);
+- fpu->x2.x[1] = NXSwapLong(fpu->x2.x[1]);
+- fpu->x2.x[2] = NXSwapLong(fpu->x2.x[2]);
+- fpu->x2.x[3] = NXSwapLong(fpu->x2.x[3]);
+- fpu->x3.x[0] = NXSwapLong(fpu->x3.x[0]);
+- fpu->x3.x[1] = NXSwapLong(fpu->x3.x[1]);
+- fpu->x3.x[2] = NXSwapLong(fpu->x3.x[2]);
+- fpu->x3.x[3] = NXSwapLong(fpu->x3.x[3]);
+- fpu->x4.x[0] = NXSwapLong(fpu->x4.x[0]);
+- fpu->x4.x[1] = NXSwapLong(fpu->x4.x[1]);
+- fpu->x4.x[2] = NXSwapLong(fpu->x4.x[2]);
+- fpu->x4.x[3] = NXSwapLong(fpu->x4.x[3]);
+- fpu->x5.x[0] = NXSwapLong(fpu->x5.x[0]);
+- fpu->x5.x[1] = NXSwapLong(fpu->x5.x[1]);
+- fpu->x5.x[2] = NXSwapLong(fpu->x5.x[2]);
+- fpu->x5.x[3] = NXSwapLong(fpu->x5.x[3]);
+- fpu->x6.x[0] = NXSwapLong(fpu->x6.x[0]);
+- fpu->x6.x[1] = NXSwapLong(fpu->x6.x[1]);
+- fpu->x6.x[2] = NXSwapLong(fpu->x6.x[2]);
+- fpu->x6.x[3] = NXSwapLong(fpu->x6.x[3]);
+- fpu->x7.x[0] = NXSwapLong(fpu->x7.x[0]);
+- fpu->x7.x[1] = NXSwapLong(fpu->x7.x[1]);
+- fpu->x7.x[2] = NXSwapLong(fpu->x7.x[2]);
+- fpu->x7.x[3] = NXSwapLong(fpu->x7.x[3]);
+- fpu->x8.x[0] = NXSwapLong(fpu->x8.x[0]);
+- fpu->x8.x[1] = NXSwapLong(fpu->x8.x[1]);
+- fpu->x8.x[2] = NXSwapLong(fpu->x8.x[2]);
+- fpu->x8.x[3] = NXSwapLong(fpu->x8.x[3]);
+- fpu->x9.x[0] = NXSwapLong(fpu->x9.x[0]);
+- fpu->x9.x[1] = NXSwapLong(fpu->x9.x[1]);
+- fpu->x9.x[2] = NXSwapLong(fpu->x9.x[2]);
+- fpu->x9.x[3] = NXSwapLong(fpu->x9.x[3]);
+- fpu->x10.x[0] = NXSwapLong(fpu->x10.x[0]);
+- fpu->x10.x[1] = NXSwapLong(fpu->x10.x[1]);
+- fpu->x10.x[2] = NXSwapLong(fpu->x10.x[2]);
+- fpu->x10.x[3] = NXSwapLong(fpu->x10.x[3]);
+- fpu->x11.x[0] = NXSwapLong(fpu->x11.x[0]);
+- fpu->x11.x[1] = NXSwapLong(fpu->x11.x[1]);
+- fpu->x11.x[2] = NXSwapLong(fpu->x11.x[2]);
+- fpu->x11.x[3] = NXSwapLong(fpu->x11.x[3]);
+- fpu->x12.x[0] = NXSwapLong(fpu->x12.x[0]);
+- fpu->x12.x[1] = NXSwapLong(fpu->x12.x[1]);
+- fpu->x12.x[2] = NXSwapLong(fpu->x12.x[2]);
+- fpu->x12.x[3] = NXSwapLong(fpu->x12.x[3]);
+- fpu->x13.x[0] = NXSwapLong(fpu->x13.x[0]);
+- fpu->x13.x[1] = NXSwapLong(fpu->x13.x[1]);
+- fpu->x13.x[2] = NXSwapLong(fpu->x13.x[2]);
+- fpu->x13.x[3] = NXSwapLong(fpu->x13.x[3]);
+- fpu->x14.x[0] = NXSwapLong(fpu->x14.x[0]);
+- fpu->x14.x[1] = NXSwapLong(fpu->x14.x[1]);
+- fpu->x14.x[2] = NXSwapLong(fpu->x14.x[2]);
+- fpu->x14.x[3] = NXSwapLong(fpu->x14.x[3]);
+- fpu->x15.x[0] = NXSwapLong(fpu->x15.x[0]);
+- fpu->x15.x[1] = NXSwapLong(fpu->x15.x[1]);
+- fpu->x15.x[2] = NXSwapLong(fpu->x15.x[2]);
+- fpu->x15.x[3] = NXSwapLong(fpu->x15.x[3]);
+- fpu->x16.x[0] = NXSwapLong(fpu->x16.x[0]);
+- fpu->x16.x[1] = NXSwapLong(fpu->x16.x[1]);
+- fpu->x16.x[2] = NXSwapLong(fpu->x16.x[2]);
+- fpu->x16.x[3] = NXSwapLong(fpu->x16.x[3]);
+- fpu->x17.x[0] = NXSwapLong(fpu->x17.x[0]);
+- fpu->x17.x[1] = NXSwapLong(fpu->x17.x[1]);
+- fpu->x17.x[2] = NXSwapLong(fpu->x17.x[2]);
+- fpu->x17.x[3] = NXSwapLong(fpu->x17.x[3]);
+- fpu->x18.x[0] = NXSwapLong(fpu->x18.x[0]);
+- fpu->x18.x[1] = NXSwapLong(fpu->x18.x[1]);
+- fpu->x18.x[2] = NXSwapLong(fpu->x18.x[2]);
+- fpu->x18.x[3] = NXSwapLong(fpu->x18.x[3]);
+- fpu->x19.x[0] = NXSwapLong(fpu->x19.x[0]);
+- fpu->x19.x[1] = NXSwapLong(fpu->x19.x[1]);
+- fpu->x19.x[2] = NXSwapLong(fpu->x19.x[2]);
+- fpu->x19.x[3] = NXSwapLong(fpu->x19.x[3]);
+- fpu->x20.x[0] = NXSwapLong(fpu->x20.x[0]);
+- fpu->x20.x[1] = NXSwapLong(fpu->x20.x[1]);
+- fpu->x20.x[2] = NXSwapLong(fpu->x20.x[2]);
+- fpu->x20.x[3] = NXSwapLong(fpu->x20.x[3]);
+- fpu->x21.x[0] = NXSwapLong(fpu->x21.x[0]);
+- fpu->x21.x[1] = NXSwapLong(fpu->x21.x[1]);
+- fpu->x21.x[2] = NXSwapLong(fpu->x21.x[2]);
+- fpu->x21.x[3] = NXSwapLong(fpu->x21.x[3]);
+- fpu->x22.x[0] = NXSwapLong(fpu->x22.x[0]);
+- fpu->x22.x[1] = NXSwapLong(fpu->x22.x[1]);
+- fpu->x22.x[2] = NXSwapLong(fpu->x22.x[2]);
+- fpu->x22.x[3] = NXSwapLong(fpu->x22.x[3]);
+- fpu->x23.x[0] = NXSwapLong(fpu->x23.x[0]);
+- fpu->x23.x[1] = NXSwapLong(fpu->x23.x[1]);
+- fpu->x23.x[2] = NXSwapLong(fpu->x23.x[2]);
+- fpu->x23.x[3] = NXSwapLong(fpu->x23.x[3]);
+- fpu->x24.x[0] = NXSwapLong(fpu->x24.x[0]);
+- fpu->x24.x[1] = NXSwapLong(fpu->x24.x[1]);
+- fpu->x24.x[2] = NXSwapLong(fpu->x24.x[2]);
+- fpu->x24.x[3] = NXSwapLong(fpu->x24.x[3]);
+- fpu->x25.x[0] = NXSwapLong(fpu->x25.x[0]);
+- fpu->x25.x[1] = NXSwapLong(fpu->x25.x[1]);
+- fpu->x25.x[2] = NXSwapLong(fpu->x25.x[2]);
+- fpu->x25.x[3] = NXSwapLong(fpu->x25.x[3]);
+- fpu->x26.x[0] = NXSwapLong(fpu->x26.x[0]);
+- fpu->x26.x[1] = NXSwapLong(fpu->x26.x[1]);
+- fpu->x26.x[2] = NXSwapLong(fpu->x26.x[2]);
+- fpu->x26.x[3] = NXSwapLong(fpu->x26.x[3]);
+- fpu->x27.x[0] = NXSwapLong(fpu->x27.x[0]);
+- fpu->x27.x[1] = NXSwapLong(fpu->x27.x[1]);
+- fpu->x27.x[2] = NXSwapLong(fpu->x27.x[2]);
+- fpu->x27.x[3] = NXSwapLong(fpu->x27.x[3]);
+- fpu->x28.x[0] = NXSwapLong(fpu->x28.x[0]);
+- fpu->x28.x[1] = NXSwapLong(fpu->x28.x[1]);
+- fpu->x28.x[2] = NXSwapLong(fpu->x28.x[2]);
+- fpu->x28.x[3] = NXSwapLong(fpu->x28.x[3]);
+- fpu->x29.x[0] = NXSwapLong(fpu->x29.x[0]);
+- fpu->x29.x[1] = NXSwapLong(fpu->x29.x[1]);
+- fpu->x29.x[2] = NXSwapLong(fpu->x29.x[2]);
+- fpu->x29.x[3] = NXSwapLong(fpu->x29.x[3]);
+- fpu->x30.x[0] = NXSwapLong(fpu->x30.x[0]);
+- fpu->x30.x[1] = NXSwapLong(fpu->x30.x[1]);
+- fpu->x30.x[2] = NXSwapLong(fpu->x30.x[2]);
+- fpu->x30.x[3] = NXSwapLong(fpu->x30.x[3]);
+- fpu->x31.x[0] = NXSwapLong(fpu->x31.x[0]);
+- fpu->x31.x[1] = NXSwapLong(fpu->x31.x[1]);
+- fpu->x31.x[2] = NXSwapLong(fpu->x31.x[2]);
+- fpu->x31.x[3] = NXSwapLong(fpu->x31.x[3]);
++ fpu->x1.x[0] = OSSwapInt32(fpu->x1.x[0]);
++ fpu->x1.x[1] = OSSwapInt32(fpu->x1.x[1]);
++ fpu->x1.x[2] = OSSwapInt32(fpu->x1.x[2]);
++ fpu->x1.x[3] = OSSwapInt32(fpu->x1.x[3]);
++ fpu->x2.x[0] = OSSwapInt32(fpu->x2.x[0]);
++ fpu->x2.x[1] = OSSwapInt32(fpu->x2.x[1]);
++ fpu->x2.x[2] = OSSwapInt32(fpu->x2.x[2]);
++ fpu->x2.x[3] = OSSwapInt32(fpu->x2.x[3]);
++ fpu->x3.x[0] = OSSwapInt32(fpu->x3.x[0]);
++ fpu->x3.x[1] = OSSwapInt32(fpu->x3.x[1]);
++ fpu->x3.x[2] = OSSwapInt32(fpu->x3.x[2]);
++ fpu->x3.x[3] = OSSwapInt32(fpu->x3.x[3]);
++ fpu->x4.x[0] = OSSwapInt32(fpu->x4.x[0]);
++ fpu->x4.x[1] = OSSwapInt32(fpu->x4.x[1]);
++ fpu->x4.x[2] = OSSwapInt32(fpu->x4.x[2]);
++ fpu->x4.x[3] = OSSwapInt32(fpu->x4.x[3]);
++ fpu->x5.x[0] = OSSwapInt32(fpu->x5.x[0]);
++ fpu->x5.x[1] = OSSwapInt32(fpu->x5.x[1]);
++ fpu->x5.x[2] = OSSwapInt32(fpu->x5.x[2]);
++ fpu->x5.x[3] = OSSwapInt32(fpu->x5.x[3]);
++ fpu->x6.x[0] = OSSwapInt32(fpu->x6.x[0]);
++ fpu->x6.x[1] = OSSwapInt32(fpu->x6.x[1]);
++ fpu->x6.x[2] = OSSwapInt32(fpu->x6.x[2]);
++ fpu->x6.x[3] = OSSwapInt32(fpu->x6.x[3]);
++ fpu->x7.x[0] = OSSwapInt32(fpu->x7.x[0]);
++ fpu->x7.x[1] = OSSwapInt32(fpu->x7.x[1]);
++ fpu->x7.x[2] = OSSwapInt32(fpu->x7.x[2]);
++ fpu->x7.x[3] = OSSwapInt32(fpu->x7.x[3]);
++ fpu->x8.x[0] = OSSwapInt32(fpu->x8.x[0]);
++ fpu->x8.x[1] = OSSwapInt32(fpu->x8.x[1]);
++ fpu->x8.x[2] = OSSwapInt32(fpu->x8.x[2]);
++ fpu->x8.x[3] = OSSwapInt32(fpu->x8.x[3]);
++ fpu->x9.x[0] = OSSwapInt32(fpu->x9.x[0]);
++ fpu->x9.x[1] = OSSwapInt32(fpu->x9.x[1]);
++ fpu->x9.x[2] = OSSwapInt32(fpu->x9.x[2]);
++ fpu->x9.x[3] = OSSwapInt32(fpu->x9.x[3]);
++ fpu->x10.x[0] = OSSwapInt32(fpu->x10.x[0]);
++ fpu->x10.x[1] = OSSwapInt32(fpu->x10.x[1]);
++ fpu->x10.x[2] = OSSwapInt32(fpu->x10.x[2]);
++ fpu->x10.x[3] = OSSwapInt32(fpu->x10.x[3]);
++ fpu->x11.x[0] = OSSwapInt32(fpu->x11.x[0]);
++ fpu->x11.x[1] = OSSwapInt32(fpu->x11.x[1]);
++ fpu->x11.x[2] = OSSwapInt32(fpu->x11.x[2]);
++ fpu->x11.x[3] = OSSwapInt32(fpu->x11.x[3]);
++ fpu->x12.x[0] = OSSwapInt32(fpu->x12.x[0]);
++ fpu->x12.x[1] = OSSwapInt32(fpu->x12.x[1]);
++ fpu->x12.x[2] = OSSwapInt32(fpu->x12.x[2]);
++ fpu->x12.x[3] = OSSwapInt32(fpu->x12.x[3]);
++ fpu->x13.x[0] = OSSwapInt32(fpu->x13.x[0]);
++ fpu->x13.x[1] = OSSwapInt32(fpu->x13.x[1]);
++ fpu->x13.x[2] = OSSwapInt32(fpu->x13.x[2]);
++ fpu->x13.x[3] = OSSwapInt32(fpu->x13.x[3]);
++ fpu->x14.x[0] = OSSwapInt32(fpu->x14.x[0]);
++ fpu->x14.x[1] = OSSwapInt32(fpu->x14.x[1]);
++ fpu->x14.x[2] = OSSwapInt32(fpu->x14.x[2]);
++ fpu->x14.x[3] = OSSwapInt32(fpu->x14.x[3]);
++ fpu->x15.x[0] = OSSwapInt32(fpu->x15.x[0]);
++ fpu->x15.x[1] = OSSwapInt32(fpu->x15.x[1]);
++ fpu->x15.x[2] = OSSwapInt32(fpu->x15.x[2]);
++ fpu->x15.x[3] = OSSwapInt32(fpu->x15.x[3]);
++ fpu->x16.x[0] = OSSwapInt32(fpu->x16.x[0]);
++ fpu->x16.x[1] = OSSwapInt32(fpu->x16.x[1]);
++ fpu->x16.x[2] = OSSwapInt32(fpu->x16.x[2]);
++ fpu->x16.x[3] = OSSwapInt32(fpu->x16.x[3]);
++ fpu->x17.x[0] = OSSwapInt32(fpu->x17.x[0]);
++ fpu->x17.x[1] = OSSwapInt32(fpu->x17.x[1]);
++ fpu->x17.x[2] = OSSwapInt32(fpu->x17.x[2]);
++ fpu->x17.x[3] = OSSwapInt32(fpu->x17.x[3]);
++ fpu->x18.x[0] = OSSwapInt32(fpu->x18.x[0]);
++ fpu->x18.x[1] = OSSwapInt32(fpu->x18.x[1]);
++ fpu->x18.x[2] = OSSwapInt32(fpu->x18.x[2]);
++ fpu->x18.x[3] = OSSwapInt32(fpu->x18.x[3]);
++ fpu->x19.x[0] = OSSwapInt32(fpu->x19.x[0]);
++ fpu->x19.x[1] = OSSwapInt32(fpu->x19.x[1]);
++ fpu->x19.x[2] = OSSwapInt32(fpu->x19.x[2]);
++ fpu->x19.x[3] = OSSwapInt32(fpu->x19.x[3]);
++ fpu->x20.x[0] = OSSwapInt32(fpu->x20.x[0]);
++ fpu->x20.x[1] = OSSwapInt32(fpu->x20.x[1]);
++ fpu->x20.x[2] = OSSwapInt32(fpu->x20.x[2]);
++ fpu->x20.x[3] = OSSwapInt32(fpu->x20.x[3]);
++ fpu->x21.x[0] = OSSwapInt32(fpu->x21.x[0]);
++ fpu->x21.x[1] = OSSwapInt32(fpu->x21.x[1]);
++ fpu->x21.x[2] = OSSwapInt32(fpu->x21.x[2]);
++ fpu->x21.x[3] = OSSwapInt32(fpu->x21.x[3]);
++ fpu->x22.x[0] = OSSwapInt32(fpu->x22.x[0]);
++ fpu->x22.x[1] = OSSwapInt32(fpu->x22.x[1]);
++ fpu->x22.x[2] = OSSwapInt32(fpu->x22.x[2]);
++ fpu->x22.x[3] = OSSwapInt32(fpu->x22.x[3]);
++ fpu->x23.x[0] = OSSwapInt32(fpu->x23.x[0]);
++ fpu->x23.x[1] = OSSwapInt32(fpu->x23.x[1]);
++ fpu->x23.x[2] = OSSwapInt32(fpu->x23.x[2]);
++ fpu->x23.x[3] = OSSwapInt32(fpu->x23.x[3]);
++ fpu->x24.x[0] = OSSwapInt32(fpu->x24.x[0]);
++ fpu->x24.x[1] = OSSwapInt32(fpu->x24.x[1]);
++ fpu->x24.x[2] = OSSwapInt32(fpu->x24.x[2]);
++ fpu->x24.x[3] = OSSwapInt32(fpu->x24.x[3]);
++ fpu->x25.x[0] = OSSwapInt32(fpu->x25.x[0]);
++ fpu->x25.x[1] = OSSwapInt32(fpu->x25.x[1]);
++ fpu->x25.x[2] = OSSwapInt32(fpu->x25.x[2]);
++ fpu->x25.x[3] = OSSwapInt32(fpu->x25.x[3]);
++ fpu->x26.x[0] = OSSwapInt32(fpu->x26.x[0]);
++ fpu->x26.x[1] = OSSwapInt32(fpu->x26.x[1]);
++ fpu->x26.x[2] = OSSwapInt32(fpu->x26.x[2]);
++ fpu->x26.x[3] = OSSwapInt32(fpu->x26.x[3]);
++ fpu->x27.x[0] = OSSwapInt32(fpu->x27.x[0]);
++ fpu->x27.x[1] = OSSwapInt32(fpu->x27.x[1]);
++ fpu->x27.x[2] = OSSwapInt32(fpu->x27.x[2]);
++ fpu->x27.x[3] = OSSwapInt32(fpu->x27.x[3]);
++ fpu->x28.x[0] = OSSwapInt32(fpu->x28.x[0]);
++ fpu->x28.x[1] = OSSwapInt32(fpu->x28.x[1]);
++ fpu->x28.x[2] = OSSwapInt32(fpu->x28.x[2]);
++ fpu->x28.x[3] = OSSwapInt32(fpu->x28.x[3]);
++ fpu->x29.x[0] = OSSwapInt32(fpu->x29.x[0]);
++ fpu->x29.x[1] = OSSwapInt32(fpu->x29.x[1]);
++ fpu->x29.x[2] = OSSwapInt32(fpu->x29.x[2]);
++ fpu->x29.x[3] = OSSwapInt32(fpu->x29.x[3]);
++ fpu->x30.x[0] = OSSwapInt32(fpu->x30.x[0]);
++ fpu->x30.x[1] = OSSwapInt32(fpu->x30.x[1]);
++ fpu->x30.x[2] = OSSwapInt32(fpu->x30.x[2]);
++ fpu->x30.x[3] = OSSwapInt32(fpu->x30.x[3]);
++ fpu->x31.x[0] = OSSwapInt32(fpu->x31.x[0]);
++ fpu->x31.x[1] = OSSwapInt32(fpu->x31.x[1]);
++ fpu->x31.x[2] = OSSwapInt32(fpu->x31.x[2]);
++ fpu->x31.x[3] = OSSwapInt32(fpu->x31.x[3]);
+
+ if(target_byte_sex == host_byte_sex){
+ memcpy(&ssr, &(fpu->fpsr), sizeof(struct swapped_m88k_fpsr));
+- ssr.u.word = NXSwapLong(ssr.u.word);
++ ssr.u.word = OSSwapInt32(ssr.u.word);
+ fpu->fpsr.afinx = ssr.u.fields.afinx;
+ fpu->fpsr.afovf = ssr.u.fields.afovf;
+ fpu->fpsr.afunf = ssr.u.fields.afunf;
+@@ -242,7 +242,7 @@
+ fpu->fpsr.xmod = ssr.u.fields.xmod;
+
+ memcpy(&scr, &(fpu->fpcr), sizeof(struct swapped_m88k_fpcr));
+- scr.u.word = NXSwapLong(scr.u.word);
++ scr.u.word = OSSwapInt32(scr.u.word);
+ fpu->fpcr.efinx = scr.u.fields.efinx;
+ fpu->fpcr.efovf = scr.u.fields.efovf;
+ fpu->fpcr.efunf = scr.u.fields.efunf;
+@@ -257,7 +257,7 @@
+ ssr.u.fields.afdvz = fpu->fpsr.afdvz;
+ ssr.u.fields.afinv = fpu->fpsr.afinv;
+ ssr.u.fields.xmod = fpu->fpsr.xmod;
+- ssr.u.word = NXSwapLong(ssr.u.word);
++ ssr.u.word = OSSwapInt32(ssr.u.word);
+ memcpy(&(fpu->fpsr), &ssr, sizeof(struct swapped_m88k_fpsr));
+
+ scr.u.fields.efinx = fpu->fpcr.efinx;
+@@ -266,7 +266,7 @@
+ scr.u.fields.efdvz = fpu->fpcr.efdvz;
+ scr.u.fields.efinv = fpu->fpcr.efinv;
+ scr.u.fields.rm = fpu->fpcr.rm;
+- scr.u.word = NXSwapLong(scr.u.word);
++ scr.u.word = OSSwapInt32(scr.u.word);
+ memcpy(&(fpu->fpcr), &scr, sizeof(struct swapped_m88k_fpcr));
+ }
+ }
+@@ -276,7 +276,7 @@
+ m88k_thread_state_user_t *user,
+ enum NXByteOrder target_byte_sex)
+ {
+- user->user = NXSwapLong(user->user);
++ user->user = OSSwapInt32(user->user);
+ }
+
+ void
+@@ -284,7 +284,7 @@
+ m88110_thread_state_impl_t *spu,
+ enum NXByteOrder target_byte_sex)
+ {
+- unsigned long i;
++ uint32_t i;
+ enum NXByteOrder host_byte_sex;
+
+ struct swapped_m88110_bp_ctrl {
+@@ -297,7 +297,7 @@
+ unsigned rw:BIT_WIDTH(28);
+ unsigned :BITS_WIDTH(31,29);
+ } fields;
+- unsigned long word;
++ uint32_t word;
+ } u;
+ } sbpc;
+
+@@ -318,7 +318,7 @@
+ unsigned le:BIT_WIDTH(30);
+ unsigned supr:BIT_WIDTH(31);
+ } fields;
+- unsigned long word;
++ uint32_t word;
+ } u;
+ } spsr;
+
+@@ -338,7 +338,7 @@
+ m88110_iresult_size_t iresult_size:BITS_WIDTH(15,14);
+ unsigned :BITS_WIDTH(31,16);
+ } fields;
+- unsigned long word;
++ uint32_t word;
+ } u;
+ } sfps;
+
+@@ -346,10 +346,10 @@
+
+ if(target_byte_sex == host_byte_sex){
+ for(i = 0; i < M88110_N_DATA_BP; i++){
+- spu->data_bp[i].addr = NXSwapLong(spu->data_bp[i].addr);
++ spu->data_bp[i].addr = OSSwapInt32(spu->data_bp[i].addr);
+ memcpy(&sbpc, &(spu->data_bp[i].ctrl),
+ sizeof(struct swapped_m88110_bp_ctrl));
+- sbpc.u.word = NXSwapLong(sbpc.u.word);
++ sbpc.u.word = OSSwapInt32(sbpc.u.word);
+ spu->data_bp[i].ctrl.v = sbpc.u.fields.v;
+ spu->data_bp[i].ctrl.addr_match = sbpc.u.fields.addr_match;
+ spu->data_bp[i].ctrl.rwm = sbpc.u.fields.rwm;
+@@ -357,7 +357,7 @@
+ }
+
+ memcpy(&spsr, &(spu->psr), sizeof(struct swap_m88110_psr));
+- spsr.u.word = NXSwapLong(spsr.u.word);
++ spsr.u.word = OSSwapInt32(spsr.u.word);
+ spu->psr.mxm_dis = spsr.u.fields.mxm_dis;
+ spu->psr.sfu1dis = spsr.u.fields.sfu1dis;
+ spu->psr.trace = spsr.u.fields.trace;
+@@ -370,7 +370,7 @@
+
+ memcpy(&sfps, &(spu->fp_trap_status),
+ sizeof(struct swapped_m88110_fp_trap_status));
+- sfps.u.word = NXSwapLong(sfps.u.word);
++ sfps.u.word = OSSwapInt32(sfps.u.word);
+ spu->fp_trap_status.efinx = sfps.u.fields.efinx;
+ spu->fp_trap_status.efovf = sfps.u.fields.efovf;
+ spu->fp_trap_status.efunf = sfps.u.fields.efunf;
+@@ -383,12 +383,12 @@
+ }
+ else{
+ for(i = 0; i < M88110_N_DATA_BP; i++){
+- spu->data_bp[i].addr = NXSwapLong(spu->data_bp[i].addr);
++ spu->data_bp[i].addr = OSSwapInt32(spu->data_bp[i].addr);
+ sbpc.u.fields.v = spu->data_bp[i].ctrl.v;
+ sbpc.u.fields.addr_match = spu->data_bp[i].ctrl.addr_match;
+ sbpc.u.fields.rwm = spu->data_bp[i].ctrl.rwm;
+ sbpc.u.fields.rw = spu->data_bp[i].ctrl.rw;
+- sbpc.u.word = NXSwapLong(sbpc.u.word);
++ sbpc.u.word = OSSwapInt32(sbpc.u.word);
+ memcpy(&(spu->data_bp[i].ctrl), &sbpc,
+ sizeof(struct swapped_m88110_bp_ctrl));
+ }
+@@ -402,7 +402,7 @@
+ spsr.u.fields.se = spu->psr.se;
+ spsr.u.fields.le = spu->psr.le;
+ spsr.u.fields.supr = spu->psr.supr;
+- spsr.u.word = NXSwapLong(spsr.u.word);
++ spsr.u.word = OSSwapInt32(spsr.u.word);
+ memcpy(&(spu->psr), &spsr, sizeof(struct swap_m88110_psr));
+
+ sfps.u.fields.efinx = spu->fp_trap_status.efinx;
+@@ -414,17 +414,17 @@
+ sfps.u.fields.unimp = spu->fp_trap_status.unimp;
+ sfps.u.fields.sfu1_disabled = spu->fp_trap_status.sfu1_disabled;
+ sfps.u.fields.iresult_size = spu->fp_trap_status.iresult_size;
+- sfps.u.word = NXSwapLong(sfps.u.word);
++ sfps.u.word = OSSwapInt32(sfps.u.word);
+ memcpy(&(spu->fp_trap_status), &sfps,
+ sizeof(struct swapped_m88110_fp_trap_status));
+ }
+ spu->intermediate_result.x[0] =
+- NXSwapLong(spu->intermediate_result.x[0]);
++ OSSwapInt32(spu->intermediate_result.x[0]);
+ spu->intermediate_result.x[1] =
+- NXSwapLong(spu->intermediate_result.x[1]);
++ OSSwapInt32(spu->intermediate_result.x[1]);
+ spu->intermediate_result.x[2] =
+- NXSwapLong(spu->intermediate_result.x[2]);
++ OSSwapInt32(spu->intermediate_result.x[2]);
+ spu->intermediate_result.x[3] =
+- NXSwapLong(spu->intermediate_result.x[3]);
++ OSSwapInt32(spu->intermediate_result.x[3]);
+ }
+ #endif /* !defined(RLD) */
+Index: odcctools-9.2-ld/libmacho/ppc_swap.c
+===================================================================
+--- odcctools-9.2-ld.orig/libmacho/ppc_swap.c 2013-08-15 11:27:10.000000000 +0000
++++ odcctools-9.2-ld/libmacho/ppc_swap.c 2013-09-03 14:11:11.073788786 +0000
+@@ -79,46 +79,46 @@
+ ppc_thread_state_t *cpu,
+ enum NXByteOrder target_byte_sex)
+ {
+- cpu->srr0 = NXSwapLong(cpu->srr0);
+- cpu->srr1 = NXSwapLong(cpu->srr1);
+- cpu->r0 = NXSwapLong(cpu->r0);
+- cpu->r1 = NXSwapLong(cpu->r1);
+- cpu->r2 = NXSwapLong(cpu->r2);
+- cpu->r3 = NXSwapLong(cpu->r3);
+- cpu->r4 = NXSwapLong(cpu->r4);
+- cpu->r5 = NXSwapLong(cpu->r5);
+- cpu->r6 = NXSwapLong(cpu->r6);
+- cpu->r7 = NXSwapLong(cpu->r7);
+- cpu->r8 = NXSwapLong(cpu->r8);
+- cpu->r9 = NXSwapLong(cpu->r9);
+- cpu->r10 = NXSwapLong(cpu->r10);
+- cpu->r11 = NXSwapLong(cpu->r11);
+- cpu->r12 = NXSwapLong(cpu->r12);
+- cpu->r13 = NXSwapLong(cpu->r13);
+- cpu->r14 = NXSwapLong(cpu->r14);
+- cpu->r15 = NXSwapLong(cpu->r15);
+- cpu->r16 = NXSwapLong(cpu->r16);
+- cpu->r17 = NXSwapLong(cpu->r17);
+- cpu->r18 = NXSwapLong(cpu->r18);
+- cpu->r19 = NXSwapLong(cpu->r19);
+- cpu->r20 = NXSwapLong(cpu->r20);
+- cpu->r21 = NXSwapLong(cpu->r21);
+- cpu->r22 = NXSwapLong(cpu->r22);
+- cpu->r23 = NXSwapLong(cpu->r23);
+- cpu->r24 = NXSwapLong(cpu->r24);
+- cpu->r25 = NXSwapLong(cpu->r25);
+- cpu->r26 = NXSwapLong(cpu->r26);
+- cpu->r27 = NXSwapLong(cpu->r27);
+- cpu->r28 = NXSwapLong(cpu->r28);
+- cpu->r29 = NXSwapLong(cpu->r29);
+- cpu->r30 = NXSwapLong(cpu->r30);
+- cpu->r31 = NXSwapLong(cpu->r31);
+- cpu->lr = NXSwapLong(cpu->lr);
+- cpu->cr = NXSwapLong(cpu->cr);
+- cpu->xer = NXSwapLong(cpu->xer);
+- cpu->ctr = NXSwapLong(cpu->ctr);
+- cpu->mq = NXSwapLong(cpu->mq);
+- cpu->vrsave = NXSwapLong(cpu->vrsave);
++ cpu->srr0 = OSSwapInt32(cpu->srr0);
++ cpu->srr1 = OSSwapInt32(cpu->srr1);
++ cpu->r0 = OSSwapInt32(cpu->r0);
++ cpu->r1 = OSSwapInt32(cpu->r1);
++ cpu->r2 = OSSwapInt32(cpu->r2);
++ cpu->r3 = OSSwapInt32(cpu->r3);
++ cpu->r4 = OSSwapInt32(cpu->r4);
++ cpu->r5 = OSSwapInt32(cpu->r5);
++ cpu->r6 = OSSwapInt32(cpu->r6);
++ cpu->r7 = OSSwapInt32(cpu->r7);
++ cpu->r8 = OSSwapInt32(cpu->r8);
++ cpu->r9 = OSSwapInt32(cpu->r9);
++ cpu->r10 = OSSwapInt32(cpu->r10);
++ cpu->r11 = OSSwapInt32(cpu->r11);
++ cpu->r12 = OSSwapInt32(cpu->r12);
++ cpu->r13 = OSSwapInt32(cpu->r13);
++ cpu->r14 = OSSwapInt32(cpu->r14);
++ cpu->r15 = OSSwapInt32(cpu->r15);
++ cpu->r16 = OSSwapInt32(cpu->r16);
++ cpu->r17 = OSSwapInt32(cpu->r17);
++ cpu->r18 = OSSwapInt32(cpu->r18);
++ cpu->r19 = OSSwapInt32(cpu->r19);
++ cpu->r20 = OSSwapInt32(cpu->r20);
++ cpu->r21 = OSSwapInt32(cpu->r21);
++ cpu->r22 = OSSwapInt32(cpu->r22);
++ cpu->r23 = OSSwapInt32(cpu->r23);
++ cpu->r24 = OSSwapInt32(cpu->r24);
++ cpu->r25 = OSSwapInt32(cpu->r25);
++ cpu->r26 = OSSwapInt32(cpu->r26);
++ cpu->r27 = OSSwapInt32(cpu->r27);
++ cpu->r28 = OSSwapInt32(cpu->r28);
++ cpu->r29 = OSSwapInt32(cpu->r29);
++ cpu->r30 = OSSwapInt32(cpu->r30);
++ cpu->r31 = OSSwapInt32(cpu->r31);
++ cpu->lr = OSSwapInt32(cpu->lr);
++ cpu->cr = OSSwapInt32(cpu->cr);
++ cpu->xer = OSSwapInt32(cpu->xer);
++ cpu->ctr = OSSwapInt32(cpu->ctr);
++ cpu->mq = OSSwapInt32(cpu->mq);
++ cpu->vrsave = OSSwapInt32(cpu->vrsave);
+
+ }
+
+@@ -127,13 +127,13 @@
+ ppc_float_state_t *fpu,
+ enum NXByteOrder target_byte_sex)
+ {
+- unsigned long i;
++ uint32_t i;
+
+ for(i = 0; i < 32; i++)
+- fpu->fpregs[i] = NXSwapDouble(fpu->fpregs[i]);
++ fpu->fpregs[i] = OSSwapInt64(fpu->fpregs[i]);
+
+- fpu->fpscr_pad = NXSwapLong(fpu->fpscr_pad);
+- fpu->fpscr = NXSwapLong(fpu->fpscr);
++ fpu->fpscr_pad = OSSwapInt32(fpu->fpscr_pad);
++ fpu->fpscr = OSSwapInt32(fpu->fpscr);
+ }
+
+ void
+@@ -141,14 +141,14 @@
+ ppc_exception_state_t *state,
+ enum NXByteOrder target_byte_sex)
+ {
+- unsigned long i;
++ uint32_t i;
+
+- state->dar = NXSwapLong(state->dar);
+- state->dsisr = NXSwapLong(state->dsisr);
+- state->exception = NXSwapLong(state->exception);
+- state->pad0 = NXSwapLong(state->pad0);
++ state->dar = OSSwapInt32(state->dar);
++ state->dsisr = OSSwapInt32(state->dsisr);
++ state->exception = OSSwapInt32(state->exception);
++ state->pad0 = OSSwapInt32(state->pad0);
+
+ for(i = 0; i < 4; i++)
+- state->pad1[i] = NXSwapLong(state->pad1[i]);
++ state->pad1[i] = OSSwapInt32(state->pad1[i]);
+ }
+ #endif /* !defined(RLD) */
+Index: odcctools-9.2-ld/libmacho/sparc_swap.c
+===================================================================
+--- odcctools-9.2-ld.orig/libmacho/sparc_swap.c 2013-08-15 11:27:10.000000000 +0000
++++ odcctools-9.2-ld/libmacho/sparc_swap.c 2013-09-03 13:44:20.233826093 +0000
+@@ -54,29 +54,29 @@
+
+ host_byte_sex = NXHostByteOrder();
+
+- cpu->regs.r_pc = NXSwapLong(cpu->regs.r_pc);
+- cpu->regs.r_npc = NXSwapLong(cpu->regs.r_npc);
+- cpu->regs.r_y = NXSwapLong(cpu->regs.r_y);
+- cpu->regs.r_g1 = NXSwapLong(cpu->regs.r_g1);
+- cpu->regs.r_g2 = NXSwapLong(cpu->regs.r_g2);
+- cpu->regs.r_g3 = NXSwapLong(cpu->regs.r_g3);
+- cpu->regs.r_g4 = NXSwapLong(cpu->regs.r_g4);
+- cpu->regs.r_g5 = NXSwapLong(cpu->regs.r_g5);
+- cpu->regs.r_g6 = NXSwapLong(cpu->regs.r_g6);
+- cpu->regs.r_g7 = NXSwapLong(cpu->regs.r_g7);
+- cpu->regs.r_o0 = NXSwapLong(cpu->regs.r_o0);
+- cpu->regs.r_o1 = NXSwapLong(cpu->regs.r_o1);
+- cpu->regs.r_o2 = NXSwapLong(cpu->regs.r_o2);
+- cpu->regs.r_o3 = NXSwapLong(cpu->regs.r_o3);
+- cpu->regs.r_o4 = NXSwapLong(cpu->regs.r_o4);
+- cpu->regs.r_o5 = NXSwapLong(cpu->regs.r_o5);
+- cpu->regs.r_o6 = NXSwapLong(cpu->regs.r_o6);
+- cpu->regs.r_o7 = NXSwapLong(cpu->regs.r_o7);
++ cpu->regs.r_pc = OSSwapInt32(cpu->regs.r_pc);
++ cpu->regs.r_npc = OSSwapInt32(cpu->regs.r_npc);
++ cpu->regs.r_y = OSSwapInt32(cpu->regs.r_y);
++ cpu->regs.r_g1 = OSSwapInt32(cpu->regs.r_g1);
++ cpu->regs.r_g2 = OSSwapInt32(cpu->regs.r_g2);
++ cpu->regs.r_g3 = OSSwapInt32(cpu->regs.r_g3);
++ cpu->regs.r_g4 = OSSwapInt32(cpu->regs.r_g4);
++ cpu->regs.r_g5 = OSSwapInt32(cpu->regs.r_g5);
++ cpu->regs.r_g6 = OSSwapInt32(cpu->regs.r_g6);
++ cpu->regs.r_g7 = OSSwapInt32(cpu->regs.r_g7);
++ cpu->regs.r_o0 = OSSwapInt32(cpu->regs.r_o0);
++ cpu->regs.r_o1 = OSSwapInt32(cpu->regs.r_o1);
++ cpu->regs.r_o2 = OSSwapInt32(cpu->regs.r_o2);
++ cpu->regs.r_o3 = OSSwapInt32(cpu->regs.r_o3);
++ cpu->regs.r_o4 = OSSwapInt32(cpu->regs.r_o4);
++ cpu->regs.r_o5 = OSSwapInt32(cpu->regs.r_o5);
++ cpu->regs.r_o6 = OSSwapInt32(cpu->regs.r_o6);
++ cpu->regs.r_o7 = OSSwapInt32(cpu->regs.r_o7);
+
+ pr_status = (struct p_status *) &(cpu->regs.r_psr);
+ if(target_byte_sex == host_byte_sex){
+ memcpy(&spsr, &(cpu->regs.r_psr), sizeof(struct swapped_psr));
+- spsr.u.word = NXSwapLong(spsr.u.word);
++ spsr.u.word = OSSwapInt32(spsr.u.word);
+ pr_status->PSRREG.psr_bits.cwp = spsr.u.fields.cwp;
+ pr_status->PSRREG.psr_bits.ps = spsr.u.fields.ps;
+ pr_status->PSRREG.psr_bits.s = spsr.u.fields.s;
+@@ -99,7 +99,7 @@
+ spsr.u.fields.icc = pr_status->PSRREG.psr_bits.icc;
+ spsr.u.fields.ver = pr_status->PSRREG.psr_bits.et;
+ spsr.u.fields.impl = pr_status->PSRREG.psr_bits.impl;
+- spsr.u.word = NXSwapLong(spsr.u.word);
++ spsr.u.word = OSSwapInt32(spsr.u.word);
+ memcpy(&(cpu->regs.r_psr), &spsr, sizeof(struct swapped_psr));
+ }
+ }
+@@ -127,7 +127,7 @@
+ unsigned int word;
+ } u;
+ } sfsr;
+- unsigned long i;
++ uint32_t i;
+ struct f_status *fpu_status;
+ enum NXByteOrder host_byte_sex;
+
+@@ -137,18 +137,18 @@
+ /* floating point registers */
+ for(i = 0; i < 16; i++) /* 16 doubles */
+ fpu->fpu.fpu_fr.Fpu_dregs[i] =
+- NXSwapDouble(fpu->fpu.fpu_fr.Fpu_dregs[i]);
++ OSSwapInt64(fpu->fpu.fpu_fr.Fpu_dregs[i]);
+
+- fpu->fpu.Fpu_q[0].FQu.whole = NXSwapDouble(fpu->fpu.Fpu_q[0].FQu.whole);
+- fpu->fpu.Fpu_q[1].FQu.whole = NXSwapDouble(fpu->fpu.Fpu_q[1].FQu.whole);
+- fpu->fpu.Fpu_flags = NXSwapLong(fpu->fpu.Fpu_flags);
+- fpu->fpu.Fpu_extra = NXSwapLong(fpu->fpu.Fpu_extra);
+- fpu->fpu.Fpu_qcnt = NXSwapLong(fpu->fpu.Fpu_qcnt);
++ fpu->fpu.Fpu_q[0].FQu.whole = OSSwapInt64(fpu->fpu.Fpu_q[0].FQu.whole);
++ fpu->fpu.Fpu_q[1].FQu.whole = OSSwapInt64(fpu->fpu.Fpu_q[1].FQu.whole);
++ fpu->fpu.Fpu_flags = OSSwapInt32(fpu->fpu.Fpu_flags);
++ fpu->fpu.Fpu_extra = OSSwapInt32(fpu->fpu.Fpu_extra);
++ fpu->fpu.Fpu_qcnt = OSSwapInt32(fpu->fpu.Fpu_qcnt);
+
+ fpu_status = (struct f_status *) &(fpu->fpu.Fpu_fsr);
+ if(target_byte_sex == host_byte_sex){
+ memcpy(&sfsr, &(fpu->fpu.Fpu_fsr), sizeof(unsigned int));
+- sfsr.u.word = NXSwapLong(sfsr.u.word);
++ sfsr.u.word = OSSwapInt32(sfsr.u.word);
+ fpu_status->FPUREG.Fpu_fsr_bits.rd = sfsr.u.fields.rd;
+ fpu_status->FPUREG.Fpu_fsr_bits.rp = sfsr.u.fields.rp;
+ fpu_status->FPUREG.Fpu_fsr_bits.tem = sfsr.u.fields.tem;
+@@ -171,7 +171,7 @@
+ sfsr.u.fields.fcc = fpu_status->FPUREG.Fpu_fsr_bits.fcc;
+ sfsr.u.fields.aexc = fpu_status->FPUREG.Fpu_fsr_bits.aexc;
+ sfsr.u.fields.cexc = fpu_status->FPUREG.Fpu_fsr_bits.cexc;
+- sfsr.u.word = NXSwapLong(sfsr.u.word);
++ sfsr.u.word = OSSwapInt32(sfsr.u.word);
+ memcpy(&(fpu->fpu.Fpu_fsr), &sfsr, sizeof(struct swapped_fsr));
+ }
+ }
+Index: odcctools-9.2-ld/libmacho/swap.c
+===================================================================
+--- odcctools-9.2-ld.orig/libmacho/swap.c 2013-08-15 11:27:10.000000000 +0000
++++ odcctools-9.2-ld/libmacho/swap.c 2013-09-03 13:43:55.657826656 +0000
+@@ -22,6 +22,7 @@
+ */
+ #ifndef RLD
+ #include <stdint.h>
++#include <libkern/OSByteOrder.h>
+ #include <mach-o/swap.h>
+ #include <string.h>
+
+@@ -30,8 +31,8 @@
+ struct fat_header *fat_header,
+ enum NXByteOrder target_byte_sex)
+ {
+- fat_header->magic = NXSwapLong(fat_header->magic);
+- fat_header->nfat_arch = NXSwapLong(fat_header->nfat_arch);
++ fat_header->magic = OSSwapInt32(fat_header->magic);
++ fat_header->nfat_arch = OSSwapInt32(fat_header->nfat_arch);
+ }
+
+ void
+@@ -43,11 +44,11 @@
+ uint32_t i;
+
+ for(i = 0; i < nfat_arch; i++){
+- fat_archs[i].cputype = NXSwapLong(fat_archs[i].cputype);
+- fat_archs[i].cpusubtype = NXSwapLong(fat_archs[i].cpusubtype);
+- fat_archs[i].offset = NXSwapLong(fat_archs[i].offset);
+- fat_archs[i].size = NXSwapLong(fat_archs[i].size);
+- fat_archs[i].align = NXSwapLong(fat_archs[i].align);
++ fat_archs[i].cputype = OSSwapInt32(fat_archs[i].cputype);
++ fat_archs[i].cpusubtype = OSSwapInt32(fat_archs[i].cpusubtype);
++ fat_archs[i].offset = OSSwapInt32(fat_archs[i].offset);
++ fat_archs[i].size = OSSwapInt32(fat_archs[i].size);
++ fat_archs[i].align = OSSwapInt32(fat_archs[i].align);
+ }
+ }
+
+@@ -56,13 +57,13 @@
+ struct mach_header *mh,
+ enum NXByteOrder target_byte_sex)
+ {
+- mh->magic = NXSwapLong(mh->magic);
+- mh->cputype = NXSwapLong(mh->cputype);
+- mh->cpusubtype = NXSwapLong(mh->cpusubtype);
+- mh->filetype = NXSwapLong(mh->filetype);
+- mh->ncmds = NXSwapLong(mh->ncmds);
+- mh->sizeofcmds = NXSwapLong(mh->sizeofcmds);
+- mh->flags = NXSwapLong(mh->flags);
++ mh->magic = OSSwapInt32(mh->magic);
++ mh->cputype = OSSwapInt32(mh->cputype);
++ mh->cpusubtype = OSSwapInt32(mh->cpusubtype);
++ mh->filetype = OSSwapInt32(mh->filetype);
++ mh->ncmds = OSSwapInt32(mh->ncmds);
++ mh->sizeofcmds = OSSwapInt32(mh->sizeofcmds);
++ mh->flags = OSSwapInt32(mh->flags);
+ }
+
+ void
+@@ -70,14 +71,14 @@
+ struct mach_header_64 *mh,
+ enum NXByteOrder target_byte_sex)
+ {
+- mh->magic = NXSwapLong(mh->magic);
+- mh->cputype = NXSwapLong(mh->cputype);
+- mh->cpusubtype = NXSwapLong(mh->cpusubtype);
+- mh->filetype = NXSwapLong(mh->filetype);
+- mh->ncmds = NXSwapLong(mh->ncmds);
+- mh->sizeofcmds = NXSwapLong(mh->sizeofcmds);
+- mh->flags = NXSwapLong(mh->flags);
+- mh->reserved = NXSwapLong(mh->reserved);
++ mh->magic = OSSwapInt32(mh->magic);
++ mh->cputype = OSSwapInt32(mh->cputype);
++ mh->cpusubtype = OSSwapInt32(mh->cpusubtype);
++ mh->filetype = OSSwapInt32(mh->filetype);
++ mh->ncmds = OSSwapInt32(mh->ncmds);
++ mh->sizeofcmds = OSSwapInt32(mh->sizeofcmds);
++ mh->flags = OSSwapInt32(mh->flags);
++ mh->reserved = OSSwapInt32(mh->reserved);
+ }
+
+ void
+@@ -85,8 +86,8 @@
+ struct load_command *lc,
+ enum NXByteOrder target_byte_sex)
+ {
+- lc->cmd = NXSwapLong(lc->cmd);
+- lc->cmdsize = NXSwapLong(lc->cmdsize);
++ lc->cmd = OSSwapInt32(lc->cmd);
++ lc->cmdsize = OSSwapInt32(lc->cmdsize);
+ }
+
+ void
+@@ -95,16 +96,16 @@
+ enum NXByteOrder target_byte_sex)
+ {
+ /* segname[16] */
+- sg->cmd = NXSwapLong(sg->cmd);
+- sg->cmdsize = NXSwapLong(sg->cmdsize);
+- sg->vmaddr = NXSwapLong(sg->vmaddr);
+- sg->vmsize = NXSwapLong(sg->vmsize);
+- sg->fileoff = NXSwapLong(sg->fileoff);
+- sg->filesize = NXSwapLong(sg->filesize);
+- sg->maxprot = NXSwapLong(sg->maxprot);
+- sg->initprot = NXSwapLong(sg->initprot);
+- sg->nsects = NXSwapLong(sg->nsects);
+- sg->flags = NXSwapLong(sg->flags);
++ sg->cmd = OSSwapInt32(sg->cmd);
++ sg->cmdsize = OSSwapInt32(sg->cmdsize);
++ sg->vmaddr = OSSwapInt32(sg->vmaddr);
++ sg->vmsize = OSSwapInt32(sg->vmsize);
++ sg->fileoff = OSSwapInt32(sg->fileoff);
++ sg->filesize = OSSwapInt32(sg->filesize);
++ sg->maxprot = OSSwapInt32(sg->maxprot);
++ sg->initprot = OSSwapInt32(sg->initprot);
++ sg->nsects = OSSwapInt32(sg->nsects);
++ sg->flags = OSSwapInt32(sg->flags);
+ }
+
+ void
+@@ -113,16 +114,16 @@
+ enum NXByteOrder target_byte_sex)
+ {
+ /* char segname[16] */
+- sg->cmd = NXSwapLong(sg->cmd);
+- sg->cmdsize = NXSwapLong(sg->cmdsize);
+- sg->vmaddr = NXSwapLongLong(sg->vmaddr);
+- sg->vmsize = NXSwapLongLong(sg->vmsize);
+- sg->fileoff = NXSwapLongLong(sg->fileoff);
+- sg->filesize = NXSwapLongLong(sg->filesize);
+- sg->maxprot = NXSwapLong(sg->maxprot);
+- sg->initprot = NXSwapLong(sg->initprot);
+- sg->nsects = NXSwapLong(sg->nsects);
+- sg->flags = NXSwapLong(sg->flags);
++ sg->cmd = OSSwapInt32(sg->cmd);
++ sg->cmdsize = OSSwapInt32(sg->cmdsize);
++ sg->vmaddr = OSSwapInt64(sg->vmaddr);
++ sg->vmsize = OSSwapInt64(sg->vmsize);
++ sg->fileoff = OSSwapInt64(sg->fileoff);
++ sg->filesize = OSSwapInt64(sg->filesize);
++ sg->maxprot = OSSwapInt32(sg->maxprot);
++ sg->initprot = OSSwapInt32(sg->initprot);
++ sg->nsects = OSSwapInt32(sg->nsects);
++ sg->flags = OSSwapInt32(sg->flags);
+ }
+
+ void
+@@ -136,15 +137,15 @@
+ for(i = 0; i < nsects; i++){
+ /* sectname[16] */
+ /* segname[16] */
+- s[i].addr = NXSwapLong(s[i].addr);
+- s[i].size = NXSwapLong(s[i].size);
+- s[i].offset = NXSwapLong(s[i].offset);
+- s[i].align = NXSwapLong(s[i].align);
+- s[i].reloff = NXSwapLong(s[i].reloff);
+- s[i].nreloc = NXSwapLong(s[i].nreloc);
+- s[i].flags = NXSwapLong(s[i].flags);
+- s[i].reserved1 = NXSwapLong(s[i].reserved1);
+- s[i].reserved2 = NXSwapLong(s[i].reserved2);
++ s[i].addr = OSSwapInt32(s[i].addr);
++ s[i].size = OSSwapInt32(s[i].size);
++ s[i].offset = OSSwapInt32(s[i].offset);
++ s[i].align = OSSwapInt32(s[i].align);
++ s[i].reloff = OSSwapInt32(s[i].reloff);
++ s[i].nreloc = OSSwapInt32(s[i].nreloc);
++ s[i].flags = OSSwapInt32(s[i].flags);
++ s[i].reserved1 = OSSwapInt32(s[i].reserved1);
++ s[i].reserved2 = OSSwapInt32(s[i].reserved2);
+ }
+ }
+
+@@ -159,16 +160,16 @@
+ for(i = 0; i < nsects; i++){
+ /* sectname[16] */
+ /* segname[16] */
+- s[i].addr = NXSwapLongLong(s[i].addr);
+- s[i].size = NXSwapLongLong(s[i].size);
+- s[i].offset = NXSwapLong(s[i].offset);
+- s[i].align = NXSwapLong(s[i].align);
+- s[i].reloff = NXSwapLong(s[i].reloff);
+- s[i].nreloc = NXSwapLong(s[i].nreloc);
+- s[i].flags = NXSwapLong(s[i].flags);
+- s[i].reserved1 = NXSwapLong(s[i].reserved1);
+- s[i].reserved2 = NXSwapLong(s[i].reserved2);
+- s[i].reserved3 = NXSwapLong(s[i].reserved3);
++ s[i].addr = OSSwapInt64(s[i].addr);
++ s[i].size = OSSwapInt64(s[i].size);
++ s[i].offset = OSSwapInt32(s[i].offset);
++ s[i].align = OSSwapInt32(s[i].align);
++ s[i].reloff = OSSwapInt32(s[i].reloff);
++ s[i].nreloc = OSSwapInt32(s[i].nreloc);
++ s[i].flags = OSSwapInt32(s[i].flags);
++ s[i].reserved1 = OSSwapInt32(s[i].reserved1);
++ s[i].reserved2 = OSSwapInt32(s[i].reserved2);
++ s[i].reserved3 = OSSwapInt32(s[i].reserved3);
+ }
+ }
+
+@@ -177,12 +178,12 @@
+ struct symtab_command *st,
+ enum NXByteOrder target_byte_sex)
+ {
+- st->cmd = NXSwapLong(st->cmd);
+- st->cmdsize = NXSwapLong(st->cmdsize);
+- st->symoff = NXSwapLong(st->symoff);
+- st->nsyms = NXSwapLong(st->nsyms);
+- st->stroff = NXSwapLong(st->stroff);
+- st->strsize = NXSwapLong(st->strsize);
++ st->cmd = OSSwapInt32(st->cmd);
++ st->cmdsize = OSSwapInt32(st->cmdsize);
++ st->symoff = OSSwapInt32(st->symoff);
++ st->nsyms = OSSwapInt32(st->nsyms);
++ st->stroff = OSSwapInt32(st->stroff);
++ st->strsize = OSSwapInt32(st->strsize);
+ }
+
+ void
+@@ -190,26 +191,26 @@
+ struct dysymtab_command *dyst,
+ enum NXByteOrder target_byte_sex)
+ {
+- dyst->cmd = NXSwapLong(dyst->cmd);
+- dyst->cmdsize = NXSwapLong(dyst->cmdsize);
+- dyst->ilocalsym = NXSwapLong(dyst->ilocalsym);
+- dyst->nlocalsym = NXSwapLong(dyst->nlocalsym);
+- dyst->iextdefsym = NXSwapLong(dyst->iextdefsym);
+- dyst->nextdefsym = NXSwapLong(dyst->nextdefsym);
+- dyst->iundefsym = NXSwapLong(dyst->iundefsym);
+- dyst->nundefsym = NXSwapLong(dyst->nundefsym);
+- dyst->tocoff = NXSwapLong(dyst->tocoff);
+- dyst->ntoc = NXSwapLong(dyst->ntoc);
+- dyst->modtaboff = NXSwapLong(dyst->modtaboff);
+- dyst->nmodtab = NXSwapLong(dyst->nmodtab);
+- dyst->extrefsymoff = NXSwapLong(dyst->extrefsymoff);
+- dyst->nextrefsyms = NXSwapLong(dyst->nextrefsyms);
+- dyst->indirectsymoff = NXSwapLong(dyst->indirectsymoff);
+- dyst->nindirectsyms = NXSwapLong(dyst->nindirectsyms);
+- dyst->extreloff = NXSwapLong(dyst->extreloff);
+- dyst->nextrel = NXSwapLong(dyst->nextrel);
+- dyst->locreloff = NXSwapLong(dyst->locreloff);
+- dyst->nlocrel = NXSwapLong(dyst->nlocrel);
++ dyst->cmd = OSSwapInt32(dyst->cmd);
++ dyst->cmdsize = OSSwapInt32(dyst->cmdsize);
++ dyst->ilocalsym = OSSwapInt32(dyst->ilocalsym);
++ dyst->nlocalsym = OSSwapInt32(dyst->nlocalsym);
++ dyst->iextdefsym = OSSwapInt32(dyst->iextdefsym);
++ dyst->nextdefsym = OSSwapInt32(dyst->nextdefsym);
++ dyst->iundefsym = OSSwapInt32(dyst->iundefsym);
++ dyst->nundefsym = OSSwapInt32(dyst->nundefsym);
++ dyst->tocoff = OSSwapInt32(dyst->tocoff);
++ dyst->ntoc = OSSwapInt32(dyst->ntoc);
++ dyst->modtaboff = OSSwapInt32(dyst->modtaboff);
++ dyst->nmodtab = OSSwapInt32(dyst->nmodtab);
++ dyst->extrefsymoff = OSSwapInt32(dyst->extrefsymoff);
++ dyst->nextrefsyms = OSSwapInt32(dyst->nextrefsyms);
++ dyst->indirectsymoff = OSSwapInt32(dyst->indirectsymoff);
++ dyst->nindirectsyms = OSSwapInt32(dyst->nindirectsyms);
++ dyst->extreloff = OSSwapInt32(dyst->extreloff);
++ dyst->nextrel = OSSwapInt32(dyst->nextrel);
++ dyst->locreloff = OSSwapInt32(dyst->locreloff);
++ dyst->nlocrel = OSSwapInt32(dyst->nlocrel);
+ }
+
+ void
+@@ -217,10 +218,10 @@
+ struct symseg_command *ss,
+ enum NXByteOrder target_byte_sex)
+ {
+- ss->cmd = NXSwapLong(ss->cmd);
+- ss->cmdsize = NXSwapLong(ss->cmdsize);
+- ss->offset = NXSwapLong(ss->offset);
+- ss->size = NXSwapLong(ss->size);
++ ss->cmd = OSSwapInt32(ss->cmd);
++ ss->cmdsize = OSSwapInt32(ss->cmdsize);
++ ss->offset = OSSwapInt32(ss->offset);
++ ss->size = OSSwapInt32(ss->size);
+ }
+
+ void
+@@ -228,11 +229,11 @@
+ struct fvmlib_command *fl,
+ enum NXByteOrder target_byte_sex)
+ {
+- fl->cmd = NXSwapLong(fl->cmd);
+- fl->cmdsize = NXSwapLong(fl->cmdsize);
+- fl->fvmlib.name.offset = NXSwapLong(fl->fvmlib.name.offset);
+- fl->fvmlib.minor_version = NXSwapLong(fl->fvmlib.minor_version);
+- fl->fvmlib.header_addr = NXSwapLong(fl->fvmlib.header_addr);
++ fl->cmd = OSSwapInt32(fl->cmd);
++ fl->cmdsize = OSSwapInt32(fl->cmdsize);
++ fl->fvmlib.name.offset = OSSwapInt32(fl->fvmlib.name.offset);
++ fl->fvmlib.minor_version = OSSwapInt32(fl->fvmlib.minor_version);
++ fl->fvmlib.header_addr = OSSwapInt32(fl->fvmlib.header_addr);
+ }
+
+ void
+@@ -240,13 +241,13 @@
+ struct dylib_command *dl,
+ enum NXByteOrder target_byte_sex)
+ {
+- dl->cmd = NXSwapLong(dl->cmd);
+- dl->cmdsize = NXSwapLong(dl->cmdsize);
+- dl->dylib.name.offset = NXSwapLong(dl->dylib.name.offset);
+- dl->dylib.timestamp = NXSwapLong(dl->dylib.timestamp);
+- dl->dylib.current_version = NXSwapLong(dl->dylib.current_version);
++ dl->cmd = OSSwapInt32(dl->cmd);
++ dl->cmdsize = OSSwapInt32(dl->cmdsize);
++ dl->dylib.name.offset = OSSwapInt32(dl->dylib.name.offset);
++ dl->dylib.timestamp = OSSwapInt32(dl->dylib.timestamp);
++ dl->dylib.current_version = OSSwapInt32(dl->dylib.current_version);
+ dl->dylib.compatibility_version =
+- NXSwapLong(dl->dylib.compatibility_version);
++ OSSwapInt32(dl->dylib.compatibility_version);
+ }
+
+ void
+@@ -254,9 +255,9 @@
+ struct sub_framework_command *sub,
+ enum NXByteOrder target_byte_sex)
+ {
+- sub->cmd = NXSwapLong(sub->cmd);
+- sub->cmdsize = NXSwapLong(sub->cmdsize);
+- sub->umbrella.offset = NXSwapLong(sub->umbrella.offset);
++ sub->cmd = OSSwapInt32(sub->cmd);
++ sub->cmdsize = OSSwapInt32(sub->cmdsize);
++ sub->umbrella.offset = OSSwapInt32(sub->umbrella.offset);
+ }
+
+ void
+@@ -264,9 +265,9 @@
+ struct sub_umbrella_command *usub,
+ enum NXByteOrder target_byte_sex)
+ {
+- usub->cmd = NXSwapLong(usub->cmd);
+- usub->cmdsize = NXSwapLong(usub->cmdsize);
+- usub->sub_umbrella.offset = NXSwapLong(usub->sub_umbrella.offset);
++ usub->cmd = OSSwapInt32(usub->cmd);
++ usub->cmdsize = OSSwapInt32(usub->cmdsize);
++ usub->sub_umbrella.offset = OSSwapInt32(usub->sub_umbrella.offset);
+ }
+
+ void
+@@ -274,9 +275,9 @@
+ struct sub_library_command *lsub,
+ enum NXByteOrder target_byte_sex)
+ {
+- lsub->cmd = NXSwapLong(lsub->cmd);
+- lsub->cmdsize = NXSwapLong(lsub->cmdsize);
+- lsub->sub_library.offset = NXSwapLong(lsub->sub_library.offset);
++ lsub->cmd = OSSwapInt32(lsub->cmd);
++ lsub->cmdsize = OSSwapInt32(lsub->cmdsize);
++ lsub->sub_library.offset = OSSwapInt32(lsub->sub_library.offset);
+ }
+
+ void
+@@ -284,9 +285,9 @@
+ struct sub_client_command *csub,
+ enum NXByteOrder target_byte_sex)
+ {
+- csub->cmd = NXSwapLong(csub->cmd);
+- csub->cmdsize = NXSwapLong(csub->cmdsize);
+- csub->client.offset = NXSwapLong(csub->client.offset);
++ csub->cmd = OSSwapInt32(csub->cmd);
++ csub->cmdsize = OSSwapInt32(csub->cmdsize);
++ csub->client.offset = OSSwapInt32(csub->client.offset);
+ }
+
+
+@@ -295,12 +296,12 @@
+ struct prebound_dylib_command *pbdylib,
+ enum NXByteOrder target_byte_sex)
+ {
+- pbdylib->cmd = NXSwapLong(pbdylib->cmd);
+- pbdylib->cmdsize = NXSwapLong(pbdylib->cmdsize);
+- pbdylib->name.offset = NXSwapLong(pbdylib->name.offset);
+- pbdylib->nmodules = NXSwapLong(pbdylib->nmodules);
++ pbdylib->cmd = OSSwapInt32(pbdylib->cmd);
++ pbdylib->cmdsize = OSSwapInt32(pbdylib->cmdsize);
++ pbdylib->name.offset = OSSwapInt32(pbdylib->name.offset);
++ pbdylib->nmodules = OSSwapInt32(pbdylib->nmodules);
+ pbdylib->linked_modules.offset =
+- NXSwapLong(pbdylib->linked_modules.offset);
++ OSSwapInt32(pbdylib->linked_modules.offset);
+ }
+
+ void
+@@ -308,9 +309,9 @@
+ struct dylinker_command *dyld,
+ enum NXByteOrder target_byte_sex)
+ {
+- dyld->cmd = NXSwapLong(dyld->cmd);
+- dyld->cmdsize = NXSwapLong(dyld->cmdsize);
+- dyld->name.offset = NXSwapLong(dyld->name.offset);
++ dyld->cmd = OSSwapInt32(dyld->cmd);
++ dyld->cmdsize = OSSwapInt32(dyld->cmdsize);
++ dyld->name.offset = OSSwapInt32(dyld->name.offset);
+ }
+
+ void
+@@ -318,10 +319,10 @@
+ struct fvmfile_command *ff,
+ enum NXByteOrder target_byte_sex)
+ {
+- ff->cmd = NXSwapLong(ff->cmd);
+- ff->cmdsize = NXSwapLong(ff->cmdsize);
+- ff->name.offset = NXSwapLong(ff->name.offset);
+- ff->header_addr = NXSwapLong(ff->header_addr);
++ ff->cmd = OSSwapInt32(ff->cmd);
++ ff->cmdsize = OSSwapInt32(ff->cmdsize);
++ ff->name.offset = OSSwapInt32(ff->name.offset);
++ ff->header_addr = OSSwapInt32(ff->header_addr);
+ }
+
+
+@@ -330,8 +331,8 @@
+ struct thread_command *ut,
+ enum NXByteOrder target_byte_sex)
+ {
+- ut->cmd = NXSwapLong(ut->cmd);
+- ut->cmdsize = NXSwapLong(ut->cmdsize);
++ ut->cmd = OSSwapInt32(ut->cmd);
++ ut->cmdsize = OSSwapInt32(ut->cmdsize);
+ }
+
+ void
+@@ -339,8 +340,8 @@
+ struct ident_command *id_cmd,
+ enum NXByteOrder target_byte_sex)
+ {
+- id_cmd->cmd = NXSwapLong(id_cmd->cmd);
+- id_cmd->cmdsize = NXSwapLong(id_cmd->cmdsize);
++ id_cmd->cmd = OSSwapInt32(id_cmd->cmd);
++ id_cmd->cmdsize = OSSwapInt32(id_cmd->cmdsize);
+ }
+
+ void
+@@ -348,16 +349,16 @@
+ struct routines_command *r_cmd,
+ enum NXByteOrder target_byte_sex)
+ {
+- r_cmd->cmd = NXSwapLong(r_cmd->cmd);
+- r_cmd->cmdsize = NXSwapLong(r_cmd->cmdsize);
+- r_cmd->init_address = NXSwapLong(r_cmd->init_address);
+- r_cmd->init_module = NXSwapLong(r_cmd->init_module);
+- r_cmd->reserved1 = NXSwapLong(r_cmd->reserved1);
+- r_cmd->reserved2 = NXSwapLong(r_cmd->reserved2);
+- r_cmd->reserved3 = NXSwapLong(r_cmd->reserved3);
+- r_cmd->reserved4 = NXSwapLong(r_cmd->reserved4);
+- r_cmd->reserved5 = NXSwapLong(r_cmd->reserved5);
+- r_cmd->reserved6 = NXSwapLong(r_cmd->reserved6);
++ r_cmd->cmd = OSSwapInt32(r_cmd->cmd);
++ r_cmd->cmdsize = OSSwapInt32(r_cmd->cmdsize);
++ r_cmd->init_address = OSSwapInt32(r_cmd->init_address);
++ r_cmd->init_module = OSSwapInt32(r_cmd->init_module);
++ r_cmd->reserved1 = OSSwapInt32(r_cmd->reserved1);
++ r_cmd->reserved2 = OSSwapInt32(r_cmd->reserved2);
++ r_cmd->reserved3 = OSSwapInt32(r_cmd->reserved3);
++ r_cmd->reserved4 = OSSwapInt32(r_cmd->reserved4);
++ r_cmd->reserved5 = OSSwapInt32(r_cmd->reserved5);
++ r_cmd->reserved6 = OSSwapInt32(r_cmd->reserved6);
+ }
+
+ void
+@@ -365,16 +366,16 @@
+ struct routines_command_64 *r_cmd,
+ enum NXByteOrder target_byte_sex)
+ {
+- r_cmd->cmd = NXSwapLong(r_cmd->cmd);
+- r_cmd->cmdsize = NXSwapLong(r_cmd->cmdsize);
+- r_cmd->init_address = NXSwapLongLong(r_cmd->init_address);
+- r_cmd->init_module = NXSwapLongLong(r_cmd->init_module);
+- r_cmd->reserved1 = NXSwapLongLong(r_cmd->reserved1);
+- r_cmd->reserved2 = NXSwapLongLong(r_cmd->reserved2);
+- r_cmd->reserved3 = NXSwapLongLong(r_cmd->reserved3);
+- r_cmd->reserved4 = NXSwapLongLong(r_cmd->reserved4);
+- r_cmd->reserved5 = NXSwapLongLong(r_cmd->reserved5);
+- r_cmd->reserved6 = NXSwapLongLong(r_cmd->reserved6);
++ r_cmd->cmd = OSSwapInt32(r_cmd->cmd);
++ r_cmd->cmdsize = OSSwapInt32(r_cmd->cmdsize);
++ r_cmd->init_address = OSSwapInt64(r_cmd->init_address);
++ r_cmd->init_module = OSSwapInt64(r_cmd->init_module);
++ r_cmd->reserved1 = OSSwapInt64(r_cmd->reserved1);
++ r_cmd->reserved2 = OSSwapInt64(r_cmd->reserved2);
++ r_cmd->reserved3 = OSSwapInt64(r_cmd->reserved3);
++ r_cmd->reserved4 = OSSwapInt64(r_cmd->reserved4);
++ r_cmd->reserved5 = OSSwapInt64(r_cmd->reserved5);
++ r_cmd->reserved6 = OSSwapInt64(r_cmd->reserved6);
+ }
+
+ void
+@@ -382,9 +383,9 @@
+ struct prebind_cksum_command *cksum_cmd,
+ enum NXByteOrder target_byte_sex)
+ {
+- cksum_cmd->cmd = NXSwapLong(cksum_cmd->cmd);
+- cksum_cmd->cmdsize = NXSwapLong(cksum_cmd->cmdsize);
+- cksum_cmd->cksum = NXSwapLong(cksum_cmd->cksum);
++ cksum_cmd->cmd = OSSwapInt32(cksum_cmd->cmd);
++ cksum_cmd->cmdsize = OSSwapInt32(cksum_cmd->cmdsize);
++ cksum_cmd->cksum = OSSwapInt32(cksum_cmd->cksum);
+ }
+
+ void
+@@ -392,8 +393,8 @@
+ struct uuid_command *uuid_cmd,
+ enum NXByteOrder target_byte_sex)
+ {
+- uuid_cmd->cmd = NXSwapLong(uuid_cmd->cmd);
+- uuid_cmd->cmdsize = NXSwapLong(uuid_cmd->cmdsize);
++ uuid_cmd->cmd = OSSwapInt32(uuid_cmd->cmd);
++ uuid_cmd->cmdsize = OSSwapInt32(uuid_cmd->cmdsize);
+ }
+
+ void
+@@ -405,11 +406,11 @@
+ uint32_t i;
+
+ for(i = 0; i < nsymbols; i++){
+- symbols[i].n_un.n_strx = NXSwapLong(symbols[i].n_un.n_strx);
++ symbols[i].n_un.n_strx = OSSwapInt32(symbols[i].n_un.n_strx);
+ /* n_type */
+ /* n_sect */
+- symbols[i].n_desc = NXSwapShort(symbols[i].n_desc);
+- symbols[i].n_value = NXSwapLong(symbols[i].n_value);
++ symbols[i].n_desc = OSSwapInt16(symbols[i].n_desc);
++ symbols[i].n_value = OSSwapInt32(symbols[i].n_value);
+ }
+ }
+
+@@ -422,11 +423,11 @@
+ uint32_t i;
+
+ for(i = 0; i < nsymbols; i++){
+- symbols[i].n_un.n_strx = NXSwapLong(symbols[i].n_un.n_strx);
++ symbols[i].n_un.n_strx = OSSwapInt32(symbols[i].n_un.n_strx);
+ /* n_type */
+ /* n_sect */
+- symbols[i].n_desc = NXSwapShort(symbols[i].n_desc);
+- symbols[i].n_value = NXSwapLongLong(symbols[i].n_value);
++ symbols[i].n_desc = OSSwapInt16(symbols[i].n_desc);
++ symbols[i].n_value = OSSwapInt64(symbols[i].n_value);
+ }
+ }
+
+@@ -439,8 +440,8 @@
+ uint32_t i;
+
+ for(i = 0; i < nranlibs; i++){
+- ranlibs[i].ran_un.ran_strx = NXSwapLong(ranlibs[i].ran_un.ran_strx);
+- ranlibs[i].ran_off = NXSwapLong(ranlibs[i].ran_off);
++ ranlibs[i].ran_un.ran_strx = OSSwapInt32(ranlibs[i].ran_un.ran_strx);
++ ranlibs[i].ran_off = OSSwapInt32(ranlibs[i].ran_off);
+ }
+ }
+
+@@ -455,7 +456,7 @@
+ uint32_t to_host_byte_sex, scattered;
+
+ struct swapped_relocation_info {
+- long r_address;
++ uint32_t r_address;
+ union {
+ struct {
+ unsigned int
+@@ -471,7 +472,7 @@
+
+ struct swapped_scattered_relocation_info {
+ uint32_t word;
+- long r_value;
++ uint32_t r_value;
+ } *ssr;
+
+ host_byte_sex = NXHostByteOrder();
+@@ -479,14 +480,14 @@
+
+ for(i = 0; i < nrelocs; i++){
+ if(to_host_byte_sex)
+- scattered = (NXSwapLong(relocs[i].r_address) & R_SCATTERED) != 0;
++ scattered = (OSSwapInt32(relocs[i].r_address) & R_SCATTERED) != 0;
+ else
+ scattered = ((relocs[i].r_address) & R_SCATTERED) != 0;
+ if(scattered == FALSE){
+ if(to_host_byte_sex){
+ memcpy(&sr, relocs + i, sizeof(struct relocation_info));
+- sr.r_address = NXSwapLong(sr.r_address);
+- sr.u.word = NXSwapLong(sr.u.word);
++ sr.r_address = OSSwapInt32(sr.r_address);
++ sr.u.word = OSSwapInt32(sr.u.word);
+ relocs[i].r_address = sr.r_address;
+ relocs[i].r_symbolnum = sr.u.fields.r_symbolnum;
+ relocs[i].r_pcrel = sr.u.fields.r_pcrel;
+@@ -501,15 +502,15 @@
+ sr.u.fields.r_pcrel = relocs[i].r_pcrel;
+ sr.u.fields.r_extern = relocs[i].r_extern;
+ sr.u.fields.r_type = relocs[i].r_type;
+- sr.r_address = NXSwapLong(sr.r_address);
+- sr.u.word = NXSwapLong(sr.u.word);
++ sr.r_address = OSSwapInt32(sr.r_address);
++ sr.u.word = OSSwapInt32(sr.u.word);
+ memcpy(relocs + i, &sr, sizeof(struct relocation_info));
+ }
+ }
+ else{
+ ssr = (struct swapped_scattered_relocation_info *)(relocs + i);
+- ssr->word = NXSwapLong(ssr->word);
+- ssr->r_value = NXSwapLong(ssr->r_value);
++ ssr->word = OSSwapInt32(ssr->word);
++ ssr->r_value = OSSwapInt32(ssr->r_value);
+ }
+ }
+ }
+@@ -523,7 +524,7 @@
+ uint32_t i;
+
+ for(i = 0; i < nindirect_symbols; i++)
+- indirect_symbols[i] = NXSwapLong(indirect_symbols[i]);
++ indirect_symbols[i] = OSSwapInt32(indirect_symbols[i]);
+ }
+
+ void
+@@ -551,14 +552,14 @@
+ for(i = 0; i < nrefs; i++){
+ if(target_byte_sex == host_byte_sex){
+ memcpy(&sref, refs + i, sizeof(struct swapped_dylib_reference));
+- sref.u.word = NXSwapLong(sref.u.word);
++ sref.u.word = OSSwapInt32(sref.u.word);
+ refs[i].flags = sref.u.fields.flags;
+ refs[i].isym = sref.u.fields.isym;
+ }
+ else{
+ sref.u.fields.isym = refs[i].isym;
+ sref.u.fields.flags = refs[i].flags;
+- sref.u.word = NXSwapLong(sref.u.word);
++ sref.u.word = OSSwapInt32(sref.u.word);
+ memcpy(refs + i, &sref, sizeof(struct swapped_dylib_reference));
+ }
+ }
+@@ -574,19 +575,19 @@
+ uint32_t i;
+
+ for(i = 0; i < nmods; i++){
+- mods[i].module_name = NXSwapLong(mods[i].module_name);
+- mods[i].iextdefsym = NXSwapLong(mods[i].iextdefsym);
+- mods[i].nextdefsym = NXSwapLong(mods[i].nextdefsym);
+- mods[i].irefsym = NXSwapLong(mods[i].irefsym);
+- mods[i].nrefsym = NXSwapLong(mods[i].nrefsym);
+- mods[i].ilocalsym = NXSwapLong(mods[i].ilocalsym);
+- mods[i].nlocalsym = NXSwapLong(mods[i].nlocalsym);
+- mods[i].iextrel = NXSwapLong(mods[i].iextrel);
+- mods[i].nextrel = NXSwapLong(mods[i].nextrel);
+- mods[i].iinit_iterm = NXSwapLong(mods[i].iinit_iterm);
+- mods[i].ninit_nterm = NXSwapLong(mods[i].ninit_nterm);
+- mods[i].objc_module_info_size = NXSwapLong(mods[i].objc_module_info_size);
+- mods[i].objc_module_info_addr = NXSwapLong(mods[i].objc_module_info_addr);
++ mods[i].module_name = OSSwapInt32(mods[i].module_name);
++ mods[i].iextdefsym = OSSwapInt32(mods[i].iextdefsym);
++ mods[i].nextdefsym = OSSwapInt32(mods[i].nextdefsym);
++ mods[i].irefsym = OSSwapInt32(mods[i].irefsym);
++ mods[i].nrefsym = OSSwapInt32(mods[i].nrefsym);
++ mods[i].ilocalsym = OSSwapInt32(mods[i].ilocalsym);
++ mods[i].nlocalsym = OSSwapInt32(mods[i].nlocalsym);
++ mods[i].iextrel = OSSwapInt32(mods[i].iextrel);
++ mods[i].nextrel = OSSwapInt32(mods[i].nextrel);
++ mods[i].iinit_iterm = OSSwapInt32(mods[i].iinit_iterm);
++ mods[i].ninit_nterm = OSSwapInt32(mods[i].ninit_nterm);
++ mods[i].objc_module_info_size = OSSwapInt32(mods[i].objc_module_info_size);
++ mods[i].objc_module_info_addr = OSSwapInt32(mods[i].objc_module_info_addr);
+ }
+ }
+
+@@ -599,19 +600,19 @@
+ uint32_t i;
+
+ for(i = 0; i < nmods; i++){
+- mods[i].module_name = NXSwapLong(mods[i].module_name);
+- mods[i].iextdefsym = NXSwapLong(mods[i].iextdefsym);
+- mods[i].nextdefsym = NXSwapLong(mods[i].nextdefsym);
+- mods[i].irefsym = NXSwapLong(mods[i].irefsym);
+- mods[i].nrefsym = NXSwapLong(mods[i].nrefsym);
+- mods[i].ilocalsym = NXSwapLong(mods[i].ilocalsym);
+- mods[i].nlocalsym = NXSwapLong(mods[i].nlocalsym);
+- mods[i].iextrel = NXSwapLong(mods[i].iextrel);
+- mods[i].nextrel = NXSwapLong(mods[i].nextrel);
+- mods[i].iinit_iterm = NXSwapLong(mods[i].iinit_iterm);
+- mods[i].ninit_nterm = NXSwapLong(mods[i].ninit_nterm);
+- mods[i].objc_module_info_size = NXSwapLong(mods[i].objc_module_info_size);
+- mods[i].objc_module_info_addr = NXSwapLongLong(mods[i].objc_module_info_addr);
++ mods[i].module_name = OSSwapInt32(mods[i].module_name);
++ mods[i].iextdefsym = OSSwapInt32(mods[i].iextdefsym);
++ mods[i].nextdefsym = OSSwapInt32(mods[i].nextdefsym);
++ mods[i].irefsym = OSSwapInt32(mods[i].irefsym);
++ mods[i].nrefsym = OSSwapInt32(mods[i].nrefsym);
++ mods[i].ilocalsym = OSSwapInt32(mods[i].ilocalsym);
++ mods[i].nlocalsym = OSSwapInt32(mods[i].nlocalsym);
++ mods[i].iextrel = OSSwapInt32(mods[i].iextrel);
++ mods[i].nextrel = OSSwapInt32(mods[i].nextrel);
++ mods[i].iinit_iterm = OSSwapInt32(mods[i].iinit_iterm);
++ mods[i].ninit_nterm = OSSwapInt32(mods[i].ninit_nterm);
++ mods[i].objc_module_info_size = OSSwapInt32(mods[i].objc_module_info_size);
++ mods[i].objc_module_info_addr = OSSwapInt64(mods[i].objc_module_info_addr);
+ }
+ }
+
+@@ -624,8 +625,8 @@
+ uint32_t i;
+
+ for(i = 0; i < ntocs; i++){
+- tocs[i].symbol_index = NXSwapLong(tocs[i].symbol_index);
+- tocs[i].module_index = NXSwapLong(tocs[i].module_index);
++ tocs[i].symbol_index = OSSwapInt32(tocs[i].symbol_index);
++ tocs[i].module_index = OSSwapInt32(tocs[i].module_index);
+ }
+ }
+ #endif /* !defined(RLD) */
+Index: odcctools-9.2-ld/include/mach/machine.h
+===================================================================
+--- odcctools-9.2-ld.orig/include/mach/machine.h 2013-09-03 11:38:18.638001227 +0000
++++ odcctools-9.2-ld/include/mach/machine.h 2013-09-03 15:11:40.625705183 +0000
+@@ -302,7 +302,14 @@
+ #define CPU_SUBTYPE_ARM_A500 ((cpu_subtype_t) 2)
+ #define CPU_SUBTYPE_ARM_A440 ((cpu_subtype_t) 3)
+ #define CPU_SUBTYPE_ARM_M4 ((cpu_subtype_t) 4)
+-#define CPU_SUBTYPE_ARM_A680 ((cpu_subtype_t) 5)
++#define CPU_SUBTYPE_ARM_V4T ((cpu_subtype_t) 5)
++#define CPU_SUBTYPE_ARM_V6 ((cpu_subtype_t) 6)
++#define CPU_SUBTYPE_ARM_V5TEJ ((cpu_subtype_t) 7)
++#define CPU_SUBTYPE_ARM_XSCALE ((cpu_subtype_t) 8)
++#define CPU_SUBTYPE_ARM_V7 ((cpu_subtype_t) 9)
++#define CPU_SUBTYPE_ARM_V7F ((cpu_subtype_t) 10) /* Cortex A9 */
++#define CPU_SUBTYPE_ARM_V7S ((cpu_subtype_t) 11) /* Swift */
++#define CPU_SUBTYPE_ARM_V7K ((cpu_subtype_t) 12) /* Kirkwood40 */
+
+ /*
+ * MC88000 subtypes
+@@ -380,11 +387,4 @@
+ #define CPU_SUBTYPE_VEO_4 ((cpu_subtype_t) 4)
+ #define CPU_SUBTYPE_VEO_ALL CPU_SUBTYPE_VEO_2
+
+-#define CPU_SUBTYPE_ARM_V4T ((cpu_subtype_t) 5)
+-#define CPU_SUBTYPE_ARM_V6 ((cpu_subtype_t) 6)
+-#define CPU_SUBTYPE_ARM_V5TEJ ((cpu_subtype_t) 7)
+-#define CPU_SUBTYPE_ARM_XSCALE ((cpu_subtype_t) 8)
+-#define CPU_SUBTYPE_ARM_ALL ((cpu_subtype_t) 0)
+-
+-
+ #endif /* _MACH_MACHINE_H_ */