* tc.h (struct relax_type, relax_typeS): Move from here..
[deliverable/binutils-gdb.git] / gas / config / tc-cris.h
index 3c3bb5a976a7b5829d0ace0072a9719e28073fdb..bb7a6acca0b69a1f61bc22ce2474db1ff5587ccc 100644 (file)
@@ -1,5 +1,6 @@
 /* tc-cris.h -- Header file for tc-cris.c, the CRIS GAS port.
-   Copyright 2000, 2001 Free Software Foundation, Inc.
+   Copyright 2000, 2001, 2002, 2003, 2004, 2005
+   Free Software Foundation, Inc.
 
    Contributed by Axis Communications AB, Lund, Sweden.
    Originally written for GAS 1.38.1 by Mikael Asker.
@@ -39,6 +40,9 @@ extern const char *cris_target_format PARAMS ((void));
 
 #define TARGET_ARCH bfd_arch_cris
 
+extern unsigned int cris_mach PARAMS ((void));
+#define TARGET_MACH (cris_mach ())
+
 #define TARGET_BYTES_BIG_ENDIAN 0
 
 extern const char *md_shortopts;
@@ -65,9 +69,6 @@ extern const char FLT_CHARS[];
 
 #define md_number_to_chars number_to_chars_littleendian
 
-extern const int md_short_jump_size;
-extern const int md_long_jump_size;
-
 /* There's no use having different functions for this; the sizes are the
    same.  Note that we can't #define md_short_jump_size here.  */
 #define md_create_short_jump md_create_long_jump
@@ -75,48 +76,43 @@ extern const int md_long_jump_size;
 extern const struct relax_type md_cris_relax_table[];
 #define TC_GENERIC_RELAX_TABLE md_cris_relax_table
 
-#define TC_HANDLES_FX_DONE
+long cris_relax_frag PARAMS ((segT, fragS *, long));
 
-#define TC_FORCE_RELOCATION(fixp) md_cris_force_relocation (fixp)
+/* GAS only handles relaxations for pc-relative data targeting addresses
+   in the same segment, so we have to handle the rest on our own.  */
+#define md_relax_frag(SEG, FRAGP, STRETCH)             \
+ ((FRAGP)->fr_symbol != NULL                           \
+  && S_GET_SEGMENT ((FRAGP)->fr_symbol) == (SEG)       \
+  ? relax_frag (SEG, FRAGP, STRETCH)                   \
+  : cris_relax_frag (SEG, FRAGP, STRETCH))
+
+#define TC_FORCE_RELOCATION(FIX) md_cris_force_relocation (FIX)
 extern int md_cris_force_relocation PARAMS ((struct fix *));
 
