ppc/svp64: introduce SVP64 name parser
[binutils-gdb.git] / gas / config / tc-sh.h
index 8f2af484d86e0846ced00ed05f5c6108056d83bf..e19b141d4f5ed6def97def0c29e6b993811f0f85 100644 (file)
@@ -1,6 +1,5 @@
 /* This file is tc-sh.h
-   Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-   2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+   Copyright (C) 1993-2022 Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
 
@@ -78,16 +77,16 @@ extern int sh_force_relocation (struct fix *);
        || (FIX)->fx_r_type == BFD_RELOC_8))
 
 #define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEC)         \
-  (! SEG_NORMAL (SEC)                                  \
+  (GENERIC_FORCE_RELOCATION_SUB_SAME (FIX, SEC)                \
    || TC_FORCE_RELOCATION (FIX)                                \
    || (sh_relax && SWITCH_TABLE (FIX)))
 
 /* Don't complain when we leave fx_subsy around.  */
-#define TC_VALIDATE_FIX_SUB(FIX)                       \
-  (sh_relax && SWITCH_TABLE (FIX))
+#define TC_VALIDATE_FIX_SUB(FIX, SEG)                  \
+  ((md_register_arithmetic || (SEG) != reg_section)    \
+   && sh_relax && SWITCH_TABLE (FIX))
 
 #define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section (FIX, SEC)
-extern long md_pcrel_from_section (struct fix *, segT);
 
 /* SH_COUNT relocs are allowed outside of frag.
    The target is also buggy and sets fix size too large for other relocs.  */
@@ -133,7 +132,7 @@ extern void sh_frob_file (void);
 
 #define COFF_MAGIC (!target_big_endian ? SH_ARCH_MAGIC_LITTLE : SH_ARCH_MAGIC_BIG)
 
-#define tc_coff_symbol_emit_hook(a) ; /* not used */
+#define tc_coff_symbol_emit_hook(a) ; /* Not used.  */
 
 #define TC_KEEP_FX_OFFSET 1
 
@@ -141,9 +140,9 @@ extern void sh_frob_file (void);
 
 /* We align most sections to a 16 byte boundary.  */
 #define SUB_SEGMENT_ALIGN(SEG, FRCHAIN)                        \
