netbsd-elf.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /* Definitions for SH running NetBSD using ELF
  2. Copyright (C) 2002-2015 Free Software Foundation, Inc.
  3. Contributed by Wasabi Systems, Inc.
  4. This file is part of GCC.
  5. GCC is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 3, or (at your option)
  8. any later version.
  9. GCC is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with GCC; see the file COPYING3. If not see
  15. <http://www.gnu.org/licenses/>. */
  16. /* Run-time Target Specification. */
  17. /* Extra specs needed for NetBSD SuperH ELF targets. */
  18. #undef SUBTARGET_EXTRA_SPECS
  19. #define SUBTARGET_EXTRA_SPECS \
  20. { "netbsd_entry_point", NETBSD_ENTRY_POINT },
  21. #define TARGET_OS_CPP_BUILTINS() \
  22. do \
  23. { \
  24. NETBSD_OS_CPP_BUILTINS_ELF(); \
  25. builtin_define ("__NO_LEADING_UNDERSCORES__"); \
  26. } \
  27. while (0)
  28. /* Provide a LINK_SPEC appropriate for a NetBSD/sh ELF target.
  29. We use the SH_LINK_SPEC from sh/sh.h, and define the appropriate
  30. SUBTARGET_LINK_SPEC that pulls in what we need from a generic
  31. NetBSD ELF LINK_SPEC. */
  32. /* LINK_EMUL_PREFIX from sh/elf.h */
  33. #undef SUBTARGET_LINK_EMUL_SUFFIX
  34. #define SUBTARGET_LINK_EMUL_SUFFIX "_nbsd"
  35. #undef SUBTARGET_LINK_SPEC
  36. #define SUBTARGET_LINK_SPEC NETBSD_LINK_SPEC_ELF
  37. #undef LINK_SPEC
  38. #define LINK_SPEC SH_LINK_SPEC
  39. #define NETBSD_ENTRY_POINT "__start"
  40. /* Provide a CPP_SPEC appropriate for NetBSD. */
  41. #undef SUBTARGET_CPP_SPEC
  42. #define SUBTARGET_CPP_SPEC NETBSD_CPP_SPEC
  43. #undef TARGET_DEFAULT
  44. #define TARGET_DEFAULT \
  45. (TARGET_CPU_DEFAULT | TARGET_ENDIAN_DEFAULT)
  46. /* Define because we use the label and we do not need them. */
  47. #define NO_PROFILE_COUNTERS 1
  48. #undef FUNCTION_PROFILER
  49. #define FUNCTION_PROFILER(STREAM,LABELNO) \
  50. do \
  51. { \
  52. if (TARGET_SHMEDIA32 || TARGET_SHMEDIA64) \
  53. { \
  54. /* FIXME */ \
  55. sorry ("unimplemented-shmedia profiling"); \
  56. } \
  57. else \
  58. { \
  59. fprintf((STREAM), "\tmov.l\t%sLP%d,r1\n", \
  60. LOCAL_LABEL_PREFIX, (LABELNO)); \
  61. fprintf((STREAM), "\tmova\t%sLP%dr,r0\n", \
  62. LOCAL_LABEL_PREFIX, (LABELNO)); \
  63. fprintf((STREAM), "\tjmp\t@r1\n"); \
  64. fprintf((STREAM), "\tnop\n"); \
  65. fprintf((STREAM), "\t.align\t2\n"); \
  66. fprintf((STREAM), "%sLP%d:\t.long\t__mcount\n", \
  67. LOCAL_LABEL_PREFIX, (LABELNO)); \
  68. fprintf((STREAM), "%sLP%dr:\n", LOCAL_LABEL_PREFIX, (LABELNO)); \
  69. } \
  70. } \
  71. while (0)
  72. /* Since libgcc is compiled with -fpic for this target, we can't use
  73. __sdivsi3_1 as the division strategy for -O0 and -Os. */
  74. #undef SH_DIV_STRATEGY_DEFAULT
  75. #define SH_DIV_STRATEGY_DEFAULT SH_DIV_CALL2
  76. #undef SH_DIV_STR_FOR_SIZE
  77. #define SH_DIV_STR_FOR_SIZE "call2"
  78. #undef SUBTARGET_OVERRIDE_OPTIONS
  79. #define SUBTARGET_OVERRIDE_OPTIONS \
  80. do \
  81. { \
  82. /* Set -musermode if it hasn't been specified. */ \
  83. if (global_options_set.x_TARGET_USERMODE == 0) \
  84. TARGET_USERMODE = true; \
  85. } \
  86. while (0)