tc-sparc.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. /* tc-sparc.h - Macros and type defines for the sparc.
  2. Copyright (C) 1989-2015 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. #ifdef TE_FreeBSD
  24. #define ELF_TARGET_FORMAT "elf32-sparc"
  25. #define ELF64_TARGET_FORMAT "elf64-sparc-freebsd"
  26. #endif
  27. #ifdef TE_SOLARIS
  28. #define ELF_TARGET_FORMAT "elf32-sparc-sol2"
  29. #define ELF64_TARGET_FORMAT "elf64-sparc-sol2"
  30. #endif
  31. #ifndef ELF_TARGET_FORMAT
  32. #define ELF_TARGET_FORMAT "elf32-sparc"
  33. #endif
  34. #ifndef ELF64_TARGET_FORMAT
  35. #define ELF64_TARGET_FORMAT "elf64-sparc"
  36. #endif
  37. extern const char *sparc_target_format (void);
  38. #define TARGET_FORMAT sparc_target_format ()
  39. #define RELOC_EXPANSION_POSSIBLE
  40. #define MAX_RELOC_EXPANSION 2
  41. /* Make it unconditional and check if -EL is valid after option parsing */
  42. #define SPARC_BIENDIAN
  43. #define WORKING_DOT_WORD
  44. #define md_convert_frag(b,s,f) \
  45. as_fatal (_("sparc convert_frag\n"))
  46. #define md_estimate_size_before_relax(f,s) \
  47. (as_fatal (_("estimate_size_before_relax called")), 1)
  48. #define LISTING_HEADER "SPARC GAS "
  49. extern int sparc_pic_code;
  50. /* We require .word, et. al., to be aligned correctly. */
  51. #define md_cons_align(nbytes) sparc_cons_align (nbytes)
  52. extern void sparc_cons_align (int);
  53. #define HANDLE_ALIGN(fragp) sparc_handle_align (fragp)
  54. extern void sparc_handle_align (struct frag *);
  55. #define MAX_MEM_FOR_RS_ALIGN_CODE (3 + 4 + 4)
  56. /* I know that "call 0" fails in sparc-coff if this doesn't return 1. I
  57. don't know about other relocation types, or other formats, yet. */
  58. #ifdef OBJ_COFF
  59. #define TC_FORCE_RELOCATION_ABS(FIX) \
  60. ((FIX)->fx_r_type == BFD_RELOC_32_PCREL_S2 \
  61. || TC_FORCE_RELOCATION (FIX))
  62. #define RELOC_REQUIRES_SYMBOL
  63. #endif
  64. #ifdef OBJ_AOUT
  65. /* This expression evaluates to true if the relocation is for a local
  66. object for which we still want to do the relocation at runtime.
  67. False if we are willing to perform this relocation while building
  68. the .o file. */
  69. #define TC_FORCE_RELOCATION_LOCAL(FIX) \
  70. (!(FIX)->fx_pcrel \
  71. || (sparc_pic_code \
  72. && S_IS_EXTERNAL ((FIX)->fx_addsy)) \
  73. || TC_FORCE_RELOCATION (FIX))
  74. #endif
  75. #ifdef OBJ_ELF
  76. /* Don't turn certain relocs into relocations against sections. This
  77. is required for the dynamic linker to operate properly. When
  78. generating PIC, we need to keep any non PC relative reloc. The PIC
  79. part of this test must be parallel to the code in tc_gen_reloc which
  80. converts relocations to GOT relocations. */
  81. #define tc_fix_adjustable(FIX) \
  82. ((FIX)->fx_r_type != BFD_RELOC_VTABLE_INHERIT \
  83. && (FIX)->fx_r_type != BFD_RELOC_VTABLE_ENTRY \
  84. && ((FIX)->fx_r_type < BFD_RELOC_SPARC_TLS_GD_HI22 \
  85. || (FIX)->fx_r_type > BFD_RELOC_SPARC_TLS_TPOFF64) \
  86. && (! sparc_pic_code \
  87. || ((FIX)->fx_r_type != BFD_RELOC_HI22 \
  88. && (FIX)->fx_r_type != BFD_RELOC_LO10 \
  89. && (FIX)->fx_r_type != BFD_RELOC_SPARC13 \
  90. && ((FIX)->fx_r_type != BFD_RELOC_32_PCREL_S2 \
  91. || !generic_force_reloc (FIX)) \
  92. && ((FIX)->fx_pcrel \
  93. || ((FIX)->fx_subsy != NULL \
  94. && (S_GET_SEGMENT ((FIX)->fx_subsy) \
  95. == S_GET_SEGMENT ((FIX)->fx_addsy))) \
  96. || S_IS_LOCAL ((FIX)->fx_addsy)))))
  97. /* Values passed to md_apply_fix don't include the symbol value. */
  98. #define MD_APPLY_SYM_VALUE(FIX) 0
  99. /* Finish up the entire symtab. */
  100. #define tc_adjust_symtab() sparc_adjust_symtab ()
  101. extern void sparc_adjust_symtab (void);
  102. #endif
  103. #ifdef OBJ_AOUT
  104. /* When generating PIC code, we must not adjust any reloc which will
  105. turn into a reloc against the global offset table, nor any reloc
  106. which we will need if a symbol is overridden. */
  107. #define tc_fix_adjustable(FIX) \
  108. (! sparc_pic_code \
  109. || ((FIX)->fx_pcrel \
  110. && ((FIX)->fx_addsy == NULL \
  111. || (! S_IS_EXTERNAL ((FIX)->fx_addsy) \
  112. && ! S_IS_WEAK ((FIX)->fx_addsy)))) \
  113. || (FIX)->fx_r_type == BFD_RELOC_16 \
  114. || (FIX)->fx_r_type == BFD_RELOC_32)
  115. #endif
  116. #define elf_tc_final_processing sparc_elf_final_processing
  117. extern void sparc_elf_final_processing (void);
  118. #define md_operand(x)
  119. extern void sparc_md_end (void);
  120. #define md_end() sparc_md_end ()
  121. #endif
  122. #define TC_PARSE_CONS_RETURN_TYPE const char *
  123. #define TC_PARSE_CONS_RETURN_NONE NULL
  124. #ifdef OBJ_ELF
  125. #define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) sparc_cons (EXP, NBYTES)
  126. extern const char *sparc_cons (expressionS *, int);
  127. #endif
  128. #define TC_CONS_FIX_NEW cons_fix_new_sparc
  129. extern void cons_fix_new_sparc
  130. (struct frag *, int, unsigned int, struct expressionS *, const char *);
  131. #define TC_FIX_TYPE valueT
  132. #define TC_INIT_FIX_DATA(X) \
  133. do \
  134. { \
  135. (X)->tc_fix_data = 0; \
  136. } \
  137. while (0)
  138. #define TC_FIX_DATA_PRINT(FILE, FIX) \
  139. do \
  140. { \
  141. fprintf ((FILE), "addend2=%ld\n", \
  142. (unsigned long) (FIX)->tc_fix_data); \
  143. } \
  144. while (0)
  145. #define TARGET_USE_CFIPOP 1
  146. #define tc_cfi_frame_initial_instructions sparc_cfi_frame_initial_instructions
  147. extern void sparc_cfi_frame_initial_instructions (void);
  148. #define tc_regname_to_dw2regnum sparc_regname_to_dw2regnum
  149. extern int sparc_regname_to_dw2regnum (char *regname);
  150. #define tc_cfi_emit_pcrel_expr sparc_cfi_emit_pcrel_expr
  151. extern void sparc_cfi_emit_pcrel_expr (expressionS *, unsigned int);
  152. extern int sparc_cie_data_alignment;
  153. #define DWARF2_LINE_MIN_INSN_LENGTH 4
  154. #define DWARF2_DEFAULT_RETURN_COLUMN 15
  155. #define DWARF2_CIE_DATA_ALIGNMENT sparc_cie_data_alignment
  156. /* end of tc-sparc.h */