-  (strncmp (SEG_NAME (SEG), ".stabstr", 8) == 0                \
+  (startswith (SEG_NAME (SEG), ".stabstr")             \
    ? 0                                                 \
-   : ((strncmp (SEG_NAME (SEG), ".stab", 5) == 0       \
+   : ((startswith (SEG_NAME (SEG), ".stab")    \
        || strcmp (SEG_NAME (SEG), ".ctors") == 0       \
        || strcmp (SEG_NAME (SEG), ".dtors") == 0)      \
       ? 2                                              \
@@ -154,16 +153,17 @@ extern void sh_frob_file (void);
 #ifdef OBJ_ELF
 /* ELF specific definitions.  */
 
-/* Whether or not the target is big endian */
+/* Whether or not the target is big endian */
 extern int target_big_endian;
 #ifdef TE_LINUX
 #define TARGET_FORMAT (!target_big_endian ? "elf32-sh-linux" : "elf32-shbig-linux")
 #elif defined(TE_NetBSD)
 #define TARGET_FORMAT (!target_big_endian ? "elf32-shl-nbsd" : "elf32-sh-nbsd")
-#elif defined TARGET_SYMBIAN
-#define TARGET_FORMAT (!target_big_endian ? "elf32-shl-symbian" : "elf32-sh-symbian")
 #elif defined (TE_VXWORKS)
 #define TARGET_FORMAT (!target_big_endian ? "elf32-shl-vxworks" : "elf32-sh-vxworks")
+#elif defined (TE_UCLINUX)
+#define TARGET_FORMAT sh_uclinux_target_format ()
+extern const char * sh_uclinux_target_format (void);
 #else
 #define TARGET_FORMAT (!target_big_endian ? "elf32-shl" : "elf32-sh")
 #endif
@@ -171,7 +171,7 @@ extern int target_big_endian;
 #define elf_tc_final_processing sh_elf_final_processing
 extern void sh_elf_final_processing (void);
 
-#define DIFF_EXPR_OK           /* foo-. gets turned into PC relative relocs */
+#define DIFF_EXPR_OK           /* foo-. gets turned into PC relative relocs */
 
 #define GLOBAL_OFFSET_TABLE_NAME "_GLOBAL_OFFSET_TABLE_"
 
@@ -185,7 +185,7 @@ extern void sh_elf_final_processing (void);
 #define TC_RELOC_GLOBAL_OFFSET_TABLE BFD_RELOC_SH_GOTPC
 
 #define tc_fix_adjustable(FIX) sh_fix_adjustable(FIX)
-extern bfd_boolean sh_fix_adjustable (struct fix *);
+extern bool sh_fix_adjustable (struct fix *);
 
 /* Values passed to md_apply_fix don't include symbol values.  */
 #define MD_APPLY_SYM_VALUE(FIX) 0
@@ -201,33 +201,37 @@ extern bfd_boolean sh_fix_adjustable (struct fix *);
    can only be determined at link time.  */
 
 #define TC_FORCE_RELOCATION_LOCAL(FIX)                 \
-  (!(FIX)->fx_pcrel                                    \
+  (GENERIC_FORCE_RELOCATION_LOCAL (FIX)                        \
    || (FIX)->fx_r_type == BFD_RELOC_32_PLT_PCREL       \
    || (FIX)->fx_r_type == BFD_RELOC_32_GOT_PCREL       \
-   || (FIX)->fx_r_type == BFD_RELOC_SH_GOTPC           \
-   || TC_FORCE_RELOCATION (FIX))
+   || (FIX)->fx_r_type == BFD_RELOC_SH_GOTPC)
 
-#define TC_FORCE_RELOCATION_SUB_LOCAL(FIX) (sh_relax && SWITCH_TABLE (FIX))
+#define TC_FORCE_RELOCATION_SUB_LOCAL(FIX, SEG)                \
+  ((!md_register_arithmetic && (SEG) == reg_section)   \
+   || (sh_relax && SWITCH_TABLE (FIX)))
 
 /* This keeps the subtracted symbol around, for use by PLT_PCREL
    relocs.  */
-#define TC_FORCE_RELOCATION_SUB_ABS(FIX)               \
-  ((FIX)->fx_r_type == BFD_RELOC_32_PLT_PCREL)
+#define TC_FORCE_RELOCATION_SUB_ABS(FIX, SEG)          \
+  ((FIX)->fx_r_type == BFD_RELOC_32_PLT_PCREL          \
+   || (!md_register_arithmetic && (SEG) == reg_section))
 
 /* Don't complain when we leave fx_subsy around.  */
 #undef TC_VALIDATE_FIX_SUB
-#define TC_VALIDATE_FIX_SUB(FIX)                       \
-  ((FIX)->fx_r_type == BFD_RELOC_32_PLT_PCREL          \
-   || (sh_relax && SWITCH_TABLE (FIX)))
+#define TC_VALIDATE_FIX_SUB(FIX, SEG)                  \
+  ((md_register_arithmetic || (SEG) != reg_section)    \
+   && ((FIX)->fx_r_type == BFD_RELOC_32_PLT_PCREL      \
+       || (sh_relax && SWITCH_TABLE (FIX))))
 
 #define md_parse_name(name, exprP, mode, nextcharP) \
   sh_parse_name ((name), (exprP), (mode), (nextcharP))
-int sh_parse_name (char const *name, expressionS *exprP,
-                  enum expr_mode mode, char *nextchar);
+int sh_parse_name (char const *, expressionS *,
+                  enum expr_mode, char *);
 
-#define TC_CONS_FIX_NEW(FRAG, OFF, LEN, EXP) \
-  sh_cons_fix_new ((FRAG), (OFF), (LEN), (EXP))
-void sh_cons_fix_new (fragS *, int, int, expressionS *);
+#define TC_CONS_FIX_NEW(FRAG, OFF, LEN, EXP, RELOC)    \
+  sh_cons_fix_new ((FRAG), (OFF), (LEN), (EXP), (RELOC))
+void sh_cons_fix_new (fragS *, int, int, expressionS *,
+                     bfd_reloc_code_real_type);
 
 /* This is used to construct expressions out of @GOTOFF, @PLT and @GOT
    symbols.  The relocation type is stored in X_md.  */
@@ -239,7 +243,7 @@ void sh_cons_fix_new (fragS *, int, int, expressionS *);
 extern void sh_cfi_frame_initial_instructions (void);
 
 #define tc_regname_to_dw2regnum sh_regname_to_dw2regnum
-extern int sh_regname_to_dw2regnum (char *regname);
+extern int sh_regname_to_dw2regnum (char *);
 
 /* All SH instructions are multiples of 16 bits.  */
 #define DWARF2_LINE_MIN_INSN_LENGTH 2
@@ -247,3 +251,5 @@ extern int sh_regname_to_dw2regnum (char *regname);
 #define DWARF2_CIE_DATA_ALIGNMENT (-4)
 
 #endif /* OBJ_ELF */
+
+#define H_TICK_HEX 1