1
0

abiname.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #include <stdio.h>
  2. const char *abi(void)
  3. {
  4. #if defined(__amd64__) || defined(__x86_64__) || defined(__AMD64__) || defined(_M_X64) || defined(__amd64)
  5. return "amd64";
  6. #elif defined(__i386__) || defined(__x86__) || defined(__X86__) || defined(_M_IX86) || defined(__i386)
  7. return "x86";
  8. #elif defined(__ia64__) || defined(__IA64__) || defined(__M_IA64)
  9. return "ia64";
  10. #elif defined(__SPU__)
  11. return "cellspu";
  12. #elif defined(__powerpc64__) || defined(__ppc64__) || defined(__PPC64__) || defined(_ARCH_PPC64)
  13. return "ppc64";
  14. #elif defined(__powerpc__) || defined(__ppc__) || defined(__PPC__) || defined(_ARCH_PPC)
  15. return "ppc32";
  16. #elif defined(__sparcv9__) || defined(__sparcv9)
  17. return "sparcv9";
  18. #elif defined(__sparc_v8__)
  19. return "sparcv8";
  20. #elif defined(__sparc__) || defined(__sparc)
  21. if (sizeof(long) == 4) return "sparcv8";
  22. return "sparcv9";
  23. #elif defined(__ARM_EABI__)
  24. return "armeabi";
  25. #elif defined(__arm__)
  26. return "arm";
  27. #elif defined(__mips__) || defined(__mips) || defined(__MIPS__)
  28. # if defined(_ABIO32)
  29. return "mipso32";
  30. # elif defined(_ABIN32)
  31. return "mips32";
  32. # else
  33. return "mips64";
  34. # endif
  35. #else
  36. return "default";
  37. #endif
  38. }
  39. int main(int argc,char **argv)
  40. {
  41. printf("%s %s\n",argv[1],abi());
  42. return 0;
  43. }