-#define MD_APPLY_FIX3
-
-#define IS_CRIS_PIC_RELOC(X)                   \
-  ((X) == BFD_RELOC_CRIS_16_GOT                        \
-   || (X) == BFD_RELOC_CRIS_32_GOT             \
-   || (X) == BFD_RELOC_CRIS_16_GOTPLT          \
-   || (X) == BFD_RELOC_CRIS_32_GOTPLT          \
-   || (X) == BFD_RELOC_CRIS_32_GOTREL          \
-   || (X) == BFD_RELOC_CRIS_32_PLT_GOTREL      \
-   || (X) == BFD_RELOC_CRIS_32_PLT_PCREL)
-
-
-/* FIXME: Undocumented macro.  Make sure we don't resolve fixups for which
-   we want to emit dynamic relocations.  */
-
-#define TC_RELOC_RTSYM_LOC_FIXUP(FIX)                          \
-  ((FIX)->fx_addsy == NULL                                     \
-   || (! S_IS_EXTERNAL ((FIX)->fx_addsy)                       \
-       && ! S_IS_WEAK ((FIX)->fx_addsy)                                \
-       && S_IS_DEFINED ((FIX)->fx_addsy)                       \
-       && ! S_IS_COMMON ((FIX)->fx_addsy)                      \
-       /* FIXME: Set fx_plt instead of this check.  */         \
-       && ! IS_CRIS_PIC_RELOC ((FIX)->fx_r_type)))
-
-/* This is really a workaround for a bug in write.c that resolves relocs
-   for weak symbols - it should be postponed to the link stage or later.
-   Also don't adjust fixups for global symbols for ELF, and no relocs
-   where the original symbol name must be kept.  */
-#define tc_fix_adjustable(X)                                   \
- (((X)->fx_addsy == NULL                                       \
-   || (! S_IS_WEAK ((X)->fx_addsy)                             \
-       && ! (OUTPUT_FLAVOR == bfd_target_elf_flavour           \
-            && S_IS_EXTERNAL ((X)->fx_addsy))))                \
-  && (X)->fx_r_type != BFD_RELOC_VTABLE_INHERIT                        \
-  && (X)->fx_r_type != BFD_RELOC_VTABLE_ENTRY                  \
-  && (! IS_CRIS_PIC_RELOC ((X)->fx_r_type)                     \
-      || (X)->fx_r_type == BFD_RELOC_CRIS_32_GOTREL))
+#define IS_CRIS_PIC_RELOC(RTYPE)                       \
+  ((RTYPE) == BFD_RELOC_CRIS_16_GOT                    \
+   || (RTYPE) == BFD_RELOC_CRIS_32_GOT                 \
+   || (RTYPE) == BFD_RELOC_CRIS_16_GOTPLT              \
+   || (RTYPE) == BFD_RELOC_CRIS_32_GOTPLT              \
+   || (RTYPE) == BFD_RELOC_CRIS_32_GOTREL              \
+   || (RTYPE) == BFD_RELOC_CRIS_32_PLT_GOTREL          \
+   || (RTYPE) == BFD_RELOC_CRIS_32_PLT_PCREL)
+
+/* Make sure we don't resolve fixups for which we want to emit dynamic
+   relocations.  FIXME: Set fx_plt instead of using IS_CRIS_PIC_RELOC.  */
+#define TC_FORCE_RELOCATION_LOCAL(FIX)                 \
+  (!(FIX)->fx_pcrel                                    \
+   || (FIX)->fx_plt                                    \
+   || IS_CRIS_PIC_RELOC ((FIX)->fx_r_type)             \
+   || TC_FORCE_RELOCATION (FIX))
+
+/* For some reloc types, don't adjust fixups by reducing to a section
+   symbol.  */
+#define tc_fix_adjustable(FIX)                         \
+ ((FIX)->fx_r_type != BFD_RELOC_VTABLE_INHERIT         \
+  && (FIX)->fx_r_type != BFD_RELOC_VTABLE_ENTRY                \
+  && (! IS_CRIS_PIC_RELOC ((FIX)->fx_r_type)           \
+      || (FIX)->fx_r_type == BFD_RELOC_CRIS_32_GOTREL))
 
 /* When we have fixups against constant expressions, we get a GAS-specific
    section symbol at no extra charge for obscure reasons in
@@ -157,12 +153,15 @@ extern void tc_cris_check_adjusted_broken_word PARAMS ((offsetT,
  tc_cris_check_adjusted_broken_word ((offsetT) (new_offset), brokw)
 
 /* We don't want any implicit alignment, so we do nothing.  */
-#define TC_IMPLICIT_LCOMM_ALIGNMENT(SIZE, P2VAR)
+#define TC_IMPLICIT_LCOMM_ALIGNMENT(SIZE, P2VAR) do { } while (0)
 
 /* CRIS instructions, with operands and prefixes included, are a multiple
    of two bytes long.  */
 #define DWARF2_LINE_MIN_INSN_LENGTH 2
 
+/* Make port immune to unwanted difference in te-generic.h vs. te-linux.h.  */
+#define LOCAL_LABELS_DOLLAR 1
+
 #endif /* TC_CRIS */
 /*
  * Local variables:
This page took 0.024646 seconds and 4 git commands to generate.