target-arm64.c 847 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #include "symbol.h"
  2. #include "target.h"
  3. #include "machine.h"
  4. static void init_arm64(const struct target *self)
  5. {
  6. if (arch_cmodel == CMODEL_UNKNOWN)
  7. arch_cmodel = CMODEL_SMALL;
  8. }
  9. static void predefine_arm64(const struct target *self)
  10. {
  11. static const char *cmodels[CMODEL_LAST] = {
  12. [CMODEL_LARGE] = "LARGE",
  13. [CMODEL_SMALL] = "SMALL",
  14. [CMODEL_TINY] = "TINY",
  15. };
  16. const char *cmodel = cmodels[arch_cmodel];
  17. predefine("__aarch64__", 1, "1");
  18. if (arch_big_endian)
  19. predefine("__AARCH64EB__", 0, "1");
  20. else
  21. predefine("__AARCH64EL__", 0, "1");
  22. if (cmodel)
  23. predefine_strong("__AARCH64_CMODEL_%s__", cmodel);
  24. }
  25. const struct target target_arm64 = {
  26. .mach = MACH_ARM64,
  27. .bitness = ARCH_LP64,
  28. .big_endian = 0,
  29. .unsigned_char = 1,
  30. .has_int128 = 1,
  31. .wchar = &uint_ctype,
  32. .init = init_arm64,
  33. .predefine = predefine_arm64,
  34. };