• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Compile with:
2    clang -c -g -arch x86_64h -arch x86_64 -arch i386 fat-test.c
3    libtool -static -o libfat-test.a fat-test.o
4 
5    to generate a dylib instead:
6    clang -arch ...  -arch ... -arch ...  -dynamiclib fat-test.o -o fat-test.dylib
7 
8    To reduce the size of the fat binary:
9    lipo -thin i386 -o fat-test.i386.o fat-test.o
10    lipo -thin x86_64 -o fat-test.x86_64.o fat-test.o
11    lipo -thin x86_64h -o fat-test.x86_64h.o fat-test.o
12    lipo -create -arch x86_64h fat-test.x86_64h.o -arch x86_64 fat-test.x86_64.o -arch i386 fat-test.i386.o -o fat-test.o -segalign i386 8 -segalign x86_64 8 -segalign x86_64h 8
13  */
14 #ifdef __x86_64h__
15 int x86_64h_var;
16 #elif defined(__x86_64__)
17 int x86_64_var;
18 #elif defined(__i386__)
19 int i386_var;
20 #elif defined(__ARM_ARCH_7S__)
21 int armv7s_var;
22 #elif defined(__ARM_ARCH_7A__)
23 int armv7_var;
24 #elif defined(__ARM64_ARCH_8__)
25 int arm64_var;
26 #else
27 #error "Unknown architecture"
28 #endif
29