1
0

abiname.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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(__s390x__)
  17. return "s390x"
  18. #elif defined(__sparcv9__) || defined(__sparcv9)
  19. return "sparcv9";
  20. #elif defined(__sparc_v8__)
  21. return "sparcv8";
  22. #elif defined(__sparc__) || defined(__sparc)
  23. if (sizeof(long) == 4) return "sparcv8";
  24. return "sparcv9";
  25. #elif defined(__ARM_EABI__)
  26. return "armeabi";
  27. #elif defined(__arm__)
  28. return "arm";
  29. #elif defined(__mips__) || defined(__mips) || defined(__MIPS__)
  30. # if defined(_ABIO32)
  31. return "mipso32";
  32. # elif defined(_ABIN32)
  33. return "mips32";
  34. # else
  35. return "mips64";
  36. # endif
  37. #else
  38. return "default";
  39. #endif
  40. }
  41. int main(int argc,char **argv)
  42. {
  43. printf("%s %s\n",argv[1],abi());
  44. return 0;
  45. }