tc-sparc.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. /* tc-sparc.h - Macros and type defines for the sparc.
  2. Copyright (C) 1989-2022 Free Software Foundation, Inc.
  3. This file is part of GAS, the GNU Assembler.
  4. GAS is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as
  6. published by the Free Software Foundation; either version 3,
  7. or (at your option) any later version.
  8. GAS is distributed in the hope that it will be useful, but
  9. WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
  11. the GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public
  13. License along with GAS; see the file COPYING. If not, write
  14. to the Free Software Foundation, 51 Franklin Street - Fifth Floor,
  15. Boston, MA 02110-1301, USA. */
  16. #ifndef TC_SPARC
  17. #define TC_SPARC 1
  18. struct frag;
  19. /* This is used to set the default value for `target_big_endian'. */
  20. #define TARGET_BYTES_BIG_ENDIAN 1
  21. #define LOCAL_LABELS_FB 1
  22. #define TARGET_ARCH bfd_arch_sparc
  23. extern unsigned long sparc_mach (void);
  24. #define TARGET_MACH sparc_mach ()
  25. #ifdef TE_FreeBSD
  26. #define ELF_TARGET_FORMAT "elf32-sparc"
  27. #define ELF64_TARGET_FORMAT "elf64-sparc-freebsd"
  28. #endif
  29. #ifdef TE_SOLARIS
  30. #define ELF_TARGET_FORMAT "elf32-sparc-sol2"
  31. #define ELF64_TARGET_FORMAT "elf64-sparc-sol2"
  32. #endif
  33. #ifndef ELF_TARGET_FORMAT
  34. #define ELF_TARGET_FORMAT "elf32-sparc"
  35. #endif
  36. #ifndef ELF64_TARGET_FORMAT
  37. #define ELF64_TARGET_FORMAT "elf64-sparc"
  38. #endif
  39. extern const char *sparc_target_format (void);
  40. #define TARGET_FORMAT sparc_target_format ()
  41. #define RELOC_EXPANSION_POSSIBLE
  42. #define MAX_RELOC_EXPANSION 2
  43. /* Make it unconditional and check if -EL is valid after option parsing */
  44. #define SPARC_BIENDIAN
  45. #define WORKING_DOT_WORD
  46. #define md_convert_frag(b,s,f) \
  47. as_fatal (_("sparc convert_frag\n"))
  48. #define md_estimate_size_before_relax(f,s) \
  49. (as_fatal (_("estimate_size_before_relax called")), 1)
  50. #define LISTING_HEADER "SPARC GAS "
  51. extern int sparc_pic_code;
  52. /* We require .word, et. al., to be aligned correctly. */
  53. #define md_cons_align(nbytes) sparc_cons_align (nbytes)
  54. extern void sparc_cons_align (int);
  55. #define HANDLE_ALIGN(fragp) sparc_handle_align (fragp)
  56. extern void sparc_handle_align (struct frag *);
  57. #define MAX_MEM_FOR_RS_ALIGN_CODE (3 + 4 + 4)
  58. #define DIFF_EXPR_OK /* foo-. gets turned into PC relative relocs */
  59. /* Don't turn certain relocs into relocations against sections. This
  60. is required for the dynamic linker to operate properly. When
  61. generating PIC, we need to keep any non PC relative reloc. The PIC
  62. part of this test must be parallel to the code in tc_gen_reloc which
  63. converts relocations to GOT relocations. */
  64. #define tc_fix_adjustable(FIX) \
  65. ((FIX)->fx_r_type != BFD_RELOC_VTABLE_INHERIT \
  66. && (FIX)->fx_r_type != BFD_RELOC_VTABLE_ENTRY \
  67. && ((FIX)->fx_r_type < BFD_RELOC_SPARC_TLS_GD_HI22 \
  68. || (FIX)->fx_r_type > BFD_RELOC_SPARC_TLS_TPOFF64) \
  69. && (! sparc_pic_code \
  70. || ((FIX)->fx_r_type != BFD_RELOC_HI22 \
  71. && (FIX)->fx_r_type != BFD_RELOC_LO10 \
  72. && (FIX)->fx_r_type != BFD_RELOC_SPARC13 \
  73. && ((FIX)->fx_r_type != BFD_RELOC_32_PCREL_S2 \
  74. || !generic_force_reloc (FIX)) \
  75. && ((FIX)->fx_pcrel \
  76. || ((FIX)->fx_subsy != NULL \
  77. && (S_GET_SEGMENT ((FIX)->fx_subsy) \
  78. == S_GET_SEGMENT ((FIX)->fx_addsy))) \
  79. || S_IS_LOCAL ((FIX)->fx_addsy)))))
  80. /* Values passed to md_apply_fix don't include the symbol value. */
  81. #define MD_APPLY_SYM_VALUE(FIX) 0
  82. /* Finish up the entire symtab. */
  83. #define tc_adjust_symtab() sparc_adjust_symtab ()
  84. extern void sparc_adjust_symtab (void);
  85. /* Don't allow the generic code to convert fixups involving the
  86. subtraction of a label in the current section to pc-relative if we
  87. don't have the necessary pc-relative relocation. */
  88. #define TC_FORCE_RELOCATION_SUB_LOCAL(FIX, SEG) \
  89. (!((FIX)->fx_r_type == BFD_RELOC_64 \
  90. || (FIX)->fx_r_type == BFD_RELOC_32 \
  91. || (FIX)->fx_r_type == BFD_RELOC_16 \
  92. || (FIX)->fx_r_type == BFD_RELOC_8))
  93. #define elf_tc_final_processing sparc_elf_final_processing
  94. extern void sparc_elf_final_processing (void);
  95. #define md_operand(x)
  96. extern void sparc_md_end (void);
  97. #define md_end() sparc_md_end ()
  98. #define TC_PARSE_CONS_RETURN_TYPE const char *
  99. #define TC_PARSE_CONS_RETURN_NONE NULL
  100. #define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) sparc_cons (EXP, NBYTES)
  101. extern const char *sparc_cons (expressionS *, int);
  102. #define TC_CONS_FIX_NEW cons_fix_new_sparc
  103. extern void cons_fix_new_sparc
  104. (struct frag *, int, unsigned int, struct expressionS *, const char *);
  105. #define TC_FIX_TYPE valueT
  106. #define TC_INIT_FIX_DATA(X) \
  107. do \
  108. { \
  109. (X)->tc_fix_data = 0; \
  110. } \
  111. while (0)
  112. #define TC_FIX_DATA_PRINT(FILE, FIX) \
  113. do \
  114. { \
  115. fprintf ((FILE), "addend2=%ld\n", \
  116. (unsigned long) (FIX)->tc_fix_data); \
  117. } \
  118. while (0)
  119. #define TARGET_USE_CFIPOP 1
  120. #define tc_cfi_frame_initial_instructions sparc_cfi_frame_initial_instructions
  121. extern void sparc_cfi_frame_initial_instructions (void);
  122. #define tc_regname_to_dw2regnum sparc_regname_to_dw2regnum
  123. extern int sparc_regname_to_dw2regnum (char *regname);
  124. #define tc_cfi_emit_pcrel_expr sparc_cfi_emit_pcrel_expr
  125. extern void sparc_cfi_emit_pcrel_expr (expressionS *, unsigned int);
  126. extern int sparc_cie_data_alignment;
  127. #define DWARF2_LINE_MIN_INSN_LENGTH 4
  128. #define DWARF2_DEFAULT_RETURN_COLUMN 15
  129. #define DWARF2_CIE_DATA_ALIGNMENT sparc_cie_data_alignment
  130. /* cons_fix_new_sparc will chooose BFD_RELOC_SPARC_UA32 for the difference
  131. expressions, but there is no corresponding PC-relative relocation; as this
  132. is for debugging info though, alignment does not matter, so by disabling
  133. this, BFD_RELOC_32_PCREL will be emitted directly instead. */
  134. #define CFI_DIFF_EXPR_OK 0
  135. #endif